Skip to content
Snippets Groups Projects
Commit e2253e7a authored by Jens Nolte's avatar Jens Nolte
Browse files

Add Applicative and Monad instances for SomeObservable

parent 844830e9
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,15 @@ instance Observable v (SomeObservable v) where
instance Functor SomeObservable where
fmap f = mapObservable f
x <$ _ = constObservable x
instance Applicative SomeObservable where
pure = constObservable
liftA2 = mergeObservable
_ *> x = x
x <* _ = x
instance Monad SomeObservable where
x >>= y = joinObservable $ y <$> x
_ >> x = x
data MappedObservable b = forall a o. Observable a o => MappedObservable (a -> IO b) o
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment