extensible-0.5: Extensible, efficient, optics-friendly data types and effects

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

Orphan instances

(Monoid w, Associate "Writer" ((,) w) xs) => 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 #

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

Methods

get :: Eff xs s #

put :: s -> Eff xs () #

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

Associate "Reader" ((:~:) r) xs => 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 #

Associate "Either" (Const e :: Type -> Type) xs => 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, Associate "Either" (Const e :: Type -> Type) xs) => 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, Associate "Either" (Const e :: Type -> Type) xs) => MonadPlus (Eff xs) Source # 
Instance details

Methods

mzero :: Eff xs a #

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

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

Methods

liftIO :: IO a -> Eff xs a #

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

Methods

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

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

Methods

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

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

Methods

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