moo-nad-0.1.0.2: Invocation helpers for the ReaderT-record-of-functions style.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Moo (signature[?])

Description

A module signature for reader-like monads carrying a record-of-functions as environment.

To be useful for writing indefinite code, it should be expanded through "signature merging" to require extra instances for the main monad M (like MonadIO or MonadUnliftIO) and/or the environment type E (like some HasX typeclass).

https://github.com/danidiaz/really-small-backpack-example/tree/master/lesson3-signature-merging

Synopsis

Documentation

data M :: Type -> Type #

A reader-like monad.

Instances

Instances details
Monad M # 
Instance details

Defined in Moo

Methods

(>>=) :: M a -> (a -> M b) -> M b #

(>>) :: M a -> M b -> M b #

return :: a -> M a #

Functor M # 
Instance details

Defined in Moo

Methods

fmap :: (a -> b) -> M a -> M b #

(<$) :: a -> M b -> M a #

Applicative M # 
Instance details

Defined in Moo

Methods

pure :: a -> M a #

(<*>) :: M (a -> b) -> M a -> M b #

liftA2 :: (a -> b -> c) -> M a -> M b -> M c #

(*>) :: M a -> M b -> M b #

(<*) :: M a -> M b -> M a #

MonadReader E M # 
Instance details

Defined in Moo

Methods

ask :: M E #

local :: (E -> E) -> M a -> M a #

reader :: (E -> a) -> M a #

data E :: Type #

The monad environment.

Instances

Instances details
MonadReader E M # 
Instance details

Defined in Moo

Methods

ask :: M E #

local :: (E -> E) -> M a -> M a #

reader :: (E -> a) -> M a #

data D :: Type -> Type #

The monad in which the functions in the environment have their effects.

We don't require Functor, Applicative or Monad from D because the plan is to always lift D values to M as soon as they're obtained.

liftD :: D x -> M x #

Lifts an effects from the secondary monad D into M.