extensible-effects-2.4.0.0: An Alternative to Monad Transformers

Safe HaskellSafe
LanguageHaskell2010

Control.Eff.Example

Description

Example usage of Control.Eff

Synopsis

Documentation

newtype TooBig #

The datatype for the example from the paper. See the tests for the example

Constructors

TooBig Int 

Instances

Eq TooBig # 

Methods

(==) :: TooBig -> TooBig -> Bool #

(/=) :: TooBig -> TooBig -> Bool #

Show TooBig # 

runErrBig :: Eff (Exc TooBig ': r) a -> Eff r (Either TooBig a) #

specialization to tell the type of the exception

sum2 :: Member (Reader Int) r => Member (Reader Float) r => Eff r Float #

Multiple Reader effects

writeAll :: Member (Writer a) e => [a] -> Eff e () #

Write the elements of a list of numbers, in order.

sumAll :: (Num a, Member (State a) e) => [a] -> Eff e () #

Add a list of numbers to the current state.

writeAndAdd :: (Member (Writer a) e, Member (State a) e, Num a) => [a] -> Eff e () #

Write a list of numbers and add them to the current state.

sumEff :: Num a => [a] -> a #

Sum a list of numbers.

lastEff :: [a] -> Maybe a #

Safely get the last element of a list. Nothing for empty lists; Just the last element otherwise.

lastAndSum :: Num a => [a] -> (Maybe a, a) #

Get the last element and sum of a list

data Move x where #

Constructors

Move :: Move () 

handUp :: Eff (Move ': r) a -> Eff r a #

handDown :: Eff (Move ': r) a -> Eff r a #