on develop help sign in
Add instance Applicative (Behavior t)
aac70f9Ryan Trinkle
src/Reflex/Class.hs+7
@@ -82,6 +82,13 @@ ffor = flip fmap
82instance Reflex t => Functor (Behavior t) where
82instance Reflex t => Functor (Behavior t) where
83 fmap f = pull . liftM f . sample
83 fmap f = pull . liftM f . sample
84
84
85+--TODO: Rewrite rules for Applicative
86+instance Reflex t => Applicative (Behavior t) where
87+ pure = constant
88+ f <*> x = pull $ sample f <*> sample x
89+ a *> b = b
90+ a <* b = a
91+
85--TODO: See if there's a better class in the standard libraries already
92--TODO: See if there's a better class in the standard libraries already
86-- | A class for values that combines filtering and mapping using 'Maybe'.
93-- | A class for values that combines filtering and mapping using 'Maybe'.
87class FunctorMaybe f where
94class FunctorMaybe f where