Skip to content

Commit c2346ca

Browse files
authored
Add back fail method for before base 4.13
1 parent 8a9789c commit c2346ca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Reflex/Class.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,9 @@ instance Reflex t => Monad (Behavior t) where
663663
a >>= f = pull $ sample a >>= sample . f
664664
-- Note: it is tempting to write (_ >> b = b); however, this would result in (fail x >> return y) succeeding (returning y), which violates the law that (a >> b = a >>= \_ -> b), since the implementation of (>>=) above actually will fail. Since we can't examine 'Behavior's other than by using sample, I don't think it's possible to write (>>) to be more efficient than the (>>=) above.
665665
return = constant
666+
#if !MIN_VERSION_base(4,13,0)
667+
fail = error "Monad (Behavior t) does not support fail"
668+
#endif
666669

667670
instance (Reflex t, Monoid a) => Monoid (Behavior t a) where
668671
mempty = constant mempty

0 commit comments

Comments
 (0)