MonadLab-0.0.2: Automatically generate layered monadsSource codeContentsIndex
MonadLab.CommonTypes
Synopsis
data Layer
= Io
| List
| ErrorT ErrorName TypeQ
| StateT StateName TypeQ
| EnvT EnvName TypeQ
| WriterT WriterName TypeQ
| ContT TypeQ
| ResT MonadName
type ErrorName = String
type StateName = String
type EnvName = String
type WriterName = String
data LayerType
= IoLayerType
| ListLayerType
| StateLayerType
| EnvLayerType
| ErrorLayerType
| WriterLayerType
| ContLayerType
| ResLayerType
layerType :: Layer -> LayerType
hasLayerType :: LayerType -> Layer -> Bool
type Monad = (MonadTypeCon, ReturnExpQ, BindExpQ, [LayerNPM], LiftExpQ)
type MonadName = String
type MonadTypeCon = TypeQ -> TypeQ
type ReturnExpQ = ExpQ
type BindExpQ = ExpQ
type LiftExpQ = ExpQ
type JoinExpQ = ExpQ
type RunExpQ = ExpQ
type NonProperMorphismExpQ = ExpQ
type MonadTransformer = Monad -> Monad
type LayerNPM = (Layer, [NonProperMorphismExpQ])
getTypeCon :: Monad -> MonadTypeCon
getReturn :: Monad -> ReturnExpQ
getBind :: Monad -> BindExpQ
getLayerNPMs :: Monad -> [LayerNPM]
getBaseLift :: Monad -> LiftExpQ
getJoin :: Monad -> JoinExpQ
int :: TypeQ
bool :: TypeQ
string :: TypeQ
composition :: ExpQ
arrow :: TypeQ -> TypeQ -> TypeQ
Documentation
data Layer Source
The Layer data type. A monad is constructed from a list of layers. Each layer adds a corresponding set of non-proper morphisms (npms) for use in the monad. The non-proper morphisms can be thought of as the interface of the monad or primitives in the constructed monad "language".
Constructors
IoThe Io layer. Adds an npm for IO operations.
ListThe List layer. Adds an npm for expressing nondeterministic computation.
ErrorT ErrorName TypeQThe Error (or Exception) layer. Adds npms for exception throwing/handling.
StateT StateName TypeQThe State layer. Adds npms for the manipulation of a mutable state.
EnvT EnvName TypeQThe Environment layer. Adds npms for reading/pre-setting an immutable environment.
WriterT WriterName TypeQThe Writer layer. Adds npms for the production/manipulation of sequenced output.
ContT TypeQThe Continuation layer. f no List layer is included in the li , then the corresponding Layer transformers are composed Adds an npm for accessing current continuation to facilate continuation passing style programming.
ResT MonadNameThe Resumption layer.
type ErrorName = StringSource
type StateName = StringSource
type EnvName = StringSource
type WriterName = StringSource
data LayerType Source
Constructors
IoLayerType
ListLayerType
StateLayerType
EnvLayerType
ErrorLayerType
WriterLayerType
ContLayerType
ResLayerType
show/hide Instances
layerType :: Layer -> LayerTypeSource
hasLayerType :: LayerType -> Layer -> BoolSource
type Monad = (MonadTypeCon, ReturnExpQ, BindExpQ, [LayerNPM], LiftExpQ)Source
The monad type. Each component contains abstract syntax of the Haskell code to implement the monad. Components are (code for the data type, code for the return, code for the bind, code for the non-proper morphisms, code for the monad lifting)
type MonadName = StringSource
The name of monad type constructor identifier
type MonadTypeCon = TypeQ -> TypeQSource
The monad type constructor type.
type ReturnExpQ = ExpQSource
Code for a monad return
type BindExpQ = ExpQSource
Code for a monad bind
type LiftExpQ = ExpQSource
Code for a monad lifting
type JoinExpQ = ExpQSource
Code for a monad join
type RunExpQ = ExpQSource
Code for a monad run (evaluation)
type NonProperMorphismExpQ = ExpQSource
Code for a monad non-proper morphism
type MonadTransformer = Monad -> MonadSource
Monad transformer data type
type LayerNPM = (Layer, [NonProperMorphismExpQ])Source
Data type to hold a layer's non-proper morphisms
getTypeCon :: Monad -> MonadTypeConSource
Type constructor accessor
getReturn :: Monad -> ReturnExpQSource
Return accessor
getBind :: Monad -> BindExpQSource
Bind accessor
getLayerNPMs :: Monad -> [LayerNPM]Source
Layers accessor
getBaseLift :: Monad -> LiftExpQSource
Base monad lifting accessor
getJoin :: Monad -> JoinExpQSource
Join accessor
int :: TypeQSource
bool :: TypeQSource
Short hand for [t| Int |], [t| Bool |], and [t| String |]
string :: TypeQSource
composition :: ExpQSource
Definition of composition function for use in TH expressions
arrow :: TypeQ -> TypeQ -> TypeQSource
Convenience function for expressing type t -> t' in TH
Produced by Haddock version 2.4.2