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

Remove default implementation of Observable.subscribe

parent 3e66b45b
No related branches found
No related tags found
No related merge requests found
...@@ -65,14 +65,12 @@ class Gettable v a | a -> v where ...@@ -65,14 +65,12 @@ class Gettable v a | a -> v where
class Gettable v o => Observable v o | o -> v where class Gettable v o => Observable v o | o -> v where
subscribe :: o -> (ObservableMessage v -> IO ()) -> IO SubscriptionHandle subscribe :: o -> (ObservableMessage v -> IO ()) -> IO SubscriptionHandle
subscribe = subscribe . toSomeObservable
toSomeObservable :: o -> SomeObservable v toSomeObservable :: o -> SomeObservable v
toSomeObservable = SomeObservable toSomeObservable = SomeObservable
mapObservable :: (v -> a) -> o -> SomeObservable a mapObservable :: (v -> a) -> o -> SomeObservable a
mapObservable f = mapObservableM (return . f) mapObservable f = mapObservableM (return . f)
mapObservableM :: (v -> IO a) -> o -> SomeObservable a mapObservableM :: (v -> IO a) -> o -> SomeObservable a
mapObservableM f = SomeObservable . MappedObservable f mapObservableM f = SomeObservable . MappedObservable f
{-# MINIMAL subscribe | toSomeObservable #-}
-- | Variant of `getValue` that throws exceptions instead of returning them. -- | Variant of `getValue` that throws exceptions instead of returning them.
getValueE :: (Exception e, Observable (Either e v) o) => o -> IO v getValueE :: (Exception e, Observable (Either e v) o) => o -> IO v
......
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