cloudchor-0.1.0.0: Lightweight and efficient choreographic programming for cloud services
Safe HaskellNone
LanguageGHC2021

Control.Monad.Freer

Description

This module defines the freer monad Freer, which allows manipulating effectful computations algebraically.

Synopsis

Documentation

data Freer (f :: Type -> Type) a where Source #

Freer monads.

A freer monad Freer f a represents an effectful computation that returns a value of type a. The parameter f :: * -> * is a effect signature that defines the effectful operations allowed in the computation. Freer f a is called a freer monad in that it's a Monad given any f.

Constructors

Return :: forall a (f :: Type -> Type). a -> Freer f a

A pure computation.

Do :: forall (f :: Type -> Type) b a. f b -> (b -> Freer f a) -> Freer f a

An effectful computation where the first argument f b is the effect to perform and returns a result of type b; the second argument b -> Freer f a is a continuation that specifies the rest of the computation given the result of the performed effect.

Instances

Instances details
Applicative (Freer f) Source # 
Instance details

Defined in Control.Monad.Freer

Methods

pure :: a -> Freer f a #

(<*>) :: Freer f (a -> b) -> Freer f a -> Freer f b #

liftA2 :: (a -> b -> c) -> Freer f a -> Freer f b -> Freer f c #

(*>) :: Freer f a -> Freer f b -> Freer f b #

(<*) :: Freer f a -> Freer f b -> Freer f a #

Functor (Freer f) Source # 
Instance details

Defined in Control.Monad.Freer

Methods

fmap :: (a -> b) -> Freer f a -> Freer f b #

(<$) :: a -> Freer f b -> Freer f a #

Monad (Freer f) Source # 
Instance details

Defined in Control.Monad.Freer

Methods

(>>=) :: Freer f a -> (a -> Freer f b) -> Freer f b #

(>>) :: Freer f a -> Freer f b -> Freer f b #

return :: a -> Freer f a #

toFreer :: f a -> Freer f a Source #

Lift an effect into the freer monad.

interpFreer :: Monad m => (forall a1. f a1 -> m a1) -> Freer f a -> m a Source #

Interpret the effects in a freer monad in terms of another monad.