All Projects → sjoerdvisscher → effects

sjoerdvisscher / effects

Licence: BSD-3-Clause license
Control.Effects

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to effects

sealed-monad
Scala library for nice business logic oriented, for-comprehension-style error handling
Stars: ✭ 16 (-15.79%)
Mutual labels:  monad-transformers
freedsl
Practical effect composition library based on abstract wrapping type and the free monad
Stars: ✭ 37 (+94.74%)
Mutual labels:  monad-transformers
tryt.scala
Monad transformers for exception handling
Stars: ✭ 18 (-5.26%)
Mutual labels:  monad-transformers
Language Ext
C# functional language extensions - a base class library for functional programming
Stars: ✭ 3,964 (+20763.16%)
Mutual labels:  monad-transformers
RAII.scala
Resource Acquisition Is Initialization
Stars: ✭ 31 (+63.16%)
Mutual labels:  monad-transformers
monad-memo
Memoization monad transformer
Stars: ✭ 29 (+52.63%)
Mutual labels:  monad-transformers
eff.lua
ONE-SHOT Algebraic Effects for Lua!
Stars: ✭ 32 (+68.42%)
Mutual labels:  eff

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. Another good example is the implementation of a parser by Jesse McDonald.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].