Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sjoerdvisscher/effects
Control.Effects
https://github.com/sjoerdvisscher/effects
eff haskell monad-transformers
Last synced: 22 days ago
JSON representation
Control.Effects
- Host: GitHub
- URL: https://github.com/sjoerdvisscher/effects
- Owner: sjoerdvisscher
- License: bsd-3-clause
- Created: 2011-10-15T19:51:45.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2019-04-14T14:38:14.000Z (over 5 years ago)
- Last Synced: 2024-09-15T01:48:06.279Z (about 2 months ago)
- Topics: eff, haskell, monad-transformers
- Language: Haskell
- Homepage: http://hackage.haskell.org/package/effects
- Size: 29.3 KB
- Stars: 19
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Control.Effects
===============Control.Effects is a Haskell library for programming with effects, like in the the [Eff language][Eff] 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 yEvery 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](https://github.com/sjoerdvisscher/effects/blob/master/examples.hs).
Another good example is the implementation of a [parser](https://github.com/nybble41/effects-parser) by Jesse McDonald.[Eff]: http://math.andrej.com/category/programming/eff/?category_name=programming/eff