-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Higher-order Functional Reactive Programming -- -- Reflex is a high-performance, deterministic, higher-order Functional -- Reactive Programming system @package reflex @version 0.6.3 module Control.Monad.ReaderIO -- | An approximate clone of RIO from the rio package, -- but not based on ReaderT. The trouble with ReaderT -- is that its third type argument has a nominal role, so we -- can't coerce through it when it's wrapped in some other data -- type. Ugh. newtype ReaderIO e a ReaderIO :: (e -> IO a) -> ReaderIO e a [runReaderIO] :: ReaderIO e a -> e -> IO a instance GHC.Base.Functor (Control.Monad.ReaderIO.ReaderIO e) instance GHC.Base.Applicative (Control.Monad.ReaderIO.ReaderIO e) instance GHC.Base.Monad (Control.Monad.ReaderIO.ReaderIO e) instance Control.Monad.Fix.MonadFix (Control.Monad.ReaderIO.ReaderIO e) instance Control.Monad.IO.Class.MonadIO (Control.Monad.ReaderIO.ReaderIO e) instance Control.Monad.Reader.Class.MonadReader e (Control.Monad.ReaderIO.ReaderIO e) module Data.AppendMap -- | AppendMap is a synonym for MonoidalMap -- | Deprecated: Use MonoidalMap instead type AppendMap = MonoidalMap -- | Pattern synonym for MonoidalMap -- | Deprecated: Use MonoidalMap instead pattern AppendMap :: Map k v -> MonoidalMap k v -- | A synonym for getMonoidalMap -- | Deprecated: Use getMonoidalMap instead _unAppendMap :: MonoidalMap k v -> Map k v -- | Deletes a key, returning Nothing if the result is empty. nonEmptyDelete :: Ord k => k -> MonoidalMap k a -> Maybe (MonoidalMap k a) -- | Like mapMaybe but indicates whether the resulting container is -- empty mapMaybeNoNull :: (a -> Maybe b) -> MonoidalMap token a -> Maybe (MonoidalMap token b) -- | Displays a MonoidalMap as a tree. See showTree for -- details. showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String -- | Displays a MonoidalMap as a tree, using the supplied function -- to convert nodes to string. showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String instance Data.Witherable.Filterable (Data.Map.Monoidal.MonoidalMap k) instance Data.Default.Class.Default (Data.Map.Monoidal.MonoidalMap k a) -- | This module defines the FastWeakBag type, which represents a -- mutable collection of items that does not cause the items to be -- retained in memory. This is useful for situations where a value needs -- to be inspected or modified if it is still alive, but can be ignored -- if it is dead. module Data.FastWeakBag -- | A FastWeakBag holds a set of values of type a, -- but does not retain them - that is, they can still be -- garbage-collected. As long as the a values remain -- alive, the FastWeakBag will continue to refer to them. data FastWeakBag a -- | When inserting an item into a FastWeakBag, a -- FastWeakBagTicket is returned. If the caller retains the -- ticket, the item is guranteed to stay in memory (and thus in the -- FastWeakBag). The ticket can also be used to remove the item -- from the FastWeakBag prematurely (i.e. while it is still -- alive), using remove. data FastWeakBagTicket a -- | Create an empty FastWeakBag. empty :: IO (FastWeakBag a) -- | Check whether a FastWeakBag is empty. isEmpty :: FastWeakBag a -> IO Bool -- | Insert an item into a FastWeakBag. insert :: a -> FastWeakBag a -> IO (FastWeakBagTicket a) -- | Deprecated: Use traverse_ instead traverse :: forall a m. MonadIO m => FastWeakBag a -> (a -> m ()) -> m () -- | Visit every node in the given list. If new nodes are appended during -- the traversal, they will not be visited. Every live node that was in -- the list when the traversal began will be visited exactly once; -- however, no guarantee is made about the order of the traversal. traverse_ :: forall a m. MonadIO m => FastWeakBag a -> (a -> m ()) -> m () -- | Remove an item from the FastWeakBag; does nothing if invoked -- multiple times on the same FastWeakBagTicket. remove :: FastWeakBagTicket a -> IO () -- | Map of items contained by the FastWeakBag _weakBag_children :: FastWeakBag a -> IORef (IntMap (Weak a)) -- | This module provides types and functions with no particular theme, but -- which are relevant to the use of Functor-based datastructures -- like DMap. module Data.Functor.Misc -- | Const2 stores a value of a given type k and ensures -- that a particular type v is always given for the last type -- parameter data Const2 :: * -> x -> x -> * [Const2] :: k -> Const2 k v v -- | Extract the value from a Const2 unConst2 :: Const2 k v v' -> k -- | Convert a DMap to a regular Map dmapToMap :: DMap (Const2 k v) Identity -> Map k v -- | Convert a DMap to an IntMap dmapToIntMap :: DMap (Const2 Key v) Identity -> IntMap v -- | Convert a DMap to a regular Map, applying the given -- function to remove the wrapping Functor dmapToMapWith :: (f v -> v') -> DMap (Const2 k v) f -> Map k v' -- | Convert a regular Map to a DMap mapToDMap :: Map k v -> DMap (Const2 k v) Identity -- | Convert a DMap to a regular Map by forgetting the types -- associated with the keys, using a function to remove the wrapping -- Functor weakenDMapWith :: (forall a. v a -> v') -> DMap k v -> Map (Some k) v' -- | WrapArg can be used to tag a value in one functor with a type -- representing another functor. This was primarily used with -- dependent-map < 0.2, in which the value type was not wrapped in a -- separate functor. data WrapArg :: (k -> *) -> (k -> *) -> * -> * [WrapArg] :: f a -> WrapArg g f (g a) -- | Convert a regular Map, where the values are already wrapped in -- a functor, to a DMap mapWithFunctorToDMap :: Map k (f v) -> DMap (Const2 k v) f -- | Convert a regular IntMap, where the values are already wrapped -- in a functor, to a DMap intMapWithFunctorToDMap :: IntMap (f v) -> DMap (Const2 Key v) f -- | Map over all key/value pairs in a DMap, potentially altering -- the key as well as the value. The provided function MUST preserve the -- ordering of the keys, or the resulting DMap will be malformed. mapKeyValuePairsMonotonic :: (DSum k v -> DSum k' v') -> DMap k v -> DMap k' v' -- | Union two DMaps of different types, yielding another type. Each -- key that is present in either input map will be present in the output. combineDMapsWithKey :: forall f g h i. GCompare f => (forall a. f a -> These (g a) (h a) -> i a) -> DMap f g -> DMap f h -> DMap f i -- | Tag type for Either to use it as a DSum. data EitherTag l r a [LeftTag] :: EitherTag l r l [RightTag] :: EitherTag l r r -- | Extract the values of a DMap of EitherTags. dmapToThese :: DMap (EitherTag a b) Identity -> Maybe (These a b) -- | Convert Either to a DSum. Inverse of -- dsumToEither. eitherToDSum :: Either a b -> DSum (EitherTag a b) Identity -- | Convert DSum to Either. Inverse of eitherToDSum. dsumToEither :: DSum (EitherTag a b) Identity -> Either a b -- | We can't use Compose Maybe instead of ComposeMaybe, -- because that would make the f parameter have a nominal type -- role. We need f to be representational so that we can use safe -- coerce. newtype ComposeMaybe f a ComposeMaybe :: Maybe (f a) -> ComposeMaybe f a [getComposeMaybe] :: ComposeMaybe f a -> Maybe (f a) instance forall k (f :: k -> *) (a :: k). GHC.Classes.Ord (f a) => GHC.Classes.Ord (Data.Functor.Misc.ComposeMaybe f a) instance forall k (f :: k -> *) (a :: k). GHC.Classes.Eq (f a) => GHC.Classes.Eq (Data.Functor.Misc.ComposeMaybe f a) instance forall k (f :: k -> *) (a :: k). GHC.Show.Show (f a) => GHC.Show.Show (Data.Functor.Misc.ComposeMaybe f a) instance forall x k (v :: x) (v' :: x). GHC.Classes.Eq k => GHC.Classes.Eq (Data.Functor.Misc.Const2 k v v') instance forall x k (v :: x) (v' :: x). GHC.Classes.Ord k => GHC.Classes.Ord (Data.Functor.Misc.Const2 k v v') instance forall x k (v :: x) (v' :: x). GHC.Show.Show k => GHC.Show.Show (Data.Functor.Misc.Const2 k v v') instance forall x k (v :: x). GHC.Read.Read k => GHC.Read.Read (Data.Functor.Misc.Const2 k v v) instance forall k (f :: k -> *) (a :: k) (g :: k -> *) (g' :: k -> *). GHC.Classes.Eq (f a) => GHC.Classes.Eq (Data.Functor.Misc.WrapArg g f (g' a)) instance forall k (f :: k -> *) (a :: k) (g :: k -> *) (g' :: k -> *). GHC.Classes.Ord (f a) => GHC.Classes.Ord (Data.Functor.Misc.WrapArg g f (g' a)) instance forall k (f :: k -> *) (a :: k) (g :: k -> *) (g' :: k -> *). GHC.Show.Show (f a) => GHC.Show.Show (Data.Functor.Misc.WrapArg g f (g' a)) instance forall k (f :: k -> *) (a :: k) (g :: k -> *). GHC.Read.Read (f a) => GHC.Read.Read (Data.Functor.Misc.WrapArg g f (g a)) instance forall k (l :: k) (r :: k) (a :: k). GHC.Show.Show (Data.Functor.Misc.EitherTag l r a) instance forall k (l :: k) (r :: k) (a :: k). GHC.Classes.Eq (Data.Functor.Misc.EitherTag l r a) instance forall k (l :: k) (r :: k) (a :: k). GHC.Classes.Ord (Data.Functor.Misc.EitherTag l r a) instance GHC.Base.Functor f => GHC.Base.Functor (Data.Functor.Misc.ComposeMaybe f) instance forall k (l :: k) (r :: k). Data.GADT.Compare.GEq (Data.Functor.Misc.EitherTag l r) instance forall k (l :: k) (r :: k). Data.GADT.Compare.GCompare (Data.Functor.Misc.EitherTag l r) instance forall k (l :: k) (r :: k). Data.GADT.Show.GShow (Data.Functor.Misc.EitherTag l r) instance forall k (f :: k -> *) (g :: k -> *). Data.GADT.Compare.GEq f => Data.GADT.Compare.GEq (Data.Functor.Misc.WrapArg g f) instance forall k (f :: k -> *) (g :: k -> *). Data.GADT.Compare.GCompare f => Data.GADT.Compare.GCompare (Data.Functor.Misc.WrapArg g f) instance forall k1 k2 (v :: k1). GHC.Show.Show k2 => Data.GADT.Show.GShow (Data.Functor.Misc.Const2 k2 v) instance forall k1 k2 (v :: k1). GHC.Classes.Eq k2 => Data.GADT.Compare.GEq (Data.Functor.Misc.Const2 k2 v) instance forall k1 k2 (v :: k1). GHC.Classes.Ord k2 => Data.GADT.Compare.GCompare (Data.Functor.Misc.Const2 k2 v) -- | Additional functions for manipulating Maps. module Data.Map.Misc -- | Produce a Map k (Maybe v) by comparing two -- Map k vs, old and new respectively. -- Just represents an association present in new and -- Nothing represents an association only present in -- old but no longer present in new. -- -- Similar to diffMap but doesn't require Eq on the values, -- thus can't tell if a value has changed or not. diffMapNoEq :: Ord k => Map k v -> Map k v -> Map k (Maybe v) -- | Produce a Map k (Maybe v) by comparing two -- Map k vs, old and new respectively. -- Just represents an association present in new and -- either not present in old or where the value has changed. -- Nothing represents an association only present in -- old but no longer present in new@. -- -- See also diffMapNoEq for a similar but weaker version which -- does not require Eq on the values but thus can't indicated a -- value not changing between old and new with -- Nothing. diffMap :: (Ord k, Eq v) => Map k v -> Map k v -> Map k (Maybe v) -- | Given a Map k (Maybe v) representing keys to -- insert/update (Just) or delete (Nothing), produce a -- new map from the given input Map k v. -- -- See also Map and MapWithMove. applyMap :: Ord k => Map k (Maybe v) -> Map k v -> Map k v -- | Split a Map k (Either a b) into Map k a and -- Map k b, equivalent to mapEither id -- | Deprecated: Use mapEither instead mapPartitionEithers :: Map k (Either a b) -> (Map k a, Map k b) -- | Given a Map k (Maybe v) representing keys to -- insert/update (Just) or delete (Nothing), produce a -- new Set k from the given input set. -- -- Equivalent to: -- --
-- applyMapKeysSet patch (keysSet m) == keysSet (applyMap patch m) ---- -- but avoids the intervening Map and needs no values. applyMapKeysSet :: Ord k => Map k (Maybe v) -> Set k -> Set k -- | This module defines the WeakBag type, which represents a -- mutable collection of items that does not cause the items to be -- retained in memory. This is useful for situations where a value needs -- to be inspected or modified if it is still alive, but can be ignored -- if it is dead. module Data.WeakBag -- | A WeakBag holds a set of values of type a, but -- does not retain them - that is, they can still be garbage-collected. -- As long as the a values remain alive, the -- WeakBag will continue to refer to them. data WeakBag a -- | When inserting an item into a WeakBag, a WeakBagTicket -- is returned. If the caller retains the ticket, the item is guranteed -- to stay in memory (and thus in the WeakBag). The ticket can -- also be used to remove the item from the WeakBag prematurely -- (i.e. while it is still alive), using remove. data WeakBagTicket -- | Create an empty WeakBag. empty :: IO (WeakBag a) -- | Create a WeakBag with one item; equivalent to creating the -- WeakBag with empty, then using insert. singleton :: a -> IORef (Weak b) -> (b -> IO ()) -> IO (WeakBag a, WeakBagTicket) -- | Insert an item into a WeakBag. insert :: a -> WeakBag a -> IORef (Weak b) -> (b -> IO ()) -> IO WeakBagTicket -- | Deprecated: Use traverse_ instead traverse :: MonadIO m => WeakBag a -> (a -> m ()) -> m () -- | Visit every node in the given list. If new nodes are appended during -- the traversal, they will not be visited. Every live node that was in -- the list when the traversal began will be visited exactly once; -- however, no guarantee is made about the order of the traversal. traverse_ :: MonadIO m => WeakBag a -> (a -> m ()) -> m () -- | Remove an item from the WeakBag; does nothing if invoked -- multiple times on the same WeakBagTicket. remove :: WeakBagTicket -> IO () -- | The items referenced by the WeakBag _weakBag_children :: WeakBag a -> IORef (IntMap (Weak a)) module Reflex.FastWeak -- | A FastWeak which has been promoted to a strong reference. -- getFastWeakTicketValue can be used to get the referred to value -- without fear of Nothing, and getFastWeakTicketWeak can -- be used to get the weak version. data FastWeakTicket a -- | A reference to some value which can be garbage collected if there are -- only weak references to the value left. -- -- getFastWeakValue can be used to try and obtain a strong -- reference to the value. -- -- The value in a FastWeak can also be kept alive by obtaining a -- FastWeakTicket using getFastWeakTicket if the value -- hasn't been collected yet. -- -- Synonymous with Weak. type FastWeak a = Weak a -- | Create a FastWeakTicket directly from a value, creating a -- FastWeak in the process which can be obtained with -- getFastWeakTicketValue. mkFastWeakTicket :: a -> IO (FastWeakTicket a) -- | Return the a kept alive by the given FastWeakTicket. -- -- This needs to be in IO so we know that we've relinquished the ticket. getFastWeakTicketValue :: FastWeakTicket a -> IO a -- | Demote a FastWeakTicket; which ensures the value is alive, to a -- FastWeak which doesn't. Note that unless the ticket for the -- same FastWeak is held in some other way the value might be -- collected immediately. getFastWeakTicketWeak :: FastWeakTicket a -> IO (FastWeak a) -- | Get the value referred to by a FastWeak if it hasn't yet been -- collected, or Nothing if it has been collected. getFastWeakValue :: FastWeak a -> IO (Maybe a) -- | Try to create a FastWeakTicket for the given FastWeak -- which will ensure the value referred remains alive. Returns -- Just if the value hasn't been collected and a ticket can -- therefore be obtained, Nothing if it's been collected. getFastWeakTicket :: forall a. FastWeak a -> IO (Maybe (FastWeakTicket a)) -- | A weak reference that is always empty emptyFastWeak :: FastWeak a module Reflex.FunctorMaybe -- | A class for values that combines filtering and mapping using -- Maybe. Morally, FunctorMaybe ~ KleisliFunctor -- Maybe. -- | Deprecated: Use Filterable from Data.Witherable instead class FunctorMaybe f -- | Combined mapping and filtering function. fmapMaybe :: FunctorMaybe f => (a -> Maybe b) -> f a -> f b instance Reflex.FunctorMaybe.FunctorMaybe Data.Semigroup.Option instance Reflex.FunctorMaybe.FunctorMaybe GHC.Maybe.Maybe instance Reflex.FunctorMaybe.FunctorMaybe [] instance Reflex.FunctorMaybe.FunctorMaybe (Data.Map.Internal.Map k) instance Reflex.FunctorMaybe.FunctorMaybe Data.IntMap.Internal.IntMap -- | The interface for types which represent changes made to other types module Reflex.Patch.Class -- | A Patch type represents a kind of change made to a -- datastructure. -- -- If an instance of Patch is also an instance of -- Semigroup, it should obey the law that applyAlways (f -- <> g) == applyAlways f . applyAlways g. class Patch p where { type family PatchTarget p :: *; } -- | Apply the patch p a to the value a. If no change is -- needed, return Nothing. apply :: Patch p => p -> PatchTarget p -> Maybe (PatchTarget p) -- | Apply a Patch; if it does nothing, return the original value applyAlways :: Patch p => p -> PatchTarget p -> PatchTarget p -- | Like '(.)', but composes functions that return patches rather than -- functions that return new values. The Semigroup instance for patches -- must apply patches right-to-left, like '(.)'. composePatchFunctions :: (Patch p, Semigroup p) => (PatchTarget p -> p) -> (PatchTarget p -> p) -> PatchTarget p -> p instance Reflex.Patch.Class.Patch (Data.Functor.Identity.Identity a) -- | Module containing PatchIntMap, a Patch for IntMap -- which allows for insert/update or delete of associations. module Reflex.Patch.IntMap -- | Patch for IntMap which represents insertion or deletion -- of keys in the mapping. Internally represented by 'IntMap (Maybe a)', -- where Just means insert/update and Nothing means -- delete. newtype PatchIntMap a PatchIntMap :: IntMap (Maybe a) -> PatchIntMap a -- | Map a function Int -> a -> b over all as in -- the given PatchIntMap a (that is, all -- inserts/updates), producing a PatchIntMap b. mapIntMapPatchWithKey :: (Int -> a -> b) -> PatchIntMap a -> PatchIntMap b -- | Map an effectful function Int -> a -> f b over all -- as in the given PatchIntMap a (that is, all -- inserts/updates), producing a f (PatchIntMap b). traverseIntMapPatchWithKey :: Applicative f => (Int -> a -> f b) -> PatchIntMap a -> f (PatchIntMap b) -- | Extract all as inserted/updated by the given -- PatchIntMap a. patchIntMapNewElements :: PatchIntMap a -> [a] -- | Convert the given PatchIntMap a into an -- IntMap a with all the inserts/updates in the given -- patch. patchIntMapNewElementsMap :: PatchIntMap a -> IntMap a -- | Subset the given IntMap a to contain only the keys -- that would be deleted by the given PatchIntMap a. getDeletions :: PatchIntMap v -> IntMap v' -> IntMap v' instance GHC.Base.Monoid (Reflex.Patch.IntMap.PatchIntMap a) instance Data.Traversable.Traversable Reflex.Patch.IntMap.PatchIntMap instance Data.Foldable.Foldable Reflex.Patch.IntMap.PatchIntMap instance GHC.Base.Functor Reflex.Patch.IntMap.PatchIntMap instance Reflex.Patch.Class.Patch (Reflex.Patch.IntMap.PatchIntMap a) instance GHC.Base.Semigroup (Reflex.Patch.IntMap.PatchIntMap v) module Data.FastMutableIntMap -- | A FastMutableIntMap holds a map of values of type a -- and allows low-overhead modifications via IO. Operations on -- FastMutableIntMap run in IO. data FastMutableIntMap a -- | Create a new FastMutableIntMap out of an IntMap new :: IntMap a -> IO (FastMutableIntMap a) -- | Create a new empty FastMutableIntMap newEmpty :: IO (FastMutableIntMap a) -- | Insert an element into a FastMutableIntMap at the given key insert :: FastMutableIntMap a -> Int -> a -> IO () -- | Checks whether a FastMutableIntMap is empty isEmpty :: FastMutableIntMap a -> IO Bool -- | Make an immutable snapshot of the datastructure and clear it getFrozenAndClear :: FastMutableIntMap a -> IO (IntMap a) -- | Retrieves the size of a FastMutableIntMap size :: FastMutableIntMap a -> IO Int -- | Updates the value of a FastMutableIntMap with the given patch -- (see IntMap), and returns an IntMap with the modified -- keys and values. applyPatch :: FastMutableIntMap a -> PatchIntMap a -> IO (IntMap a) -- | Patch for IntMap which represents insertion or deletion -- of keys in the mapping. Internally represented by 'IntMap (Maybe a)', -- where Just means insert/update and Nothing means -- delete. newtype PatchIntMap a PatchIntMap :: IntMap (Maybe a) -> PatchIntMap a -- | Map an effectful function Int -> a -> f b over all -- as in the given PatchIntMap a (that is, all -- inserts/updates), producing a f (PatchIntMap b). traverseIntMapPatchWithKey :: Applicative f => (Int -> a -> f b) -> PatchIntMap a -> f (PatchIntMap b) -- | Attempt to lookup an element by key in a FastMutableIntMap lookup :: FastMutableIntMap a -> Int -> IO (Maybe a) -- | Runs the provided action over the intersection of a -- FastMutableIntMap and an IntMap forIntersectionWithImmutable_ :: MonadIO m => FastMutableIntMap a -> IntMap b -> (a -> b -> m ()) -> m () -- | Runs the provided action over the values of a FastMutableIntMap for_ :: MonadIO m => FastMutableIntMap a -> (a -> m ()) -> m () -- | Extract all as inserted/updated by the given -- PatchIntMap a. patchIntMapNewElements :: PatchIntMap a -> [a] -- | Convert the given PatchIntMap a into an -- IntMap a with all the inserts/updates in the given -- patch. patchIntMapNewElementsMap :: PatchIntMap a -> IntMap a -- | Subset the given IntMap a to contain only the keys -- that would be deleted by the given PatchIntMap a. getDeletions :: PatchIntMap v -> IntMap v' -> IntMap v' -- | Patches on Map that consist only of insertions -- (including overwrites) and deletions module Reflex.Patch.Map -- | A set of changes to a Map. Any element may be inserted/updated -- or deleted. Insertions are represented as values wrapped in -- Just, while deletions are represented as Nothings newtype PatchMap k v PatchMap :: Map k (Maybe v) -> PatchMap k v [unPatchMap] :: PatchMap k v -> Map k (Maybe v) -- | Returns all the new elements that will be added to the Map patchMapNewElements :: PatchMap k v -> [v] -- | Returns all the new elements that will be added to the Map patchMapNewElementsMap :: PatchMap k v -> Map k v instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => GHC.Classes.Ord (Reflex.Patch.Map.PatchMap k v) instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Reflex.Patch.Map.PatchMap k v) instance (GHC.Classes.Ord k, GHC.Read.Read k, GHC.Read.Read v) => GHC.Read.Read (Reflex.Patch.Map.PatchMap k v) instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Reflex.Patch.Map.PatchMap k v) instance GHC.Classes.Ord k => Reflex.Patch.Class.Patch (Reflex.Patch.Map.PatchMap k v) instance GHC.Classes.Ord k => GHC.Base.Semigroup (Reflex.Patch.Map.PatchMap k v) instance GHC.Classes.Ord k => GHC.Base.Monoid (Reflex.Patch.Map.PatchMap k v) instance GHC.Base.Functor (Reflex.Patch.Map.PatchMap k) -- | Patches on DMap that consist only of insertions (or -- overwrites) and deletions. module Reflex.Patch.DMap -- | A set of changes to a DMap. Any element may be inserted/updated -- or deleted. Insertions are represented as ComposeMaybe -- (Just value), while deletions are represented as -- ComposeMaybe Nothing. newtype PatchDMap k v PatchDMap :: DMap k (ComposeMaybe v) -> PatchDMap k v [unPatchDMap] :: PatchDMap k v -> DMap k (ComposeMaybe v) -- | Map a function v a -> v' a over any inserts/updates in the -- given PatchDMap k v to produce a PatchDMap -- k v'. mapPatchDMap :: (forall a. v a -> v' a) -> PatchDMap k v -> PatchDMap k v' -- | Map an effectful function v a -> f (v' a) over any -- inserts/updates in the given PatchDMap k v to produce -- a PatchDMap k v'. traversePatchDMap :: Applicative f => (forall a. v a -> f (v' a)) -> PatchDMap k v -> f (PatchDMap k v') -- | Map an effectful function k a -> v a -> f (v' a) over -- any inserts/updates in the given PatchDMap k v to -- produce a PatchDMap k v'. traversePatchDMapWithKey :: Applicative m => (forall a. k a -> v a -> m (v' a)) -> PatchDMap k v -> m (PatchDMap k v') -- | Weaken a PatchDMap k v to a PatchMap (Some -- k) v' using a function v a -> v' to weaken each value -- contained in the patch. weakenPatchDMapWith :: (forall a. v a -> v') -> PatchDMap k v -> PatchMap (Some k) v' -- | Convert a weak PatchDMap (Const2 k a) v where -- the a is known by way of the Const2 into a -- PatchMap k v' using a rank 1 function v a -> -- v'. patchDMapToPatchMapWith :: (v a -> v') -> PatchDMap (Const2 k a) v -> PatchMap k v' -- | Convert a PatchMap k v into a PatchDMap -- (Const2 k a) v' using a function v -> v' a. const2PatchDMapWith :: forall k v v' a. (v -> v' a) -> PatchMap k v -> PatchDMap (Const2 k a) v' -- | Convert a PatchIntMap v into a PatchDMap -- (Const2 Int a) v' using a function v -> v' a. const2IntPatchDMapWith :: forall v f a. (v -> f a) -> PatchIntMap v -> PatchDMap (Const2 Key a) f -- | Get the values that will be replaced or deleted if the given patch is -- applied to the given DMap. getDeletions :: GCompare k => PatchDMap k v -> DMap k v' -> DMap k v' instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *). Data.GADT.Compare.GCompare k2 => GHC.Base.Semigroup (Reflex.Patch.DMap.PatchDMap k2 v) instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *). Data.GADT.Compare.GCompare k2 => GHC.Base.Monoid (Reflex.Patch.DMap.PatchDMap k2 v) instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *). Data.GADT.Compare.GCompare k2 => Reflex.Patch.Class.Patch (Reflex.Patch.DMap.PatchDMap k2 v) -- | Patches on Map that can insert, delete, and move values -- from one key to another module Reflex.Patch.MapWithMove -- | Patch a DMap with additions, deletions, and moves. Invariant: If key -- k1 is coming from From_Move k2, then key k2 -- should be going to Just k1, and vice versa. There should -- never be any unpaired From/To keys. newtype PatchMapWithMove k v PatchMapWithMove :: Map k (NodeInfo k v) -> PatchMapWithMove k v -- | Holds the information about each key: where its new value should come -- from, and where its old value should go to data NodeInfo k v NodeInfo :: !From k v -> !To k -> NodeInfo k v -- | Where do we get the new value for this key? [_nodeInfo_from] :: NodeInfo k v -> !From k v -- | If the old value is being kept (i.e. moved rather than deleted or -- replaced), where is it going? [_nodeInfo_to] :: NodeInfo k v -> !To k -- | Describe how a key's new value should be produced data From k v -- | Insert the given value here From_Insert :: v -> From k v -- | Delete the existing value, if any, from here From_Delete :: From k v -- | Move the value here from the given key From_Move :: !k -> From k v -- | Describe where a key's old value will go. If this is Just, that -- means the key's old value will be moved to the given other key; if it -- is Nothing, that means it will be deleted. type To = Maybe -- | Create a PatchMapWithMove, validating it patchMapWithMove :: Ord k => Map k (NodeInfo k v) -> Maybe (PatchMapWithMove k v) -- | Create a PatchMapWithMove that inserts everything in the given -- Map patchMapWithMoveInsertAll :: Map k v -> PatchMapWithMove k v -- | Extract the internal representation of the PatchMapWithMove unPatchMapWithMove :: PatchMapWithMove k v -> Map k (NodeInfo k v) -- | Make a PatchMapWithMove k v which has the effect of -- inserting or updating a value v to the given key k, -- like insert. insertMapKey :: k -> v -> PatchMapWithMove k v -- | Make a PatchMapWithMove k v which has the effect of -- moving the value from the first key k to the second key -- k, equivalent to: -- --
-- delete src (maybe map (insert dst) (Map.lookup src map)) --moveMapKey :: Ord k => k -> k -> PatchMapWithMove k v -- | Make a PatchMapWithMove k v which has the effect of -- swapping two keys in the mapping, equivalent to: -- --
-- let aMay = Map.lookup a map -- bMay = Map.lookup b map -- in maybe id (Map.insert a) (bMay mplus aMay) -- . maybe id (Map.insert b) (aMay mplus bMay) -- . Map.delete a . Map.delete b $ map --swapMapKey :: Ord k => k -> k -> PatchMapWithMove k v -- | Make a PatchMapWithMove k v which has the effect of -- deleting a key in the mapping, equivalent to delete. deleteMapKey :: k -> PatchMapWithMove k v -- | Wrap a Map k (NodeInfo k v) representing patch changes -- into a PatchMapWithMove k v, without checking any -- invariants. -- -- Warning: when using this function, you must ensure that the -- invariants of PatchMapWithMove are preserved; they will not be -- checked. unsafePatchMapWithMove :: Map k (NodeInfo k v) -> PatchMapWithMove k v -- | Returns all the new elements that will be added to the Map. patchMapWithMoveNewElements :: PatchMapWithMove k v -> [v] -- | Return a Map k v with all the inserts/updates from the -- given PatchMapWithMove k v. patchMapWithMoveNewElementsMap :: PatchMapWithMove k v -> Map k v -- | Create a PatchMapWithMove that, if applied to the given -- Map, will sort its values using the given ordering function. -- The set keys of the Map is not changed. patchThatSortsMapWith :: Ord k => (v -> v -> Ordering) -> Map k v -> PatchMapWithMove k v -- | Create a PatchMapWithMove that, if applied to the first -- Map provided, will produce a Map with the same values as -- the second Map but with the values sorted with the given -- ordering function. patchThatChangesAndSortsMapWith :: forall k v. (Ord k, Ord v) => (v -> v -> Ordering) -> Map k v -> Map k v -> PatchMapWithMove k v -- | Create a PatchMapWithMove that, if applied to the first -- Map provided, will produce the second Map. patchThatChangesMap :: (Ord k, Ord v) => Map k v -> Map k v -> PatchMapWithMove k v -- | Change the From value of a NodeInfo nodeInfoMapFrom :: (From k v -> From k v) -> NodeInfo k v -> NodeInfo k v -- | Change the From value of a NodeInfo, using a -- Functor (or Applicative, Monad, etc.) action to -- get the new value nodeInfoMapMFrom :: Functor f => (From k v -> f (From k v)) -> NodeInfo k v -> f (NodeInfo k v) -- | Set the To field of a NodeInfo nodeInfoSetTo :: To k -> NodeInfo k v -> NodeInfo k v -- | Helper data structure used for composing patches using the monoid -- instance. data Fixup k v Fixup_Delete :: Fixup k v Fixup_Update :: These (From k v) (To k) -> Fixup k v instance Data.Traversable.Traversable (Reflex.Patch.MapWithMove.PatchMapWithMove k) instance Data.Foldable.Foldable (Reflex.Patch.MapWithMove.PatchMapWithMove k) instance GHC.Base.Functor (Reflex.Patch.MapWithMove.PatchMapWithMove k) instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => GHC.Classes.Ord (Reflex.Patch.MapWithMove.PatchMapWithMove k v) instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Reflex.Patch.MapWithMove.PatchMapWithMove k v) instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Reflex.Patch.MapWithMove.PatchMapWithMove k v) instance Data.Traversable.Traversable (Reflex.Patch.MapWithMove.NodeInfo k) instance Data.Foldable.Foldable (Reflex.Patch.MapWithMove.NodeInfo k) instance GHC.Base.Functor (Reflex.Patch.MapWithMove.NodeInfo k) instance (GHC.Classes.Ord v, GHC.Classes.Ord k) => GHC.Classes.Ord (Reflex.Patch.MapWithMove.NodeInfo k v) instance (GHC.Classes.Eq v, GHC.Classes.Eq k) => GHC.Classes.Eq (Reflex.Patch.MapWithMove.NodeInfo k v) instance (GHC.Read.Read v, GHC.Read.Read k) => GHC.Read.Read (Reflex.Patch.MapWithMove.NodeInfo k v) instance (GHC.Show.Show v, GHC.Show.Show k) => GHC.Show.Show (Reflex.Patch.MapWithMove.NodeInfo k v) instance Data.Traversable.Traversable (Reflex.Patch.MapWithMove.From k) instance Data.Foldable.Foldable (Reflex.Patch.MapWithMove.From k) instance GHC.Base.Functor (Reflex.Patch.MapWithMove.From k) instance (GHC.Classes.Ord v, GHC.Classes.Ord k) => GHC.Classes.Ord (Reflex.Patch.MapWithMove.From k v) instance (GHC.Classes.Eq v, GHC.Classes.Eq k) => GHC.Classes.Eq (Reflex.Patch.MapWithMove.From k v) instance (GHC.Read.Read v, GHC.Read.Read k) => GHC.Read.Read (Reflex.Patch.MapWithMove.From k v) instance (GHC.Show.Show v, GHC.Show.Show k) => GHC.Show.Show (Reflex.Patch.MapWithMove.From k v) instance GHC.Classes.Ord k => GHC.Base.Semigroup (Reflex.Patch.MapWithMove.PatchMapWithMove k v) instance GHC.Classes.Ord k => Reflex.Patch.Class.Patch (Reflex.Patch.MapWithMove.PatchMapWithMove k v) instance GHC.Classes.Ord k => GHC.Base.Monoid (Reflex.Patch.MapWithMove.PatchMapWithMove k v) -- | Module containing PatchDMapWithMove k v and associated -- functions, which represents a Patch to a DMap k -- v which can insert, update, delete, and move values between keys. module Reflex.Patch.DMapWithMove -- | Like PatchMapWithMove, but for DMap. Each key carries a -- NodeInfo which describes how it will be changed by the patch -- and connects move sources and destinations. -- -- Invariants: -- --
-- delete src (maybe dmap (insert dst) (DMap.lookup src dmap)) --moveDMapKey :: GCompare k => k a -> k a -> PatchDMapWithMove k v -- | Make a PatchDMapWithMove k v which has the effect of -- swapping two keys in the mapping, equivalent to: -- --
-- let aMay = DMap.lookup a dmap -- bMay = DMap.lookup b dmap -- in maybe id (DMap.insert a) (bMay mplus aMay) -- . maybe id (DMap.insert b) (aMay mplus bMay) -- . DMap.delete a . DMap.delete b $ dmap --swapDMapKey :: GCompare k => k a -> k a -> PatchDMapWithMove k v -- | Make a PatchDMapWithMove k v which has the effect of -- deleting a key in the mapping, equivalent to delete. deleteDMapKey :: k a -> PatchDMapWithMove k v -- | Extract the DMap representing the patch changes from the -- PatchDMapWithMove. unPatchDMapWithMove :: PatchDMapWithMove k v -> DMap k (NodeInfo k v) -- | Wrap a DMap representing patch changes into a -- PatchDMapWithMove, without checking any invariants. -- -- Warning: when using this function, you must ensure that the -- invariants of PatchDMapWithMove are preserved; they will not be -- checked. unsafePatchDMapWithMove :: DMap k (NodeInfo k v) -> PatchDMapWithMove k v -- | Wrap a DMap representing patch changes into a -- PatchDMapWithMove while checking invariants. If the invariants -- are satisfied, Right p is returned otherwise Left -- errors. patchDMapWithMove :: (GCompare k, GShow k) => DMap k (NodeInfo k v) -> Either [String] (PatchDMapWithMove k v) -- | Map a natural transform v -> v' over the given patch, -- transforming PatchDMapWithMove k v into -- PatchDMapWithMove k v'. mapPatchDMapWithMove :: forall k v v'. (forall a. v a -> v' a) -> PatchDMapWithMove k v -> PatchDMapWithMove k v' -- | Traverse an effectful function forall a. v a -> m (v ' a) -- over the given patch, transforming PatchDMapWithMove k -- v into m (PatchDMapWithMove k v'). traversePatchDMapWithMove :: forall m k v v'. Applicative m => (forall a. v a -> m (v' a)) -> PatchDMapWithMove k v -> m (PatchDMapWithMove k v') -- | Map an effectful function forall a. k a -> v a -> m (v ' -- a) over the given patch, transforming -- PatchDMapWithMove k v into m -- (PatchDMapWithMove k v'). traversePatchDMapWithMoveWithKey :: forall m k v v'. Applicative m => (forall a. k a -> v a -> m (v' a)) -> PatchDMapWithMove k v -> m (PatchDMapWithMove k v') -- | Map a function which transforms From k v a into a -- From k v' a over a NodeInfo k v a. nodeInfoMapFrom :: (From k v a -> From k v' a) -> NodeInfo k v a -> NodeInfo k v' a -- | Map an effectful function which transforms From k v a -- into a f (From k v' a) over a NodeInfo k v -- a. nodeInfoMapFromM :: Functor f => (From k v a -> f (From k v' a)) -> NodeInfo k v a -> f (NodeInfo k v' a) -- | Weaken a PatchDMapWithMove to a PatchMapWithMove by -- weakening the keys from k a to Some k and -- applying a given weakening function v a -> v' to values. weakenPatchDMapWithMoveWith :: forall k v v'. (forall a. v a -> v') -> PatchDMapWithMove k v -> PatchMapWithMove (Some k) v' -- | Weaken a PatchDMapWithMove (Const2 k a) v to a -- PatchMapWithMove k v'. Weaken is in scare quotes -- because the Const2 has already disabled any dependency in the -- typing and all points are already a, hence the function to -- map each value to v' is not higher rank. patchDMapWithMoveToPatchMapWithMoveWith :: forall k v v' a. (v a -> v') -> PatchDMapWithMove (Const2 k a) v -> PatchMapWithMove k v' -- | Strengthen a PatchMapWithMove k v into a -- 'PatchDMapWithMove (Const2 k a); that is, turn a -- non-dependently-typed patch into a dependently typed one but which -- always has a constant key type represented by Const2. Apply the -- given function to each v to produce a v' a. -- Completemented by patchDMapWithMoveToPatchMapWithMoveWith const2PatchDMapWithMoveWith :: forall k v v' a. (v -> v' a) -> PatchMapWithMove k v -> PatchDMapWithMove (Const2 k a) v' -- | Get the values that will be replaced, deleted, or moved if the given -- patch is applied to the given DMap. getDeletionsAndMoves :: GCompare k => PatchDMapWithMove k v -> DMap k v' -> DMap k (Product v' (ComposeMaybe k)) instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *) (a :: k1). (GHC.Show.Show (v a), GHC.Show.Show (k2 a)) => GHC.Show.Show (Reflex.Patch.DMapWithMove.NodeInfo k2 v a) instance forall a (k :: a -> *) (v :: a -> *) (b :: a). (GHC.Classes.Ord (v b), GHC.Classes.Ord (k b)) => GHC.Classes.Ord (Reflex.Patch.DMapWithMove.From k v b) instance forall a (k :: a -> *) (v :: a -> *) (b :: a). (GHC.Classes.Eq (v b), GHC.Classes.Eq (k b)) => GHC.Classes.Eq (Reflex.Patch.DMapWithMove.From k v b) instance forall a (k :: a -> *) (v :: a -> *) (b :: a). (GHC.Read.Read (v b), GHC.Read.Read (k b)) => GHC.Read.Read (Reflex.Patch.DMapWithMove.From k v b) instance forall a (k :: a -> *) (v :: a -> *) (b :: a). (GHC.Show.Show (v b), GHC.Show.Show (k b)) => GHC.Show.Show (Reflex.Patch.DMapWithMove.From k v b) instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *). Data.GADT.Compare.GCompare k2 => GHC.Base.Semigroup (Reflex.Patch.DMapWithMove.PatchDMapWithMove k2 v) instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *). (Data.GADT.Compare.GEq k2, Data.Constraint.Extras.Has' GHC.Classes.Eq k2 (Reflex.Patch.DMapWithMove.NodeInfo k2 v)) => GHC.Classes.Eq (Reflex.Patch.DMapWithMove.PatchDMapWithMove k2 v) instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *). Data.GADT.Compare.GCompare k2 => GHC.Base.Monoid (Reflex.Patch.DMapWithMove.PatchDMapWithMove k2 v) instance forall k1 (k2 :: k1 -> *) (v :: k1 -> *). Data.GADT.Compare.GCompare k2 => Reflex.Patch.Class.Patch (Reflex.Patch.DMapWithMove.PatchDMapWithMove k2 v) module Reflex.Patch -- | The elements of an Additive Semigroup can be considered -- as patches of their own type. newtype AdditivePatch p AdditivePatch :: p -> AdditivePatch p [unAdditivePatch] :: AdditivePatch p -> p -- | An Additive Semigroup is one where (<>) is -- commutative class Semigroup q => Additive q -- | A Group is a Monoid where every element has an inverse. class (Semigroup q, Monoid q) => Group q negateG :: Group q => q -> q (~~) :: Group q => q -> q -> q -- | A Patch type represents a kind of change made to a -- datastructure. -- -- If an instance of Patch is also an instance of -- Semigroup, it should obey the law that applyAlways (f -- <> g) == applyAlways f . applyAlways g. class Patch p where { type family PatchTarget p :: *; } -- | Apply the patch p a to the value a. If no change is -- needed, return Nothing. apply :: Patch p => p -> PatchTarget p -> Maybe (PatchTarget p) -- | Apply a Patch; if it does nothing, return the original value applyAlways :: Patch p => p -> PatchTarget p -> PatchTarget p -- | Like '(.)', but composes functions that return patches rather than -- functions that return new values. The Semigroup instance for patches -- must apply patches right-to-left, like '(.)'. composePatchFunctions :: (Patch p, Semigroup p) => (PatchTarget p -> p) -> (PatchTarget p -> p) -> PatchTarget p -> p -- | Patch for IntMap which represents insertion or deletion -- of keys in the mapping. Internally represented by 'IntMap (Maybe a)', -- where Just means insert/update and Nothing means -- delete. newtype PatchIntMap a PatchIntMap :: IntMap (Maybe a) -> PatchIntMap a -- | Map a function Int -> a -> b over all as in -- the given PatchIntMap a (that is, all -- inserts/updates), producing a PatchIntMap b. mapIntMapPatchWithKey :: (Int -> a -> b) -> PatchIntMap a -> PatchIntMap b -- | Map an effectful function Int -> a -> f b over all -- as in the given PatchIntMap a (that is, all -- inserts/updates), producing a f (PatchIntMap b). traverseIntMapPatchWithKey :: Applicative f => (Int -> a -> f b) -> PatchIntMap a -> f (PatchIntMap b) -- | Extract all as inserted/updated by the given -- PatchIntMap a. patchIntMapNewElements :: PatchIntMap a -> [a] -- | Convert the given PatchIntMap a into an -- IntMap a with all the inserts/updates in the given -- patch. patchIntMapNewElementsMap :: PatchIntMap a -> IntMap a -- | A set of changes to a Map. Any element may be inserted/updated -- or deleted. Insertions are represented as values wrapped in -- Just, while deletions are represented as Nothings newtype PatchMap k v PatchMap :: Map k (Maybe v) -> PatchMap k v [unPatchMap] :: PatchMap k v -> Map k (Maybe v) -- | Returns all the new elements that will be added to the Map patchMapNewElements :: PatchMap k v -> [v] -- | Returns all the new elements that will be added to the Map patchMapNewElementsMap :: PatchMap k v -> Map k v -- | A set of changes to a DMap. Any element may be inserted/updated -- or deleted. Insertions are represented as ComposeMaybe -- (Just value), while deletions are represented as -- ComposeMaybe Nothing. newtype PatchDMap k v PatchDMap :: DMap k (ComposeMaybe v) -> PatchDMap k v [unPatchDMap] :: PatchDMap k v -> DMap k (ComposeMaybe v) -- | Map a function v a -> v' a over any inserts/updates in the -- given PatchDMap k v to produce a PatchDMap -- k v'. mapPatchDMap :: (forall a. v a -> v' a) -> PatchDMap k v -> PatchDMap k v' -- | Map an effectful function v a -> f (v' a) over any -- inserts/updates in the given PatchDMap k v to produce -- a PatchDMap k v'. traversePatchDMap :: Applicative f => (forall a. v a -> f (v' a)) -> PatchDMap k v -> f (PatchDMap k v') -- | Map an effectful function k a -> v a -> f (v' a) over -- any inserts/updates in the given PatchDMap k v to -- produce a PatchDMap k v'. traversePatchDMapWithKey :: Applicative m => (forall a. k a -> v a -> m (v' a)) -> PatchDMap k v -> m (PatchDMap k v') -- | Weaken a PatchDMap k v to a PatchMap (Some -- k) v' using a function v a -> v' to weaken each value -- contained in the patch. weakenPatchDMapWith :: (forall a. v a -> v') -> PatchDMap k v -> PatchMap (Some k) v' -- | Convert a weak PatchDMap (Const2 k a) v where -- the a is known by way of the Const2 into a -- PatchMap k v' using a rank 1 function v a -> -- v'. patchDMapToPatchMapWith :: (v a -> v') -> PatchDMap (Const2 k a) v -> PatchMap k v' -- | Convert a PatchMap k v into a PatchDMap -- (Const2 k a) v' using a function v -> v' a. const2PatchDMapWith :: forall k v v' a. (v -> v' a) -> PatchMap k v -> PatchDMap (Const2 k a) v' -- | Convert a PatchIntMap v into a PatchDMap -- (Const2 Int a) v' using a function v -> v' a. const2IntPatchDMapWith :: forall v f a. (v -> f a) -> PatchIntMap v -> PatchDMap (Const2 Key a) f -- | Patch a DMap with additions, deletions, and moves. Invariant: If key -- k1 is coming from From_Move k2, then key k2 -- should be going to Just k1, and vice versa. There should -- never be any unpaired From/To keys. data PatchMapWithMove k v -- | Extract the internal representation of the PatchMapWithMove unPatchMapWithMove :: PatchMapWithMove k v -> Map k (NodeInfo k v) -- | Wrap a Map k (NodeInfo k v) representing patch changes -- into a PatchMapWithMove k v, without checking any -- invariants. -- -- Warning: when using this function, you must ensure that the -- invariants of PatchMapWithMove are preserved; they will not be -- checked. unsafePatchMapWithMove :: Map k (NodeInfo k v) -> PatchMapWithMove k v -- | Returns all the new elements that will be added to the Map. patchMapWithMoveNewElements :: PatchMapWithMove k v -> [v] -- | Return a Map k v with all the inserts/updates from the -- given PatchMapWithMove k v. patchMapWithMoveNewElementsMap :: PatchMapWithMove k v -> Map k v -- | Like PatchMapWithMove, but for DMap. Each key carries a -- NodeInfo which describes how it will be changed by the patch -- and connects move sources and destinations. -- -- Invariants: -- --
-- f :: a -> b -> c -> d -- b1 :: Behavior t a -- b2 :: Behavior t b -- e :: Event t c ---- -- then we can do: -- --
-- f <$> b1 <*> b2 <@> e :: Event t d ---- -- in order to apply the function f to the relevant values. -- -- The alternative would be something like: -- --
-- attachWith (\(x1, x2) y -> f x1 x2 y) ((,) <$> b1 <*> b2) e :: Event t d ---- -- or a variation involing a custom data type to hold the combination of -- Behaviors even when that combination might only ever be used by -- f. -- -- A more suggestive example might be: -- --
-- handleMouse <$> bPlayerState <*> bMousePosition <@> eMouseClick :: Event t (GameState -> GameState) --(<@>) :: Reflex t => Behavior t (a -> b) -> Event t a -> Event t b infixl 4 <@> -- | An version of <@> that does not use the value of the -- Event. -- -- Alternatively, it is tag in operator form. -- -- This is useful when we want to combine the values of several -- Behaviors at particular points in time using an -- Applicative style syntax. -- -- If we have: -- --
-- g :: a -> b -> d -- b1 :: Behavior t a -- b2 :: Behavior t b -- e :: Event t c ---- -- where e is firing at the points in time of interest. -- -- Then we can use <@: -- --
-- g <$> b1 <*> b2 <@ e :: Event t d ---- -- to combine the values of b1 and b2 at each of those -- points of time, with the function g being used to combine the -- values. -- -- This is the same as <@> except that the Event is -- being used only to act as a trigger. (<@) :: Reflex t => Behavior t b -> Event t a -> Event t b infixl 4 <@ -- | Create a new Event that occurs on all but the first occurrence -- of the supplied Event. tailE :: (Reflex t, MonadHold t m) => Event t a -> m (Event t a) -- | Create a tuple of two Events with the first one occurring only -- the first time the supplied Event occurs and the second -- occurring on all but the first occurrence. headTailE :: (Reflex t, MonadHold t m) => Event t a -> m (Event t a, Event t a) -- | Take the streak of occurrences starting at the current time for which -- the event returns True. -- -- Starting at the current time, fire all the occurrences of the -- Event for which the given predicate returns True. When -- first False is returned, do not fire, and permanently stop -- firing, even if True values would have been encountered later. takeWhileE :: forall t m a. (Reflex t, MonadFix m, MonadHold t m) => (a -> Bool) -> Event t a -> m (Event t a) -- | Take the streak of occurrences starting at the current time for which -- the event returns 'Just b'. -- -- Starting at the current time, fire all the occurrences of the -- Event for which the given predicate returns 'Just b'. When -- first Nothing is returned, do not fire, and permanently stop -- firing, even if 'Just b' values would have been encountered later. takeWhileJustE :: forall t m a b. (Reflex t, MonadFix m, MonadHold t m) => (a -> Maybe b) -> Event t a -> m (Event t b) -- | Drop the streak of occurrences starting at the current time for which -- the event returns True. -- -- Starting at the current time, do not fire all the occurrences of the -- Event for which the given predicate returns True. When -- False is first returned, do fire, and permanently continue -- firing, even if True values would have been encountered later. dropWhileE :: forall t m a. (Reflex t, MonadFix m, MonadHold t m) => (a -> Bool) -> Event t a -> m (Event t a) -- | Both take and drop the streak of occurrences starting at the current -- time for which the event returns 'Just b'. -- -- For the left event, starting at the current time, fire all the -- occurrences of the Event for which the given function returns -- 'Just b'. When Nothing is returned, do not fire, and -- permanently stop firing, even if 'Just b' values would have been -- encountered later. -- -- For the right event, do not fire until the first occurrence where the -- given function returns Nothing, and fire that one and all -- subsequent occurrences. Even if the function would have again returned -- 'Just b', keep on firing. takeDropWhileJustE :: forall t m a b. (Reflex t, MonadFix m, MonadHold t m) => (a -> Maybe b) -> Event t a -> m (Event t b, Event t a) -- | Create a new behavior given a starting behavior and switch to the -- behavior carried by the event when it fires. switcher :: (Reflex t, MonadHold t m) => Behavior t a -> Event t (Behavior t a) -> m (Behavior t a) -- | Print the supplied String and the value of the Event on -- each occurrence. This should only be used for debugging. -- -- Note: As with Debug.Trace.trace, the message will only be printed if -- the Event is actually used. traceEvent :: (Reflex t, Show a) => String -> Event t a -> Event t a -- | Print the output of the supplied function on each occurrence of the -- Event. This should only be used for debugging. -- -- Note: As with Debug.Trace.trace, the message will only be printed if -- the Event is actually used. traceEventWith :: Reflex t => (a -> String) -> Event t a -> Event t a -- | Construct a Dynamic from a Behavior and an Event. -- The Behavior must change when and only when the -- Event fires, such that the Behavior's value is always -- equal to the most recent firing of the Event; if this is not -- the case, the resulting Dynamic will behave -- nondeterministically. unsafeDynamic :: Reflex t => Behavior t a -> Event t a -> Dynamic t a unsafeMapIncremental :: (Reflex t, Patch p, Patch p') => (PatchTarget p -> PatchTarget p') -> (p -> p') -> Incremental t p -> Incremental t p' -- | A class for values that combines filtering and mapping using -- Maybe. Morally, FunctorMaybe ~ KleisliFunctor -- Maybe. -- | Deprecated: Use Filterable from Data.Witherable instead class FunctorMaybe f -- | Like mapMaybe. mapMaybe :: Filterable f => (a -> Maybe b) -> f a -> f b -- | Alias for mapMaybe fmapMaybe :: Filterable f => (a -> Maybe b) -> f a -> f b -- | Flipped version of mapMaybe. fforMaybe :: Filterable f => f a -> (a -> Maybe b) -> f b -- | Filter 'f a' using the provided predicate. ffilter :: Filterable f => (a -> Bool) -> f a -> f a -- | Filter Lefts from 'f (Either a b)' into a. filterLeft :: Filterable f => f (Either a b) -> f a -- | Filter Rights from 'f (Either a b)' into b. filterRight :: Filterable f => f (Either a b) -> f b -- | Flipped version of fmap. ffor :: Functor f => f a -> (a -> b) -> f b -- | Rotated version of liftA2. ffor2 :: Applicative f => f a -> f b -> (a -> b -> c) -> f c -- | Rotated version of liftA3. ffor3 :: Applicative f => f a -> f b -> f c -> (a -> b -> c -> d) -> f d -- | See switchHoldPromptly -- | Deprecated: Use switchHoldPromptly instead. The -- 'switchHold*' naming convention was chosen because those functions are -- more closely related to each other than they are to switch. -- switchPromptly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a) -- | See switchHoldPromptOnly -- | Deprecated: Use switchHoldPromptOnly instead. The -- 'switchHold*' naming convention was chosen because those functions are -- more closely related to each other than they are to switch. -- switchPromptOnly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a) -- | An alias for mapMaybeCheap fmapMaybeCheap :: Reflex t => (a -> Maybe b) -> Event t a -> Event t b -- | A "cheap" version of mapMaybe. See the performance note on -- pushCheap. mapMaybeCheap :: Reflex t => (a -> Maybe b) -> Event t a -> Event t b -- | A "cheap" version of fmap. See the performance note on -- pushCheap. fmapCheap :: Reflex t => (a -> b) -> Event t a -> Event t b -- | A "cheap" version of ffor. See the performance note on -- pushCheap. fforCheap :: Reflex t => Event t a -> (a -> b) -> Event t b -- | A "cheap" version of fforMaybe. See the performance note on -- pushCheap. fforMaybeCheap :: Reflex t => Event t a -> (a -> Maybe b) -> Event t b -- | A "cheap" version of pushAlways. See the performance note on -- pushCheap. pushAlwaysCheap :: Reflex t => (a -> PushM t b) -> Event t a -> Event t b -- | A "cheap" version of tag. See the performance note on -- pushCheap. tagCheap :: Reflex t => Behavior t b -> Event t a -> Event t b -- | A "cheap" version of mergeWithCheap. See the performance note -- on pushCheap. mergeWithCheap :: Reflex t => (a -> a -> a) -> [Event t a] -> Event t a -- | A "cheap" version of mergeWithCheap'. See the performance note -- on pushCheap. mergeWithCheap' :: Reflex t => (a -> b) -> (b -> b -> b) -> [Event t a] -> Event t b -- | A somewhat slow implementation of headE slowHeadE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a) instance forall k (t :: k). Reflex.Class.Reflex t => Reflex.Class.Accumulator t (Reflex.Class.Dynamic t) instance forall k (t :: k). Reflex.Class.Reflex t => Reflex.Class.Accumulator t (Reflex.Class.Behavior t) instance forall k (t :: k). Reflex.Class.Reflex t => Reflex.Class.Accumulator t (Reflex.Class.Event t) instance forall k (t :: k) a. (Reflex.Class.Reflex t, Data.Default.Class.Default a) => Data.Default.Class.Default (Reflex.Class.Dynamic t a) instance forall k (t :: k) (m :: * -> *) r. Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Control.Monad.Trans.Reader.ReaderT r m) instance forall k (t :: k) (m :: * -> *) r. Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Control.Monad.Trans.Reader.ReaderT r m) instance forall k (t :: k) (m :: * -> *) r. (Reflex.Class.MonadSample t m, GHC.Base.Monoid r) => Reflex.Class.MonadSample t (Control.Monad.Trans.Writer.Lazy.WriterT r m) instance forall k (t :: k) (m :: * -> *) r. (Reflex.Class.MonadHold t m, GHC.Base.Monoid r) => Reflex.Class.MonadHold t (Control.Monad.Trans.Writer.Lazy.WriterT r m) instance forall k (t :: k) (m :: * -> *) s. Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Control.Monad.Trans.State.Strict.StateT s m) instance forall k (t :: k) (m :: * -> *) s. Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Control.Monad.Trans.State.Strict.StateT s m) instance forall k (t :: k) (m :: * -> *) e. Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Control.Monad.Trans.Except.ExceptT e m) instance forall k (t :: k) (m :: * -> *) e. Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Control.Monad.Trans.Except.ExceptT e m) instance forall k (t :: k) (m :: * -> *) w r s. (Reflex.Class.MonadSample t m, GHC.Base.Monoid w) => Reflex.Class.MonadSample t (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance forall k (t :: k) (m :: * -> *) w r s. (Reflex.Class.MonadHold t m, GHC.Base.Monoid w) => Reflex.Class.MonadHold t (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance forall k (t :: k) (m :: * -> *) r. Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Control.Monad.Trans.Cont.ContT r m) instance forall k (t :: k) (m :: * -> *) r. Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Control.Monad.Trans.Cont.ContT r m) instance forall k (t :: k). Reflex.Class.Reflex t => GHC.Base.Applicative (Reflex.Class.Behavior t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Functor.Bind.Class.Apply (Reflex.Class.Behavior t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Functor.Bind.Class.Bind (Reflex.Class.Behavior t) instance forall k (t :: k) a. (Reflex.Class.Reflex t, GHC.Real.Fractional a) => GHC.Real.Fractional (Reflex.Class.Behavior t a) instance forall k (t :: k). Reflex.Class.Reflex t => GHC.Base.Functor (Reflex.Class.Behavior t) instance forall k (t :: k) a. (Reflex.Class.Reflex t, Data.String.IsString a) => Data.String.IsString (Reflex.Class.Behavior t a) instance forall k (t :: k). Reflex.Class.Reflex t => GHC.Base.Monad (Reflex.Class.Behavior t) instance forall k (t :: k) a. (Reflex.Class.Reflex t, GHC.Base.Monoid a) => GHC.Base.Monoid (Reflex.Class.Behavior t a) instance forall k (t :: k) a. (Reflex.Class.Reflex t, GHC.Num.Num a) => GHC.Num.Num (Reflex.Class.Behavior t a) instance forall k a (t :: k). (GHC.Num.Num a, Reflex.Class.Reflex t) => GHC.Num.Num (Reflex.Class.Dynamic t a) instance forall k (t :: k) a. (Reflex.Class.Reflex t, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Reflex.Class.Behavior t a) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Functor.Alt.Alt (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Functor.Bind.Class.Apply (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Functor.Bind.Class.Bind (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => GHC.Base.Functor (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => Reflex.FunctorMaybe.FunctorMaybe (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Witherable.Filterable (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Functor.Plus.Plus (Reflex.Class.Event t) instance forall k a (t :: k). (GHC.Base.Semigroup a, Reflex.Class.Reflex t) => GHC.Base.Semigroup (Reflex.Class.Event t a) instance forall k a (t :: k). (GHC.Base.Semigroup a, Reflex.Class.Reflex t) => GHC.Base.Monoid (Reflex.Class.Event t a) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Semialign.Internal.Align (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Semialign.Internal.Semialign (Reflex.Class.Event t) instance forall k (t :: k). Reflex.Class.Reflex t => Data.Semialign.Internal.Zip (Reflex.Class.Event t) instance forall k (t :: k) a. (Reflex.Class.Reflex t, Data.String.IsString a) => Data.String.IsString (Reflex.Class.Dynamic t a) instance forall k (t :: k) a. (Reflex.Class.Reflex t, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Reflex.Class.Dynamic t a) instance forall k (t :: k) a. (Reflex.Class.Reflex t, GHC.Base.Monoid a) => GHC.Base.Monoid (Reflex.Class.Dynamic t a) -- | This module provides the interface for hosting Reflex engines. -- This should only be necessary if you're writing a binding or some -- other library that provides a core event loop. module Reflex.Host.Class -- | Framework implementation support class for the reflex implementation -- represented by t. class (Reflex t, MonadReflexCreateTrigger t (HostFrame t), MonadSample t (HostFrame t), MonadHold t (HostFrame t), MonadFix (HostFrame t), MonadSubscribeEvent t (HostFrame t)) => ReflexHost t where { type family EventTrigger t :: * -> *; type family EventHandle t :: * -> *; type family HostFrame t :: * -> *; } -- | Monad in which Events can be subscribed. This forces all -- underlying event sources to be initialized, so that the event will -- fire whenever it ought to. Events must be subscribed before they are -- read using readEvent class (Reflex t, Monad m) => MonadSubscribeEvent t m | m -> t -- | Subscribe to an event and set it up if needed. -- -- This function will create a new EventHandle from an -- Event. This handle may then be used via readEvent in the -- read callback of fireEventsAndRead. -- -- If the event wasn't subscribed to before (either manually or through a -- dependent event or behavior) then this function will cause the event -- and all dependencies of this event to be set up. For example, if the -- event was created by newEventWithTrigger, then it's callback -- will be executed. -- -- It's safe to call this function multiple times. subscribeEvent :: MonadSubscribeEvent t m => Event t a -> m (EventHandle t a) -- | Monad that allows to read events' values. class (ReflexHost t, Applicative m, Monad m) => MonadReadEvent t m | m -> t -- | Read the value of an Event from an EventHandle (created -- by calling subscribeEvent). -- -- After event propagation is done, all events can be in two states: -- either they are firing with some value or they are not firing. In the -- former case, this function returns Just act, where -- act in an action to read the current value of the event. In -- the latter case, the function returns Nothing. -- -- This function is normally used in the calllback for -- fireEventsAndRead. readEvent :: MonadReadEvent t m => EventHandle t a -> m (Maybe (m a)) -- | A monad where new events feed from external sources can be created. class (Applicative m, Monad m) => MonadReflexCreateTrigger t m | m -> t -- | Creates a root Event (one that is not based on any other -- event). -- -- When a subscriber first subscribes to an event (building another event -- that depends on the subscription) the given callback function is run -- and passed a trigger. The callback function can then set up the event -- source in IO. After this is done, the callback function must return an -- accompanying teardown action. -- -- Any time between setup and teardown the trigger can be used to fire -- the event, by passing it to fireEventsAndRead. -- -- 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. newEventWithTrigger :: MonadReflexCreateTrigger t m => (EventTrigger t a -> IO (IO ())) -> m (Event t a) newFanEventWithTrigger :: (MonadReflexCreateTrigger t m, GCompare k) => (forall a. k a -> EventTrigger t a -> IO (IO ())) -> m (EventSelector t k) -- | MonadReflexHost designates monads that can run reflex frames. class (ReflexHost t, MonadReflexCreateTrigger t m, MonadSubscribeEvent t m, MonadReadEvent t (ReadPhase m), MonadSample t (ReadPhase m), MonadHold t (ReadPhase m)) => MonadReflexHost t m | m -> t where { type family ReadPhase m :: * -> *; } -- | Propagate some events firings and read the values of events -- afterwards. -- -- This function will create a new frame to fire the given events. It -- will then update all dependent events and behaviors. After that is -- done, the given callback is executed which allows to read the final -- values of events and check whether they have fired in this frame or -- not. -- -- All events that are given are fired at the same time. -- -- This function is typically used in the main loop of a reflex framework -- implementation. The main loop waits for external events to happen -- (such as keyboard input or a mouse click) and then fires the -- corresponding events using this function. The read callback can be -- used to read output events and perform a corresponding response action -- to the external event. fireEventsAndRead :: MonadReflexHost t m => [DSum (EventTrigger t) Identity] -> ReadPhase m a -> m a -- | Run a frame without any events firing. -- -- This function should be used when you want to use sample and -- hold when no events are currently firing. Using this function -- in that case can improve performance, since the implementation can -- assume that no events are firing when sample or hold are -- called. -- -- This function is commonly used to set up the basic event network when -- the application starts up. runHostFrame :: MonadReflexHost t m => HostFrame t a -> m a -- | Like fireEventsAndRead, but without reading any events. fireEvents :: MonadReflexHost t m => [DSum (EventTrigger t) Identity] -> m () -- | Create a new event and store its trigger in an IORef while -- it's active. -- -- An event is only active between the set up (when it's first subscribed -- to) and the teardown phases (when noboby is subscribing the event -- anymore). This function returns an Event and an IORef. As -- long as the event is active, the IORef will contain -- Just the event trigger to trigger this event. When the event is -- not active, the IORef will contain Nothing. This -- allows event sources to be more efficient, since they don't need to -- produce events when nobody is listening. newEventWithTriggerRef :: (MonadReflexCreateTrigger t m, MonadRef m, Ref m ~ Ref IO) => m (Event t a, Ref m (Maybe (EventTrigger t a))) -- | Fire the given trigger if it is not Nothing. fireEventRef :: (MonadReflexHost t m, MonadRef m, Ref m ~ Ref IO) => Ref m (Maybe (EventTrigger t a)) -> a -> m () -- | Fire the given trigger if it is not Nothing, and read from the -- given EventHandle. fireEventRefAndRead :: (MonadReflexHost t m, MonadRef m, Ref m ~ Ref IO) => Ref m (Maybe (EventTrigger t a)) -> a -> EventHandle t b -> m (Maybe b) instance Reflex.Host.Class.MonadReflexHost t m => Reflex.Host.Class.MonadReflexHost t (Control.Monad.Trans.Reader.ReaderT r m) instance (Reflex.Host.Class.MonadReflexHost t m, GHC.Base.Monoid w) => Reflex.Host.Class.MonadReflexHost t (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Reflex.Host.Class.MonadReflexHost t m => Reflex.Host.Class.MonadReflexHost t (Control.Monad.Trans.State.Lazy.StateT s m) instance Reflex.Host.Class.MonadReflexHost t m => Reflex.Host.Class.MonadReflexHost t (Control.Monad.Trans.State.Strict.StateT s m) instance Reflex.Host.Class.MonadReflexHost t m => Reflex.Host.Class.MonadReflexHost t (Control.Monad.Trans.Cont.ContT r m) instance Reflex.Host.Class.MonadReflexHost t m => Reflex.Host.Class.MonadReflexHost t (Control.Monad.Trans.Except.ExceptT e m) instance (Reflex.Host.Class.MonadReflexHost t m, GHC.Base.Monoid w) => Reflex.Host.Class.MonadReflexHost t (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Control.Monad.Trans.Reader.ReaderT r m) instance Reflex.Host.Class.MonadSubscribeEvent t m => Reflex.Host.Class.MonadSubscribeEvent t (Control.Monad.Trans.Reader.ReaderT r m) instance (Reflex.Host.Class.MonadReflexCreateTrigger t m, GHC.Base.Monoid w) => Reflex.Host.Class.MonadReflexCreateTrigger t (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance (Reflex.Host.Class.MonadSubscribeEvent t m, GHC.Base.Monoid w) => Reflex.Host.Class.MonadSubscribeEvent t (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Control.Monad.Trans.State.Lazy.StateT s m) instance Reflex.Host.Class.MonadSubscribeEvent t m => Reflex.Host.Class.MonadSubscribeEvent t (Control.Monad.Trans.State.Lazy.StateT r m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Control.Monad.Trans.State.Strict.StateT s m) instance Reflex.Host.Class.MonadSubscribeEvent t m => Reflex.Host.Class.MonadSubscribeEvent t (Control.Monad.Trans.State.Strict.StateT r m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Control.Monad.Trans.Cont.ContT r m) instance Reflex.Host.Class.MonadSubscribeEvent t m => Reflex.Host.Class.MonadSubscribeEvent t (Control.Monad.Trans.Cont.ContT r m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Control.Monad.Trans.Except.ExceptT e m) instance Reflex.Host.Class.MonadSubscribeEvent t m => Reflex.Host.Class.MonadSubscribeEvent t (Control.Monad.Trans.Except.ExceptT r m) instance (Reflex.Host.Class.MonadReflexCreateTrigger t m, GHC.Base.Monoid w) => Reflex.Host.Class.MonadReflexCreateTrigger t (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance (Reflex.Host.Class.MonadSubscribeEvent t m, GHC.Base.Monoid w) => Reflex.Host.Class.MonadSubscribeEvent t (Control.Monad.Trans.RWS.Lazy.RWST r w s m) -- | This module defines the EventWriter class. module Reflex.EventWriter.Class -- | EventWriter efficiently collects Event values using -- tellEvent and combines them via Semigroup to provide an -- Event result. class (Monad m, Semigroup w) => EventWriter t w m | m -> t w tellEvent :: EventWriter t w m => Event t w -> m () instance Reflex.EventWriter.Class.EventWriter t w m => Reflex.EventWriter.Class.EventWriter t w (Control.Monad.Trans.Reader.ReaderT r m) -- | This module defines the DynamicWriter class. module Reflex.DynamicWriter.Class -- | Type synonym for DynamicWriter -- | Deprecated: Use DynamicWriter instead type MonadDynamicWriter = DynamicWriter -- | MonadDynamicWriter efficiently collects Dynamic values -- using tellDyn and combines them monoidally to provide a -- Dynamic result. class (Monad m, Monoid w) => DynamicWriter t w m | m -> t w tellDyn :: DynamicWriter t w m => Dynamic t w -> m () instance Reflex.DynamicWriter.Class.DynamicWriter t w m => Reflex.DynamicWriter.Class.DynamicWriter t w (Control.Monad.Trans.Reader.ReaderT r m) -- | This module provides a variation of Dynamic values that uses -- cheap pointer equality checks to reduce the amount of signal -- propagation needed. module Reflex.Dynamic.Uniq -- | A Dynamic whose updated Event will never fire -- with the same value as the current Behavior's -- contents. In order to maintain this constraint, the value inside a -- UniqDynamic is always evaluated to weak head normal -- form. -- -- Internally, UniqDynamic uses pointer equality as a heuristic to -- avoid unnecessary update propagation; this is much more efficient than -- performing full comparisons. However, when the UniqDynamic is -- converted back into a regular Dynamic, a full comparison is -- performed. data UniqDynamic t a -- | Construct a UniqDynamic by eliminating redundant updates from a -- Dynamic. uniqDynamic :: Reflex t => Dynamic t a -> UniqDynamic t a -- | Retrieve a normal Dynamic from a UniqDynamic. This will -- perform a final check using the output type's Eq instance to -- ensure deterministic behavior. -- -- WARNING: If used with a type whose Eq instance is not -- law-abiding - specifically, if there are cases where x /= x, -- fromUniqDynamic may eliminate more updated occurrences -- than it should. For example, NaN values of Double and -- Float are considered unequal to themselves by the Eq -- instance, but can be equal by pointer equality. This may cause -- UniqDynamic to lose changes from NaN to NaN. fromUniqDynamic :: (Reflex t, Eq a) => UniqDynamic t a -> Dynamic t a -- | Create a UniqDynamic without uniqing it on creation. This will be -- slightly faster than uniqDynamic when used with a Dynamic whose values -- are always (or nearly always) different from its previous values; if -- used with a Dynamic whose values do not change frequently, it may be -- much slower than uniqDynamic alreadyUniqDynamic :: Dynamic t a -> UniqDynamic t a instance Reflex.Class.Reflex t => Reflex.Class.Accumulator t (Reflex.Dynamic.Uniq.UniqDynamic t) instance Reflex.Class.Reflex t => GHC.Base.Functor (Reflex.Dynamic.Uniq.UniqDynamic t) instance Reflex.Class.Reflex t => GHC.Base.Applicative (Reflex.Dynamic.Uniq.UniqDynamic t) instance Reflex.Class.Reflex t => GHC.Base.Monad (Reflex.Dynamic.Uniq.UniqDynamic t) module Reflex.Dynamic -- | A container for a value that can change over time and allows -- notifications on changes. Basically a combination of a Behavior -- and an Event, with a rule that the Behavior will change -- if and only if the Event fires. data family Dynamic t :: * -> * -- | Extract the Behavior of a Dynamic. current :: Reflex t => Dynamic t a -> Behavior t a -- | Extract the Event of the Dynamic. updated :: Reflex t => Dynamic t a -> Event t a -- | Create a Dynamic value using the given initial value that -- changes every time the Event occurs. holdDyn :: MonadHold t m => a -> Event t a -> m (Dynamic t a) -- | Map a sampling function over a Dynamic. mapDynM :: forall t m a b. (Reflex t, MonadHold t m) => (forall m'. MonadSample t m' => a -> m' b) -> Dynamic t a -> m (Dynamic t b) -- | Flipped version of mapDynM forDynM :: forall t m a b. (Reflex t, MonadHold t m) => Dynamic t a -> (forall m'. MonadSample t m' => a -> m' b) -> m (Dynamic t b) -- | Construct a Dynamic value that never changes constDyn :: Reflex t => a -> Dynamic t a -- | Create a new Dynamic that counts the occurrences of the -- Event. count :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Dynamic t b) -- | Create a new Dynamic using the initial value that flips its -- value every time the Event occurs. toggle :: (Reflex t, MonadHold t m, MonadFix m) => Bool -> Event t a -> m (Dynamic t Bool) -- | Switches to the new Event whenever it receives one. Only the -- old event is considered the moment a new one is switched in; the -- output event will fire at that moment if only if the old event does. -- -- Prefer this to switchPromptlyDyn where possible. The lack of -- doing double work when the outer and (new) inner fires means this -- imposes fewer "timing requirements" and thus is far more easy to use -- without introducing fresh failure cases. switchDyn is also more -- performant. switchDyn :: forall t a. Reflex t => Dynamic t (Event t a) -> Event t a -- | Switches to the new Event whenever it receives one. Switching -- occurs before the inner Event fires - so if the -- Dynamic changes and both the old and new inner Events fire -- simultaneously, the output will fire with the value of the new -- Event. -- -- Prefer switchDyn to this where possible. The timing -- requirements that switching before imposes are likely to bring down -- your app unless you are very careful. switchDyn is also more -- performant. switchPromptlyDyn :: forall t a. Reflex t => Dynamic t (Event t a) -> Event t a -- | Replace the value of the Event with the current value of the -- Dynamic each time the Event occurs. -- -- Note: tagPromptlyDyn d e differs from tag -- (current d) e in the case that e is firing at -- the same time that d is changing. With -- tagPromptlyDyn d e, the new value of -- d will replace the value of e, whereas -- with tag (current d) e, the old value will be -- used, since the Behavior won't be updated until the end of the -- frame. Additionally, this means that the output Event may not -- be used to directly change the input Dynamic, because that -- would mean its value depends on itself. When creating cyclic -- data flows, generally tag (current d) e is -- preferred. tagPromptlyDyn :: Reflex t => Dynamic t a -> Event t b -> Event t a -- | Attach the current value of the Dynamic to the value of the -- Event each time it occurs. -- -- Note: attachPromptlyDyn d is not the same as -- attach (current d). See tagPromptlyDyn for -- details. attachPromptlyDyn :: Reflex t => Dynamic t a -> Event t b -> Event t (a, b) -- | Combine the current value of the Dynamic with the value of the -- Event each time it occurs. -- -- Note: attachPromptlyDynWith f d is not the same as -- attachWith f (current d). See tagPromptlyDyn -- for details. attachPromptlyDynWith :: Reflex t => (a -> b -> c) -> Dynamic t a -> Event t b -> Event t c -- | Create a new Event by combining the value at each occurrence -- with the current value of the Dynamic value and possibly -- filtering if the combining function returns Nothing. -- -- Note: attachPromptlyDynWithMaybe f d is not the same -- as attachWithMaybe f (current d). See -- tagPromptlyDyn for details. attachPromptlyDynWithMaybe :: Reflex t => (a -> b -> Maybe c) -> Dynamic t a -> Event t b -> Event t c -- | Factor a Dynamic t (Maybe a) into a Dynamic t -- (Maybe (Dynamic t a)), such that the outer Dynamic is -- updated only when the Maybe's constructor chages from -- Nothing to Just or vice-versa. Whenever the constructor -- becomes Just, an inner Dynamic will be provided, whose -- value will track the a inside the Just; when the -- constructor becomes Nothing, the existing inner Dynamic -- will become constant, and will not change when the outer constructor -- changes back to Nothing. maybeDyn :: forall t a m. (Reflex t, MonadFix m, MonadHold t m) => Dynamic t (Maybe a) -> m (Dynamic t (Maybe (Dynamic t a))) -- | Turns a 'Dynamic t (Either a b)' into a 'Dynamic t (Either (Dynamic t -- a) (Dynamic t b))' such that the outer Dynamic is updated only -- when the Either constructor changes (e.g., from Left to -- Right). eitherDyn :: forall t a b m. (Reflex t, MonadFix m, MonadHold t m) => Dynamic t (Either a b) -> m (Dynamic t (Either (Dynamic t a) (Dynamic t b))) -- | Factor a 'Dynamic t DSum' into a Dynamic DSum containing -- nested Dynamic values. The outer Dynamic updates only -- when the key of the DSum changes, while the update of the inner -- Dynamic represents updates within the current key. factorDyn :: forall t m k v. (Reflex t, MonadHold t m, GEq k) => Dynamic t (DSum k v) -> m (Dynamic t (DSum k (Compose (Dynamic t) v))) -- | Create a Dynamic that accumulates values from another -- Dynamic. This function does not force its input Dynamic -- until the output Dynamic is forced. scanDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b) -> (a -> b -> b) -> Dynamic t a -> m (Dynamic t b) -- | Like scanDyn, but the the accumulator function may decline to -- update the result Dynamic's value. scanDynMaybe :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b) -> (a -> b -> Maybe b) -> Dynamic t a -> m (Dynamic t b) -- | Create a new Dynamic that only signals changes if the values -- actually changed. holdUniqDyn :: (Reflex t, MonadHold t m, MonadFix m, Eq a) => Dynamic t a -> m (Dynamic t a) -- | Create a new Dynamic that changes only when the underlying -- Dynamic changes and the given function returns False -- when given both the old and the new values. holdUniqDynBy :: (Reflex t, MonadHold t m, MonadFix m) => (a -> a -> Bool) -> Dynamic t a -> m (Dynamic t a) -- | Dynamic Maybe that can only update from -- Nothing to Just or -- Just to Just (i.e., cannot revert to -- Nothing) improvingMaybe :: (Reflex t, MonadHold t m, MonadFix m) => Dynamic t (Maybe a) -> m (Dynamic t (Maybe a)) -- | Create a Dynamic using the initial value and change it each -- time the Event occurs using a folding function on the previous -- value and the value of the Event. foldDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> b) -> b -> Event t a -> m (Dynamic t b) -- | Like foldDyn, but the combining function is a PushM -- action, so it can sample existing Behaviors and -- hold new ones. foldDynM :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t b) -> b -> Event t a -> m (Dynamic t b) -- | Create a Dynamic using the provided initial value and change it -- each time the provided Event occurs, using a function to -- combine the old value with the Event's value. If the function -- returns Nothing, the value is not changed; this is distinct -- from returning Just the old value, since the Dynamic's -- updated Event will fire in the Just case, and -- will not fire in the Nothing case. foldDynMaybe :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> Maybe b) -> b -> Event t a -> m (Dynamic t b) -- | Like foldDynMaybe, but the combining function is a PushM -- action, so it can sample existing Behaviors and -- hold new ones. foldDynMaybeM :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe b)) -> b -> Event t a -> m (Dynamic t b) -- | Combine a Dynamic of a Map of Dynamics into a -- Dynamic with the current values of the Dynamics in a -- map. joinDynThroughMap :: forall t k a. (Reflex t, Ord k) => Dynamic t (Map k (Dynamic t a)) -> Dynamic t (Map k a) -- | Print the value of the Dynamic when it is first read and on -- each subsequent change that is observed (as traceEvent), -- prefixed with the provided string. This should only be used for -- debugging. -- -- Note: Just like Debug.Trace.trace, the value will only be shown if -- something else in the system is depending on it. traceDyn :: (Reflex t, Show a) => String -> Dynamic t a -> Dynamic t a -- | Print the result of applying the provided function to the value of the -- Dynamic when it is first read and on each subsequent change -- that is observed (as traceEvent). This should only be -- used for debugging. -- -- Note: Just like Debug.Trace.trace, the value will only be shown if -- something else in the system is depending on it. traceDynWith :: Reflex t => (a -> String) -> Dynamic t a -> Dynamic t a -- | Split a Dynamic pair into a pair of Dynamics splitDynPure :: Reflex t => Dynamic t (a, b) -> (Dynamic t a, Dynamic t b) -- | Convert a Map with Dynamic elements into a -- Dynamic of a Map with non-Dynamic elements. distributeMapOverDynPure :: (Reflex t, Ord k) => Map k (Dynamic t v) -> Dynamic t (Map k v) -- | This function converts a DMap whose elements are -- Dynamics into a Dynamic DMap. Its implementation -- is more efficient than doing the same through the use of multiple uses -- of zipDynWith or Applicative operators. distributeDMapOverDynPure :: forall t k. (Reflex t, GCompare k) => DMap k (Dynamic t) -> Dynamic t (DMap k Identity) -- | Convert a list with Dynamic elements into a Dynamic of a -- list with non-Dynamic elements, preserving the order of the -- elements. -- | Deprecated: Use distributeListOverDyn instead distributeListOverDynPure :: Reflex t => [Dynamic t v] -> Dynamic t [v] -- | Represents a time changing value together with an EventSelector -- that can efficiently detect when the underlying Dynamic has a -- particular value. This is useful for representing data like the -- current selection of a long list. -- -- Semantically, -- --
-- demuxed (demux d) k === fmap (== k) d ---- -- However, when getDemuxed is used multiple times, the complexity is -- only O(log(n)), rather than O(n) for fmap. data Demux t k -- | Demultiplex an input value to a Demux with many outputs. At any -- given time, whichever output is indicated by the given Dynamic -- will be True. demux :: (Reflex t, Ord k) => Dynamic t k -> Demux t k -- | Select a particular output of the Demux; this is equivalent to -- (but much faster than) mapping over the original Dynamic and -- checking whether it is equal to the given key. demuxed :: (Reflex t, Eq k) => Demux t k -> k -> Dynamic t Bool -- | A heterogeneous list whose type and length are fixed statically. This -- is reproduced from the HList package due to integration issues, -- and because very little other functionality from that library is -- needed. data HList (l :: [*]) [HNil] :: HList '[] [HCons] :: e -> HList l -> HList (e : l) infixr 2 `HCons` -- | Like HList, but with a functor wrapping each element. data FHList f l [FHNil] :: FHList f '[] [FHCons] :: f e -> FHList f l -> FHList f (e : l) -- | Convert a datastructure whose constituent parts are all -- Dynamics into a single Dynamic whose value represents -- all the current values of the input's constituent Dynamics. collectDynPure :: (RebuildSortedHList (HListElems b), IsHList a, IsHList b, AllAreFunctors (Dynamic t) (HListElems b), Reflex t, HListElems a ~ FunctorList (Dynamic t) (HListElems b)) => a -> Dynamic t b -- | This class allows HLists and FHlists to be built from -- regular lists; they must be contiguous and sorted. class RebuildSortedHList l rebuildSortedFHList :: RebuildSortedHList l => [DSum (HListPtr l) f] -> FHList f l rebuildSortedHList :: RebuildSortedHList l => [DSum (HListPtr l) Identity] -> HList l -- | Poor man's Generics for product types only. class IsHList a where { type family HListElems a :: [*]; } toHList :: IsHList a => a -> HList (HListElems a) fromHList :: IsHList a => HList (HListElems a) -> a -- | Indicates that all elements in a type-level list are applications of -- the same functor. class AllAreFunctors (f :: a -> *) (l :: [a]) where { type family FunctorList f l :: [*]; } toFHList :: AllAreFunctors f l => HList (FunctorList f l) -> FHList f l fromFHList :: AllAreFunctors f l => FHList f l -> HList (FunctorList f l) -- | A typed index into a typed heterogeneous list. data HListPtr l a [HHeadPtr] :: HListPtr (h : t) h [HTailPtr] :: HListPtr t a -> HListPtr (h : t) a -- | Collect a hetereogeneous list whose elements are all Dynamics -- into a single Dynamic whose value represents the current values -- of all of the input Dynamics. distributeFHListOverDynPure :: (Reflex t, RebuildSortedHList l) => FHList (Dynamic t) l -> Dynamic t (HList l) -- | Construct a Dynamic from a Behavior and an Event. -- The Behavior must change when and only when the -- Event fires, such that the Behavior's value is always -- equal to the most recent firing of the Event; if this is not -- the case, the resulting Dynamic will behave -- nondeterministically. unsafeDynamic :: Reflex t => Behavior t a -> Event t a -> Dynamic t a instance forall a1 (l :: [a1]) (a2 :: a1). GHC.Classes.Eq (Reflex.Dynamic.HListPtr l a2) instance forall a1 (l :: [a1]) (a2 :: a1). GHC.Classes.Ord (Reflex.Dynamic.HListPtr l a2) instance Reflex.Dynamic.IsHList (a, b) instance Reflex.Dynamic.IsHList (a, b, c, d) instance Reflex.Dynamic.IsHList (a, b, c, d, e, f) instance forall a (f :: a -> *). Reflex.Dynamic.AllAreFunctors f '[] instance forall a (f :: a -> *) (t :: [a]) (h :: a). Reflex.Dynamic.AllAreFunctors f t => Reflex.Dynamic.AllAreFunctors f (h : t) instance Reflex.Dynamic.RebuildSortedHList '[] instance Reflex.Dynamic.RebuildSortedHList t => Reflex.Dynamic.RebuildSortedHList (h : t) instance forall k (l :: [k]). Data.GADT.Compare.GEq (Reflex.Dynamic.HListPtr l) instance forall k (l :: [k]). Data.GADT.Compare.GCompare (Reflex.Dynamic.HListPtr l) instance (l' Data.Type.Equality.~ Reflex.Dynamic.HRevApp l '[]) => Reflex.Dynamic.HBuild' l (Reflex.Dynamic.HList l') instance Reflex.Dynamic.HBuild' (a : l) r => Reflex.Dynamic.HBuild' l (a -> r) -- | Template Haskell helper functions for building complex Dynamic -- values. module Reflex.Dynamic.TH -- | Quote a Dynamic expression. Within the quoted expression, you -- can use $(unqDyn [| x |]) to refer to any expression -- x of type Dynamic t a; the unquoted result will be -- of type a qDynPure :: Q Exp -> Q Exp -- | Antiquote a Dynamic expression. This can only be used -- inside of a qDyn quotation. unqDyn :: Q Exp -> Q Exp -- | Create a Dynamic value using other Dynamics as inputs. -- The result is sometimes more concise and readable than the equivalent -- Applicative-based expression. For example: -- --
-- [mkDyn| $x + $v * $t + 1/2 * $a * $t ^ 2 |] ---- -- would have a very cumbersome Applicative encoding. mkDynPure :: QuasiQuoter module Reflex.BehaviorWriter.Class -- | MonadBehaviorWriter efficiently collects Behavior values -- using tellBehavior and combines them monoidally to provide a -- Behavior result. class (Monad m, Monoid w) => MonadBehaviorWriter t w m | m -> t w tellBehavior :: MonadBehaviorWriter t w m => Behavior t w -> m () instance Reflex.BehaviorWriter.Class.MonadBehaviorWriter t w m => Reflex.BehaviorWriter.Class.MonadBehaviorWriter t w (Control.Monad.Trans.Reader.ReaderT r m) module Reflex.Adjustable.Class -- | A Monad that supports adjustment over time. After an action has -- been run, if the given events fire, it will adjust itself so that its -- net effect is as though it had originally been run with the new value. -- Note that there is some issue here with persistent side-effects: -- obviously, IO (and some other side-effects) cannot be undone, so it is -- up to the instance implementer to determine what the best meaning for -- this class is in such cases. class (Reflex t, Monad m) => Adjustable t m | m -> t runWithReplace :: Adjustable t m => m a -> Event t (m b) -> m (a, Event t b) traverseIntMapWithKeyWithAdjust :: Adjustable t m => (Key -> v -> m v') -> IntMap v -> Event t (PatchIntMap v) -> m (IntMap v', Event t (PatchIntMap v')) traverseDMapWithKeyWithAdjust :: (Adjustable t m, GCompare k) => (forall a. k a -> v a -> m (v' a)) -> DMap k v -> Event t (PatchDMap k v) -> m (DMap k v', Event t (PatchDMap k v')) traverseDMapWithKeyWithAdjustWithMove :: (Adjustable t m, GCompare k) => (forall a. k a -> v a -> m (v' a)) -> DMap k v -> Event t (PatchDMapWithMove k v) -> m (DMap k v', Event t (PatchDMapWithMove k v')) -- | Traverse a DMap of Adjustable actions, running each of -- them. The provided Event of patches to the DMap can add, -- remove, or update values. sequenceDMapWithAdjust :: (GCompare k, Adjustable t m) => DMap k m -> Event t (PatchDMap k m) -> m (DMap k Identity, Event t (PatchDMap k Identity)) -- | Traverses a DMap of Adjustable actions, running each of -- them. The provided Event of patches to the DMap can add, -- remove, update, move, or swap values. sequenceDMapWithAdjustWithMove :: (GCompare k, Adjustable t m) => DMap k m -> Event t (PatchDMapWithMove k m) -> m (DMap k Identity, Event t (PatchDMapWithMove k Identity)) -- | Traverses a Map, running the provided Adjustable action. -- The provided Event of patches to the Map can add, -- remove, update, move, or swap values. mapMapWithAdjustWithMove :: forall t m k v v'. (Adjustable t m, Ord k) => (k -> v -> m v') -> Map k v -> Event t (PatchMapWithMove k v) -> m (Map k v', Event t (PatchMapWithMove k v')) -- | Synonym for Adjustable -- | Deprecated: Use Adjustable instead type MonadAdjust = Adjustable instance Reflex.Adjustable.Class.Adjustable t m => Reflex.Adjustable.Class.Adjustable t (Control.Monad.Trans.Reader.ReaderT r m) -- | This module defines PostBuild, which indicates that an action -- will be notified when it, and any action it's a part of, has finished -- executing. module Reflex.PostBuild.Class -- | PostBuild represents an action that is notified via an -- Event when it has finished executing. Note that the specific -- definition of "finished" is determined by the instance of -- PostBuild, but the intent is to allow Behaviors and -- Dynamics to be safely sampled, regardless of where they were -- created, when the post-build Event fires. The post-build -- Event will fire exactly once for an given action. class (Reflex t, Monad m) => PostBuild t m | m -> t -- | Retrieve the post-build Event for this action. getPostBuild :: PostBuild t m => m (Event t ()) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Control.Monad.Trans.Reader.ReaderT r m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Control.Monad.Trans.State.Lazy.StateT s m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Control.Monad.Trans.State.Strict.StateT s m) module Reflex.Collection -- | Create a set of widgets based on the provided Map. When the -- input Event fires, remove widgets for keys with the value -- Nothing and add/replace widgets for keys with Just -- values. listHoldWithKey :: forall t m k v a. (Ord k, Adjustable t m, MonadHold t m) => Map k v -> Event t (Map k (Maybe v)) -> (k -> v -> m a) -> m (Dynamic t (Map k a)) listWithKey :: forall t k v m a. (Ord k, Adjustable t m, PostBuild t m, MonadFix m, MonadHold t m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m a) -> m (Dynamic t (Map k a)) -- | Display the given map of items (in key order) using the builder -- function provided, and update it with the given event. Nothing -- update entries will delete the corresponding children, and Just -- entries will create them if they do not exist or send an update event -- to them if they do. listWithKeyShallowDiff :: (Ord k, Adjustable t m, MonadFix m, MonadHold t m) => Map k v -> Event t (Map k (Maybe v)) -> (k -> v -> Event t v -> m a) -> m (Dynamic t (Map k a)) -- | Create a dynamically-changing set of Event-valued widgets. This is -- like listWithKey, specialized for widgets returning -- Event t a. listWithKey would return -- Dynamic t (Map k (Event t a)) in this scenario, but -- listViewWithKey flattens this to Event t (Map k -- a) via switch. listViewWithKey :: (Ord k, Adjustable t m, PostBuild t m, MonadHold t m, MonadFix m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m (Event t a)) -> m (Event t (Map k a)) -- | Create a dynamically-changing set of widgets, one of which is selected -- at any time. selectViewListWithKey :: forall t m k v a. (Adjustable t m, Ord k, PostBuild t m, MonadHold t m, MonadFix m) => Dynamic t k -> Dynamic t (Map k v) -> (k -> Dynamic t v -> Dynamic t Bool -> m (Event t a)) -> m (Event t (k, a)) -- | Like selectViewListWithKey but discards the value of the list -- item widget's output Event. selectViewListWithKey_ :: forall t m k v a. (Adjustable t m, Ord k, PostBuild t m, MonadHold t m, MonadFix m) => Dynamic t k -> Dynamic t (Map k v) -> (k -> Dynamic t v -> Dynamic t Bool -> m (Event t a)) -> m (Event t k) -- | Create a dynamically-changing set of widgets from a Dynamic key/value -- map. Unlike the withKey variants, the child widgets are -- insensitive to which key they're associated with. list :: (Ord k, Adjustable t m, MonadHold t m, PostBuild t m, MonadFix m) => Dynamic t (Map k v) -> (Dynamic t v -> m a) -> m (Dynamic t (Map k a)) -- | Create a dynamically-changing set of widgets from a Dynamic list. simpleList :: (Adjustable t m, MonadHold t m, PostBuild t m, MonadFix m) => Dynamic t [v] -> (Dynamic t v -> m a) -> m (Dynamic t [a]) module Reflex.Pure -- | A completely pure-functional Reflex timeline, identifying -- moments in time with the type t. data Pure (t :: Type) -- | A container for a value that can change over time. Behaviors -- can be sampled at will, but it is not possible to be notified when -- they change data family Behavior t :: * -> * -- | A stream of occurrences. During any given frame, an Event is -- either occurring or not occurring; if it is occurring, it will contain -- a value of the given type (its "occurrence type") data family Event t :: * -> * -- | A container for a value that can change over time and allows -- notifications on changes. Basically a combination of a Behavior -- and an Event, with a rule that the Behavior will change -- if and only if the Event fires. data family Dynamic t :: * -> * -- | An Incremental is a more general form of a Dynamic. -- Instead of always fully replacing the value, only parts of it can be -- patched. This is only needed for performance critical code via -- mergeIncremental to make small changes to large values. data family Incremental t :: * -> * instance (GHC.Enum.Enum t, Data.MemoTrie.HasTrie t, GHC.Classes.Ord t) => Reflex.Class.Reflex (Reflex.Pure.Pure t) instance GHC.Base.Functor (Reflex.Class.Dynamic (Reflex.Pure.Pure t)) instance GHC.Base.Applicative (Reflex.Class.Dynamic (Reflex.Pure.Pure t)) instance GHC.Base.Monad (Reflex.Class.Dynamic (Reflex.Pure.Pure t)) instance Reflex.Class.MonadSample (Reflex.Pure.Pure t) ((->) t) instance (GHC.Enum.Enum t, Data.MemoTrie.HasTrie t, GHC.Classes.Ord t) => Reflex.Class.MonadHold (Reflex.Pure.Pure t) ((->) t) module Reflex.Query.Class -- | A Query can be thought of as a declaration of interest in some -- set of data. A QueryResult is the set of data associated with -- that interest set. The crop function provides a way to -- determine what part of a given QueryResult is relevant to a -- given Query. class (Monoid (QueryResult a), Semigroup (QueryResult a)) => Query a where { type family QueryResult a :: *; } crop :: Query a => a -> QueryResult a -> QueryResult a -- | QueryMorphism's must be group homomorphisms when acting on the query -- type and compatible with the query relationship when acting on the -- query result. data QueryMorphism q q' QueryMorphism :: (q -> q') -> (QueryResult q' -> QueryResult q) -> QueryMorphism q q' [_queryMorphism_mapQuery] :: QueryMorphism q q' -> q -> q' [_queryMorphism_mapQueryResult] :: QueryMorphism q q' -> QueryResult q' -> QueryResult q -- | This type can be used to track of the frequency of interest in a given -- Query. See note on combineSelectedCounts newtype SelectedCount SelectedCount :: Int -> SelectedCount [unSelectedCount] :: SelectedCount -> Int -- | The SemigroupMonoidGroup instances for a Query containing -- SelectedCounts should use this function which returns Nothing -- if the result is 0. This allows the pruning of leaves of the -- Query that are no longer wanted. combineSelectedCounts :: SelectedCount -> SelectedCount -> Maybe SelectedCount -- | A class that allows sending of Querys and retrieval of -- QueryResults. See queryDyn for a commonly used -- interface. class (Group q, Additive q, Query q) => MonadQuery t q m | m -> q t tellQueryIncremental :: MonadQuery t q m => Incremental t (AdditivePatch q) -> m () askQueryResult :: MonadQuery t q m => m (Dynamic t (QueryResult q)) queryIncremental :: MonadQuery t q m => Incremental t (AdditivePatch q) -> m (Dynamic t (QueryResult q)) -- | Produce and send an Incremental Query from a -- Dynamic Query. tellQueryDyn :: (Reflex t, MonadQuery t q m) => Dynamic t q -> m () -- | Retrieve Dynamically updating QueryResults for a -- Dynamically updating Query. queryDyn :: (Reflex t, Monad m, MonadQuery t q m) => Dynamic t q -> m (Dynamic t (QueryResult q)) -- | Apply a QueryMorphism to a Query mapQuery :: QueryMorphism q q' -> q -> q' -- | Map a QueryMorphism to a QueryResult mapQueryResult :: QueryMorphism q q' -> QueryResult q' -> QueryResult q instance Data.Data.Data Reflex.Query.Class.SelectedCount instance Foreign.Storable.Storable Reflex.Query.Class.SelectedCount instance Data.Bits.FiniteBits Reflex.Query.Class.SelectedCount instance Data.Bits.Bits Reflex.Query.Class.SelectedCount instance GHC.Arr.Ix Reflex.Query.Class.SelectedCount instance GHC.Real.Real Reflex.Query.Class.SelectedCount instance GHC.Enum.Enum Reflex.Query.Class.SelectedCount instance GHC.Enum.Bounded Reflex.Query.Class.SelectedCount instance GHC.Num.Num Reflex.Query.Class.SelectedCount instance GHC.Real.Integral Reflex.Query.Class.SelectedCount instance GHC.Read.Read Reflex.Query.Class.SelectedCount instance GHC.Show.Show Reflex.Query.Class.SelectedCount instance GHC.Classes.Ord Reflex.Query.Class.SelectedCount instance GHC.Classes.Eq Reflex.Query.Class.SelectedCount instance (GHC.Base.Monad m, Reflex.Query.Class.MonadQuery t q m) => Reflex.Query.Class.MonadQuery t q (Control.Monad.Trans.Reader.ReaderT r m) instance GHC.Base.Semigroup Reflex.Query.Class.SelectedCount instance GHC.Base.Monoid Reflex.Query.Class.SelectedCount instance Reflex.Patch.Group Reflex.Query.Class.SelectedCount instance Reflex.Patch.Additive Reflex.Query.Class.SelectedCount instance Control.Category.Category Reflex.Query.Class.QueryMorphism instance (GHC.Classes.Ord k, Reflex.Query.Class.Query v) => Reflex.Query.Class.Query (Data.Map.Monoidal.MonoidalMap k v) -- | This module defines Requester, which indicates that an action -- can make requests and receive responses to them. Typically, this is -- used for things like a WebSocket, where it's desirable to collect many -- potential sources of events and send them over a single channel, then -- distribute the results back out efficiently to their original request -- sites. module Reflex.Requester.Class -- | A Requester action can trigger requests of type Request m -- a based on Events, and receive responses of type -- Response m a in return. Note that the a type can -- vary within the Requester action, but will be linked for a -- given request. For example, if Request m is IO and -- Response m is Identity, then requestingIdentity -- has the same type as performEvent. class (Reflex t, Monad m) => Requester t m | m -> t where { -- | The type of requests that this Requester can emit type family Request m :: * -> *; -- | The type of responses that this Requester can receive type family Response m :: * -> *; } -- | Emit a request whenever the given Event fires, and return -- responses in the resulting Event. requesting :: Requester t m => Event t (Request m a) -> m (Event t (Response m a)) -- | Emit a request whenever the given Event fires, and ignore all -- responses. requesting_ :: Requester t m => Event t (Request m a) -> m () withRequesting :: (Requester t m, MonadFix m) => (Event t (Response m a) -> m (Event t (Request m a), r)) -> m r -- | Emit a request whenever the given Event fires, and unwrap the -- responses before returning them. Response m must be -- Identity. requestingIdentity :: (Requester t m, Response m ~ Identity) => Event t (Request m a) -> m (Event t a) instance Reflex.Requester.Class.Requester t m => Reflex.Requester.Class.Requester t (Control.Monad.Trans.Reader.ReaderT r m) instance Reflex.Requester.Class.Requester t m => Reflex.Requester.Class.Requester t (Control.Monad.Trans.State.Strict.StateT s m) instance Reflex.Requester.Class.Requester t m => Reflex.Requester.Class.Requester t (Control.Monad.Trans.State.Lazy.StateT s m) -- | This module defines TriggerEvent, which describes actions that -- may create new Events that can be triggered from IO. module Reflex.TriggerEvent.Class -- | TriggerEvent represents actions that can create Events -- that can be triggered by IO actions. class Monad m => TriggerEvent t m | m -> t -- | Create a triggerable Event. Whenever the resulting function is -- called, the resulting Event will fire at some point in the -- future. Note that this may not be synchronous. newTriggerEvent :: TriggerEvent t m => m (Event t a, a -> IO ()) -- | Like newTriggerEvent, but the callback itself takes another -- callback, to be invoked once the requested Event occurrence has -- finished firing. This allows synchronous operation. newTriggerEventWithOnComplete :: TriggerEvent t m => m (Event t a, a -> IO () -> IO ()) -- | Like newTriggerEventWithOnComplete, but with setup and -- teardown. This relatively complex type signature allows any external -- listeners to be subscribed lazily and then removed whenever the -- returned Event is no longer being listened to. Note that the -- setup/teardown may happen multiple times, and there is no guarantee -- that the teardown will be executed promptly, or even at all, in the -- case of program termination. newEventWithLazyTriggerWithOnComplete :: TriggerEvent t m => ((a -> IO () -> IO ()) -> IO (IO ())) -> m (Event t a) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Control.Monad.Trans.Reader.ReaderT r m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Control.Monad.Trans.State.Lazy.StateT s m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Control.Monad.Trans.State.Strict.StateT s m) -- | This module defines PerformEvent and TriggerEvent, which -- mediate the interaction between a Reflex-based program and the -- external side-effecting actions such as IO. module Reflex.PerformEvent.Class -- | PerformEvent represents actions that can trigger other actions -- based on Events. class (Reflex t, Monad (Performable m), Monad m) => PerformEvent t m | m -> t where { -- | The type of action to be triggered; this is often not the same type as -- the triggering action. type family Performable m :: * -> *; } -- | Perform the action contained in the given Event whenever the -- Event fires. Return the result in another Event. Note -- that the output Event will generally occur later than the input -- Event, since most Performable actions cannot be -- performed during Event propagation. performEvent :: PerformEvent t m => Event t (Performable m a) -> m (Event t a) -- | Like performEvent, but do not return the result. May have -- slightly better performance. performEvent_ :: PerformEvent t m => Event t (Performable m ()) -> m () -- | Like performEvent, but the resulting Event occurs only -- when the callback (a -> IO ()) is called, not when the -- included action finishes. -- -- NOTE: Despite the name, performEventAsync does not run its -- action in a separate thread - although the action is free to invoke -- forkIO and then call the callback whenever it is ready. This will work -- properly, even in GHCJS (which fully implements concurrency even -- though JavaScript does not have built in concurrency). performEventAsync :: (TriggerEvent t m, PerformEvent t m) => Event t ((a -> IO ()) -> Performable m ()) -> m (Event t a) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Control.Monad.Trans.Reader.ReaderT r m) -- | This module defines TriggerEventT, the standard implementation -- of TriggerEvent. module Reflex.TriggerEvent.Base -- | A basic implementation of TriggerEvent. newtype TriggerEventT t m a TriggerEventT :: ReaderT (Chan [DSum (EventTriggerRef t) TriggerInvocation]) m a -> TriggerEventT t m a [unTriggerEventT] :: TriggerEventT t m a -> ReaderT (Chan [DSum (EventTriggerRef t) TriggerInvocation]) m a -- | Run a TriggerEventT action. The argument should be a -- Chan into which TriggerInvocations can be passed; it is -- expected that some other thread will be responsible for popping values -- out of the Chan and firing their EventTriggers. runTriggerEventT :: TriggerEventT t m a -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> m a -- | Retrieve the current Chan; event trigger invocations pushed -- into it will be fired. askEvents :: Monad m => TriggerEventT t m (Chan [DSum (EventTriggerRef t) TriggerInvocation]) -- | A value with which to fire an Event, as well as a callback to -- invoke after its propagation has completed. data TriggerInvocation a TriggerInvocation :: a -> IO () -> TriggerInvocation a -- | A reference to an EventTrigger suitable for firing with -- TriggerEventT. newtype EventTriggerRef t a EventTriggerRef :: IORef (Maybe (EventTrigger t a)) -> EventTriggerRef t a [unEventTriggerRef] :: EventTriggerRef t a -> IORef (Maybe (EventTrigger t a)) instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.TriggerEvent.Base.TriggerEventT t m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.TriggerEvent.Base.TriggerEventT t m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Reflex.TriggerEvent.Base.TriggerEventT t m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Control.Monad.Trans.Class.MonadTrans (Reflex.TriggerEvent.Base.TriggerEventT t) instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.TriggerEvent.Base.TriggerEventT t m) instance (GHC.Base.Monad m, Control.Monad.Ref.MonadRef m, Control.Monad.Ref.Ref m Data.Type.Equality.~ Control.Monad.Ref.Ref GHC.Types.IO, Reflex.Host.Class.MonadReflexCreateTrigger t m) => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Control.Monad.Ref.MonadAtomicRef m => Control.Monad.Ref.MonadAtomicRef (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Reflex.TriggerEvent.Base.TriggerEventT t m) instance Reflex.Adjustable.Class.Adjustable t m => Reflex.Adjustable.Class.Adjustable t (Reflex.TriggerEvent.Base.TriggerEventT t m) instance (GHC.Base.Monoid a, GHC.Base.Applicative m) => GHC.Base.Monoid (Reflex.TriggerEvent.Base.TriggerEventT t m a) instance (GHC.Base.Semigroup a, GHC.Base.Applicative m) => GHC.Base.Semigroup (Reflex.TriggerEvent.Base.TriggerEventT t m a) module Reflex.Time -- | Metadata associated with a timer "tick" data TickInfo TickInfo :: UTCTime -> Integer -> NominalDiffTime -> TickInfo -- | UTC time immediately after the last tick. [_tickInfo_lastUTC] :: TickInfo -> UTCTime -- | Number of time periods or ticks since the start of the timer [_tickInfo_n] :: TickInfo -> Integer -- | Amount of time that has elapsed in the current tick period. [_tickInfo_alreadyElapsed] :: TickInfo -> NominalDiffTime -- | Fires an Event once every time provided interval elapses, -- approximately. The provided UTCTime is used bootstrap the -- determination of how much time has elapsed with each tick. This is a -- special case of tickLossyFrom that uses the post-build event to -- start the tick thread. tickLossy :: (PostBuild t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> UTCTime -> m (Event t TickInfo) -- | Fires an Event once every time provided interval elapses, -- approximately. This is a special case of tickLossyFrom that -- uses the post-build event to start the tick thread and the time of the -- post-build as the tick basis time. tickLossyFromPostBuildTime :: (PostBuild t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> m (Event t TickInfo) -- | Fires an Event approximately each time the provided interval -- elapses. If the system starts running behind, occurrences will be -- dropped rather than buffered. Each occurrence of the resulting event -- will contain the index of the current interval, with 0 representing -- the provided initial time. tickLossyFrom :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => NominalDiffTime -> UTCTime -> Event t a -> m (Event t TickInfo) -- | Generalization of tickLossyFrom that takes the delay and initial time -- as an Event. tickLossyFrom' :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => Event t (NominalDiffTime, UTCTime) -> m (Event t TickInfo) -- | Like tickLossy, but immediately calculates the first tick and -- provides a Dynamic that is updated as ticks fire. clockLossy :: (MonadIO m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), PostBuild t m, MonadHold t m, MonadFix m) => NominalDiffTime -> UTCTime -> m (Dynamic t TickInfo) -- | Generates a TickInfo, given the specified interval and -- timestamp. The TickInfo will include the current time, the -- number of ticks that have elapsed since the timestamp, and the amount -- of time that has elapsed since the start time of this tick. getCurrentTick :: NominalDiffTime -> UTCTime -> IO TickInfo -- | Delay an Event's occurrences by a given amount in seconds. delay :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a) -- | Send events with Poisson timing with the given basis and rate Each -- occurrence of the resulting event will contain the index of the -- current interval, with 0 representing the basis time poissonLossyFrom :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) => g -> Double -> UTCTime -> Event t a -> m (Event t TickInfo) -- | Send events with Poisson timing with the given basis and rate Each -- occurrence of the resulting event will contain the index of the -- current interval, with 0 representing the basis time. Automatically -- begin sending events when the DOM is built poissonLossy :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m, PostBuild t m) => g -> Double -> UTCTime -> m (Event t TickInfo) -- | Send events with inhomogeneous Poisson timing with the given basis and -- variable rate. Provide a maxRate that you expect to support. inhomogeneousPoissonFrom :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) => g -> Behavior t Double -> Double -> UTCTime -> Event t a -> m (Event t TickInfo) -- | Send events with inhomogeneous Poisson timing with the given basis and -- variable rate. Provide a maxRate that you expect to support inhomogeneousPoisson :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m, PostBuild t m) => g -> Behavior t Double -> Double -> UTCTime -> m (Event t TickInfo) -- | Block occurrences of an Event until the given number of seconds -- elapses without the Event firing, at which point the last occurrence -- of the Event will fire. debounce :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a) -- | When the given Event occurs, wait the given amount of time and -- collect all occurrences during that time. Then, fire the output -- Event with the collected output. batchOccurrences :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t (Seq a)) -- | Throttle an input event, ensuring that at least a given amount of time -- passes between occurrences of the output event. If the input event -- occurs too frequently, the output event occurs with the most recently -- seen input value after the given delay passes since the last -- occurrence of the output. If the output event has not occurred -- recently, occurrences of the input event will cause the output event -- to fire immediately. throttle :: (MonadFix m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> Event t a -> m (Event t a) data ThrottleState b ThrottleState_Immediate :: ThrottleState b ThrottleState_Buffered :: ThrottleBuffer b -> ThrottleState b data ThrottleBuffer b ThrottleBuffer_Empty :: ThrottleBuffer b ThrottleBuffer_Full :: b -> ThrottleBuffer b -- | Throttle an input event, ensuring that the output event doesn't occur -- more often than you are ready for it. If the input event occurs too -- frequently, the output event will contain semigroup-based summaries of -- the input firings that happened since the last output firing. If the -- output event has not occurred recently, occurrences of the input event -- will cause the output event to fire immediately. The first parameter -- is a function that receives access to the output event, and should -- construct an event that fires when the receiver is ready for more -- input. For example, using delay 20 would give a simple -- time-based throttle. -- -- NB: The provided lag function must *actually* delay the event. throttleBatchWithLag :: (MonadFix m, MonadHold t m, PerformEvent t m, Semigroup a) => (Event t () -> m (Event t ())) -> Event t a -> m (Event t a) tickInfo_n :: Lens' TickInfo Integer tickInfo_lastUTC :: Lens' TickInfo UTCTime tickInfo_alreadyElapsed :: Lens' TickInfo NominalDiffTime instance Data.Data.Data b => Data.Data.Data (Reflex.Time.ThrottleState b) instance GHC.Generics.Generic (Reflex.Time.ThrottleState b) instance Data.Traversable.Traversable Reflex.Time.ThrottleState instance Data.Foldable.Foldable Reflex.Time.ThrottleState instance GHC.Base.Functor Reflex.Time.ThrottleState instance GHC.Show.Show b => GHC.Show.Show (Reflex.Time.ThrottleState b) instance GHC.Classes.Ord b => GHC.Classes.Ord (Reflex.Time.ThrottleState b) instance GHC.Classes.Eq b => GHC.Classes.Eq (Reflex.Time.ThrottleState b) instance Data.Data.Data b => Data.Data.Data (Reflex.Time.ThrottleBuffer b) instance GHC.Generics.Generic (Reflex.Time.ThrottleBuffer b) instance Data.Traversable.Traversable Reflex.Time.ThrottleBuffer instance Data.Foldable.Foldable Reflex.Time.ThrottleBuffer instance GHC.Base.Functor Reflex.Time.ThrottleBuffer instance GHC.Show.Show b => GHC.Show.Show (Reflex.Time.ThrottleBuffer b) instance GHC.Classes.Ord b => GHC.Classes.Ord (Reflex.Time.ThrottleBuffer b) instance GHC.Classes.Eq b => GHC.Classes.Eq (Reflex.Time.ThrottleBuffer b) instance GHC.Show.Show Reflex.Time.TickInfo instance GHC.Classes.Ord Reflex.Time.TickInfo instance GHC.Classes.Eq Reflex.Time.TickInfo instance GHC.Base.Semigroup b => GHC.Base.Semigroup (Reflex.Time.ThrottleBuffer b) instance GHC.Base.Semigroup b => GHC.Base.Monoid (Reflex.Time.ThrottleBuffer b) -- | This module provides RequesterT, the standard implementation of -- Requester. module Reflex.Requester.Base -- | A basic implementation of Requester. newtype RequesterT t request (response :: * -> *) m a RequesterT :: StateT (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a -> RequesterT t request m a [unRequesterT] :: RequesterT t request m a -> StateT (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a -- | Run a RequesterT action. The resulting Event will fire -- whenever requests are made, and responses should be provided in the -- input Event. The Tag keys will be used to return the -- responses to the same place the requests were issued. runRequesterT :: (Reflex t, Monad m) => RequesterT t request response m a -> Event t (RequesterData response) -> m (a, Event t (RequesterData request)) -- | Map a function over the request and response of a RequesterT withRequesterT :: (Reflex t, MonadFix m) => (forall x. req x -> req' x) -> (forall x. rsp' x -> rsp x) -> RequesterT t req rsp m a -> RequesterT t req' rsp' m a runWithReplaceRequesterTWith :: forall m t request response a b. (Reflex t, MonadHold t m, MonadFix m) => (forall a' b'. m a' -> Event t (m b') -> RequesterT t request response m (a', Event t b')) -> RequesterT t request response m a -> Event t (RequesterT t request response m b) -> RequesterT t request response m (a, Event t b) traverseIntMapWithKeyWithAdjustRequesterTWith :: forall t request response m v v' p. (Reflex t, MonadHold t m, PatchTarget (p (Event t (IntMap (RequesterData request)))) ~ IntMap (Event t (IntMap (RequesterData request))), Patch (p (Event t (IntMap (RequesterData request)))), Functor p, MonadFix m) => ((Key -> (Key, v) -> m (Event t (IntMap (RequesterData request)), v')) -> IntMap (Key, v) -> Event t (p (Key, v)) -> RequesterT t request response m (IntMap (Event t (IntMap (RequesterData request)), v'), Event t (p (Event t (IntMap (RequesterData request)), v')))) -> (p (Event t (IntMap (RequesterData request))) -> IntMap (Event t (IntMap (RequesterData request)))) -> (Incremental t (p (Event t (IntMap (RequesterData request)))) -> Event t (IntMap (IntMap (RequesterData request)))) -> (Key -> v -> RequesterT t request response m v') -> IntMap v -> Event t (p v) -> RequesterT t request response m (IntMap v', Event t (p v')) traverseDMapWithKeyWithAdjustRequesterTWith :: forall k t request response m v v' p p'. (GCompare k, Reflex t, MonadHold t m, PatchTarget (p' (Some k) (Event t (IntMap (RequesterData request)))) ~ Map (Some k) (Event t (IntMap (RequesterData request))), Patch (p' (Some k) (Event t (IntMap (RequesterData request)))), MonadFix m) => (forall k' v1 v2. GCompare k' => (forall a. k' a -> v1 a -> m (v2 a)) -> DMap k' v1 -> Event t (p k' v1) -> RequesterT t request response m (DMap k' v2, Event t (p k' v2))) -> (forall v1 v2. (forall a. v1 a -> v2 a) -> p k v1 -> p k v2) -> (forall v1 v2. (forall a. v1 a -> v2) -> p k v1 -> p' (Some k) v2) -> (forall v2. p' (Some k) v2 -> Map (Some k) v2) -> (forall a. Incremental t (p' (Some k) (Event t a)) -> Event t (Map (Some k) a)) -> (forall a. k a -> v a -> RequesterT t request response m (v' a)) -> DMap k v -> Event t (p k v) -> RequesterT t request response m (DMap k v', Event t (p k v')) data RequesterData f data RequesterDataKey a -- | Runs in reverse to accommodate for the fact that we accumulate it in -- reverse traverseRequesterData :: forall m request response. Applicative m => (forall a. request a -> m (response a)) -> RequesterData request -> m (RequesterData response) -- | traverseRequesterData with its arguments flipped forRequesterData :: forall request response m. Applicative m => RequesterData request -> (forall a. request a -> m (response a)) -> m (RequesterData response) requesterDataToList :: RequesterData f -> [DSum RequesterDataKey f] singletonRequesterData :: RequesterDataKey a -> f a -> RequesterData f -- | Matches incoming responses with previously-sent requests and uses the -- provided request "decoder" function to process incoming responses. matchResponsesWithRequests :: forall t rawRequest rawResponse request response m. (MonadFix m, MonadHold t m, Reflex t) => (forall a. request a -> (rawRequest, rawResponse -> response a)) -> Event t (RequesterData request) -> Event t (Int, rawResponse) -> m (Event t (Map Int rawRequest), Event t (RequesterData response)) multiEntry :: IntMap (RequesterData f) -> Entry f Multi unMultiEntry :: Entry f Multi -> IntMap (RequesterData f) requesting' :: (MyTagTypeOffset x, Monad m) => Event t (Entry request x) -> RequesterT t request response m (Event t (Entry response x)) instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.Requester.Base.RequesterT t request response m) instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.Requester.Base.RequesterT t request response m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.Requester.Base.RequesterT t request response m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.Requester.Base.RequesterT t request response m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.Requester.Base.RequesterT t request response m) instance GHC.Base.Monad m => GHC.Base.Applicative (Reflex.Requester.Base.RequesterT t request response m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.Requester.Base.RequesterT t request response m) instance GHC.Enum.Enum (Reflex.Requester.Base.MyTagWrap f x) instance GHC.Classes.Ord (Reflex.Requester.Base.MyTagWrap f x) instance GHC.Classes.Eq (Reflex.Requester.Base.MyTagWrap f x) instance GHC.Show.Show (Reflex.Requester.Base.MyTagWrap f x) instance GHC.Enum.Enum (Reflex.Requester.Base.MyTag x) instance GHC.Classes.Ord (Reflex.Requester.Base.MyTag x) instance GHC.Classes.Eq (Reflex.Requester.Base.MyTag x) instance GHC.Show.Show (Reflex.Requester.Base.MyTag x) instance Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Reflex.Requester.Base.RequesterT t request response m) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Reflex.Requester.Base.RequesterT t request response m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Reflex.Requester.Base.RequesterT t request response m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.Requester.Base.RequesterT t request response m) instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Reflex.Requester.Base.RequesterT t request response m) instance (GHC.Base.Monoid a, GHC.Base.Monad m) => GHC.Base.Monoid (Reflex.Requester.Base.RequesterT t request response m a) instance (GHC.Base.Semigroup a, GHC.Base.Monad m) => GHC.Base.Semigroup (Reflex.Requester.Base.RequesterT t request response m a) instance (Reflex.Class.Reflex t, GHC.Base.Monad m) => Reflex.Requester.Class.Requester t (Reflex.Requester.Base.RequesterT t request response m) instance Control.Monad.Trans.Class.MonadTrans (Reflex.Requester.Base.RequesterT t request response) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Reflex.Requester.Base.RequesterT t request response m) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.Requester.Base.RequesterT t request response m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.Requester.Base.RequesterT t request response m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Reflex.Requester.Base.RequesterT t request response m) instance (Reflex.Class.Reflex t, Reflex.Adjustable.Class.Adjustable t m, Reflex.Class.MonadHold t m, Control.Monad.Fix.MonadFix m) => Reflex.Adjustable.Class.Adjustable t (Reflex.Requester.Base.RequesterT t request response m) instance Data.GADT.Compare.GEq (Reflex.Requester.Base.MyTagWrap f) instance Data.GADT.Compare.GCompare (Reflex.Requester.Base.MyTagWrap f) instance Data.GADT.Compare.GEq Reflex.Requester.Base.MyTag instance Data.GADT.Compare.GCompare Reflex.Requester.Base.MyTag instance Reflex.Requester.Base.MyTagTypeOffset (Reflex.Requester.Base.Single a) instance Reflex.Requester.Base.MyTagTypeOffset Reflex.Requester.Base.Multi instance Reflex.Requester.Base.MyTagTypeOffset (Reflex.Requester.Base.Multi2 k) instance Reflex.Requester.Base.MyTagTypeOffset Reflex.Requester.Base.Multi3 module Reflex.Profiled data ProfiledTimeline t profilingData :: IORef (Map (Ptr CostCentreStack) Int) data CostCentreTree CostCentreTree :: !Int -> !Int -> !Map (Ptr CostCentre) CostCentreTree -> CostCentreTree [_costCentreTree_ownEntries] :: CostCentreTree -> !Int [_costCentreTree_cumulativeEntries] :: CostCentreTree -> !Int [_costCentreTree_children] :: CostCentreTree -> !Map (Ptr CostCentre) CostCentreTree getCostCentreStack :: Ptr CostCentreStack -> IO [Ptr CostCentre] toCostCentreTree :: Ptr CostCentreStack -> Int -> IO CostCentreTree getCostCentreTree :: IO CostCentreTree formatCostCentreTree :: CostCentreTree -> IO String showProfilingData :: IO () writeProfilingData :: FilePath -> IO () newtype ProfiledM m a ProfiledM :: m a -> ProfiledM m a [runProfiledM] :: ProfiledM m a -> m a profileEvent :: Reflex t => Event t a -> Event t a instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.Profiled.ProfiledM m) instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.Profiled.ProfiledM m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.Profiled.ProfiledM m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.Profiled.ProfiledM m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Reflex.Profiled.ProfiledM m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.Profiled.ProfiledM m) instance GHC.Classes.Ord Reflex.Profiled.CostCentreTree instance GHC.Classes.Eq Reflex.Profiled.CostCentreTree instance GHC.Show.Show Reflex.Profiled.CostCentreTree instance forall k (t :: k). GHC.Base.Functor (Reflex.Class.Dynamic t) => GHC.Base.Functor (Reflex.Class.Dynamic (Reflex.Profiled.ProfiledTimeline t)) instance forall k (t :: k). GHC.Base.Applicative (Reflex.Class.Dynamic t) => GHC.Base.Applicative (Reflex.Class.Dynamic (Reflex.Profiled.ProfiledTimeline t)) instance forall k (t :: k). GHC.Base.Monad (Reflex.Class.Dynamic t) => GHC.Base.Monad (Reflex.Class.Dynamic (Reflex.Profiled.ProfiledTimeline t)) instance forall k (t :: k). Reflex.Class.Reflex t => Reflex.Class.Reflex (Reflex.Profiled.ProfiledTimeline t) instance forall k (t :: k) (m :: * -> *). Reflex.Class.MonadHold t m => Reflex.Class.MonadHold (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance forall k (t :: k) (m :: * -> *). Reflex.Class.MonadSample t m => Reflex.Class.MonadSample (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance Control.Monad.Trans.Class.MonadTrans Reflex.Profiled.ProfiledM instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.Profiled.ProfiledM m) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.Profiled.ProfiledM m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Reflex.Profiled.ProfiledM m) instance Reflex.Host.Class.ReflexHost t => Reflex.Host.Class.ReflexHost (Reflex.Profiled.ProfiledTimeline t) instance Reflex.Host.Class.MonadSubscribeEvent t m => Reflex.Host.Class.MonadSubscribeEvent (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Reflex.Profiled.ProfiledM m) instance Reflex.Host.Class.MonadReflexHost t m => Reflex.Host.Class.MonadReflexHost (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance Reflex.Host.Class.MonadReadEvent t m => Reflex.Host.Class.MonadReadEvent (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance GHC.Base.Semigroup Reflex.Profiled.CostCentreTree instance GHC.Base.Monoid Reflex.Profiled.CostCentreTree -- | This module defines PostBuildT, the standard implementation of -- PostBuild. module Reflex.PostBuild.Base -- | Provides a basic implementation of PostBuild. newtype PostBuildT t m a PostBuildT :: ReaderT (Event t ()) m a -> PostBuildT t m a [unPostBuildT] :: PostBuildT t m a -> ReaderT (Event t ()) m a -- | Run a PostBuildT action. An Event should be provided -- that fires immediately after the action is finished running; no other -- Events should fire first. runPostBuildT :: PostBuildT t m a -> Event t () -> m a mapIntMapWithAdjustImpl :: forall t m v v' p. (Reflex t, MonadFix m, MonadHold t m, Functor p) => ((Key -> (Event t (), v) -> m v') -> IntMap (Event t (), v) -> Event t (p (Event t (), v)) -> m (IntMap v', Event t (p v'))) -> (Key -> v -> PostBuildT t m v') -> IntMap v -> Event t (p v) -> PostBuildT t m (IntMap v', Event t (p v')) mapDMapWithAdjustImpl :: forall t m k v v' p. (Reflex t, MonadFix m, MonadHold t m) => ((forall a. k a -> Compose ((,) (Bool, Event t ())) v a -> m (v' a)) -> DMap k (Compose ((,) (Bool, Event t ())) v) -> Event t (p k (Compose ((,) (Bool, Event t ())) v)) -> m (DMap k v', Event t (p k v'))) -> ((forall a. v a -> Compose ((,) (Bool, Event t ())) v a) -> p k v -> p k (Compose ((,) (Bool, Event t ())) v)) -> (forall a. k a -> v a -> PostBuildT t m (v' a)) -> DMap k v -> Event t (p k v) -> PostBuildT t m (DMap k v', Event t (p k v')) instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.PostBuild.Base.PostBuildT t m) instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.PostBuild.Base.PostBuildT t m) instance Control.Monad.Trans.Class.MonadTrans (Reflex.PostBuild.Base.PostBuildT t) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.PostBuild.Base.PostBuildT t m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.PostBuild.Base.PostBuildT t m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.PostBuild.Base.PostBuildT t m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Reflex.PostBuild.Base.PostBuildT t m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.PostBuild.Base.PostBuildT t m) instance (GHC.Base.Monoid a, GHC.Base.Applicative m) => GHC.Base.Monoid (Reflex.PostBuild.Base.PostBuildT t m a) instance (GHC.Base.Semigroup a, GHC.Base.Applicative m) => GHC.Base.Semigroup (Reflex.PostBuild.Base.PostBuildT t m a) instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Reflex.PostBuild.Base.PostBuildT x m) instance (Reflex.Class.Reflex t, GHC.Base.Monad m) => Reflex.PostBuild.Class.PostBuild t (Reflex.PostBuild.Base.PostBuildT t m) instance Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Reflex.PostBuild.Base.PostBuildT t m) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Reflex.PostBuild.Base.PostBuildT t m) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Reflex.PostBuild.Base.PostBuildT t m) instance (Reflex.Host.Class.ReflexHost t, Reflex.Host.Class.MonadReflexCreateTrigger t m) => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.PostBuild.Base.PostBuildT t m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.PostBuild.Base.PostBuildT t m) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.PostBuild.Base.PostBuildT t m) instance Control.Monad.Ref.MonadAtomicRef m => Control.Monad.Ref.MonadAtomicRef (Reflex.PostBuild.Base.PostBuildT t m) instance (Reflex.Class.Reflex t, Reflex.Class.MonadHold t m, Control.Monad.Fix.MonadFix m, Reflex.Adjustable.Class.Adjustable t m, Reflex.PerformEvent.Class.PerformEvent t m) => Reflex.Adjustable.Class.Adjustable t (Reflex.PostBuild.Base.PostBuildT t m) instance Control.Monad.Trans.Control.MonadTransControl (Reflex.PostBuild.Base.PostBuildT t) -- | This module provides PerformEventT, the standard implementation -- of PerformEvent. module Reflex.PerformEvent.Base -- | Provides a basic implementation of PerformEvent. Note that, -- despite the name, PerformEventT is not an instance of -- MonadTrans. newtype PerformEventT t m a PerformEventT :: RequesterT t (HostFrame t) Identity (HostFrame t) a -> PerformEventT t m a [unPerformEventT] :: PerformEventT t m a -> RequesterT t (HostFrame t) Identity (HostFrame t) a -- | A function that fires events for the given EventTriggers and -- then runs any followup actions provided via PerformEvent. The -- given ReadPhase action will be run once for the initial trigger -- execution as well as once for each followup. newtype FireCommand t m FireCommand :: (forall a. [DSum (EventTrigger t) Identity] -> ReadPhase m a -> m [a]) -> FireCommand t m [runFireCommand] :: FireCommand t m -> forall a. [DSum (EventTrigger t) Identity] -> ReadPhase m a -> m [a] -- | Run a PerformEventT action, returning a FireCommand that -- allows the caller to trigger Events while ensuring that -- performEvent actions are run at the appropriate time. hostPerformEventT :: forall t m a. (Monad m, MonadSubscribeEvent t m, MonadReflexHost t m, MonadRef m, Ref m ~ Ref IO) => PerformEventT t m a -> m (a, FireCommand t m) instance forall k t (m :: k). Reflex.Host.Class.ReflexHost t => GHC.Base.Functor (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). Reflex.Host.Class.ReflexHost t => GHC.Base.Applicative (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). Reflex.Host.Class.ReflexHost t => GHC.Base.Monad (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). Reflex.Host.Class.ReflexHost t => Control.Monad.Fix.MonadFix (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). (Reflex.Host.Class.ReflexHost t, Control.Monad.IO.Class.MonadIO (Reflex.Host.Class.HostFrame t)) => Control.Monad.IO.Class.MonadIO (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). (Reflex.Host.Class.ReflexHost t, Control.Monad.Exception.MonadException (Reflex.Host.Class.HostFrame t)) => Control.Monad.Exception.MonadException (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t a (m :: k). (Reflex.Host.Class.ReflexHost t, GHC.Base.Monoid a) => GHC.Base.Monoid (Reflex.PerformEvent.Base.PerformEventT t m a) instance forall k t a (m :: k). (Reflex.Host.Class.ReflexHost t, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Reflex.PerformEvent.Base.PerformEventT t m a) instance forall k t (m :: k). (Control.Monad.Primitive.PrimMonad (Reflex.Host.Class.HostFrame t), Reflex.Host.Class.ReflexHost t) => Control.Monad.Primitive.PrimMonad (Reflex.PerformEvent.Base.PerformEventT t m) instance (Reflex.Host.Class.ReflexHost t, Control.Monad.Ref.Ref m Data.Type.Equality.~ Control.Monad.Ref.Ref GHC.Types.IO) => Reflex.PerformEvent.Class.PerformEvent t (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). (Reflex.Host.Class.ReflexHost t, Control.Monad.Primitive.PrimMonad (Reflex.Host.Class.HostFrame t)) => Reflex.Adjustable.Class.Adjustable t (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). Reflex.Host.Class.ReflexHost t => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). Reflex.Host.Class.ReflexHost t => Reflex.Class.MonadSample t (Reflex.PerformEvent.Base.PerformEventT t m) instance (Reflex.Host.Class.ReflexHost t, Reflex.Class.MonadHold t m) => Reflex.Class.MonadHold t (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). (Control.Monad.Ref.MonadRef (Reflex.Host.Class.HostFrame t), Reflex.Host.Class.ReflexHost t) => Control.Monad.Ref.MonadRef (Reflex.PerformEvent.Base.PerformEventT t m) instance forall k t (m :: k). (Control.Monad.Ref.MonadAtomicRef (Reflex.Host.Class.HostFrame t), Reflex.Host.Class.ReflexHost t) => Control.Monad.Ref.MonadAtomicRef (Reflex.PerformEvent.Base.PerformEventT t m) -- | This module provides EventWriterT, the standard implementation -- of EventWriter. module Reflex.EventWriter.Base -- | A basic implementation of EventWriter. newtype EventWriterT t w m a EventWriterT :: StateT (EventWriterState t w) m a -> EventWriterT t w m a [unEventWriterT] :: EventWriterT t w m a -> StateT (EventWriterState t w) m a -- | Run a EventWriterT action. runEventWriterT :: forall t m w a. (Reflex t, Monad m, Semigroup w) => EventWriterT t w m a -> m (a, Event t w) -- | Given a function like runWithReplace for the underlying monad, -- implement runWithReplace for EventWriterT. This is -- necessary when the underlying monad doesn't have a Adjustable -- instance or to override the default Adjustable behavior. runWithReplaceEventWriterTWith :: forall m t w a b. (Reflex t, MonadHold t m, Semigroup w) => (forall a' b'. m a' -> Event t (m b') -> EventWriterT t w m (a', Event t b')) -> EventWriterT t w m a -> Event t (EventWriterT t w m b) -> EventWriterT t w m (a, Event t b) -- | Like runWithReplaceEventWriterTWith, but for -- sequenceDMapWithAdjust. sequenceDMapWithAdjustEventWriterTWith :: forall t m p p' w k v v'. (Reflex t, MonadHold t m, Semigroup w, Patch (p' (Some k) (Event t w)), PatchTarget (p' (Some k) (Event t w)) ~ Map (Some k) (Event t w), GCompare k, Patch (p' (Some k) w), PatchTarget (p' (Some k) w) ~ Map (Some k) w) => ((forall a. k a -> v a -> m (Compose ((,) (Event t w)) v' a)) -> DMap k v -> Event t (p k v) -> EventWriterT t w m (DMap k (Compose ((,) (Event t w)) v'), Event t (p k (Compose ((,) (Event t w)) v')))) -> ((forall a. Compose ((,) (Event t w)) v' a -> v' a) -> p k (Compose ((,) (Event t w)) v') -> p k v') -> ((forall a. Compose ((,) (Event t w)) v' a -> Event t w) -> p k (Compose ((,) (Event t w)) v') -> p' (Some k) (Event t w)) -> (Incremental t (p' (Some k) (Event t w)) -> Event t (PatchTarget (p' (Some k) w))) -> (Event t (p' (Some k) (Event t w)) -> Event t (p' (Some k) w)) -> (forall a. k a -> v a -> EventWriterT t w m (v' a)) -> DMap k v -> Event t (p k v) -> EventWriterT t w m (DMap k v', Event t (p k v')) -- | Change the monad underlying an EventWriterT mapEventWriterT :: (forall x. m x -> n x) -> EventWriterT t w m a -> EventWriterT t w n a -- | Map a function over the output of a EventWriterT. withEventWriterT :: (Semigroup w, Semigroup w', Reflex t, MonadHold t m) => (w -> w') -> EventWriterT t w m a -> EventWriterT t w' m a instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.EventWriter.Base.EventWriterT t w m) instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.EventWriter.Base.EventWriterT t w m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.EventWriter.Base.EventWriterT t w m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.EventWriter.Base.EventWriterT t w m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.EventWriter.Base.EventWriterT t w m) instance GHC.Base.Monad m => GHC.Base.Applicative (Reflex.EventWriter.Base.EventWriterT t w m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.EventWriter.Base.EventWriterT t w m) instance GHC.Enum.Enum (Reflex.EventWriter.Base.TellId w x) instance GHC.Classes.Ord (Reflex.EventWriter.Base.TellId w x) instance GHC.Classes.Eq (Reflex.EventWriter.Base.TellId w x) instance GHC.Show.Show (Reflex.EventWriter.Base.TellId w x) instance (Reflex.Class.Reflex t, GHC.Base.Monad m, GHC.Base.Semigroup w) => Reflex.EventWriter.Class.EventWriter t w (Reflex.EventWriter.Base.EventWriterT t w m) instance Control.Monad.Trans.Class.MonadTrans (Reflex.EventWriter.Base.EventWriterT t w) instance Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Reflex.EventWriter.Base.EventWriterT t w m) instance (Reflex.Class.Reflex t, Reflex.Adjustable.Class.Adjustable t m, Reflex.Class.MonadHold t m, GHC.Base.Semigroup w) => Reflex.Adjustable.Class.Adjustable t (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.Requester.Class.Requester t m => Reflex.Requester.Class.Requester t (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.EventWriter.Base.EventWriterT t w m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Reflex.EventWriter.Base.EventWriterT t w m) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.EventWriter.Base.EventWriterT t w m) instance Control.Monad.Ref.MonadAtomicRef m => Control.Monad.Ref.MonadAtomicRef (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.EventWriter.Base.EventWriterT t w m) instance (Reflex.Query.Class.MonadQuery t q m, GHC.Base.Monad m) => Reflex.Query.Class.MonadQuery t q (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.DynamicWriter.Class.DynamicWriter t w m => Reflex.DynamicWriter.Class.DynamicWriter t w (Reflex.EventWriter.Base.EventWriterT t v m) instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Reflex.EventWriter.Base.EventWriterT t w m) instance Data.GADT.Compare.GEq (Reflex.EventWriter.Base.TellId w) instance Data.GADT.Compare.GCompare (Reflex.EventWriter.Base.TellId w) module Reflex.Query.Base newtype QueryT t q m a QueryT :: StateT [Behavior t q] (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)) a -> QueryT t q m a [unQueryT] :: QueryT t q m a -> StateT [Behavior t q] (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)) a runQueryT :: (MonadFix m, Additive q, Group q, Reflex t) => QueryT t q m a -> Dynamic t (QueryResult q) -> m (a, Incremental t (AdditivePatch q)) -- | Apply a QueryMorphism to a Query mapQuery :: QueryMorphism q q' -> q -> q' -- | Map a QueryMorphism to a QueryResult mapQueryResult :: QueryMorphism q q' -> QueryResult q' -> QueryResult q -- | dynWithQueryT's (Dynamic t QueryMorphism) argument needs to be a group -- homomorphism at all times in order to behave correctly dynWithQueryT :: (MonadFix m, PostBuild t m, Group q, Additive q, Group q', Additive q', Query q') => Dynamic t (QueryMorphism q q') -> QueryT t q m a -> QueryT t q' m a -- | withQueryT's QueryMorphism argument needs to be a group homomorphism -- in order to behave correctly withQueryT :: (MonadFix m, PostBuild t m, Group q, Group q', Additive q, Additive q', Query q') => QueryMorphism q q' -> QueryT t q m a -> QueryT t q' m a instance Control.Monad.Ref.MonadAtomicRef m => Control.Monad.Ref.MonadAtomicRef (Reflex.Query.Base.QueryT t q m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.Query.Base.QueryT t q m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.Query.Base.QueryT t q m) instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.Query.Base.QueryT t q m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.Query.Base.QueryT t q m) instance GHC.Base.Monad m => GHC.Base.Applicative (Reflex.Query.Base.QueryT t q m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.Query.Base.QueryT t q m) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Reflex.Query.Base.QueryT t q m) instance Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Reflex.Query.Base.QueryT t q m) instance (Reflex.Class.Reflex t, Control.Monad.Fix.MonadFix m, Reflex.Patch.Group q, Reflex.Patch.Additive q, Reflex.Query.Class.Query q, GHC.Classes.Eq q, Reflex.Class.MonadHold t m, Reflex.Adjustable.Class.Adjustable t m) => Reflex.Adjustable.Class.Adjustable t (Reflex.Query.Base.QueryT t q m) instance Control.Monad.Trans.Class.MonadTrans (Reflex.Query.Base.QueryT t q) instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Reflex.Query.Base.QueryT t q m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Reflex.Query.Base.QueryT t q m) instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.Query.Base.QueryT t q m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.Query.Base.QueryT t q m) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Reflex.Query.Base.QueryT t q m) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.Query.Base.QueryT t q m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.Query.Base.QueryT t q m) instance (GHC.Base.Monoid a, GHC.Base.Monad m) => GHC.Base.Monoid (Reflex.Query.Base.QueryT t q m a) instance (GHC.Base.Semigroup a, GHC.Base.Monad m) => GHC.Base.Semigroup (Reflex.Query.Base.QueryT t q m a) instance (GHC.Base.Monad m, Reflex.Patch.Group q, Reflex.Patch.Additive q, Reflex.Query.Class.Query q, Reflex.Class.Reflex t) => Reflex.Query.Class.MonadQuery t q (Reflex.Query.Base.QueryT t q m) instance Reflex.Requester.Class.Requester t m => Reflex.Requester.Class.Requester t (Reflex.Query.Base.QueryT t q m) instance Reflex.EventWriter.Class.EventWriter t w m => Reflex.EventWriter.Class.EventWriter t w (Reflex.Query.Base.QueryT t q m) instance Reflex.DynamicWriter.Class.DynamicWriter t w m => Reflex.DynamicWriter.Class.DynamicWriter t w (Reflex.Query.Base.QueryT t q m) -- | Deprecated: Use Class and Base instead, or just -- import Reflex module Reflex.EventWriter module Reflex.DynamicWriter.Base -- | A basic implementation of DynamicWriter. newtype DynamicWriterT t w m a DynamicWriterT :: StateT [Dynamic t w] m a -> DynamicWriterT t w m a [unDynamicWriterT] :: DynamicWriterT t w m a -> StateT [Dynamic t w] m a -- | Run a DynamicWriterT action. The dynamic writer output will be -- provided along with the result of the action. runDynamicWriterT :: (MonadFix m, Reflex t, Monoid w) => DynamicWriterT t w m a -> m (a, Dynamic t w) -- | Map a function over the output of a DynamicWriterT. withDynamicWriterT :: (Monoid w, Monoid w', Reflex t, MonadHold t m, MonadFix m) => (w -> w') -> DynamicWriterT t w m a -> DynamicWriterT t w' m a instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance GHC.Base.Monad m => GHC.Base.Applicative (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.Trans.Class.MonadTrans (Reflex.DynamicWriter.Base.DynamicWriterT t w) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.Ref.MonadAtomicRef m => Control.Monad.Ref.MonadAtomicRef (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance (GHC.Base.Monad m, GHC.Base.Monoid w, Reflex.Class.Reflex t) => Reflex.DynamicWriter.Class.DynamicWriter t w (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance (Reflex.Adjustable.Class.Adjustable t m, Control.Monad.Fix.MonadFix m, GHC.Base.Monoid w, Reflex.Class.MonadHold t m, Reflex.Class.Reflex t) => Reflex.Adjustable.Class.Adjustable t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.Requester.Class.Requester t m => Reflex.Requester.Class.Requester t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance (Reflex.Query.Class.MonadQuery t q m, GHC.Base.Monad m) => Reflex.Query.Class.MonadQuery t q (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.EventWriter.Class.EventWriter t w m => Reflex.EventWriter.Class.EventWriter t w (Reflex.DynamicWriter.Base.DynamicWriterT t v m) -- | Deprecated: Use Class and Base instead, or just -- import Reflex module Reflex.DynamicWriter module Reflex.BehaviorWriter.Base -- | A basic implementation of MonadBehaviorWriter. newtype BehaviorWriterT t w m a BehaviorWriterT :: StateT [Behavior t w] m a -> BehaviorWriterT t w m a [unBehaviorWriterT] :: BehaviorWriterT t w m a -> StateT [Behavior t w] m a -- | Run a BehaviorWriterT action. The behavior writer output will -- be provided along with the result of the action. runBehaviorWriterT :: (Monad m, Reflex t, Monoid w) => BehaviorWriterT t w m a -> m (a, Behavior t w) -- | Map a function over the output of a BehaviorWriterT. withBehaviorWriterT :: (Monoid w, Monoid w', Reflex t, MonadHold t m) => (w -> w') -> BehaviorWriterT t w m a -> BehaviorWriterT t w' m a instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance GHC.Base.Monad m => GHC.Base.Monad (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance GHC.Base.Monad m => GHC.Base.Applicative (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance GHC.Base.Functor m => GHC.Base.Functor (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.Class.MonadSample t m => Reflex.Class.MonadSample t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Control.Monad.Trans.Class.MonadTrans (Reflex.BehaviorWriter.Base.BehaviorWriterT t w) instance Control.Monad.Ref.MonadRef m => Control.Monad.Ref.MonadRef (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Control.Monad.Ref.MonadAtomicRef m => Control.Monad.Ref.MonadAtomicRef (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.Host.Class.MonadReflexCreateTrigger t m => Reflex.Host.Class.MonadReflexCreateTrigger t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance (GHC.Base.Monad m, GHC.Base.Monoid w, Reflex.Class.Reflex t) => Reflex.BehaviorWriter.Class.MonadBehaviorWriter t w (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.PerformEvent.Class.PerformEvent t m => Reflex.PerformEvent.Class.PerformEvent t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.TriggerEvent.Class.TriggerEvent t m => Reflex.TriggerEvent.Class.TriggerEvent t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.PostBuild.Class.PostBuild t m => Reflex.PostBuild.Class.PostBuild t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.Requester.Class.Requester t m => Reflex.Requester.Class.Requester t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance (Reflex.Query.Class.MonadQuery t q m, GHC.Base.Monad m) => Reflex.Query.Class.MonadQuery t q (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance (Reflex.Adjustable.Class.Adjustable t m, GHC.Base.Monoid w, Reflex.Class.MonadHold t m, Reflex.Class.Reflex t) => Reflex.Adjustable.Class.Adjustable t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) module Reflex.NotReady.Class class Monad m => NotReady t m | m -> t notReadyUntil :: NotReady t m => Event t a -> m () notReadyUntil :: (NotReady t m, MonadTrans f, m ~ f m', NotReady t m') => Event t a -> m () notReady :: NotReady t m => m () notReady :: (NotReady t m, MonadTrans f, m ~ f m', NotReady t m') => m () instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Control.Monad.Trans.Reader.ReaderT r m) instance (Reflex.NotReady.Class.NotReady t m, GHC.Base.Monoid w) => Reflex.NotReady.Class.NotReady t (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Reflex.PostBuild.Base.PostBuildT t m) instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Reflex.EventWriter.Base.EventWriterT t w m) instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Reflex.DynamicWriter.Base.DynamicWriterT t w m) instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Reflex.BehaviorWriter.Base.BehaviorWriterT t w m) instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Reflex.Query.Base.QueryT t q m) instance (Reflex.Host.Class.ReflexHost t, Reflex.NotReady.Class.NotReady t (Reflex.Host.Class.HostFrame t)) => Reflex.NotReady.Class.NotReady t (Reflex.PerformEvent.Base.PerformEventT t m) instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Reflex.Requester.Base.RequesterT t request response m) instance Reflex.NotReady.Class.NotReady t m => Reflex.NotReady.Class.NotReady t (Reflex.TriggerEvent.Base.TriggerEventT t m) -- | This module is the implementation of the Spider Reflex -- engine. It uses a graph traversal algorithm to propagate Events -- and Behaviors. module Reflex.Spider.Internal pattern SpiderBehavior :: () => Behavior x a -> Behavior (SpiderTimeline x) a unSpiderBehavior :: Behavior (SpiderTimeline x) a -> Behavior x a pattern SpiderEvent :: () => Event x a -> Event (SpiderTimeline x) a unSpiderEvent :: Event (SpiderTimeline x) a -> Event x a pattern SpiderDynamic :: () => DynamicS x (Identity a) -> Dynamic (SpiderTimeline x) a unSpiderDynamic :: Dynamic (SpiderTimeline x) a -> DynamicS x (Identity a) pattern SpiderIncremental :: () => DynamicS x p -> Incremental (SpiderTimeline x) p unSpiderIncremental :: Incremental (SpiderTimeline x) p -> DynamicS x p newtype ReadPhase x a ReadPhase :: ResultM x a -> ReadPhase x a newtype SpiderHostFrame (x :: Type) a SpiderHostFrame :: EventM x a -> SpiderHostFrame a [runSpiderHostFrame] :: SpiderHostFrame a -> EventM x a -- | The monad for actions that manipulate a Spider timeline identified by -- x newtype SpiderHost (x :: Type) a SpiderHost :: IO a -> SpiderHost a [unSpiderHost] :: SpiderHost a -> IO a data SpiderEventHandle x a SpiderEventHandle :: EventSubscription x -> IORef (Maybe a) -> SpiderEventHandle x a [spiderEventHandleSubscription] :: SpiderEventHandle x a -> EventSubscription x [spiderEventHandleValue] :: SpiderEventHandle x a -> IORef (Maybe a) data RootTrigger x a RootTrigger :: (WeakBag (Subscriber x a), IORef (DMap k Identity), k a) -> RootTrigger x a newtype SpiderPushM (x :: Type) a SpiderPushM :: ComputeM x a -> SpiderPushM a type ComputeM = EventM newtype SpiderPullM (x :: Type) a SpiderPullM :: BehaviorM x a -> SpiderPullM a data LocalSpiderTimeline (x :: Type) s -- | SpiderEnv is the old name for SpiderTimeline -- | Deprecated: Use SpiderTimelineEnv instead type SpiderEnv = SpiderTimeline -- | The default, global Spider environment type Spider = SpiderTimeline Global -- | Designates the default, global Spider timeline data SpiderTimeline x data SomeSwitchSubscribed x SomeSwitchSubscribed :: {-# NOUNPACK #-}SwitchSubscribed x a -> SomeSwitchSubscribed x newtype Height Height :: Int -> Height [unHeight] :: Height -> Int newtype EventSelectorG x k v EventSelectorG :: (forall a. k a -> Event x (v a)) -> EventSelectorG x k v [selectG] :: EventSelectorG x k v -> forall a. k a -> Event x (v a) newtype EventSelector x k EventSelector :: (forall a. k a -> Event x a) -> EventSelector x k [select] :: EventSelector x k -> forall a. k a -> Event x a data Merge x k v s Merge :: {-# UNPACK #-} !IORef (DMap k s) -> {-# UNPACK #-} !IORef HeightBag -> {-# UNPACK #-} !IORef Height -> {-# UNPACK #-} !Subscriber x (DMap k v) -> {-# UNPACK #-} !IORef (DMap k v) -> Merge x k v s [_merge_parentsRef] :: Merge x k v s -> {-# UNPACK #-} !IORef (DMap k s) [_merge_heightBagRef] :: Merge x k v s -> {-# UNPACK #-} !IORef HeightBag [_merge_heightRef] :: Merge x k v s -> {-# UNPACK #-} !IORef Height [_merge_sub] :: Merge x k v s -> {-# UNPACK #-} !Subscriber x (DMap k v) [_merge_accumRef] :: Merge x k v s -> {-# UNPACK #-} !IORef (DMap k v) type MergeDestroyFunc k s = DMap k s -> IO () type MergeInitFunc k v q x s = DMap k q -> (forall a. EventM x (k a) -> Subscriber x (v a)) -> EventM x (DMap k v, [Height], DMap k s) type MergeUpdateFunc k v x p s = (forall a. EventM x (k a) -> Subscriber x (v a)) -> IORef HeightBag -> DMap k s -> p -> EventM x ([EventSubscription x], DMap k s) data FanInt x a FanInt :: {-# UNPACK #-} !FastMutableIntMap (FastWeakBag (Subscriber x a)) -> {-# UNPACK #-} !IORef (EventSubscription x) -> {-# UNPACK #-} !IORef (IntMap a) -> FanInt x a [_fanInt_subscribers] :: FanInt x a -> {-# UNPACK #-} !FastMutableIntMap (FastWeakBag (Subscriber x a)) [_fanInt_subscriptionRef] :: FanInt x a -> {-# UNPACK #-} !IORef (EventSubscription x) [_fanInt_occRef] :: FanInt x a -> {-# UNPACK #-} !IORef (IntMap a) newtype EventSelectorInt x a EventSelectorInt :: (Int -> Event x a) -> EventSelectorInt x a [selectInt] :: EventSelectorInt x a -> Int -> Event x a data SomeResetCoincidence x SomeResetCoincidence :: !EventSubscription x -> !Maybe (CoincidenceSubscribed x a) -> SomeResetCoincidence x type CanTrace x m = (HasSpiderTimeline x, MonadIO m) type WeakList a = [Weak a] data SomeAssignment x SomeAssignment :: {-# UNPACK #-} !IORef a -> {-# UNPACK #-} !IORef [Weak (Invalidator x)] -> a -> SomeAssignment x newtype RootClear k RootClear :: IORef (DMap k Identity) -> RootClear k newtype IntClear a IntClear :: IORef (IntMap a) -> IntClear a newtype Clear a Clear :: IORef (Maybe a) -> Clear a type ResultM = EventM newtype Dyn (x :: Type) p Dyn :: IORef (DynType x p) -> Dyn p [unDyn] :: Dyn p -> IORef (DynType x p) data DynType x p UnsafeDyn :: !(BehaviorM x (PatchTarget p), Event x p) -> DynType x p BuildDyn :: !(EventM x (PatchTarget p), Event x p) -> DynType x p HoldDyn :: !Hold x p -> DynType x p data Coincidence x a Coincidence :: !Event x (Event x a) -> !IORef (Maybe (CoincidenceSubscribed x a)) -> Coincidence x a [coincidenceParent] :: Coincidence x a -> !Event x (Event x a) [coincidenceSubscribed] :: Coincidence x a -> !IORef (Maybe (CoincidenceSubscribed x a)) data CoincidenceSubscribed x a CoincidenceSubscribed :: !IORef (Maybe (CoincidenceSubscribed x a)) -> !IORef (Maybe a) -> !WeakBag (Subscriber x a) -> !IORef Height -> {-# NOUNPACK #-}Subscriber x (Event x a) -> !EventSubscription x -> !IORef (Maybe (EventSubscribed x)) -> !IORef (Weak (CoincidenceSubscribed x a)) -> CoincidenceSubscribed x a [coincidenceSubscribedCachedSubscribed] :: CoincidenceSubscribed x a -> !IORef (Maybe (CoincidenceSubscribed x a)) [coincidenceSubscribedOccurrence] :: CoincidenceSubscribed x a -> !IORef (Maybe a) [coincidenceSubscribedSubscribers] :: CoincidenceSubscribed x a -> !WeakBag (Subscriber x a) [coincidenceSubscribedHeight] :: CoincidenceSubscribed x a -> !IORef Height [coincidenceSubscribedOuter] :: CoincidenceSubscribed x a -> {-# NOUNPACK #-}Subscriber x (Event x a) [coincidenceSubscribedOuterParent] :: CoincidenceSubscribed x a -> !EventSubscription x [coincidenceSubscribedInnerParent] :: CoincidenceSubscribed x a -> !IORef (Maybe (EventSubscribed x)) [coincidenceSubscribedWeakSelf] :: CoincidenceSubscribed x a -> !IORef (Weak (CoincidenceSubscribed x a)) data Switch x a Switch :: !Behavior x (Event x a) -> !IORef (Maybe (SwitchSubscribed x a)) -> Switch x a [switchParent] :: Switch x a -> !Behavior x (Event x a) [switchSubscribed] :: Switch x a -> !IORef (Maybe (SwitchSubscribed x a)) data SwitchSubscribed x a SwitchSubscribed :: !IORef (Maybe (SwitchSubscribed x a)) -> !IORef (Maybe a) -> !IORef Height -> !WeakBag (Subscriber x a) -> {-# NOUNPACK #-} !Invalidator x -> !IORef (Weak (Invalidator x)) -> !IORef [SomeBehaviorSubscribed x] -> !Behavior x (Event x a) -> !IORef (EventSubscription x) -> !IORef (Weak (SwitchSubscribed x a)) -> SwitchSubscribed x a [switchSubscribedCachedSubscribed] :: SwitchSubscribed x a -> !IORef (Maybe (SwitchSubscribed x a)) [switchSubscribedOccurrence] :: SwitchSubscribed x a -> !IORef (Maybe a) [switchSubscribedHeight] :: SwitchSubscribed x a -> !IORef Height [switchSubscribedSubscribers] :: SwitchSubscribed x a -> !WeakBag (Subscriber x a) [switchSubscribedOwnInvalidator] :: SwitchSubscribed x a -> {-# NOUNPACK #-} !Invalidator x [switchSubscribedOwnWeakInvalidator] :: SwitchSubscribed x a -> !IORef (Weak (Invalidator x)) [switchSubscribedBehaviorParents] :: SwitchSubscribed x a -> !IORef [SomeBehaviorSubscribed x] [switchSubscribedParent] :: SwitchSubscribed x a -> !Behavior x (Event x a) [switchSubscribedCurrentParent] :: SwitchSubscribed x a -> !IORef (EventSubscription x) [switchSubscribedWeakSelf] :: SwitchSubscribed x a -> !IORef (Weak (SwitchSubscribed x a)) data Fan x k v Fan :: !Event x (DMap k v) -> !IORef (Maybe (FanSubscribed x k v)) -> Fan x k v [fanParent] :: Fan x k v -> !Event x (DMap k v) [fanSubscribed] :: Fan x k v -> !IORef (Maybe (FanSubscribed x k v)) data FanSubscribed x k v FanSubscribed :: !IORef (Maybe (FanSubscribed x k v)) -> !IORef (Maybe (DMap k v)) -> !IORef (DMap k (FanSubscribedChildren x k v)) -> !EventSubscription x -> FanSubscribed x k v [fanSubscribedCachedSubscribed] :: FanSubscribed x k v -> !IORef (Maybe (FanSubscribed x k v)) [fanSubscribedOccurrence] :: FanSubscribed x k v -> !IORef (Maybe (DMap k v)) [fanSubscribedSubscribers] :: FanSubscribed x k v -> !IORef (DMap k (FanSubscribedChildren x k v)) [fanSubscribedParent] :: FanSubscribed x k v -> !EventSubscription x data FanSubscribedChildren x k v a FanSubscribedChildren :: !WeakBag (Subscriber x (v a)) -> {-# NOUNPACK #-} !(k a, FanSubscribed x k v) -> !IORef (Weak (k a, FanSubscribed x k v)) -> FanSubscribedChildren x k v a [_fanSubscribedChildren_list] :: FanSubscribedChildren x k v a -> !WeakBag (Subscriber x (v a)) [_fanSubscribedChildren_self] :: FanSubscribedChildren x k v a -> {-# NOUNPACK #-} !(k a, FanSubscribed x k v) [_fanSubscribedChildren_weakSelf] :: FanSubscribedChildren x k v a -> !IORef (Weak (k a, FanSubscribed x k v)) data HeightBag HeightBag :: {-# UNPACK #-} !Int -> !IntMap Word -> HeightBag [_heightBag_size] :: HeightBag -> {-# UNPACK #-} !Int [_heightBag_contents] :: HeightBag -> !IntMap Word data MergeSubscribedParentWithMove x k a MergeSubscribedParentWithMove :: !EventSubscription x -> !IORef (k a) -> MergeSubscribedParentWithMove x k a [_mergeSubscribedParentWithMove_subscription] :: MergeSubscribedParentWithMove x k a -> !EventSubscription x [_mergeSubscribedParentWithMove_key] :: MergeSubscribedParentWithMove x k a -> !IORef (k a) newtype MergeSubscribedParent x a MergeSubscribedParent :: EventSubscription x -> MergeSubscribedParent x a [unMergeSubscribedParent] :: MergeSubscribedParent x a -> EventSubscription x newtype EventM x a EventM :: IO a -> EventM x a [unEventM] :: EventM x a -> IO a newtype SomeMergeInit x SomeMergeInit :: EventM x () -> SomeMergeInit x [unSomeMergeInit] :: SomeMergeInit x -> EventM x () data SomeMergeUpdate x SomeMergeUpdate :: !EventM x [EventSubscription x] -> !IO () -> !IO () -> SomeMergeUpdate x [_someMergeUpdate_update] :: SomeMergeUpdate x -> !EventM x [EventSubscription x] [_someMergeUpdate_invalidateHeight] :: SomeMergeUpdate x -> !IO () [_someMergeUpdate_recalculateHeight] :: SomeMergeUpdate x -> !IO () data SomeDynInit x SomeDynInit :: !Dyn x p -> SomeDynInit x data SomeHoldInit x SomeHoldInit :: !Hold x p -> SomeHoldInit x data Root x k Root :: !IORef (DMap k Identity) -> !IORef (DMap k (RootSubscribed x)) -> !forall a. k a -> RootTrigger x a -> IO (IO ()) -> Root x k [rootOccurrence] :: Root x k -> !IORef (DMap k Identity) [rootSubscribed] :: Root x k -> !IORef (DMap k (RootSubscribed x)) [rootInit] :: Root x k -> !forall a. k a -> RootTrigger x a -> IO (IO ()) data RootSubscribed x a RootSubscribed :: !k a -> !IORef (DMap k (RootSubscribed x)) -> !WeakBag (Subscriber x a) -> !IO (Maybe a) -> IO () -> !IORef (Weak (RootSubscribed x a)) -> RootSubscribed x a [rootSubscribedKey] :: RootSubscribed x a -> !k a [rootSubscribedCachedSubscribed] :: RootSubscribed x a -> !IORef (DMap k (RootSubscribed x)) [rootSubscribedSubscribers] :: RootSubscribed x a -> !WeakBag (Subscriber x a) [rootSubscribedOccurrence] :: RootSubscribed x a -> !IO (Maybe a) [rootSubscribedUninit] :: RootSubscribed x a -> IO () [rootSubscribedWeakSelf] :: RootSubscribed x a -> !IORef (Weak (RootSubscribed x a)) data Invalidator x InvalidatorPull :: Pull x a -> Invalidator x InvalidatorSwitch :: SwitchSubscribed x a -> Invalidator x data Pull x a Pull :: !IORef (Maybe (PullSubscribed x a)) -> !BehaviorM x a -> Pull x a [pullValue] :: Pull x a -> !IORef (Maybe (PullSubscribed x a)) [pullCompute] :: Pull x a -> !BehaviorM x a data PullSubscribed x a PullSubscribed :: !a -> !IORef [Weak (Invalidator x)] -> !Invalidator x -> ![SomeBehaviorSubscribed x] -> PullSubscribed x a [pullSubscribedValue] :: PullSubscribed x a -> !a [pullSubscribedInvalidators] :: PullSubscribed x a -> !IORef [Weak (Invalidator x)] [pullSubscribedOwnInvalidator] :: PullSubscribed x a -> !Invalidator x [pullSubscribedParents] :: PullSubscribed x a -> ![SomeBehaviorSubscribed x] newtype SomeBehaviorSubscribed x SomeBehaviorSubscribed :: Some (BehaviorSubscribed x) -> SomeBehaviorSubscribed x data BehaviorSubscribed x a BehaviorSubscribedHold :: Hold x p -> BehaviorSubscribed x a BehaviorSubscribedPull :: PullSubscribed x a -> BehaviorSubscribed x a newtype BehaviorM x a BehaviorM :: ReaderIO (BehaviorEnv x) a -> BehaviorM x a [unBehaviorM] :: BehaviorM x a -> ReaderIO (BehaviorEnv x) a type BehaviorEnv x = (Maybe (Weak (Invalidator x), IORef [SomeBehaviorSubscribed x]), IORef [SomeHoldInit x]) class HasSpiderTimeline x -- | Retrieve the current SpiderTimelineEnv spiderTimeline :: HasSpiderTimeline x => SpiderTimelineEnv x class HasSpiderTimeline x => HasCurrentHeight x m | m -> x getCurrentHeight :: HasCurrentHeight x m => m Height scheduleMerge :: HasCurrentHeight x m => Height -> EventM x () -> m () class MonadIO m => Defer a m getDeferralQueue :: Defer a m => m (IORef [a]) data EventEnv x EventEnv :: !IORef [SomeAssignment x] -> !IORef [SomeHoldInit x] -> !IORef [SomeDynInit x] -> !IORef [SomeMergeUpdate x] -> !IORef [SomeMergeInit x] -> !IORef [Some Clear] -> !IORef [Some IntClear] -> !IORef [Some RootClear] -> !IORef Height -> !IORef [SomeResetCoincidence x] -> !IORef (IntMap [EventM x ()]) -> EventEnv x [eventEnvAssignments] :: EventEnv x -> !IORef [SomeAssignment x] [eventEnvHoldInits] :: EventEnv x -> !IORef [SomeHoldInit x] [eventEnvDynInits] :: EventEnv x -> !IORef [SomeDynInit x] [eventEnvMergeUpdates] :: EventEnv x -> !IORef [SomeMergeUpdate x] [eventEnvMergeInits] :: EventEnv x -> !IORef [SomeMergeInit x] [eventEnvClears] :: EventEnv x -> !IORef [Some Clear] [eventEnvIntClears] :: EventEnv x -> !IORef [Some IntClear] [eventEnvRootClears] :: EventEnv x -> !IORef [Some RootClear] [eventEnvCurrentHeight] :: EventEnv x -> !IORef Height [eventEnvResetCoincidences] :: EventEnv x -> !IORef [SomeResetCoincidence x] [eventEnvDelayedMerges] :: EventEnv x -> !IORef (IntMap [EventM x ()]) data SpiderTimelineEnv' x SpiderTimelineEnv :: {-# UNPACK #-} !MVar () -> {-# UNPACK #-} !EventEnv x -> SpiderTimelineEnv' x [_spiderTimeline_lock] :: SpiderTimelineEnv' x -> {-# UNPACK #-} !MVar () [_spiderTimeline_eventEnv] :: SpiderTimelineEnv' x -> {-# UNPACK #-} !EventEnv x -- | Stores all global data relevant to a particular Spider timeline; only -- one value should exist for each type x newtype SpiderTimelineEnv x STE :: SpiderTimelineEnv' x -> SpiderTimelineEnv x [unSTE] :: SpiderTimelineEnv x -> SpiderTimelineEnv' x -- | A statically allocated SpiderTimeline data Global data Hold x p Hold :: !IORef (PatchTarget p) -> !IORef [Weak (Invalidator x)] -> Event x p -> !IORef (Maybe (EventSubscription x)) -> Hold x p [holdValue] :: Hold x p -> !IORef (PatchTarget p) [holdInvalidators] :: Hold x p -> !IORef [Weak (Invalidator x)] [holdEvent] :: Hold x p -> Event x p [holdParent] :: Hold x p -> !IORef (Maybe (EventSubscription x)) data Dynamic x target p Dynamic :: !Behavior x target -> Event x p -> Dynamic x target p [dynamicCurrent] :: Dynamic x target p -> !Behavior x target [dynamicUpdated] :: Dynamic x target p -> Event x p type DynamicS x p = Dynamic x (PatchTarget p) p newtype Behavior x a Behavior :: BehaviorM x a -> Behavior x a [readBehaviorTracked] :: Behavior x a -> BehaviorM x a data EventSubscribed x EventSubscribed :: {-# UNPACK #-} !IORef Height -> {-# NOUNPACK #-} !Any -> EventSubscribed x [eventSubscribedHeightRef] :: EventSubscribed x -> {-# UNPACK #-} !IORef Height [eventSubscribedRetained] :: EventSubscribed x -> {-# NOUNPACK #-} !Any data Subscriber x a Subscriber :: !a -> EventM x () -> !Height -> IO () -> !Height -> IO () -> Subscriber x a [subscriberPropagate] :: Subscriber x a -> !a -> EventM x () [subscriberInvalidateHeight] :: Subscriber x a -> !Height -> IO () [subscriberRecalculateHeight] :: Subscriber x a -> !Height -> IO () data CacheSubscribed x a CacheSubscribed :: {-# UNPACK #-} !FastWeakBag (Subscriber x a) -> {-# UNPACK #-} !EventSubscription x -> {-# UNPACK #-} !IORef (Maybe a) -> CacheSubscribed x a [_cacheSubscribed_subscribers] :: CacheSubscribed x a -> {-# UNPACK #-} !FastWeakBag (Subscriber x a) [_cacheSubscribed_parent] :: CacheSubscribed x a -> {-# UNPACK #-} !EventSubscription x [_cacheSubscribed_occurrence] :: CacheSubscribed x a -> {-# UNPACK #-} !IORef (Maybe a) newtype Event x a Event :: (Subscriber x a -> EventM x (EventSubscription x, Maybe a)) -> Event x a [unEvent] :: Event x a -> Subscriber x a -> EventM x (EventSubscription x, Maybe a) data EventSubscription x EventSubscription :: !IO () -> {-# UNPACK #-} !EventSubscribed x -> EventSubscription x [_eventSubscription_unsubscribe] :: EventSubscription x -> !IO () [_eventSubscription_subscribed] :: EventSubscription x -> {-# UNPACK #-} !EventSubscribed x debugPropagate :: Bool debugInvalidateHeight :: Bool debugInvalidate :: Bool showNodeId :: a -> String unsubscribe :: EventSubscription x -> IO () subscribeAndRead :: Event x a -> Subscriber x a -> EventM x (EventSubscription x, Maybe a) -- | Construct an Event equivalent to that constructed by -- push, but with no caching; if the computation function is very -- cheap, this is (much) more efficient than push pushCheap :: (a -> ComputeM x (Maybe b)) -> Event x a -> Event x b -- | A subscriber that never triggers other Events terminalSubscriber :: (a -> EventM x ()) -> Subscriber x a -- | Subscribe to an Event only for the duration of one occurrence subscribeAndReadHead :: Event x a -> Subscriber x a -> EventM x (EventSubscription x, Maybe a) headE :: (MonadIO m, Defer (SomeMergeInit x) m) => Event x a -> m (Event x a) -- | Construct an Event whose value is guaranteed not to be -- recomputed repeatedly -- -- TODO: Try a caching strategy where we subscribe directly to the parent -- when there's only one subscriber, and then build our own FastWeakBag -- only when a second subscriber joins cacheEvent :: forall x a. HasSpiderTimeline x => Event x a -> Event x a subscribe :: Event x a -> Subscriber x a -> EventM x (EventSubscription x) wrap :: MonadIO m => (t -> EventSubscribed x) -> (Subscriber x a -> m (WeakBagTicket, t, Maybe a)) -> Subscriber x a -> m (EventSubscription x, Maybe a) eventRoot :: GCompare k => k a -> Root x k -> Event x a eventNever :: Event x a eventFan :: (GCompare k, HasSpiderTimeline x) => k a -> Fan x k v -> Event x (v a) eventSwitch :: HasSpiderTimeline x => Switch x a -> Event x a eventCoincidence :: HasSpiderTimeline x => Coincidence x a -> Event x a eventHold :: Hold x p -> Event x p eventDyn :: (HasSpiderTimeline x, Patch p) => Dyn x p -> Event x p subscribeCoincidenceInner :: HasSpiderTimeline x => Event x a -> Height -> CoincidenceSubscribed x a -> EventM x (Maybe a, Height, EventSubscribed x) newSubscriberHold :: (HasSpiderTimeline x, Patch p) => Hold x p -> IO (Subscriber x p) newSubscriberFan :: forall x k v. (HasSpiderTimeline x, GCompare k) => FanSubscribed x k v -> IO (Subscriber x (DMap k v)) newSubscriberSwitch :: forall x a. HasSpiderTimeline x => SwitchSubscribed x a -> IO (Subscriber x a) newSubscriberCoincidenceOuter :: forall x b. HasSpiderTimeline x => CoincidenceSubscribed x b -> IO (Subscriber x (Event x b)) newSubscriberCoincidenceInner :: forall x a. HasSpiderTimeline x => CoincidenceSubscribed x a -> IO (Subscriber x a) invalidateSubscriberHeight :: Height -> Subscriber x a -> IO () recalculateSubscriberHeight :: Height -> Subscriber x a -> IO () -- | Propagate everything at the current height propagate :: a -> WeakBag (Subscriber x a) -> EventM x () -- | Propagate everything at the current height propagateFast :: a -> FastWeakBag (Subscriber x a) -> EventM x () toAny :: a -> Any eventSubscribedRoot :: RootSubscribed x a -> EventSubscribed x eventSubscribedNever :: EventSubscribed x eventSubscribedFan :: FanSubscribed x k v -> EventSubscribed x eventSubscribedSwitch :: SwitchSubscribed x a -> EventSubscribed x eventSubscribedCoincidence :: CoincidenceSubscribed x a -> EventSubscribed x getEventSubscribedHeight :: EventSubscribed x -> IO Height subscribeHoldEvent :: Hold x p -> Subscriber x p -> EventM x (EventSubscription x, Maybe p) behaviorHold :: Hold x p -> Behavior x (PatchTarget p) behaviorHoldIdentity :: Hold x (Identity a) -> Behavior x a behaviorConst :: a -> Behavior x a behaviorPull :: Pull x a -> Behavior x a behaviorDyn :: Patch p => Dyn x p -> Behavior x (PatchTarget p) readHoldTracked :: Hold x p -> BehaviorM x (PatchTarget p) readBehaviorUntracked :: Defer (SomeHoldInit x) m => Behavior x a -> m a dynamicHold :: Hold x p -> DynamicS x p dynamicHoldIdentity :: Hold x (Identity a) -> DynamicS x (Identity a) dynamicConst :: PatchTarget p -> DynamicS x p dynamicDyn :: (HasSpiderTimeline x, Patch p) => Dyn x p -> DynamicS x p dynamicDynIdentity :: HasSpiderTimeline x => Dyn x (Identity a) -> DynamicS x (Identity a) globalSpiderTimelineEnv :: SpiderTimelineEnv Global runEventM :: EventM x a -> IO a asksEventEnv :: forall x a. HasSpiderTimeline x => (EventEnv x -> a) -> EventM x a defer :: Defer a m => a -> m () putCurrentHeight :: HasSpiderTimeline x => Height -> EventM x () scheduleClear :: Defer (Some Clear) m => IORef (Maybe a) -> m () scheduleIntClear :: Defer (Some IntClear) m => IORef (IntMap a) -> m () scheduleRootClear :: Defer (Some RootClear) m => IORef (DMap k Identity) -> m () hold :: (Patch p, Defer (SomeHoldInit x) m) => PatchTarget p -> Event x p -> m (Hold x p) getHoldEventSubscription :: forall p x. (HasSpiderTimeline x, Patch p) => Hold x p -> EventM x (EventSubscription x) heightBagEmpty :: HeightBag heightBagSize :: HeightBag -> Int heightBagFromList :: [Height] -> HeightBag heightBagAdd :: Height -> HeightBag -> HeightBag heightBagRemove :: Height -> HeightBag -> HeightBag heightBagMax :: HeightBag -> Height heightBagVerify :: HeightBag -> HeightBag newInvalidatorSwitch :: SwitchSubscribed x a -> IO (Invalidator x) newInvalidatorPull :: Pull x a -> IO (Invalidator x) newMapDyn :: HasSpiderTimeline x => (a -> b) -> DynamicS x (Identity a) -> DynamicS x (Identity b) zipDynWith :: HasSpiderTimeline x => (a -> b -> c) -> DynamicS x (Identity a) -> DynamicS x (Identity b) -> DynamicS x (Identity c) buildDynamic :: (Defer (SomeDynInit x) m, Patch p) => EventM x (PatchTarget p) -> Event x p -> m (Dyn x p) unsafeBuildDynamic :: BehaviorM x (PatchTarget p) -> Event x p -> Dyn x p push :: HasSpiderTimeline x => (a -> ComputeM x (Maybe b)) -> Event x a -> Event x b pull :: BehaviorM x a -> Behavior x a switch :: HasSpiderTimeline x => Behavior x (Event x a) -> Event x a coincidence :: HasSpiderTimeline x => Event x (Event x a) -> Event x a run :: forall x b. HasSpiderTimeline x => [DSum (RootTrigger x) Identity] -> ResultM x b -> SpiderHost x b scheduleMerge' :: HasSpiderTimeline x => Height -> IORef Height -> EventM x () -> EventM x () debugFinalize :: Bool mkWeakPtrWithDebug :: a -> String -> IO (Weak a) withIncreasedDepth :: m a -> m a tracePropagate :: CanTrace x m => proxy x -> String -> m () traceInvalidate :: String -> IO () traceWhen :: CanTrace x m => proxy x -> Bool -> String -> m () traceMWhen :: CanTrace x m => proxy x -> Bool -> m String -> m () whoCreatedIORef :: IORef a -> IO [String] propagateSubscriberHold :: forall x p. (HasSpiderTimeline x, Patch p) => Hold x p -> p -> EventM x () runBehaviorM :: BehaviorM x a -> Maybe (Weak (Invalidator x), IORef [SomeBehaviorSubscribed x]) -> IORef [SomeHoldInit x] -> IO a askInvalidator :: BehaviorM x (Maybe (Weak (Invalidator x))) askParentsRef :: BehaviorM x (Maybe (IORef [SomeBehaviorSubscribed x])) askBehaviorHoldInits :: BehaviorM x (IORef [SomeHoldInit x]) getDynHold :: (Defer (SomeHoldInit x) m, Patch p) => Dyn x p -> m (Hold x p) zeroRef :: IORef Height getRootSubscribed :: GCompare k => k a -> Root x k -> Subscriber x a -> IO (WeakBagTicket, RootSubscribed x a, Maybe a) cleanupRootSubscribed :: RootSubscribed x a -> IO () subscribeRootSubscribed :: RootSubscribed x a -> Subscriber x a -> IO WeakBagTicket newFanInt :: IO (FanInt x a) fanInt :: HasSpiderTimeline x => Event x (IntMap a) -> EventSelectorInt x a getFanSubscribed :: (HasSpiderTimeline x, GCompare k) => k a -> Fan x k v -> Subscriber x (v a) -> EventM x (WeakBagTicket, FanSubscribed x k v, Maybe (v a)) cleanupFanSubscribed :: GCompare k => (k a, FanSubscribed x k v) -> IO () subscribeFanSubscribed :: GCompare k => k a -> FanSubscribed x k v -> Subscriber x (v a) -> IO WeakBagTicket getSwitchSubscribed :: HasSpiderTimeline x => Switch x a -> Subscriber x a -> EventM x (WeakBagTicket, SwitchSubscribed x a, Maybe a) cleanupSwitchSubscribed :: SwitchSubscribed x a -> IO () subscribeSwitchSubscribed :: SwitchSubscribed x a -> Subscriber x a -> IO WeakBagTicket getCoincidenceSubscribed :: forall x a. HasSpiderTimeline x => Coincidence x a -> Subscriber x a -> EventM x (WeakBagTicket, CoincidenceSubscribed x a, Maybe a) cleanupCoincidenceSubscribed :: CoincidenceSubscribed x a -> IO () subscribeCoincidenceSubscribed :: CoincidenceSubscribed x a -> Subscriber x a -> IO WeakBagTicket mergeG :: forall k q x v. (HasSpiderTimeline x, GCompare k) => (forall a. q a -> Event x (v a)) -> DynamicS x (PatchDMap k q) -> Event x (DMap k v) mergeWithMove :: forall k v q x. (HasSpiderTimeline x, GCompare k) => (forall a. q a -> Event x (v a)) -> DynamicS x (PatchDMapWithMove k q) -> Event x (DMap k v) mergeCheap :: forall k x q v. (HasSpiderTimeline x, GCompare k) => (forall a. q a -> Event x (v a)) -> DynamicS x (PatchDMap k q) -> Event x (DMap k v) mergeCheapWithMove :: forall k x v q. (HasSpiderTimeline x, GCompare k) => (forall a. q a -> Event x (v a)) -> DynamicS x (PatchDMapWithMove k q) -> Event x (DMap k v) invalidateMergeHeight :: Merge x k v s -> IO () invalidateMergeHeight' :: IORef Height -> Subscriber x a -> IO () revalidateMergeHeight :: Merge x k v s -> IO () scheduleMergeSelf :: HasSpiderTimeline x => Merge x k v s -> Height -> EventM x () mergeSubscriber :: forall x k v s a. (HasSpiderTimeline x, GCompare k) => Merge x k v s -> EventM x (k a) -> Subscriber x (v a) updateMerge :: (HasSpiderTimeline x, GCompare k) => Merge x k v s -> MergeUpdateFunc k v x p s -> p -> SomeMergeUpdate x mergeGCheap' :: forall k v x p s q. (HasSpiderTimeline x, GCompare k, PatchTarget p ~ DMap k q) => MergeInitFunc k v q x s -> MergeUpdateFunc k v x p s -> MergeDestroyFunc k s -> DynamicS x p -> Event x (DMap k v) mergeInt :: forall x a. HasSpiderTimeline x => DynamicS x (PatchIntMap (Event x a)) -> Event x (IntMap a) mergeIntCheap :: forall x a. HasSpiderTimeline x => DynamicS x (PatchIntMap (Event x a)) -> Event x (IntMap a) fanG :: (HasSpiderTimeline x, GCompare k) => Event x (DMap k v) -> EventSelectorG x k v runHoldInits :: HasSpiderTimeline x => IORef [SomeHoldInit x] -> IORef [SomeDynInit x] -> IORef [SomeMergeInit x] -> EventM x () initHold :: HasSpiderTimeline x => SomeHoldInit x -> EventM x () initDyn :: HasSpiderTimeline x => SomeDynInit x -> EventM x () newEventEnv :: IO (EventEnv x) clearEventEnv :: EventEnv x -> IO () -- | Run an event action outside of a frame runFrame :: forall x a. HasSpiderTimeline x => EventM x a -> SpiderHost x a zeroHeight :: Height invalidHeight :: Height succHeight :: Height -> Height invalidateCoincidenceHeight :: CoincidenceSubscribed x a -> IO () updateSwitchHeight :: Height -> SwitchSubscribed x a -> IO () recalculateCoincidenceHeight :: CoincidenceSubscribed x a -> IO () calculateSwitchHeight :: SwitchSubscribed x a -> IO Height calculateCoincidenceHeight :: CoincidenceSubscribed x a -> IO Height invalidate :: IORef [SomeSwitchSubscribed x] -> WeakList (Invalidator x) -> IO (WeakList (Invalidator x)) newJoinDyn :: HasSpiderTimeline x => DynamicS x (Identity (DynamicS x (Identity a))) -> Dyn x (Identity a) mapDynamicSpider :: HasSpiderTimeline x => (a -> b) -> Dynamic (SpiderTimeline x) a -> Dynamic (SpiderTimeline x) b holdSpiderEventM :: HasSpiderTimeline x => a -> Event (SpiderTimeline x) a -> EventM x (Behavior (SpiderTimeline x) a) holdDynSpiderEventM :: HasSpiderTimeline x => a -> Event (SpiderTimeline x) a -> EventM x (Dynamic (SpiderTimeline x) a) holdIncrementalSpiderEventM :: (HasSpiderTimeline x, Patch p) => PatchTarget p -> Event (SpiderTimeline x) p -> EventM x (Incremental (SpiderTimeline x) p) buildDynamicSpiderEventM :: HasSpiderTimeline x => SpiderPushM x a -> Event (SpiderTimeline x) a -> EventM x (Dynamic (SpiderTimeline x) a) unsafeNewSpiderTimelineEnv :: forall x. IO (SpiderTimelineEnv x) -- | Create a new SpiderTimelineEnv newSpiderTimeline :: IO (Some SpiderTimelineEnv) localSpiderTimeline :: proxy s -> SpiderTimelineEnv x -> SpiderTimelineEnv (LocalSpiderTimeline x s) -- | Pass a new timeline to the given function. withSpiderTimeline :: (forall x. HasSpiderTimeline x => SpiderTimelineEnv x -> IO r) -> IO r -- | Run an action affecting the global Spider timeline; this will be -- guarded by a mutex for that timeline runSpiderHost :: SpiderHost Global a -> IO a -- | Run an action affecting a given Spider timeline; this will be guarded -- by a mutex for that timeline runSpiderHostForTimeline :: SpiderHost x a -> SpiderTimelineEnv x -> IO a newEventWithTriggerIO :: (RootTrigger x a -> IO (IO ())) -> IO (Event x a) newFanEventWithTriggerIO :: GCompare k => (forall a. k a -> RootTrigger x a -> IO (IO ())) -> IO (EventSelector x k) instance forall k (x :: k). Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.ReadPhase x) instance forall k (x :: k). GHC.Base.Monad (Reflex.Spider.Internal.ReadPhase x) instance forall k (x :: k). GHC.Base.Applicative (Reflex.Spider.Internal.ReadPhase x) instance forall k (x :: k). GHC.Base.Functor (Reflex.Spider.Internal.ReadPhase x) instance Control.Monad.Exception.MonadAsyncException (Reflex.Spider.Internal.SpiderHostFrame x) instance Control.Monad.Exception.MonadException (Reflex.Spider.Internal.SpiderHostFrame x) instance Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.SpiderHostFrame x) instance Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.SpiderHostFrame x) instance GHC.Base.Applicative (Reflex.Spider.Internal.SpiderHostFrame x) instance GHC.Base.Functor (Reflex.Spider.Internal.SpiderHostFrame x) instance Control.Monad.Exception.MonadAsyncException (Reflex.Spider.Internal.SpiderHost x) instance Control.Monad.Exception.MonadException (Reflex.Spider.Internal.SpiderHost x) instance Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.SpiderHost x) instance Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.SpiderHost x) instance GHC.Base.Applicative (Reflex.Spider.Internal.SpiderHost x) instance GHC.Base.Functor (Reflex.Spider.Internal.SpiderHost x) instance Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.SpiderPushM x) instance Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.SpiderPushM x) instance GHC.Base.Monad (Reflex.Spider.Internal.SpiderPushM x) instance GHC.Base.Applicative (Reflex.Spider.Internal.SpiderPushM x) instance GHC.Base.Functor (Reflex.Spider.Internal.SpiderPushM x) instance Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.SpiderPullM x) instance Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.SpiderPullM x) instance GHC.Base.Monad (Reflex.Spider.Internal.SpiderPullM x) instance GHC.Base.Applicative (Reflex.Spider.Internal.SpiderPullM x) instance GHC.Base.Functor (Reflex.Spider.Internal.SpiderPullM x) instance forall k (x :: k). Control.Monad.Reader.Class.MonadReader (Reflex.Spider.Internal.BehaviorEnv x) (Reflex.Spider.Internal.BehaviorM x) instance forall k (x :: k). Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.BehaviorM x) instance forall k (x :: k). Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.BehaviorM x) instance forall k (x :: k). GHC.Base.Applicative (Reflex.Spider.Internal.BehaviorM x) instance forall k (x :: k). GHC.Base.Functor (Reflex.Spider.Internal.BehaviorM x) instance GHC.Enum.Bounded Reflex.Spider.Internal.Height instance GHC.Classes.Ord Reflex.Spider.Internal.Height instance GHC.Classes.Eq Reflex.Spider.Internal.Height instance GHC.Read.Read Reflex.Spider.Internal.Height instance GHC.Show.Show Reflex.Spider.Internal.Height instance GHC.Classes.Ord Reflex.Spider.Internal.HeightBag instance GHC.Classes.Eq Reflex.Spider.Internal.HeightBag instance GHC.Read.Read Reflex.Spider.Internal.HeightBag instance GHC.Show.Show Reflex.Spider.Internal.HeightBag instance forall k (x :: k). Control.Monad.Exception.MonadAsyncException (Reflex.Spider.Internal.EventM x) instance forall k (x :: k). Control.Monad.Exception.MonadException (Reflex.Spider.Internal.EventM x) instance forall k (x :: k). Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.EventM x) instance forall k (x :: k). Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.EventM x) instance forall k (x :: k). GHC.Base.Monad (Reflex.Spider.Internal.EventM x) instance forall k (x :: k). GHC.Base.Applicative (Reflex.Spider.Internal.EventM x) instance forall k (x :: k). GHC.Base.Functor (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => GHC.Base.Functor (Reflex.Spider.Internal.Dynamic x target) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadSample (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.ReadPhase x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadHold (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.ReadPhase x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Host.Class.MonadReadEvent (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.ReadPhase x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Host.Class.MonadReflexHost (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHost x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadHold (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHost x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadSample (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHostFrame x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadHold (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHostFrame x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Host.Class.MonadSubscribeEvent (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHostFrame x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Host.Class.ReflexHost (Reflex.Spider.Internal.SpiderTimeline x) instance Reflex.Host.Class.MonadReflexCreateTrigger (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHostFrame x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Host.Class.MonadSubscribeEvent (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHost x) instance GHC.Base.Monad (Reflex.Spider.Internal.SpiderHostFrame x) instance Reflex.NotReady.Class.NotReady (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHostFrame x) instance Control.Monad.Ref.MonadRef (Reflex.Spider.Internal.SpiderHostFrame x) instance Control.Monad.Ref.MonadAtomicRef (Reflex.Spider.Internal.SpiderHostFrame x) instance Control.Monad.Primitive.PrimMonad (Reflex.Spider.Internal.SpiderHostFrame x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadSample (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHost x) instance Reflex.Host.Class.MonadReflexCreateTrigger (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHost x) instance GHC.Base.Monad (Reflex.Spider.Internal.SpiderHost x) instance Control.Monad.Ref.MonadRef (Reflex.Spider.Internal.SpiderHost x) instance Control.Monad.Ref.MonadAtomicRef (Reflex.Spider.Internal.SpiderHost x) instance Reflex.NotReady.Class.NotReady (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHost x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.NotReady.Class.NotReady (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.PerformEvent.Base.PerformEventT (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderHost x)) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadSample (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderPushM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadHold (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderPushM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.Reflex (Reflex.Spider.Internal.SpiderTimeline x) instance Reflex.Class.MonadSample (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.SpiderPullM x) instance forall k (s :: k) x. Data.Reflection.Reifies s (Reflex.Spider.Internal.SpiderTimelineEnv x) => Reflex.Spider.Internal.HasSpiderTimeline (Reflex.Spider.Internal.LocalSpiderTimeline x s) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadSample (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Class.MonadHold (Reflex.Spider.Internal.SpiderTimeline x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => GHC.Base.Monad (Reflex.Class.Dynamic (Reflex.Spider.Internal.SpiderTimeline x)) instance Reflex.Spider.Internal.HasSpiderTimeline x => GHC.Base.Functor (Reflex.Class.Dynamic (Reflex.Spider.Internal.SpiderTimeline x)) instance Reflex.Spider.Internal.HasSpiderTimeline x => GHC.Base.Applicative (Reflex.Class.Dynamic (Reflex.Spider.Internal.SpiderTimeline x)) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.HasCurrentHeight x (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeAssignment x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeHoldInit x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeDynInit x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeMergeUpdate x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeMergeInit x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline Reflex.Spider.Internal.Global instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Data.Some.Some Reflex.Spider.Internal.Clear) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Data.Some.Some Reflex.Spider.Internal.IntClear) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Data.Some.Some Reflex.Spider.Internal.RootClear) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeResetCoincidence x) (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Data.Witherable.Filterable (Reflex.Spider.Internal.Event x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Data.Semialign.Internal.Align (Reflex.Spider.Internal.Event x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Data.Semialign.Internal.Semialign (Reflex.Spider.Internal.Event x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Data.Semialign.Internal.Zip (Reflex.Spider.Internal.Event x) instance Reflex.Spider.Internal.HasSpiderTimeline x => GHC.Base.Functor (Reflex.Spider.Internal.Event x) instance GHC.Classes.Eq (Reflex.Spider.Internal.SpiderTimelineEnv x) instance Data.GADT.Compare.GEq Reflex.Spider.Internal.SpiderTimelineEnv instance forall k (x :: k). Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeHoldInit x) (Reflex.Spider.Internal.BehaviorM x) instance forall k (x :: k). GHC.Base.Monad (Reflex.Spider.Internal.BehaviorM x) instance forall k (x :: k). GHC.Base.Functor (Reflex.Spider.Internal.Behavior x) instance forall k (x :: k). Control.Monad.Ref.MonadRef (Reflex.Spider.Internal.EventM x) instance forall k (x :: k). Control.Monad.Ref.MonadAtomicRef (Reflex.Spider.Internal.EventM x) module Reflex.Spider -- | The default, global Spider environment type Spider = SpiderTimeline Global -- | Designates the default, global Spider timeline data SpiderTimeline x -- | A statically allocated SpiderTimeline data Global -- | The monad for actions that manipulate a Spider timeline identified by -- x data SpiderHost (x :: Type) a -- | Run an action affecting the global Spider timeline; this will be -- guarded by a mutex for that timeline runSpiderHost :: SpiderHost Global a -> IO a -- | Run an action affecting a given Spider timeline; this will be guarded -- by a mutex for that timeline runSpiderHostForTimeline :: SpiderHost x a -> SpiderTimelineEnv x -> IO a -- | Create a new SpiderTimelineEnv newSpiderTimeline :: IO (Some SpiderTimelineEnv) -- | Pass a new timeline to the given function. withSpiderTimeline :: (forall x. HasSpiderTimeline x => SpiderTimelineEnv x -> IO r) -> IO r -- | SpiderEnv is the old name for SpiderTimeline -- | Deprecated: Use SpiderTimelineEnv instead type SpiderEnv = SpiderTimeline module Reflex.Network -- | A Dynamic "network": Takes a Dynamic of network-creating -- actions and replaces the network whenever the Dynamic updates. -- The returned Event of network results fires at post-build time and -- when the Dynamic updates. Note: Often, the type a is -- an Event, in which case the return value is an Event-of-Events, where -- the outer Event fires when switching networks. Such an -- Event would typically be flattened (via switchPromptly). networkView :: (NotReady t m, Adjustable t m, PostBuild t m) => Dynamic t (m a) -> m (Event t a) -- | Given an initial "network" and an Event of network-creating -- actions, create a network that is recreated whenever the Event fires. -- The returned Dynamic of network results occurs when the Event does. -- Note: Often, the type a is an Event, in which case the return -- value is a Dynamic-of-Events that would typically be flattened. networkHold :: (Adjustable t m, MonadHold t m) => m a -> Event t (m a) -> m (Dynamic t a) -- | Render a placeholder network to be shown while another network is not -- yet done building untilReady :: (Adjustable t m, PostBuild t m) => m a -> m b -> m (a, Event t b) -- | This module exports all of the commonly-used functionality of Reflex; -- if you are just getting started with Reflex, this is probably what you -- want. module Reflex module Reflex.Widget.Basic -- | Build sortable content in such a way that re-sorting it can cause -- minimal disruption to an existing context. -- -- Naively re-sorting a list of images would destroy every image and add -- them back in the new order. This framework is able to avoid that by -- preserving the identity of each image and simply moving it to the new -- location. -- -- Example: -- --
-- let sortByFst = buttonA $> comparing fst -- sortBySnd = buttonB $> comparing snd -- sortEvent = leftmost [sortByFst, sortBySnd] -- sortableList -- (\k v -> text $ "\n" ++ show k ++ " " ++ v) -- show each element on a new line -- (Map.fromList $ zip [0..] [(3, "a"), (2, "b"), (1, "c")]) -- sortEvent --sortableList :: forall t m k v a. (MonadHold t m, MonadFix m, Adjustable t m, Ord k) => (k -> v -> m a) -> Map k v -> Event t (v -> v -> Ordering) -> m (Map k a) module Reflex.Workflow -- | A widget in a workflow When the Event returned by a -- Workflow fires, the current Workflow is replaced by the -- one inside the firing Event. A series of Workflows must -- share the same return type. newtype Workflow t m a Workflow :: m (a, Event t (Workflow t m a)) -> Workflow t m a [unWorkflow] :: Workflow t m a -> m (a, Event t (Workflow t m a)) -- | Runs a Workflow and returns the Dynamic result of the -- Workflow (i.e., a Dynamic of the value produced by the -- current Workflow node, and whose update Event fires -- whenever one Workflow is replaced by another). workflow :: forall t m a. (Reflex t, Adjustable t m, MonadFix m, MonadHold t m) => Workflow t m a -> m (Dynamic t a) -- | Similar to workflow, but outputs an Event that fires at -- post-build time and whenever the current Workflow is replaced -- by the next Workflow. workflowView :: forall t m a. (Reflex t, NotReady t m, Adjustable t m, MonadFix m, MonadHold t m, PostBuild t m) => Workflow t m a -> m (Event t a) -- | Map a function over a Workflow, possibly changing the return -- type. mapWorkflow :: (Reflex t, Functor m) => (a -> b) -> Workflow t m a -> Workflow t m b -- | Map a "cheap" function over a Workflow. Refer to the -- documentation for pushCheap for more information and -- performance considerations. mapWorkflowCheap :: (Reflex t, Functor m) => (a -> b) -> Workflow t m a -> Workflow t m b