summaryrefslogtreecommitdiff
path: root/src/Reflex/Host/Basic.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Reflex/Host/Basic.hs')
-rw-r--r--src/Reflex/Host/Basic.hs28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/Reflex/Host/Basic.hs b/src/Reflex/Host/Basic.hs
index 15ba7be..7b35ebf 100644
--- a/src/Reflex/Host/Basic.hs
+++ b/src/Reflex/Host/Basic.hs
@@ -2,9 +2,9 @@
Module : Reflex.Host.Basic
Copyright : (c) 2019 Commonwealth Scientific and Industrial Research Organisation (CSIRO)
License : BSD-3
-Maintainer : dave.laing.80@gmail.com
+Maintainer : dave.laing.80@gmail.com, jack.kelly@data61.csiro.au
-'BasicGuest' provides instances that most `reflex` programs need:
+'BasicGuest' provides instances that most Reflex programs need:
* 'MonadIO'
* 'MonadFix'
@@ -17,7 +17,7 @@ Maintainer : dave.laing.80@gmail.com
* 'Adjustable'
For some usage examples, see
-<https://github.com/qfpl/reflex-basic-host/tree/master/example the example directory>
+<https://github.com/qfpl/reflex-basic-host/tree/master/example the example directory>.
-}
@@ -31,10 +31,16 @@ For some usage examples, see
{-# LANGUAGE UndecidableInstances #-}
module Reflex.Host.Basic
- ( BasicGuest
- , BasicGuestConstraints
- , basicHostWithQuit
+ (
+ -- * Running the host
+ basicHostWithQuit
, basicHostForever
+
+ -- * Types
+ , BasicGuest
+ , BasicGuestConstraints
+
+ -- * Utilities
, repeatUntilQuit
, repeatUntilQuit_
) where
@@ -57,6 +63,8 @@ import Data.Traversable (for)
import Reflex
import Reflex.Host.Class
+-- | Constraints provided by a 'BasicGuest', when run by
+-- 'basicHostWithQuit' or 'basicHostForever'.
type BasicGuestConstraints t (m :: * -> *) =
( MonadReflexHost t m
, MonadHold t m
@@ -70,6 +78,12 @@ type BasicGuestConstraints t (m :: * -> *) =
, MonadFix m
)
+-- | 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) => ...
+-- @
newtype BasicGuest t (m :: * -> *) a =
BasicGuest {
unBasicGuest :: PostBuildT t (TriggerEventT t (PerformEventT t m)) a
@@ -181,7 +195,7 @@ basicHostForever guest = basicHostWithQuit $ never <$ guest
-- | Run a 'BasicGuest', and return when the 'Event' returned by the
-- 'BasicGuest' fires.
--
--- Each call runs on a separate spider timeline, so you can launch
+-- Each host runs on a separate spider timeline, so you can launch
-- multiple hosts via 'Control.Concurrent.forkIO' or
-- 'Control.Concurrent.forkOS' and they will not mutex each other.
--