Copyright | (c) Fumiaki Kinoshita 2018 |
---|---|
License | BSD3 |
Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Default monad runners and MonadIO
, MonadReader
, MonadWriter
,
MonadState
, MonadError
instances
Synopsis
- type ReaderDef r = "Reader" >: ReaderEff r
- runReaderDef :: Eff (ReaderDef r ': xs) a -> r -> Eff xs a
- type StateDef s = "State" >: State s
- runStateDef :: Eff (StateDef s ': xs) a -> s -> Eff xs (a, s)
- evalStateDef :: Eff (StateDef s ': xs) a -> s -> Eff xs a
- execStateDef :: Eff (StateDef s ': xs) a -> s -> Eff xs s
- type WriterDef w = "Writer" >: WriterEff w
- runWriterDef :: Monoid w => Eff (WriterDef w ': xs) a -> Eff xs (a, w)
- execWriterDef :: Monoid w => Eff (WriterDef w ': xs) a -> Eff xs w
- type MaybeDef = "Either" >: EitherEff ()
- runMaybeDef :: Eff (MaybeDef ': xs) a -> Eff xs (Maybe a)
- type EitherDef e = "Either" >: EitherEff e
- runEitherDef :: Eff (EitherDef e ': xs) a -> Eff xs (Either e a)
- type ContDef r m = "Cont" >: ContT r m
- runContDef :: Eff (ContDef r (Eff xs) ': xs) a -> (a -> Eff xs r) -> Eff xs r
Documentation
runReaderDef :: Eff (ReaderDef r ': xs) a -> r -> Eff xs a Source #
Specialised version of runReaderEff
compatible with the MonadReader
instance.
runStateDef :: Eff (StateDef s ': xs) a -> s -> Eff xs (a, s) Source #
runStateEff
specialised for the MonadState
instance.
evalStateDef :: Eff (StateDef s ': xs) a -> s -> Eff xs a Source #
evalStateEff
specialised for the MonadState
instance.
execStateDef :: Eff (StateDef s ': xs) a -> s -> Eff xs s Source #
execStateEff
specialised for the MonadState
instance.
runWriterDef :: Monoid w => Eff (WriterDef w ': xs) a -> Eff xs (a, w) Source #
runWriterDef
specialised for the MonadWriter
instance.
execWriterDef :: Monoid w => Eff (WriterDef w ': xs) a -> Eff xs w Source #
execWriterDef
specialised for the MonadWriter
instance.
runEitherDef :: Eff (EitherDef e ': xs) a -> Eff xs (Either e a) Source #
Similar to runExceptT
, but on Eff
runContDef :: Eff (ContDef r (Eff xs) ': xs) a -> (a -> Eff xs r) -> Eff xs r Source #
runContEff
specialised for the MonadCont
instance.
Orphan instances
(Monoid w, Lookup xs "Writer" ((,) w)) => MonadWriter w (Eff xs) Source # | |
Lookup xs "State" (State s) => MonadState s (Eff xs) Source # | |
Lookup xs "Reader" ((:~:) r) => MonadReader r (Eff xs) Source # | |
Lookup xs "Either" (Const e :: Type -> Type) => MonadError e (Eff xs) Source # | |
throwError :: e -> Eff xs a # catchError :: Eff xs a -> (e -> Eff xs a) -> Eff xs a # | |
(Monoid e, Lookup xs "Either" (Const e :: Type -> Type)) => Alternative (Eff xs) Source # | A bit dubious |
(Monoid e, Lookup xs "Either" (Const e :: Type -> Type)) => MonadPlus (Eff xs) Source # | |
(MonadIO m, Lookup xs "IO" m) => MonadIO (Eff xs) Source # | |
(MonadThrow m, Lookup xs "IO" m) => MonadThrow (Eff xs) Source # | |
(MonadCatch m, Lookup xs "IO" m) => MonadCatch (Eff xs) Source # | |
MonadCont (Eff (ContDef r (Eff xs) ': xs)) Source # | |
(MonadResource m, Lookup xs "IO" m) => MonadResource (Eff xs) Source # | |
liftResourceT :: ResourceT IO a -> Eff xs a # |