Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

Example usage of Control.Eff

- writeAll :: (Typeable a, Member (Writer a) e) => [a] -> Eff e ()
- sumAll :: (Typeable a, Num a, Member (State a) e) => [a] -> Eff e ()
- writeAndAdd :: (Member (Writer a) e, Member (State a) e, Num a, Typeable a) => [a] -> Eff e ()
- sumEff :: (Num a, Typeable a) => [a] -> a
- lastEff :: Typeable a => [a] -> Maybe a
- lastAndSum :: (Typeable a, Num a) => [a] -> (Maybe a, a)

# Documentation

writeAll :: (Typeable a, Member (Writer a) e) => [a] -> Eff e () Source

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

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

Add a list of numbers to the current state.

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

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

lastEff :: Typeable a => [a] -> Maybe a Source

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

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

Get the last element and sum of a list