@@ -3,6 +3,7 @@ module Reflex.Host.Class where
4import Reflex.Class
4import Reflex.Class
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 :: * -> *
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').
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))
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).
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)
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.
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