on develop help sign in
Add back fail method for before base 4.13
commitc2346ca70a09a84a6d663e46a701b005413b8911 authorJohn Ericson <John.Ericson@Obsidian.Systems> dateMon 30 Dec 2019, 13:51 (7 years ago) parent8a9789c
1 file changed+3
src/Reflex/Class.hs+3
src/Reflex/Class.hs+3
@@ -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
667670instance (Reflex t, Monoid a) => Monoid (Behavior t a) where
668671 mempty = constant mempty