on develop help sign in
Add Applicative constraints for pre-AMP
2a8a79aBenno Fünfstück
src/Reflex/Class.hs+1−1
@@ -53,7 +53,7 @@ class (MonadHold t (PushM t), MonadSample t (PullM t), Functor (Event t), Functo
53 -- | Create an Event that will occur whenever the input event is occurring and its occurrence value, another Event, is also occurring
53 -- | Create an Event that will occur whenever the input event is occurring and its occurrence value, another Event, is also occurring
54 coincidence :: Event t (Event t a) -> Event t a
54 coincidence :: Event t (Event t a) -> Event t a
55
55
56−class Monad m => MonadSample t m | m -> t where
56+class (Applicative m, Monad m) => MonadSample t m | m -> t where
57 -- | Get the current value in the Behavior
57 -- | Get the current value in the Behavior
58 sample :: Behavior t a -> m a
58 sample :: Behavior t a -> m a
59
59
src/Reflex/Host/Class.hs+4−3
@@ -3,6 +3,7 @@ module Reflex.Host.Class where
3
3
4import Reflex.Class
4import Reflex.Class
5
5
6+import Control.Applicative
6import Control.Monad.Fix
7import Control.Monad.Fix
7import Control.Monad.Trans
8import Control.Monad.Trans
8import Control.Monad.Trans.Reader (ReaderT())
9import Control.Monad.Trans.Reader (ReaderT())
@@ -25,7 +26,7 @@ class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFr
25 type HostFrame t :: * -> *
26 type HostFrame t :: * -> *
26
27
27-- | Monad that allows to read events' values.
28-- | 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
29 -- | Read the value of an 'Event' from an 'EventHandle' (created by calling 'subscribeEvent').
30 -- | Read the value of an 'Event' from an 'EventHandle' (created by calling 'subscribeEvent').
30 --
31 --
31 -- After event propagation is done, all events can be in two states: either they are firing with some value or they are not firing.
32 -- 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
36 readEvent :: EventHandle t a -> m (Maybe (m a))
37 readEvent :: EventHandle t a -> m (Maybe (m a))
37
38
38-- | A monad where new events feed from external sources can be created.
39-- | 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
40 -- | Creates a root 'Event' (one that is not based on any other event).
41 -- | Creates a root 'Event' (one that is not based on any other event).
41 --
42 --
42 -- When a subscriber first subscribes to an event (building another event
43 -- When a subscriber first subscribes to an event (building another event
@@ -50,7 +51,7 @@ class Monad m => MonadReflexCreateTrigger t m | m -> t where
50 -- 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.
51 -- 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.
51 newEventWithTrigger :: (EventTrigger t a -> IO (IO ())) -> m (Event t a)
52 newEventWithTrigger :: (EventTrigger t a -> IO (IO ())) -> m (Event t a)
52
53
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
54 -- | Propagate some events firings and read the values of events afterwards.
55 -- | Propagate some events firings and read the values of events afterwards.
55 --
56 --
56 -- This function will create a new frame to fire the given events. It will then update all
57 -- This function will create a new frame to fire the given events. It will then update all