reflex-transformers-0.2.1: Collections and switchable Monad transformers for Reflex

Safe HaskellNone
LanguageHaskell2010

Reflex.Monad.Supply

Synopsis

Documentation

data SupplyT s m a Source

ID Supply transformer for switchable reflex stacks over splittable ID supplies Fresh variables are obtained using getFresh. Admits a MonadSwitch instance.

type Supply s a = SupplyT s Identity a Source

Non transformer version

class Splitable s i | s -> i where Source

Abstraction for splittable identifier supplies, priovided is an instance for Enum a => [a] but a more efficient supply would be for example, found in the concurrent-supply package. at the cost of determinism. Two parameters, a state s and an identifier type i

Methods

freshId :: s -> (i, s) Source

splitSupply :: s -> (s, s) Source

Instances

Enum a => Splitable [a] [a] Source 

runSupplyT :: Monad m => SupplyT s m a -> s -> m (a, s) Source

Run a SupplyT with a Spittable state

evalSupplyT :: Monad m => SupplyT s m a -> s -> m a Source

runSupply :: Supply s a -> s -> (a, s) Source

evalSupply :: Supply s a -> s -> a Source

runSplit :: (Monad m, Splitable s i) => SupplyT s m a -> Supply s (m a) Source

Run a non transformer Supply using a split

getFresh :: (Monad m, Splitable s i) => SupplyT s m i Source

Obtain a fresh ID from the Supply

getSplit :: (Monad m, Splitable s i) => SupplyT s m s Source

Obtain a value of the ID Supply which provides distinct ids from those returned from the Monad in future.