on develop help sign in
Fixups for GHC 7.8
18b2cadRyan Trinkle
src/Reflex/Class.hs+12−3
@@ -46,7 +46,15 @@ import Prelude hiding (foldl, mapM, mapM_, sequence, sequence_)
46
46
47import Debug.Trace (trace)
47import Debug.Trace (trace)
48
48
49−class (MonadHold t (PushM t), MonadSample t (PullM t), MonadFix (PushM t), Functor (Event t), Functor (Behavior t), Functor (Dynamic t), Monad (Dynamic t)) => Reflex t where
49+class ( MonadHold t (PushM t)
50+ , MonadSample t (PullM t)
51+ , MonadFix (PushM t)
52+ , Functor (Event t)
53+ , Functor (Behavior t)
54+ , Functor (Dynamic t)
55+ , Applicative (Dynamic t) -- ^ Necessary for GHC <=7.8
56+ , Monad (Dynamic t)
57+ ) => Reflex t where
50 -- | A container for a value that can change over time. Behaviors can be sampled at will, but it is not possible to be notified when they change
58 -- | A container for a value that can change over time. Behaviors can be sampled at will, but it is not possible to be notified when they change
51 data Behavior t :: * -> *
59 data Behavior t :: * -> *
52 -- | A stream of occurrences. During any given frame, an Event is either occurring or not occurring; if it is occurring, it will contain a value of the given type (its "occurrence type")
60 -- | A stream of occurrences. During any given frame, an Event is either occurring or not occurring; if it is occurring, it will contain a value of the given type (its "occurrence type")
@@ -393,11 +401,12 @@ appendEvents :: (Reflex t, Monoid a) => Event t a -> Event t a -> Event t a
393appendEvents e1 e2 = mergeThese mappend <$> align e1 e2
401appendEvents e1 e2 = mergeThese mappend <$> align e1 e2
394
402
395{-# DEPRECATED sequenceThese "Use bisequenceA or bisequence from the bifunctors package instead" #-}
403{-# DEPRECATED sequenceThese "Use bisequenceA or bisequence from the bifunctors package instead" #-}
404+{-# ANN sequenceThese "HLint: ignore Use fmap" #-}
396sequenceThese :: Monad m => These (m a) (m b) -> m (These a b)
405sequenceThese :: Monad m => These (m a) (m b) -> m (These a b)
397sequenceThese t = case t of
406sequenceThese t = case t of
398− This ma -> fmap This ma
407+ This ma -> liftM This ma
399 These ma mb -> liftM2 These ma mb
408 These ma mb -> liftM2 These ma mb
400− That mb -> fmap That mb
409+ That mb -> liftM That mb
401
410
402instance (Semigroup a, Reflex t) => Semigroup (Event t a) where
411instance (Semigroup a, Reflex t) => Semigroup (Event t a) where
403 (<>) = alignWith (mergeThese (<>))
412 (<>) = alignWith (mergeThese (<>))