on develop help sign in
Add Applicative constraints for pre-AMP
commit2a8a79a9beb188f8d54a1920d6981bbb4759fca7 authorBenno Fünfstück <benno.fuenfstueck@gmail.com> dateMon 13 Jul 2015, 11:42 (11 years ago) parent5b6f4f0
2 files changed+5−4
src/Reflex/Class.hs+1−1 src/Reflex/Host/Class.hs+4−3
src/Reflex/Class.hs+1−1
@@ -53,7 +53,7 @@ class (MonadHold t (PushM t), MonadSample t (PullM t), Functor (Event t), Functo
5353 -- | Create an Event that will occur whenever the input event is occurring and its occurrence value, another Event, is also occurring
5454 coincidence :: Event t (Event t a) -> Event t a
5555
56−class Monad m => MonadSample t m | m -> t where
56+class (Applicative m, Monad m) => MonadSample t m | m -> t where
5757 -- | Get the current value in the Behavior
5858 sample :: Behavior t a -> m a
5959
src/Reflex/Host/Class.hs+4−3
@@ -3,6 +3,7 @@ module Reflex.Host.Class where
33
44import Reflex.Class
55
6+import Control.Applicative
67import Control.Monad.Fix
78import Control.Monad.Trans
89import Control.Monad.Trans.Reader (ReaderT())
@@ -25,7 +26,7 @@ class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFr
2526 type HostFrame t :: * -> *
2627
2728-- | Monad that allows to read events' values.
28−class (ReflexHost t, Monad m) => MonadReadEvent t m | m -> t where
29+class (ReflexHost t, Applicative m, Monad m) => MonadReadEvent t m | m -> t where
2930 -- | Read the value of an 'Event' from an 'EventHandle' (created by calling 'subscribeEvent').
3031 --
3132 -- After event propagation is done, all events can be in two states: either they are firing with some value or they are not firing.
@@ -36,7 +37,7 @@ class (ReflexHost t, Monad m) => MonadReadEvent t m | m -> t where
3637 readEvent :: EventHandle t a -> m (Maybe (m a))
3738
3839-- | A monad where new events feed from external sources can be created.
39−class Monad m => MonadReflexCreateTrigger t m | m -> t where
40+class (Applicative m, Monad m) => MonadReflexCreateTrigger t m | m -> t where
4041 -- | Creates a root 'Event' (one that is not based on any other event).
4142 --
4243 -- When a subscriber first subscribes to an event (building another event
@@ -50,7 +51,7 @@ class Monad m => MonadReflexCreateTrigger t m | m -> t where
5051 -- Note: An event may be set up multiple times. So after the teardown action is executed, the event may still be set up again in the future.
5152 newEventWithTrigger :: (EventTrigger t a -> IO (IO ())) -> m (Event t a)
5253
53−class (Monad m, ReflexHost t, MonadReflexCreateTrigger t m) => MonadReflexHost t m | m -> t where
54+class (ReflexHost t, MonadReflexCreateTrigger t m) => MonadReflexHost t m | m -> t where
5455 -- | Propagate some events firings and read the values of events afterwards.
5556 --
5657 -- This function will create a new frame to fire the given events. It will then update all