effect-handlers

A library for writing extensible algebraic effects and handlers. Similar to extensible-effects but with deep handlers. https://github.com/edofic/effect-handlers

Version on this page:0.1.0.6
LTS Haskell 9.14:0.1.0.8
Stackage Nightly 2017-11-20:0.1.0.8
Latest on Hackage:0.1.0.8
MIT licensed by Andraz Bajt, Blaz Repas
Maintained by Andraz Bajt

Module documentation for 0.1.0.6

There are no documented modules for this package.

effect-handlers

This is an extensible effects library for Haskell taking inspiration from the Eff language.

See these papers for the ideas and theory behind the library:

Implementation wise it's most close to extensible-effects (also see the Extensible Effects paper) but it implements deep handlers instead of shallow.

What does this library provide?

There is the Eff monad type and modules for pre-implemented effects.

  • Exception
  • IO
  • Reader
  • Search
  • State
  • Writer

It is easy to define your own effects and combine them.

Example

Most of the types are inferred, you only need to provide enough to tell the compiler how to specialize some effect handlers (e.g. readerHandler).

import Control.Effects.Cont.Eff
import Control.Effects.Cont.Reader
import Control.Effects.Cont.Exception

program = do
  v <- ask
  if v < 15 
  then throw $ show v
  else return (v+1)

run n = runPure 
                 . handle exceptionHandler 
                 . handle (readerHandler n)

res :: Integer -> Either String Integer
res n = run n program

Documentation

Haddock docs are available online

Depends on:
Used by 1 package:
comments powered byDisqus