The effin package

[ Tags: bsd3, control, effect, library ] [ Propose Tags ]

This package implements extensible effects, an alternative to monad transformers. The original paper can be found at http://okmij.org/ftp/Haskell/extensible/exteff.pdf. The main differences between this library and the one described in the paper are that this library does not use the Typeable type class, does not require that effects implement the Functor type class, and has a simpler API for handling effects.

For example, the following code implements a handler for exceptions:

newtype Exception e = Throw e

runException :: Effect (Exception e :+ es) a -> Effect es (Either e a)
runException = eliminate
    (\x -> return (Right x))
    (\(Throw e) k -> return (Left e))

Compare this to the corresponding code in extensible-effects (http://hackage.haskell.org/package/extensible-effects):

runExc :: Typeable e => Eff (Exc e :> r) a -> Eff r (Either e a)
runExc = loop . admin
  where
    loop (Val x) = return (Right x)
    loop (E u)   = handleRelay u loop (\(Exc e) -> return (Left e))

In particular, effect implementors are not required to do any recursion, thereby making effect handlers more composeable.

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.2.0.0, 0.2.1.0, 0.2.1.1, 0.2.1.2, 0.2.1.3, 0.3.0.1, 0.3.0.2, 0.3.0.3
Dependencies base (>=4.7 && <4.11), mtl (>=2.1 && <3) [details]
License BSD3
Copyright (c) 2014 Anthony Vandikas
Author Anthony Vandikas
Maintainer yellpika@gmail.com
Category Control, Effect
Home page https://github.com/YellPika/effin
Source repository head: git clone git://github.com/YellPika/effin.git
Uploaded Thu Aug 3 04:03:13 UTC 2017 by AnthonyVandikas
Distributions LTSHaskell:0.3.0.3, NixOS:0.3.0.3, Tumbleweed:0.3.0.2
Downloads 1897 total (19 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-08-03 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Flags

NameDescriptionDefaultType
mtl

Enable MTL support

EnabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees