boots-0.2: IoC Monad in Haskell

Copyright2019 Daniel YU
LicenseMIT
Maintainerleptonyu@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Factory.Class

Description

 
Synopsis

Documentation

class (Monad m, Monad n) => MonadFactory env n m | m -> env n where Source #

Monads which allow to produce component under env, and env can be changed by this procedure.

Methods

getEnv :: m env Source #

Return the environment of the monad.

putEnv :: env -> m () Source #

Replace the environment inside the monad.

produce Source #

Arguments

:: n component

Open resource

-> (component -> n ())

Close resource

-> m component 

Produce a resource component, with open and close.

Instances
MonadMask m => MonadFactory env m (Factory m env) Source # 
Instance details

Defined in Control.Monad.Factory

Methods

getEnv :: Factory m env env Source #

putEnv :: env -> Factory m env () Source #

produce :: m component -> (component -> m ()) -> Factory m env component Source #

defer :: MonadFactory env n m => n () -> m () Source #

Defer to run side effect when closeing resource.

asksEnv :: MonadFactory env n m => (env -> a) -> m a Source #

Asks sub value of env.

withEnv :: MonadFactory env n m => (env -> m env) -> m () Source #

Change environment env.

modifyEnv :: MonadFactory env n m => (env -> env) -> m () Source #

Modify environment env.

runEnv :: MonadFactory env n m => m c -> m (env, c) Source #

Run factory, return component c and updated environment env.