The effects package

[Tags: bsd3, library]

Control.Effects is a library for programming with effects, like in the the Eff language by Andrej Bauer and Matija Pretnar. Effects can be used instead of monad transformers.

See the home page for some example code.


[Skip to ReadMe]

Properties

Versions0, 0.1, 0.2, 0.2.1, 0.2.2
Change logNone available
Dependenciesbase (>=3 && <5), containers (==0.4.*), newtype (==0.2.*), void [details]
LicenseBSD3
AuthorSjoerd Visscher
Maintainersjoerd@w3future.com
Stabilityexperimental
CategoryControl, Monads
Home pagehttp://github.com/sjoerdvisscher/effects
Bug trackerhttp://github.com/sjoerdvisscher/effects/issues
Source repositoryhead: git clone git://github.com/sjoerdvisscher/effects.git
UploadedSat Dec 3 15:49:26 UTC 2011 by SjoerdVisscher
DistributionsNixOS:0.2.2
Downloads880 total (48 in last 30 days)
Votes
0 []
StatusDocs not available [build log]
All reported builds failed as of 2015-05-27 [all 2 reports]

Modules

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for effects-0.2.1

Control.Effects

Control.Effects is a Haskell library for programming with effects, like in the the Eff language by Andrej Bauer and Matija Pretnar. Effects can be used instead of monad transformers, they are designed to be easier to use and to define.

Installation

cabal install effects

Using effects

Here's an example how to use the state effect from Control.Effects.State.

example :: (Int, Int)
example = run $ do
  with (ref 5) $ \x -> do
    with (ref 10) $ \y -> do
      x =: (+) <$> get x <*> get y
      y =: (+) <$> get x <*> get y
      (,) <$> get x <*> get y

Every instance of an effect is given a name (x and y in this example), which makes is possible to easily mix several instances of the same effect.

For more examples see examples.hs.