effects: Computational Effects

[ bsd3, control, library, monads ] [ Propose Tags ]

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]

Modules

[Last Documentation]

  • Control
    • Control.Effects
      • Control.Effects.Cont
      • Control.Effects.Either
      • Control.Effects.Error
      • Control.Effects.NonDet
      • Control.Effects.State
      • Control.Effects.Writer

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0, 0.1, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4
Dependencies base (>=3 && <5), containers (>=0.4 && <0.5), newtype (>=0.2 && <0.3), void [details]
License BSD-3-Clause
Author Sjoerd Visscher
Maintainer sjoerd@w3future.com
Category Control, Monads
Home page http://github.com/sjoerdvisscher/effects
Bug tracker http://github.com/sjoerdvisscher/effects/issues
Source repo head: git clone git://github.com/sjoerdvisscher/effects.git
Uploaded by SjoerdVisscher at 2011-12-03T15:49:26Z
Distributions NixOS:0.2.4
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 5705 total (27 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-12-26 [all 7 reports]

Readme for effects-0.2.1

[back to package description]

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.