https://github.com/paulcadman/lean-effects
https://github.com/paulcadman/lean-effects
algebraic-effects lean lean4
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/paulcadman/lean-effects
- Owner: paulcadman
- License: apache-2.0
- Created: 2026-01-23T13:55:31.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-03-27T14:43:53.000Z (3 months ago)
- Last Synced: 2026-03-27T22:54:46.845Z (3 months ago)
- Topics: algebraic-effects, lean, lean4
- Language: Lean
- Homepage:
- Size: 1.28 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lean-effects
`lean-effects` is an algebraic effects library for Lean that supports scoped effects.
The implementation is based on an [Agda library](https://github.com/JonasHoefer/scoped-effects-agda) by Jonas Höfer.
## Example:
```lean
import Effects
open scoped Container
open State
def tickTwice {effs : List Effect} [State Nat ∈ effs] : Prog effs Nat := do
let n ← get
put (n + 1)
let n ← get
put (n + 1)
get
def ex : Nat :=
tickTwice
|> State.eval 0
|> Prog.run
#guard ex = 2
```