Safe Haskell | None |
---|---|
Language | Haskell2010 |
IO control-flow with cache
Synopsis
- data MonadFlowF m a e
- type MonadFlow m a r = Free (MonadFlowF m a) r
- runMonadFlow :: Monad m => MonadFlow m a r -> m (r, [a])
- runM :: forall m v a. Eq v => m v -> MonadFlow m a v
- withM :: Eq v => m v -> (v -> MonadFlow m a ()) -> MonadFlow m a ()
- emitM :: a -> MonadFlow m a ()
- data CachedMonadFlow m a = CachedMonadFlow {
- cachedTree :: [MonadTree m a]
- cachedContext :: forall b. m b -> m b
- cacheMonadFlow :: Monad m => (forall b. m b -> m b) -> MonadFlow m a r -> m (CachedMonadFlow m a)
- cacheMonadFlowPure :: (forall b. m b -> m b) -> MonadFlow m a r -> CachedMonadFlow m a
- updateCachedMonadFlow :: Monad m => CachedMonadFlow m a -> m (CachedMonadFlow m a)
- updateCachedMonadFlowMaybe :: Monad m => CachedMonadFlow m a -> m (Maybe (CachedMonadFlow m a))
- monadFlowToMonadTree :: MonadFlow m a r -> [MonadTree m a]
Documentation
data MonadFlowF m a e Source #
MonadFlow Functor
Instances
Functor (MonadFlowF m a) Source # | |
Defined in Haskus.Utils.MonadFlow fmap :: (a0 -> b) -> MonadFlowF m a a0 -> MonadFlowF m a b # (<$) :: a0 -> MonadFlowF m a b -> MonadFlowF m a a0 # |
type MonadFlow m a r = Free (MonadFlowF m a) r Source #
runMonadFlow :: Monad m => MonadFlow m a r -> m (r, [a]) Source #
Run an MonadFlow
runM :: forall m v a. Eq v => m v -> MonadFlow m a v Source #
Get a variable in IO
Use withM
to clearly limit the variable scope
withM :: Eq v => m v -> (v -> MonadFlow m a ()) -> MonadFlow m a () Source #
Read and use an IO variable in a delimited scope
Cached control flow
data CachedMonadFlow m a Source #
Cached control-flow
CachedMonadFlow | |
|
Instances
Functor (CachedMonadFlow m) Source # | |
Defined in Haskus.Utils.MonadFlow fmap :: (a -> b) -> CachedMonadFlow m a -> CachedMonadFlow m b # (<$) :: a -> CachedMonadFlow m b -> CachedMonadFlow m a # |
cacheMonadFlow :: Monad m => (forall b. m b -> m b) -> MonadFlow m a r -> m (CachedMonadFlow m a) Source #
Create a cache from an MonadFlow.
Execute the MonadFlow once to get cached values
cacheMonadFlowPure :: (forall b. m b -> m b) -> MonadFlow m a r -> CachedMonadFlow m a Source #
Create a cache from an MonadFlow.
This is the pure version: IO dependent nodes may not have any cached value
updateCachedMonadFlow :: Monad m => CachedMonadFlow m a -> m (CachedMonadFlow m a) Source #
Update a cached MonadFlow
updateCachedMonadFlowMaybe :: Monad m => CachedMonadFlow m a -> m (Maybe (CachedMonadFlow m a)) Source #
Update a cached MonadFlow
monadFlowToMonadTree :: MonadFlow m a r -> [MonadTree m a] Source #