Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Haskell
branch: Operational

This branch is 4 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/Control
.gitignore
LICENSE
README.md
Setup.lhs
effects.cabal
examples.hs

README.md

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.

Something went wrong with that request. Please try again.