Add instance Applicative (Behavior t)

This commit is contained in:
Ryan Trinkle 2015-05-08 06:10:48 -04:00
parent 2498523eef
commit aac70f964b

View File

@ -82,6 +82,13 @@ ffor = flip fmap
instance Reflex t => Functor (Behavior t) where
fmap f = pull . liftM f . sample
--TODO: Rewrite rules for Applicative
instance Reflex t => Applicative (Behavior t) where
pure = constant
f <*> x = pull $ sample f <*> sample x
a *> b = b
a <* b = a
--TODO: See if there's a better class in the standard libraries already
-- | A class for values that combines filtering and mapping using 'Maybe'.
class FunctorMaybe f where