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

Moo.Prelude

Description

Invocation helpers for functions with effects in a monad D and which are stored in the environment E of a reader-like monad M.

Synopsis
  • self :: Call curried => (E -> curried) -> LiftedD curried
  • call :: forall component curried. (Has component D E, Call curried) => (component D -> curried) -> LiftedD curried
  • data M :: Type -> Type
  • data E :: Type
  • data D :: Type -> Type

Documentation

self :: Call curried => (E -> curried) -> LiftedD curried Source #

Given a way of extracting from the environment E a curried function that ends in a D action, lift the curried D-function into the main monad M.

call :: forall component curried. (Has component D E, Call curried) => (component D -> curried) -> LiftedD curried Source #

Provided that the environment E Has a component, and given a way of extracting from the component a curried function that ends in a D action, lift the curried D-function into the main monad M.

The extractor must be monomorphic on the component, so that the intended instance of Has is picked.

The typical case is for the component to be a parameterized record and for the extractor to be a field accessor.

Re-exports from Moo

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.