on develop help sign in
Add instance Applicative (Behavior t)
commitaac70f964b71ddb16f611c906b52924ac97ea762 authorRyan Trinkle <ryan.trinkle@gmail.com> dateFri 8 May 2015, 06:10 (11 years ago) parent2498523
1 file changed+7
src/Reflex/Class.hs+7
src/Reflex/Class.hs+7
@@ -82,6 +82,13 @@ ffor = flip fmap
8282instance Reflex t => Functor (Behavior t) where
8383 fmap f = pull . liftM f . sample
8484
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+
8592--TODO: See if there's a better class in the standard libraries already
8693-- | A class for values that combines filtering and mapping using 'Maybe'.
8794class FunctorMaybe f where