Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandonbloom/cleff
Algebraic Effect Handlers for Clojure
https://github.com/brandonbloom/cleff
Last synced: about 1 month ago
JSON representation
Algebraic Effect Handlers for Clojure
- Host: GitHub
- URL: https://github.com/brandonbloom/cleff
- Owner: brandonbloom
- Created: 2013-08-13T18:52:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-19T16:29:01.000Z (over 11 years ago)
- Last Synced: 2024-10-03T05:10:22.495Z (3 months ago)
- Language: Clojure
- Size: 148 KB
- Stars: 45
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cleff
Cleff provides a framework for extensible handling of computational effects.
The design is heavily inspired by the Eff programming language. This project
aims to provide a proof of concept implementation of all of the examples in
[Programming with Algebraic Effects and Handlers][1] by Bauer and Pretnar.## Status
The basics of first-class effects and handlers are working.
Here's a simple non-deterministic choice effect:
```clojure
(defn choose-all [c]
(handler
(value [x] [x])
c
(decide []
(concat (continue true) (continue false)))))(let [c (choice)]
(handle-with (choose-all c)
(let [x (if (effect c 'decide) 10 20)
y (if (effect c 'decide) 0 5)]
(- x y))))
;;=> (10 5 20 15)
```Lots left to do:
- Polish up the syntax
- defprotocol-style defeffect
- Subroutines for coping with core.async's lexical IOCSee the `test/` directory for some more examples.
## License
Copyright © 2013 Brandon Bloom
Distributed under the Eclipse Public License, the same as Clojure.
[1]: http://math.andrej.com/2012/03/08/programming-with-algebraic-effects-and-handlers/