extensible-skeleton-0: Operational-based extensible effect library

Copyright(c) Fumiaki Kinoshita 2018
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Extensible.Effect.Default

Contents

Description

Default monad runners and MonadIO, MonadReader, MonadWriter, MonadState, MonadError instances

Synopsis

Documentation

type ReaderDef r = "Reader" >: ReaderEff r Source #

mtl-compatible reader

runReaderDef :: Eff (ReaderDef r ': xs) a -> r -> Eff xs a Source #

Specialised version of runReaderEff compatible with the MonadReader instance.

type StateDef s = "State" >: State s Source #

mtl-compatible state

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.

type WriterDef w = "Writer" >: WriterEff w Source #

mtl-compatible writer

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.

type MaybeDef = "Either" >: EitherEff () Source #

Same as EitherDef ()

runMaybeDef :: Eff (MaybeDef ': xs) a -> Eff xs (Maybe a) Source #

Similar to runMaybeT, but on Eff

type EitherDef e = "Either" >: EitherEff e Source #

mtl-compatible either effect

runEitherDef :: Eff (EitherDef e ': xs) a -> Eff xs (Either e a) Source #

Similar to runExceptT, but on Eff

type ContDef r m = "Cont" >: ContT r m Source #

mtl-compatible continuation

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 # 
Instance details

Methods

writer :: (a, w) -> Eff xs a #

tell :: w -> Eff xs () #

listen :: Eff xs a -> Eff xs (a, w) #

pass :: Eff xs (a, w -> w) -> Eff xs a #

Lookup xs "State" (State s) => MonadState s (Eff xs) Source # 
Instance details

Methods

get :: Eff xs s #

put :: s -> Eff xs () #

state :: (s -> (a, s)) -> Eff xs a #

Lookup xs "Reader" ((:~:) r) => MonadReader r (Eff xs) Source # 
Instance details

Methods

ask :: Eff xs r #

local :: (r -> r) -> Eff xs a -> Eff xs a #

reader :: (r -> a) -> Eff xs a #

Lookup xs "Either" (Const e :: Type -> Type) => MonadError e (Eff xs) Source # 
Instance details

Methods

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

Instance details

Methods

empty :: Eff xs a #

(<|>) :: Eff xs a -> Eff xs a -> Eff xs a #

some :: Eff xs a -> Eff xs [a] #

many :: Eff xs a -> Eff xs [a] #

(Monoid e, Lookup xs "Either" (Const e :: Type -> Type)) => MonadPlus (Eff xs) Source # 
Instance details

Methods

mzero :: Eff xs a #

mplus :: Eff xs a -> Eff xs a -> Eff xs a #

(MonadIO m, Lookup xs "IO" m) => MonadIO (Eff xs) Source # 
Instance details

Methods

liftIO :: IO a -> Eff xs a #

(MonadThrow m, Lookup xs "IO" m) => MonadThrow (Eff xs) Source # 
Instance details

Methods

throwM :: Exception e => e -> Eff xs a #

(MonadCatch m, Lookup xs "IO" m) => MonadCatch (Eff xs) Source # 
Instance details

Methods

catch :: Exception e => Eff xs a -> (e -> Eff xs a) -> Eff xs a #

MonadCont (Eff (ContDef r (Eff xs) ': xs)) Source # 
Instance details

Methods

callCC :: ((a -> Eff (ContDef r (Eff xs) ': xs) b) -> Eff (ContDef r (Eff xs) ': xs) a) -> Eff (ContDef r (Eff xs) ': xs) a #

(MonadResource m, Lookup xs "IO" m) => MonadResource (Eff xs) Source # 
Instance details

Methods

liftResourceT :: ResourceT IO a -> Eff xs a #