-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A basic Reflex host for backend work -- -- -- reflex-basic-host provides a basic Reflex host for backend work. It -- provides instances for most of the important Reflex typeclasses. -- -- Reflex.Host.Basic.basicHostWithQuit is the main entry point -- for running FRP code. Use the TriggerEvent instance to -- construct Events and control when they fire, and use the -- PerformEvent instance to take actions in response to -- Event firings. @package reflex-basic-host @version 0.2.0.1 -- | BasicGuest provides instances that most Reflex programs need: -- -- -- -- For some usage examples, see the example directory. module Reflex.Host.Basic -- | Run a BasicGuest, and return when the Event returned by -- the BasicGuest fires. -- -- Each host runs on a separate spider timeline, so you can launch -- multiple hosts via forkIO or forkOS and they will not -- mutex each other. -- -- NOTE: If you want to capture values from a build before the network -- starts firing (e.g., to hand off event triggers to another thread), -- populate an MVar (if threading) or IORef as you build -- the network. If you receive errors about untouchable type variables -- while doing this, add type annotations to constrain the MVar or -- IORef contents before passing them to the function that returns -- your BasicGuest. See the Multithread.hs example for a -- demonstration of this pattern, and where to put the type annotations. basicHostWithQuit :: (forall t m. BasicGuestConstraints t m => BasicGuest t m (Event t ())) -> IO () -- | Run a BasicGuest without a quit Event. -- --
--   basicHostForever guest = basicHostWithQuit $ never <$ guest
--   
basicHostForever :: (forall t m. BasicGuestConstraints t m => BasicGuest t m ()) -> IO () -- | The basic guest type. Try not to code against it directly; instead ask -- for the features you need MTL-style: -- --
--   myFunction :: (Reflex t, MonadHold m) => ...
--   
data BasicGuest t (m :: * -> *) a -- | Constraints provided by a BasicGuest, when run by -- basicHostWithQuit or basicHostForever. type BasicGuestConstraints t (m :: * -> *) = (MonadReflexHost t m, MonadHold t m, MonadSample t m, Ref m ~ Ref IO, MonadRef (HostFrame t), Ref (HostFrame t) ~ Ref IO, MonadIO (HostFrame t), PrimMonad (HostFrame t), MonadIO m, MonadFix m) -- | Augment a BasicGuest with an action that is repeatedly run -- until the provided Event fires. Each time the action completes, -- the returned Event will fire. -- -- Example - providing a 'tick' Event to a network -- --
--   myNetwork
--     :: (Reflex t, MonadHold t m, MonadFix m)
--     => Event t ()
--     -> m (Dynamic t Int)
--   myNetwork = count
--   
--   myGuest :: BasicGuestConstraints t m => BasicGuest t m (Event t ())
--   myGuest = mdo
--     eTick <- repeatUntilQuit (void $ threadDelay 1000000) eQuit
--     let
--       eCountUpdated = updated dCount
--       eQuit = () <$ ffilter (==5) eCountUpdated
--     dCount <- myNetwork eTick
--   
--     performEvent_ $ liftIO . print <$> eCountUpdated
--     pure eQuit
--   
--   main :: IO ()
--   main = basicHostWithQuit myGuest
--   
repeatUntilQuit :: BasicGuestConstraints t m => IO a -> Event t () -> BasicGuest t m (Event t a) -- | Like repeatUntilQuit, but it doesn't do anything with the -- result of the action. May be a little more efficient if you don't need -- it. repeatUntilQuit_ :: BasicGuestConstraints t m => IO a -> Event t () -> BasicGuest t m () instance Reflex.Host.Class.ReflexHost t => Control.Monad.Fix.MonadFix (Reflex.Host.Basic.BasicGuest t m) instance Reflex.Host.Class.ReflexHost t => GHC.Base.Monad (Reflex.Host.Basic.BasicGuest t m) instance Reflex.Host.Class.ReflexHost t => GHC.Base.Applicative (Reflex.Host.Basic.BasicGuest t m) instance Reflex.Host.Class.ReflexHost t => GHC.Base.Functor (Reflex.Host.Basic.BasicGuest t m) instance (Reflex.Host.Class.ReflexHost t, Control.Monad.IO.Class.MonadIO (Reflex.Host.Class.HostFrame t)) => Control.Monad.IO.Class.MonadIO (Reflex.Host.Basic.BasicGuest t m) instance Reflex.Host.Class.ReflexHost t => Reflex.Class.MonadSample t (Reflex.Host.Basic.BasicGuest t m) instance (Reflex.Host.Class.ReflexHost t, Reflex.Class.MonadHold t m) => Reflex.Class.MonadHold t (Reflex.Host.Basic.BasicGuest t m) instance Reflex.Host.Class.ReflexHost t => Reflex.PostBuild.Class.PostBuild t (Reflex.Host.Basic.BasicGuest t m) instance (Reflex.Host.Class.ReflexHost t, Control.Monad.Ref.MonadRef (Reflex.Host.Class.HostFrame t), Control.Monad.Ref.Ref (Reflex.Host.Class.HostFrame t) Data.Type.Equality.~ Control.Monad.Ref.Ref GHC.Types.IO) => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.Host.Basic.BasicGuest t m) instance (Reflex.Host.Class.ReflexHost t, Control.Monad.Ref.Ref m Data.Type.Equality.~ Control.Monad.Ref.Ref GHC.Types.IO, Control.Monad.Ref.MonadRef (Reflex.Host.Class.HostFrame t), Control.Monad.Ref.Ref (Reflex.Host.Class.HostFrame t) Data.Type.Equality.~ Control.Monad.Ref.Ref GHC.Types.IO, Control.Monad.IO.Class.MonadIO (Reflex.Host.Class.HostFrame t), Control.Monad.Primitive.PrimMonad (Reflex.Host.Class.HostFrame t), Control.Monad.IO.Class.MonadIO m) => Reflex.PerformEvent.Class.PerformEvent t (Reflex.Host.Basic.BasicGuest t m) instance (Reflex.Host.Class.ReflexHost t, Control.Monad.Ref.Ref m Data.Type.Equality.~ Control.Monad.Ref.Ref GHC.Types.IO, Reflex.Class.MonadHold t m, Control.Monad.Primitive.PrimMonad (Reflex.Host.Class.HostFrame t)) => Reflex.Adjustable.Class.Adjustable t (Reflex.Host.Basic.BasicGuest t m) instance Reflex.Host.Class.ReflexHost t => Reflex.NotReady.Class.NotReady t (Reflex.Host.Basic.BasicGuest t m)