-- 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.5 -- | 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) -- | 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 () _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 -- | Run the actions contained in the DMap -- | Deprecated: Use 'Data.Dependent.Map.traverseWithKey (_ -> fmap -- Identity)' instead sequenceDmap :: Applicative t => DMap f t -> t (DMap f Identity) -- | Replace the Identity functor for a DMap's values with -- a different functor -- | Deprecated: Use 'Data.Dependent.Map.map (f . runIdentity)' -- instead wrapDMap :: (forall a. a -> f a) -> DMap k Identity -> DMap k f -- | Replace one functor for a DMap's values with a different -- functor -- | Deprecated: Use map instead rewrapDMap :: (forall (a :: *). f a -> g a) -> DMap k f -> DMap k g -- | Replace one functor for a DMap's values with the -- Identity functor -- | Deprecated: Use 'Data.Dependent.Map.map (Identity . f)' instead unwrapDMap :: (forall a. f a -> a) -> DMap k f -> DMap k Identity -- | Like unwrapDMap, but possibly delete some values from the DMap -- | Deprecated: Use 'Data.Dependent.Map.mapMaybeWithKey (_ a -> fmap -- Identity $ f a)' instead unwrapDMapMaybe :: GCompare k => (forall a. f a -> Maybe a) -> DMap k f -> DMap k Identity -- | Eliminate the Identity functor in a DMap and replace it -- with the underlying functor -- | Deprecated: Use 'mapKeyValuePairsMonotonic ((Const2 k :=> -- Identity v) -> Const2 k :=> v)' instead extractFunctorDMap :: DMap (Const2 k (f v)) Identity -> DMap (Const2 k v) f -- | 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 (GHC.Show.Show l, GHC.Show.Show r) => Data.Dependent.Sum.ShowTag (Data.Functor.Misc.EitherTag l r) Data.Functor.Identity.Identity 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 (f :: k1 -> *) (v :: k1). (GHC.Show.Show k2, GHC.Show.Show (f v)) => Data.Dependent.Sum.ShowTag (Data.Functor.Misc.Const2 k2 v) f 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 -- | 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)) -- | FastWeak is a weak pointer to some value, and -- FastWeakTicket ensures the value referred to by a -- FastWeak stays live while the ticket is held (live). -- -- On GHC or GHCJS when not built with the fast-weak cabal flag, -- FastWeak is a wrapper around the simple version of Weak -- where the key and value are the same. -- -- On GHCJS when built with the fast-weak cabal flag, -- FastWeak is implemented directly in JS using -- h$FastWeak and h$FastWeakTicket which are a -- nonstandard part of the GHCJS RTS. 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 -- | This module defines the FunctorMaybe class, which extends Functors -- with the ability to delete values. module Reflex.FunctorMaybe -- | A class for values that combines filtering and mapping using -- Maybe. Morally, FunctorMaybe ~ KleisliFunctor -- Maybe. Also similar is the Witherable typeclass, -- but it requires Foldable f and Traverable f, and -- e.g. Event is instance of neither. -- -- A definition of fmapMaybe must satisfy the following laws: -- -- class FunctorMaybe f -- | Combined mapping and filtering function. fmapMaybe :: FunctorMaybe f => (a -> Maybe b) -> f a -> f b 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 data FastMutableIntMap a new :: IntMap a -> IO (FastMutableIntMap a) newEmpty :: IO (FastMutableIntMap a) insert :: FastMutableIntMap a -> Int -> a -> IO () isEmpty :: FastMutableIntMap a -> IO Bool -- | Make an immutable snapshot of the datastructure and clear it getFrozenAndClear :: FastMutableIntMap a -> IO (IntMap a) size :: FastMutableIntMap a -> IO Int 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) lookup :: FastMutableIntMap a -> Int -> IO (Maybe a) forIntersectionWithImmutable_ :: MonadIO m => FastMutableIntMap a -> IntMap b -> (a -> b -> m ()) -> m () 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: -- -- newtype PatchDMapWithMove k v PatchDMapWithMove :: DMap k (NodeInfo k v) -> PatchDMapWithMove k v -- | Structure which represents what changes apply to a particular key. -- _nodeInfo_from specifies what happens to this key, and in -- particular what other key the current key is moving from, while -- _nodeInfo_to specifies what key the current key is moving to -- if involved in a move. data NodeInfo k v a NodeInfo :: !From k v a -> !To k a -> NodeInfo k v a -- | Change applying to the current key, be it an insert, move, or delete. [_nodeInfo_from] :: NodeInfo k v a -> !From k v a -- | Where this key is moving to, if involved in a move. Should only be -- ComposeMaybe (Just k) when there is a corresponding -- From_Move. [_nodeInfo_to] :: NodeInfo k v a -> !To k a -- | Structure describing a particular change to a key, be it inserting a -- new key (From_Insert), updating an existing key -- (From_Insert again), deleting a key (From_Delete), -- or moving a key (From_Move). data From (k :: a -> *) (v :: a -> *) :: a -> * -- | Insert a new or update an existing key with the given value v -- a [From_Insert] :: v a -> From k v a -- | Delete the existing key [From_Delete] :: From k v a -- | Move the value from the given key k a to this key. The source -- key should also have an entry in the patch giving the current key as -- _nodeInfo_to, usually but not necessarily with -- From_Delete. [From_Move] :: !k a -> From k v a -- | Type alias for the "to" part of a NodeInfo. -- ComposeMaybe (Just k) means the key is moving -- to another key, ComposeMaybe Nothing for any other operation. type To = ComposeMaybe -- | Test whether a PatchDMapWithMove satisfies its invariants. validPatchDMapWithMove :: forall k v. (GCompare k, GShow k) => DMap k (NodeInfo k v) -> Bool -- | Enumerate what reasons a PatchDMapWithMove doesn't satisfy its -- invariants, returning [] if it's valid. validationErrorsForPatchDMapWithMove :: forall k v. (GCompare k, GShow k) => DMap k (NodeInfo k v) -> [String] -- | Higher kinded 2-tuple, identical to Data.Functor.Product from -- base ≥ 4.9 data Pair1 f g a Pair1 :: f a -> g a -> Pair1 f g a -- | Helper data structure used for composing patches using the monoid -- instance. data Fixup k v a Fixup_Delete :: Fixup k v a Fixup_Update :: These (From k v a) (To k a) -> Fixup k v a -- | Make a PatchDMapWithMove k v which has the effect of -- inserting or updating a value v a to the given key k -- a, like insert. insertDMapKey :: k a -> v a -> PatchDMapWithMove k v -- | Make a PatchDMapWithMove k v which has the effect of -- moving the value from the first key k a to the second key -- k a, equivalent to: -- --
--   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.Dependent.Sum.EqTag 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) -- | This module defines the Patch class, which is used by Reflex to -- manage changes to Incremental values. 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: -- -- data 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 -- | 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' -- | 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') -- | 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' instance Reflex.Patch.Additive p => Reflex.Patch.Class.Patch (Reflex.Patch.AdditivePatch p) -- | This module contains the Reflex interface, as well as a variety of -- convenience functions for working with Events, -- Behaviors, and other signals. module Reflex.Class -- | The Reflex class contains all the primitive functionality -- needed for Functional Reactive Programming (FRP). The -- t type parameter indicates which "timeline" is in use. -- Timelines are fully-independent FRP contexts, and the type of the -- timeline determines the FRP engine to be used. For most purposes, the -- Spider implementation is recommended. class (MonadHold t (PushM t), MonadSample t (PullM t), MonadFix (PushM t), Functor (Dynamic t), Applicative (Dynamic t), Monad (Dynamic t)) => Reflex t where { -- | 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 :: * -> *; -- | A monad for doing complex push-based calculations efficiently type family PushM t :: * -> *; -- | A monad for doing complex pull-based calculations efficiently type family PullM t :: * -> *; } -- | An Event with no occurrences never :: Reflex t => Event t a -- | Create a Behavior that always has the given value constant :: Reflex t => a -> Behavior t a -- | Create an Event from another Event; the provided -- function can sample Behaviors and hold Events, and use -- the results to produce a occurring (Just) or non-occurring (Nothing) -- result push :: Reflex t => (a -> PushM t (Maybe b)) -> Event t a -> Event t b -- | Like push but intended for functions that the implementation -- can consider cheap to compute for performance considerations. WARNING: -- The function passed to pushCheap may be run multiple times -- without any caching. pushCheap :: Reflex t => (a -> PushM t (Maybe b)) -> Event t a -> Event t b -- | Create a Behavior by reading from other Behaviors; the -- result will be recomputed whenever any of the read Behaviors -- changes pull :: Reflex t => PullM t a -> Behavior t a -- | Merge a collection of events; the resulting Event will only -- occur if at least one input event is occurring, and will contain all -- of the input keys that are occurring simultaneously merge :: (Reflex t, GCompare k) => DMap k (Event t) -> Event t (DMap k Identity) -- | Efficiently fan-out an event to many destinations. This function -- should be partially applied, and then the result applied repeatedly to -- create child events fan :: (Reflex t, GCompare k) => Event t (DMap k Identity) -> EventSelector t k -- | Create an Event that will occur whenever the currently-selected -- input Event occurs switch :: Reflex t => Behavior t (Event t a) -> Event t a -- | Create an Event that will occur whenever the input event is -- occurring and its occurrence value, another Event, is also -- occurring coincidence :: Reflex t => Event t (Event t a) -> Event t a -- | 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 new Dynamic. The given PullM must always return -- the most recent firing of the given Event, if any. unsafeBuildDynamic :: Reflex t => PullM t a -> Event t a -> Dynamic t a -- | Create a new Incremental. The given PullM's value must -- always change in the same way that the accumulated application of -- patches would change that value. unsafeBuildIncremental :: (Reflex t, Patch p) => PullM t (PatchTarget p) -> Event t p -> Incremental t p -- | Create a merge whose parents can change over time mergeIncremental :: (Reflex t, GCompare k) => Incremental t (PatchDMap k (Event t)) -> Event t (DMap k Identity) -- | Experimental: Create a merge whose parents can change over time; -- changing the key of an Event is more efficient than with -- mergeIncremental mergeIncrementalWithMove :: (Reflex t, GCompare k) => Incremental t (PatchDMapWithMove k (Event t)) -> Event t (DMap k Identity) -- | Extract the Behavior component of an Incremental currentIncremental :: (Reflex t, Patch p) => Incremental t p -> Behavior t (PatchTarget p) -- | Extract the Event component of an Incremental updatedIncremental :: (Reflex t, Patch p) => Incremental t p -> Event t p -- | Convert an Incremental to a Dynamic incrementalToDynamic :: (Reflex t, Patch p) => Incremental t p -> Dynamic t (PatchTarget p) -- | Construct a Coercion for a Behavior given an -- Coercion for its occurrence type behaviorCoercion :: Reflex t => Coercion a b -> Coercion (Behavior t a) (Behavior t b) -- | Construct a Coercion for an Event given an -- Coercion for its occurrence type eventCoercion :: Reflex t => Coercion a b -> Coercion (Event t a) (Event t b) -- | Construct a Coercion for a Dynamic given an -- Coercion for its occurrence type dynamicCoercion :: Reflex t => Coercion a b -> Coercion (Dynamic t a) (Dynamic t b) mergeIntIncremental :: Reflex t => Incremental t (PatchIntMap (Event t a)) -> Event t (IntMap a) fanInt :: Reflex t => Event t (IntMap a) -> EventSelectorInt t a mergeInt :: Reflex t => IntMap (Event t a) -> Event t (IntMap a) -- | Coerce a Behavior between representationally-equivalent value -- types coerceBehavior :: (Reflex t, Coercible a b) => Behavior t a -> Behavior t b -- | Coerce an Event between representationally-equivalent -- occurrence types coerceEvent :: (Reflex t, Coercible a b) => Event t a -> Event t b -- | Coerce a Dynamic between representationally-equivalent value -- types coerceDynamic :: (Reflex t, Coercible a b) => Dynamic t a -> Dynamic t b -- | MonadSample designates monads that can read the current value -- of a Behavior. This includes both PullM and -- PushM. class (Applicative m, Monad m) => MonadSample t m | m -> t -- | Get the current value in the Behavior sample :: MonadSample t m => Behavior t a -> m a -- | MonadHold designates monads that can create new -- Behaviors based on Events; usually this will be -- PushM or a monad based on it. MonadHold is required to -- create any stateful computations with Reflex. class MonadSample t m => MonadHold t m -- | Create a new Behavior whose value will initially be equal to -- the given value and will be updated whenever the given Event -- occurs. The update takes effect immediately after the Event -- occurs; if the occurrence that sets the Behavior (or one that -- is simultaneous with it) is used to sample the Behavior, it -- will see the old value of the Behavior, not the new one. hold :: MonadHold t m => a -> Event t a -> m (Behavior t a) -- | Create a new Behavior whose value will initially be equal to -- the given value and will be updated whenever the given Event -- occurs. The update takes effect immediately after the Event -- occurs; if the occurrence that sets the Behavior (or one that -- is simultaneous with it) is used to sample the Behavior, it -- will see the old value of the Behavior, not the new one. hold :: (MonadHold t m, m ~ f m', MonadTrans f, MonadHold t m') => a -> Event t a -> m (Behavior 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) -- | Create a Dynamic value using the given initial value that -- changes every time the Event occurs. holdDyn :: (MonadHold t m, m ~ f m', MonadTrans f, MonadHold t m') => a -> Event t a -> m (Dynamic t a) -- | Create an Incremental value using the given initial value that -- changes every time the Event occurs. holdIncremental :: (MonadHold t m, Patch p) => PatchTarget p -> Event t p -> m (Incremental t p) -- | Create an Incremental value using the given initial value that -- changes every time the Event occurs. holdIncremental :: (MonadHold t m, Patch p, m ~ f m', MonadTrans f, MonadHold t m') => PatchTarget p -> Event t p -> m (Incremental t p) buildDynamic :: MonadHold t m => PushM t a -> Event t a -> m (Dynamic t a) -- | Create a new Event that only occurs only once, on the first -- occurrence of the supplied Event. headE :: MonadHold t m => Event t a -> m (Event t a) -- | An EventSelector allows you to efficiently select an -- Event based on a key. This is much more efficient than -- filtering for each key with fmapMaybe. newtype EventSelector t k EventSelector :: (forall a. k a -> Event t a) -> EventSelector t k -- | Retrieve the Event for the given key. The type of the -- Event is determined by the type of the key, so this can be used -- to fan-out Events whose sub-Events have different types. -- -- Using EventSelectors and the fan primitive is far more -- efficient than (but equivalent to) using fmapMaybe to select -- only the relevant occurrences of an Event. [select] :: EventSelector t k -> forall a. k a -> Event t a newtype EventSelectorInt t a EventSelectorInt :: (Int -> Event t a) -> EventSelectorInt t a [selectInt] :: EventSelectorInt t a -> Int -> Event t a -- | Construct a Dynamic value that never changes constDyn :: Reflex t => a -> Dynamic t a -- | Create an Event from another Event. The provided -- function can sample Behaviors and hold Events. pushAlways :: Reflex t => (a -> PushM t b) -> Event t a -> Event t b -- | Create a new Event that occurs if at least one of the -- Events in the list occurs. If multiple occur at the same time -- the value is the value of the leftmost event. leftmost :: Reflex t => [Event t a] -> Event t a -- | Create a new Event combining the map of Events into an -- Event that occurs if at least one of them occurs and has a map -- of values of all Events occurring at that time. mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a) -- | Like mergeMap but for IntMap. mergeIntMap :: Reflex t => IntMap (Event t a) -> Event t (IntMap a) -- | Create a merge whose parents can change over time mergeMapIncremental :: (Reflex t, Ord k) => Incremental t (PatchMap k (Event t a)) -> Event t (Map k a) -- | Experimental: Create a merge whose parents can change over time; -- changing the key of an Event is more efficient than with -- mergeIncremental mergeMapIncrementalWithMove :: (Reflex t, Ord k) => Incremental t (PatchMapWithMove k (Event t a)) -> Event t (Map k a) -- | Create a merge whose parents can change over time mergeIntMapIncremental :: Reflex t => Incremental t (PatchIntMap (Event t a)) -> Event t (IntMap a) -- | When the given outer event fires, condense the inner events into the -- contained patch. Non-firing inner events will be replaced with -- deletions. coincidencePatchMap :: (Reflex t, Ord k) => Event t (PatchMap k (Event t v)) -> Event t (PatchMap k v) -- | See coincidencePatchMap coincidencePatchMapWithMove :: (Reflex t, Ord k) => Event t (PatchMapWithMove k (Event t v)) -> Event t (PatchMapWithMove k v) -- | See coincidencePatchMap coincidencePatchIntMap :: Reflex t => Event t (PatchIntMap (Event t v)) -> Event t (PatchIntMap v) -- | Create a new Event that occurs if at least one of the -- Events in the list occurs and has a list of the values of all -- Events occurring at that time. mergeList :: Reflex t => [Event t a] -> Event t (NonEmpty a) -- | Create a new Event that occurs if at least one of the -- Events in the list occurs. If multiple occur at the same time -- they are folded from the left with the given function. mergeWith :: Reflex t => (a -> a -> a) -> [Event t a] -> Event t a -- | Create a new Event that occurs when the first supplied -- Event occurs unless the second supplied Event occurs -- simultaneously. difference :: Reflex t => Event t a -> Event t b -> Event t a alignEventWithMaybe :: Reflex t => (These a b -> Maybe c) -> Event t a -> Event t b -> Event t c -- | Split the supplied Event into two individual Events -- occurring at the same time with the respective values from the tuple. splitE :: Reflex t => Event t (a, b) -> (Event t a, Event t b) -- | Split the event into separate events for Left and Right -- values. fanEither :: Reflex t => Event t (Either a b) -> (Event t a, Event t b) -- | Split the event into separate events for This and That -- values, allowing them to fire simultaneously when the input value is -- These. fanThese :: Reflex t => Event t (These a b) -> (Event t a, Event t b) -- | Split the event into an EventSelector that allows efficient -- selection of the individual Events. fanMap :: (Reflex t, Ord k) => Event t (Map k a) -> EventSelector t (Const2 k a) -- | Extract the values of a DMap of EitherTags. dmapToThese :: DMap (EitherTag a b) Identity -> Maybe (These a b) -- | 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 -- | 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 factorEvent :: forall t m k v a. (Reflex t, MonadFix m, MonadHold t m, GEq k) => k a -> Event t (DSum k v) -> m (Event t (v a), Event t (DSum k (Product v (Compose (Event t) v)))) filterEventKey :: forall t m k v a. (Reflex t, MonadFix m, MonadHold t m, GEq k) => k a -> Event t (DSum k v) -> m (Event t (v a)) -- | 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 only if the old event does. -- -- Because the simultaneous firing case is irrelevant, this function -- imposes laxer "timing requirements" on the overall circuit, avoiding -- many potential cyclic dependency / metastability failures. It's also -- more performant. Use this rather than switchHoldPromptly and -- switchHoldPromptOnly unless you are absolutely sure you need to -- act on the new event in the coincidental case. switchHold :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a) -- | Switches to the new event whenever it receives one. Whenever a new -- event is provided, if it is firing, its value will be the resulting -- event's value; if it is not firing, but the old one is, the old one's -- value will be used. -- -- switchHold, by always forwarding the old event the moment it is -- switched out, avoids many potential cyclic dependency problems / -- metastability problems. It's also more performant. Use it instead -- unless you are sure you cannot. switchHoldPromptly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a) -- | switches to a new event whenever it receives one. At the moment of -- switching, the old event will be ignored if it fires, and the new one -- will be used if it fires; this is the opposite of switch, which -- will use only the old value. -- -- switchHold, by always forwarding the old event the moment it is -- switched out, avoids many potential cyclic dependency problems / -- metastability problems. It's also more performant. Use it instead -- unless you are sure you cannot. switchHoldPromptOnly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a) switchHoldPromptOnlyIncremental :: forall t m p pt w. (Reflex t, MonadHold t m, Patch (p (Event t w)), PatchTarget (p (Event t w)) ~ pt (Event t w), Patch (p w), PatchTarget (p w) ~ pt w, Monoid (pt w)) => (Incremental t (p (Event t w)) -> Event t (pt w)) -> (Event t (p (Event t w)) -> Event t (p w)) -> pt (Event t w) -> Event t (p (Event t w)) -> m (Event t (pt w)) -- | Replace each occurrence value of the Event with the value of -- the Behavior at the time of that occurrence. tag :: Reflex t => Behavior t b -> Event t a -> Event t b -- | Replace each occurrence value of the Event with the value of -- the Behavior at that time; if it is Just, fire with the -- contained value; if it is Nothing, drop the occurrence. tagMaybe :: Reflex t => Behavior t (Maybe b) -> Event t a -> Event t b -- | Create a new Event that combines occurrences of supplied -- Event with the current value of the Behavior. attach :: Reflex t => Behavior t a -> Event t b -> Event t (a, b) -- | Create a new Event that occurs when the supplied Event -- occurs by combining it with the current value of the Behavior. attachWith :: Reflex t => (a -> b -> c) -> Behavior t a -> Event t b -> Event t c -- | Create a new Event by combining each occurrence with the -- current value of the Behavior. The occurrence is discarded if -- the combining function returns Nothing attachWithMaybe :: Reflex t => (a -> b -> Maybe c) -> Behavior t a -> Event t b -> Event t c -- | Create a new Event that only occurs if the supplied -- Event occurs and the Behavior is true at the time of -- occurrence. gate :: Reflex t => Behavior t Bool -> Event t a -> Event t a -- | 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 of Dynamics into a Dynamic list. distributeListOverDyn :: Reflex t => [Dynamic t a] -> Dynamic t [a] -- | Create a new Dynamic by applying a combining function to a list -- of Dynamics distributeListOverDynWith :: Reflex t => ([a] -> b) -> [Dynamic t a] -> Dynamic t b -- | Combine two Dynamics. The result will change whenever either -- (or both) input Dynamic changes. Equivalent to zipDynWith -- (,). zipDyn :: Reflex t => Dynamic t a -> Dynamic t b -> Dynamic t (a, b) -- | Combine two Dynamics with a combining function. The result will -- change whenever either (or both) input Dynamic changes. More -- efficient than liftA2. zipDynWith :: Reflex t => (a -> b -> c) -> Dynamic t a -> Dynamic t b -> Dynamic t c -- | An Accumulator type can be built by accumulating occurrences of -- an Event. class Reflex t => Accumulator t f | f -> t accum :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> a) -> a -> Event t b -> m (f a) accumM :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> PushM t a) -> a -> Event t b -> m (f a) accumMaybe :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> Maybe a) -> a -> Event t b -> m (f a) accumMaybeM :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a)) -> a -> Event t b -> m (f a) mapAccum :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> (a, c)) -> a -> Event t b -> m (f a, Event t c) mapAccumM :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> PushM t (a, c)) -> a -> Event t b -> m (f a, Event t c) mapAccumMaybe :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> (Maybe a, Maybe c)) -> a -> Event t b -> m (f a, Event t c) mapAccumMaybeM :: (Accumulator t f, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a, Maybe c)) -> a -> Event t b -> m (f a, Event t c) accumDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> a) -> a -> Event t b -> m (Dynamic t a) accumMDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t a) -> a -> Event t b -> m (Dynamic t a) accumMaybeDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> Maybe a) -> a -> Event t b -> m (Dynamic t a) accumMaybeMDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a)) -> a -> Event t b -> m (Dynamic t a) mapAccumDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (a, c)) -> a -> Event t b -> m (Dynamic t a, Event t c) mapAccumMDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (a, c)) -> a -> Event t b -> m (Dynamic t a, Event t c) mapAccumMaybeDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (Maybe a, Maybe c)) -> a -> Event t b -> m (Dynamic t a, Event t c) mapAccumMaybeMDyn :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a, Maybe c)) -> a -> Event t b -> m (Dynamic t a, Event t c) accumB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> a) -> a -> Event t b -> m (Behavior t a) accumMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t a) -> a -> Event t b -> m (Behavior t a) accumMaybeB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> Maybe a) -> a -> Event t b -> m (Behavior t a) accumMaybeMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a)) -> a -> Event t b -> m (Behavior t a) mapAccumB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (a, c)) -> a -> Event t b -> m (Behavior t a, Event t c) mapAccumMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (a, c)) -> a -> Event t b -> m (Behavior t a, Event t c) mapAccumMaybeB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (Maybe a, Maybe c)) -> a -> Event t b -> m (Behavior t a, Event t c) mapAccumMaybeMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a, Maybe c)) -> a -> Event t b -> m (Behavior t a, Event t c) -- | Accumulate occurrences of an Event, producing an output -- occurrence each time. Discard the underlying Accumulator. mapAccum_ :: forall t m a b c. (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (a, c)) -> a -> Event t b -> m (Event t c) -- | Accumulate occurrences of an Event, using a PushM action -- and producing an output occurrence each time. Discard the underlying -- Accumulator. mapAccumM_ :: forall t m a b c. (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (a, c)) -> a -> Event t b -> m (Event t c) -- | Accumulate occurrences of an Event, possibly producing an -- output occurrence each time. Discard the underlying -- Accumulator. mapAccumMaybe_ :: forall t m a b c. (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (Maybe a, Maybe c)) -> a -> Event t b -> m (Event t c) -- | Accumulate occurrences of an Event, using a PushM action -- and possibly producing an output occurrence each time. Discard the -- underlying Accumulator. mapAccumMaybeM_ :: forall t m a b c. (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a, Maybe c)) -> a -> Event t b -> m (Event t c) accumIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> p) -> PatchTarget p -> Event t b -> m (Incremental t p) accumMIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> PushM t p) -> PatchTarget p -> Event t b -> m (Incremental t p) accumMaybeIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> Maybe p) -> PatchTarget p -> Event t b -> m (Incremental t p) accumMaybeMIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> PushM t (Maybe p)) -> PatchTarget p -> Event t b -> m (Incremental t p) mapAccumIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> (p, c)) -> PatchTarget p -> Event t b -> m (Incremental t p, Event t c) mapAccumMIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> PushM t (p, c)) -> PatchTarget p -> Event t b -> m (Incremental t p, Event t c) mapAccumMaybeIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> (Maybe p, Maybe c)) -> PatchTarget p -> Event t b -> m (Incremental t p, Event t c) mapAccumMaybeMIncremental :: (Reflex t, Patch p, MonadHold t m, MonadFix m) => (PatchTarget p -> b -> PushM t (Maybe p, Maybe c)) -> PatchTarget p -> Event t b -> m (Incremental t p, Event t c) -- | Create a new Event by combining each occurrence with the next -- value of the list using the supplied function. If the list runs out of -- items, all subsequent Event occurrences will be ignored. zipListWithEvent :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> c) -> [a] -> Event t b -> m (Event t c) -- | Assign a number to each occurrence of the given Event, starting -- from 0 numberOccurrences :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Event t (b, a)) -- | Assign a number to each occurrence of the given Event numberOccurrencesFrom :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t (b, a)) -- | Assign a number to each occurrence of the given Event; discard -- the occurrences' values numberOccurrencesFrom_ :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t b) -- | This is used to sample the value of a Behavior using an -- Event. -- -- The <@> operator is intended to be used in conjunction -- with the Applicative instance for Behavior. -- -- This is useful when we want to combine the values of one Event -- and the value of several Behaviors at the time the Event -- is firing. -- -- If we have: -- --
--   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. Also similar is the Witherable typeclass, -- but it requires Foldable f and Traverable f, and -- e.g. Event is instance of neither. -- -- A definition of fmapMaybe must satisfy the following laws: -- -- class FunctorMaybe f -- | Combined mapping and filtering function. fmapMaybe :: FunctorMaybe f => (a -> Maybe b) -> f a -> f b -- | Flipped version of fmapMaybe. fforMaybe :: FunctorMaybe f => f a -> (a -> Maybe b) -> f b -- | Filter 'f a' using the provided predicate. Relies on fforMaybe. ffilter :: FunctorMaybe f => (a -> Bool) -> f a -> f a -- | Filter Lefts from 'f (Either a b)' into a. filterLeft :: FunctorMaybe f => f (Either a b) -> f a -- | Filter Rights from 'f (Either a b)' into b. filterRight :: FunctorMaybe 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 -- | Create a new Event that occurs if at least one of the supplied -- Events occurs. If both occur at the same time they are combined -- using mappend. -- | Deprecated: If a 'Semigroup a' instance is available, use -- mappend; otherwise, use 'alignWith (mergeThese mappend)' -- instead appendEvents :: (Reflex t, Monoid a) => Event t a -> Event t a -> Event t a -- | Alias for headE -- | Deprecated: Use headE instead onceE :: MonadHold t m => Event t a -> m (Event t a) -- | Run both sides of a These monadically, combining the results. -- | Deprecated: Use bisequenceA or bisequence from the bifunctors -- package instead sequenceThese :: Monad m => These (m a) (m b) -> m (These a b) fmapMaybeCheap :: Reflex t => (a -> Maybe b) -> Event t a -> Event t b fmapCheap :: Reflex t => (a -> b) -> Event t a -> Event t b fforCheap :: Reflex t => Event t a -> (a -> b) -> Event t b fforMaybeCheap :: Reflex t => Event t a -> (a -> Maybe b) -> Event t b pushAlwaysCheap :: Reflex t => (a -> PushM t b) -> Event t a -> Event t b tagCheap :: Reflex t => Behavior t b -> Event t a -> Event t b mergeWithCheap :: Reflex t => (a -> a -> a) -> [Event t a] -> Event t a mergeWithCheap' :: Reflex t => (a -> b) -> (b -> b -> b) -> [Event t a] -> Event t b -- | 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) -- | 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) 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 (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.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.Align.Align (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 MonadDynamicWriter class. module Reflex.DynamicWriter.Class -- | MonadDynamicWriter efficiently collects Dynamic values -- using tellDyn and combines them monoidally to provide a -- Dynamic result. class (Monad m, Monoid w) => MonadDynamicWriter t w m | m -> t w tellDyn :: MonadDynamicWriter t w m => Dynamic t w -> m () instance Reflex.DynamicWriter.Class.MonadDynamicWriter t w m => Reflex.DynamicWriter.Class.MonadDynamicWriter 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) -- | This module contains various functions for working with Dynamic -- values. Dynamic and its primitives have been moved to the -- Reflex class. 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))) 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))) 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. 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, the 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 consitutent 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 -- | A psuedo applicative version of ap for Dynamic. Example useage: -- --
--   do
--      person <- Person `mapDyn` dynFirstName
--                       `apDyn` dynListName
--                       `apDyn` dynAge
--                       `apDyn` dynAddress
--   
-- | Deprecated: Use 'ffor m (* a)' instead of 'apDyn m a'; -- consider eliminating monadic style, since Dynamics are now Applicative -- and can be used with applicative style directly apDyn :: forall t m a b. (Reflex t, Monad m) => m (Dynamic t (a -> b)) -> Dynamic t a -> m (Dynamic t b) -- | This function has been renamed to attachPromptlyDyn to clarify -- its semantics. -- | Deprecated: Use attachPromptlyDyn instead attachDyn :: Reflex t => Dynamic t a -> Event t b -> Event t (a, b) -- | This function has been renamed to attachPromptlyDynWith to -- clarify its semantics. -- | Deprecated: Use attachPromptlyDynWith instead attachDynWith :: Reflex t => (a -> b -> c) -> Dynamic t a -> Event t b -> Event t c -- | This function has been renamed to attachPromptlyDynWithMaybe to -- clarify its semantics. -- | Deprecated: Use attachPromptlyDynWithMaybe instead attachDynWithMaybe :: Reflex t => (a -> b -> Maybe c) -> Dynamic t a -> Event t b -> Event t c -- | This function no longer needs to be monadic, so it has been replaced -- by collectDynPure, which is pure. -- | Deprecated: Use 'return . collectDynPure' instead; consider -- eliminating monadic style collectDyn :: (RebuildSortedHList (HListElems b), IsHList a, IsHList b, AllAreFunctors (Dynamic t) (HListElems b), Reflex t, Monad m, HListElems a ~ FunctorList (Dynamic t) (HListElems b)) => a -> m (Dynamic t b) -- | Merge two Dynamics into a new one using the provided function. -- The new Dynamic changes its value each time one of the original -- Dynamics changes its value. -- | Deprecated: Use 'return (zipDynWith f a b)' instead of 'combineDyn -- f a b'; consider eliminating monadic style combineDyn :: forall t m a b c. (Reflex t, Monad m) => (a -> b -> c) -> Dynamic t a -> Dynamic t b -> m (Dynamic t c) -- | This function no longer needs to be monadic; see -- distributeMapOverDynPure. -- | Deprecated: Use 'return . distributeDMapOverDynPure' instead; -- consider eliminating monadic style distributeDMapOverDyn :: (Reflex t, Monad m, GCompare k) => DMap k (Dynamic t) -> m (Dynamic t (DMap k Identity)) -- | This function no longer needs to be monadic, so it has been replaced -- by distributeFHListOverDynPure, which is pure. -- | Deprecated: Use 'return . distributeFHListOverDynPure' instead; -- consider eliminating monadic style distributeFHListOverDyn :: forall t m l. (Reflex t, Monad m, RebuildSortedHList l) => FHList (Dynamic t) l -> m (Dynamic t (HList l)) -- | Flipped version of mapDyn. -- | Deprecated: Use 'return . ffor a' instead of 'forDyn a'; consider -- eliminating monadic style forDyn :: (Reflex t, Monad m) => Dynamic t a -> (a -> b) -> m (Dynamic t b) -- | This function no longer needs to be monadic, so it has been replaced -- by demuxed, which is pure. -- | Deprecated: Use 'return . demuxed d' instead of 'getDemuxed d'; -- consider eliminating monadic style getDemuxed :: (Reflex t, Monad m, Eq k) => Demux t k -> k -> m (Dynamic t Bool) -- | Combine an inner and outer Dynamic such that the resulting -- Dynamic's current value will always be equal to the current -- value's current value, and will change whenever either the inner or -- the outer (or both) values change. -- | Deprecated: Use join instead joinDyn :: Reflex t => Dynamic t (Dynamic t a) -> Dynamic t a -- | Map a function over a Dynamic. -- | Deprecated: Use 'return . fmap f' instead of 'mapDyn f'; consider -- eliminating monadic style mapDyn :: (Reflex t, Monad m) => (a -> b) -> Dynamic t a -> m (Dynamic t b) -- | Merge the Dynamic values using their Monoid instance. -- | Deprecated: Use 'return . mconcat' instead; consider eliminating -- monadic style mconcatDyn :: forall t m a. (Reflex t, Monad m, Monoid a) => [Dynamic t a] -> m (Dynamic t a) -- | WARNING: This function is only pure if a's Eq instance -- tests representational equality. Use holdUniqDyn instead, which -- is pure in all circumstances. Also, note that, unlike nub, -- this function does not prevent all recurrences of a value, only -- consecutive recurrences. -- | Deprecated: Use holdUniqDyn instead; note that it returns a -- MonadHold action rather than a pure Dynamic nubDyn :: (Reflex t, Eq a) => Dynamic t a -> Dynamic t a -- | Split the Dynamic into two Dynamics, each taking the -- respective value of the tuple. -- | Deprecated: Use 'return . splitDynPure' instead; consider -- eliminating monadic style splitDyn :: (Reflex t, Monad m) => Dynamic t (a, b) -> m (Dynamic t a, Dynamic t b) -- | This function has been renamed to tagPromptlyDyn to clarify its -- semantics. -- | Deprecated: Use tagPromptlyDyn instead tagDyn :: Reflex t => Dynamic t a -> Event t b -> Event t a -- | WARNING: This function is only pure if a's Eq instance -- tests representational equality. Use holdUniqDyn instead, which -- is pure in all circumstances. -- | Deprecated: Use holdUniqDyn instead; note that it returns a -- MonadHold action rather than a pure Dynamic uniqDyn :: (Reflex t, Eq a) => Dynamic t a -> Dynamic t a -- | WARNING: This function is impure. Use holdUniqDynBy instead. -- | Deprecated: Use holdUniqDynBy instead; note that it returns -- a MonadHold action rather than a pure Dynamic uniqDynBy :: Reflex t => (a -> a -> Bool) -> Dynamic 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 -- | Like qDynPure, but wraps its result monadically using -- return. This is no longer necessary, due to Dynamic -- being an instance of Functor. -- | Deprecated: Instead of $(qDyn x), use return $(qDynPure x) qDyn :: Q Exp -> Q Exp -- | Like mkDynPure, but wraps its result monadically using -- return. This is no longer necessary, due to Dynamic -- being an instance of Functor. -- | Deprecated: Instead of [mkDyn| x |], use return [mkDynPure| x -- |] mkDyn :: 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')) sequenceDMapWithAdjust :: (GCompare k, Adjustable t m) => DMap k m -> Event t (PatchDMap k m) -> m (DMap k Identity, Event t (PatchDMap k Identity)) sequenceDMapWithAdjustWithMove :: (GCompare k, Adjustable t m) => DMap k m -> Event t (PatchDMapWithMove k m) -> m (DMap k Identity, Event t (PatchDMapWithMove k Identity)) 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')) -- | 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) -- | Map with a better Monoid instance -- -- Map has mappend = union, which is left-biased. -- AppendMap has mappend = unionWith mappend instead. module Data.AppendMap -- | Deprecated: Use MonoidalMap instead type AppendMap = MonoidalMap -- | Deprecated: Use MonoidalMap instead pattern AppendMap :: Map k v -> MonoidalMap k v -- | 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) mapMaybeNoNull :: (a -> Maybe b) -> MonoidalMap token a -> Maybe (MonoidalMap token b) showTree :: forall k a. (Show k, Show a) => MonoidalMap k a -> String showTreeWith :: forall k a. (k -> a -> String) -> Bool -> Bool -> MonoidalMap k a -> String instance Reflex.FunctorMaybe.FunctorMaybe (Data.Map.Monoidal.MonoidalMap k) instance (GHC.Classes.Ord k, Reflex.Patch.Group q) => Reflex.Patch.Group (Data.Map.Monoidal.MonoidalMap k q) instance (GHC.Classes.Ord k, Reflex.Patch.Additive q) => Reflex.Patch.Additive (Data.Map.Monoidal.MonoidalMap k q) instance Data.Default.Class.Default (Data.Map.Monoidal.MonoidalMap k a) -- | 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 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)) -- | Deprecated: listWithKey' has been renamed to -- listWithKeyShallowDiff; also, its behavior has changed to fix a bug -- where children were always rebuilt (never updated) listWithKey' :: (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)) -- | 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)) 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]) -- | This module provides a pure implementation of Reflex, which is -- intended to serve as a reference for the semantics of the Reflex -- class. All implementations of Reflex should produce the same results -- as this implementation, although performance and laziness/strictness -- may differ. module Reflex.Pure -- | A completely pure-functional Reflex timeline, identifying -- moments in time with the type t. data Pure t -- | 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 class (Monoid (QueryResult a), Semigroup (QueryResult a)) => Query a where { type family QueryResult a :: *; } crop :: Query a => a -> QueryResult a -> QueryResult a -- | NB: 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 keeps track of the multiplicity of elements of the view -- selector that are being used by the app newtype SelectedCount SelectedCount :: Int -> SelectedCount [unSelectedCount] :: SelectedCount -> Int -- | The SemigroupMonoidGroup instances for a ViewSelector should -- use this function which returns Nothing if the result is 0. This -- allows the pruning of leaves that are no longer wanted. combineSelectedCounts :: SelectedCount -> SelectedCount -> Maybe SelectedCount 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)) tellQueryDyn :: (Reflex t, MonadQuery t q m) => Dynamic t q -> m () queryDyn :: (Reflex t, Monad m, MonadQuery t q m) => Dynamic t q -> m (Dynamic t (QueryResult q)) mapQuery :: QueryMorphism q q' -> q -> q' 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 data TickInfo TickInfo :: UTCTime -> Integer -> NominalDiffTime -> TickInfo -- | UTC time immediately after the last tick. [_tickInfo_lastUTC] :: TickInfo -> UTCTime -- | Number of time periods since t0 [_tickInfo_n] :: TickInfo -> Integer -- | Amount of time already elapsed in the current tick period. [_tickInfo_alreadyElapsed] :: TickInfo -> NominalDiffTime -- | 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) -- | 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) -- | Send events over time with the given basis time and interval 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 basis 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 dt and t0 in the event. tickLossyFrom' :: (PerformEvent t m, TriggerEvent t m, MonadIO (Performable m), MonadFix m) => Event t (NominalDiffTime, UTCTime) -> m (Event t TickInfo) 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) 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) tickInfo_n :: Lens' TickInfo Integer tickInfo_lastUTC :: Lens' TickInfo UTCTime tickInfo_alreadyElapsed :: Lens' TickInfo NominalDiffTime instance GHC.Show.Show Reflex.Time.TickInfo instance GHC.Classes.Ord Reflex.Time.TickInfo instance GHC.Classes.Eq Reflex.Time.TickInfo -- | 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)) 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 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 (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 GHC.Base.Functor (Reflex.Class.Dynamic t) => GHC.Base.Functor (Reflex.Class.Dynamic (Reflex.Profiled.ProfiledTimeline t)) instance GHC.Base.Applicative (Reflex.Class.Dynamic t) => GHC.Base.Applicative (Reflex.Class.Dynamic (Reflex.Profiled.ProfiledTimeline t)) instance GHC.Base.Monad (Reflex.Class.Dynamic t) => GHC.Base.Monad (Reflex.Class.Dynamic (Reflex.Profiled.ProfiledTimeline t)) instance Reflex.Class.Reflex t => Reflex.Class.Reflex (Reflex.Profiled.ProfiledTimeline t) instance Reflex.Class.MonadHold t m => Reflex.Class.MonadHold (Reflex.Profiled.ProfiledTimeline t) (Reflex.Profiled.ProfiledM m) instance 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.MonadDynamicWriter t w m => Reflex.DynamicWriter.Class.MonadDynamicWriter 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)) mapQuery :: QueryMorphism q q' -> q -> q' 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, 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.MonadDynamicWriter t w m => Reflex.DynamicWriter.Class.MonadDynamicWriter 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 MonadDynamicWriter. 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.MonadDynamicWriter 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 (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) 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 => 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.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 :: () => Dynamic x (Identity a) -> Dynamic (SpiderTimeline x) a unSpiderDynamic :: Dynamic (SpiderTimeline x) a -> Dynamic x (Identity a) pattern SpiderIncremental :: () => Dynamic x p -> Incremental (SpiderTimeline x) p unSpiderIncremental :: Incremental (SpiderTimeline x) p -> Dynamic x p newtype ReadPhase x a ReadPhase :: ResultM x a -> ReadPhase x a newtype SpiderHostFrame x a SpiderHostFrame :: EventM x a -> SpiderHostFrame x a [runSpiderHostFrame] :: SpiderHostFrame x a -> EventM x a -- | The monad for actions that manipulate a Spider timeline identified by -- x newtype SpiderHost x a SpiderHost :: IO a -> SpiderHost x a [unSpiderHost] :: SpiderHost x 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 a SpiderPushM :: ComputeM x a -> SpiderPushM x a type ComputeM = EventM newtype SpiderPullM x a SpiderPullM :: BehaviorM x a -> SpiderPullM x a data LocalSpiderTimeline x 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 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 s Merge :: {-# UNPACK #-} !IORef (DMap k s) -> {-# UNPACK #-} !IORef HeightBag -> {-# UNPACK #-} !IORef Height -> {-# UNPACK #-} !Subscriber x (DMap k Identity) -> {-# UNPACK #-} !IORef (DMap k Identity) -> Merge x k s [_merge_parentsRef] :: Merge x k s -> {-# UNPACK #-} !IORef (DMap k s) [_merge_heightBagRef] :: Merge x k s -> {-# UNPACK #-} !IORef HeightBag [_merge_heightRef] :: Merge x k s -> {-# UNPACK #-} !IORef Height [_merge_sub] :: Merge x k s -> {-# UNPACK #-} !Subscriber x (DMap k Identity) [_merge_accumRef] :: Merge x k s -> {-# UNPACK #-} !IORef (DMap k Identity) type MergeDestroyFunc k s = DMap k s -> IO () type MergeInitFunc k x s = DMap k (Event x) -> (forall a. EventM x (k a) -> Subscriber x a) -> EventM x (DMap k Identity, [Height], DMap k s) type MergeUpdateFunc k x p s = (forall a. EventM x (k a) -> Subscriber x 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 data SomeRootClear SomeRootClear :: {-# UNPACK #-} !IORef (DMap k Identity) -> SomeRootClear data SomeIntClear SomeIntClear :: {-# UNPACK #-} !IORef (IntMap a) -> SomeIntClear data SomeClear SomeClear :: {-# UNPACK #-} !IORef (Maybe a) -> SomeClear type ResultM = EventM newtype Dyn x p Dyn :: IORef (DynType x p) -> Dyn x p [unDyn] :: Dyn x 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 Fan :: !Event x (DMap k Identity) -> !IORef (Maybe (FanSubscribed x k)) -> Fan x k [fanParent] :: Fan x k -> !Event x (DMap k Identity) [fanSubscribed] :: Fan x k -> !IORef (Maybe (FanSubscribed x k)) data FanSubscribed (x :: *) k FanSubscribed :: !IORef (Maybe (FanSubscribed x k)) -> !IORef (Maybe (DMap k Identity)) -> !IORef (DMap k (FanSubscribedChildren x k)) -> !EventSubscription x -> FanSubscribed k [fanSubscribedCachedSubscribed] :: FanSubscribed k -> !IORef (Maybe (FanSubscribed x k)) [fanSubscribedOccurrence] :: FanSubscribed k -> !IORef (Maybe (DMap k Identity)) [fanSubscribedSubscribers] :: FanSubscribed k -> !IORef (DMap k (FanSubscribedChildren x k)) [fanSubscribedParent] :: FanSubscribed k -> !EventSubscription x data FanSubscribedChildren (x :: *) k a FanSubscribedChildren :: !WeakBag (Subscriber x a) -> {-# NOUNPACK #-} !(k a, FanSubscribed x k) -> !IORef (Weak (k a, FanSubscribed x k)) -> FanSubscribedChildren k a [_fanSubscribedChildren_list] :: FanSubscribedChildren k a -> !WeakBag (Subscriber x a) [_fanSubscribedChildren_self] :: FanSubscribedChildren k a -> {-# NOUNPACK #-} !(k a, FanSubscribed x k) [_fanSubscribedChildren_weakSelf] :: FanSubscribedChildren k a -> !IORef (Weak (k a, FanSubscribed x k)) 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 [rootOccurrence] :: Root x -> !IORef (DMap k Identity) [rootSubscribed] :: Root x -> !IORef (DMap k (RootSubscribed x)) [rootInit] :: Root x -> !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] data SomeBehaviorSubscribed x SomeBehaviorSubscribed :: BehaviorSubscribed x a -> 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 :: ReaderT (BehaviorEnv x) IO a -> BehaviorM x a [unBehaviorM] :: BehaviorM x a -> ReaderT (BehaviorEnv x) IO 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 [SomeClear] -> !IORef [SomeIntClear] -> !IORef [SomeRootClear] -> !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 [SomeClear] [eventEnvIntClears] :: EventEnv x -> !IORef [SomeIntClear] [eventEnvRootClears] :: EventEnv x -> !IORef [SomeRootClear] [eventEnvCurrentHeight] :: EventEnv x -> !IORef Height [eventEnvResetCoincidences] :: EventEnv x -> !IORef [SomeResetCoincidence x] [eventEnvDelayedMerges] :: EventEnv x -> !IORef (IntMap [EventM x ()]) -- | Stores all global data relevant to a particular Spider timeline; only -- one value should exist for each type 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 -- | 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 p Dynamic :: !Behavior x (PatchTarget p) -> !Event x p -> Dynamic x p [dynamicCurrent] :: Dynamic x p -> !Behavior x (PatchTarget p) [dynamicUpdated] :: Dynamic x p -> !Event x 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 -> Event x 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. (HasSpiderTimeline x, GCompare k) => FanSubscribed x k -> IO (Subscriber x (DMap k Identity)) 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 -> 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 -> Dynamic x p dynamicHoldIdentity :: Hold x (Identity a) -> Dynamic x (Identity a) dynamicConst :: PatchTarget p -> Dynamic x p dynamicDyn :: (HasSpiderTimeline x, Patch p) => Dyn x p -> Dynamic x p dynamicDynIdentity :: HasSpiderTimeline x => Dyn x (Identity a) -> Dynamic 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 SomeClear m => IORef (Maybe a) -> m () scheduleIntClear :: Defer SomeIntClear m => IORef (IntMap a) -> m () scheduleRootClear :: Defer SomeRootClear 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) -> Dynamic x (Identity a) -> Dynamic x (Identity b) zipDynWith :: HasSpiderTimeline x => (a -> b -> c) -> Dynamic x (Identity a) -> Dynamic x (Identity b) -> Dynamic 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 unsafeNewIORef :: a -> b -> IORef b 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) unsafeNewFanInt :: b -> FanInt x a fanInt :: HasSpiderTimeline x => Event x (IntMap a) -> EventSelectorInt x a getFanSubscribed :: (HasSpiderTimeline x, GCompare k) => k a -> Fan x k -> Subscriber x a -> EventM x (WeakBagTicket, FanSubscribed x k, Maybe a) cleanupFanSubscribed :: GCompare k => (k a, FanSubscribed x k) -> IO () subscribeFanSubscribed :: GCompare k => k a -> FanSubscribed x k -> Subscriber x 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 merge :: forall k x. (HasSpiderTimeline x, GCompare k) => Dynamic x (PatchDMap k (Event x)) -> Event x (DMap k Identity) mergeWithMove :: forall k x. (HasSpiderTimeline x, GCompare k) => Dynamic x (PatchDMapWithMove k (Event x)) -> Event x (DMap k Identity) mergeCheap :: forall k x. (HasSpiderTimeline x, GCompare k) => Dynamic x (PatchDMap k (Event x)) -> Event x (DMap k Identity) mergeCheapWithMove :: forall k x. (HasSpiderTimeline x, GCompare k) => Dynamic x (PatchDMapWithMove k (Event x)) -> Event x (DMap k Identity) invalidateMergeHeight :: Merge x k s -> IO () invalidateMergeHeight' :: IORef Height -> Subscriber x a -> IO () revalidateMergeHeight :: Merge x k s -> IO () scheduleMergeSelf :: HasSpiderTimeline x => Merge x k s -> Height -> EventM x () mergeSubscriber :: forall x k s a. (HasSpiderTimeline x, GCompare k) => Merge x k s -> EventM x (k a) -> Subscriber x a updateMerge :: (HasSpiderTimeline x, GCompare k) => Merge x k s -> MergeUpdateFunc k x p s -> p -> SomeMergeUpdate x mergeCheap' :: forall k x p s. (HasSpiderTimeline x, GCompare k, PatchTarget p ~ DMap k (Event x)) => MergeInitFunc k x s -> MergeUpdateFunc k x p s -> MergeDestroyFunc k s -> Dynamic x p -> Event x (DMap k Identity) mergeInt :: forall x a. HasSpiderTimeline x => Dynamic x (PatchIntMap (Event x a)) -> Event x (IntMap a) mergeIntCheap :: forall x a. HasSpiderTimeline x => Dynamic x (PatchIntMap (Event x a)) -> Event x (IntMap a) fan :: (HasSpiderTimeline x, GCompare k) => Event x (DMap k Identity) -> EventSelector x k 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 => Dynamic x (Identity (Dynamic 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 Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.ReadPhase x) instance GHC.Base.Monad (Reflex.Spider.Internal.ReadPhase x) instance GHC.Base.Applicative (Reflex.Spider.Internal.ReadPhase x) instance 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 Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.BehaviorM x) instance Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.BehaviorM x) instance GHC.Base.Applicative (Reflex.Spider.Internal.BehaviorM x) instance 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 Control.Monad.Exception.MonadAsyncException (Reflex.Spider.Internal.EventM x) instance Control.Monad.Exception.MonadException (Reflex.Spider.Internal.EventM x) instance Control.Monad.Fix.MonadFix (Reflex.Spider.Internal.EventM x) instance Control.Monad.IO.Class.MonadIO (Reflex.Spider.Internal.EventM x) instance GHC.Base.Monad (Reflex.Spider.Internal.EventM x) instance GHC.Base.Applicative (Reflex.Spider.Internal.EventM x) instance GHC.Base.Functor (Reflex.Spider.Internal.EventM x) 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.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 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 Reflex.Spider.Internal.SomeClear (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer Reflex.Spider.Internal.SomeIntClear (Reflex.Spider.Internal.EventM x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Reflex.Spider.Internal.Defer Reflex.Spider.Internal.SomeRootClear (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 => Reflex.FunctorMaybe.FunctorMaybe (Reflex.Spider.Internal.Event x) instance Reflex.Spider.Internal.HasSpiderTimeline x => Data.Align.Align (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 Reflex.Spider.Internal.Defer (Reflex.Spider.Internal.SomeHoldInit x) (Reflex.Spider.Internal.BehaviorM x) instance GHC.Base.Monad (Reflex.Spider.Internal.BehaviorM x) instance GHC.Base.Functor (Reflex.Spider.Internal.Behavior x) instance Control.Monad.Ref.MonadRef (Reflex.Spider.Internal.EventM x) instance Control.Monad.Ref.MonadAtomicRef (Reflex.Spider.Internal.EventM x) -- | This module exports all of the user-facing functionality of the -- Spider Reflex engine 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 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 -- | Given a Dynamic of network-creating actions, create a network that is -- recreated whenever the Dynamic updates. The returned Event of network -- results occurs when the Dynamic does. Note: Often, the type a -- is an Event, in which case the return value is an Event-of-Events that -- 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) -- | 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) -- | 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 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)) workflow :: forall t m a. (Reflex t, Adjustable t m, MonadFix m, MonadHold t m) => Workflow t m a -> m (Dynamic t a) 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) mapWorkflow :: (Reflex t, Functor m) => (a -> b) -> Workflow t m a -> Workflow t m b mapWorkflowCheap :: (Reflex t, Functor m) => (a -> b) -> Workflow t m a -> Workflow t m b