This is a Haskell library which explores some ideas around continuations and co-exponentials.
The library has the following modules:
Control.Monad.Coexp
: a monadic interface for coexponentialsControl.Monad.Control
: a monadic interface for control operators using coexponentialsData.Coexp
: implementation of coexponential types usingCont
Data.Coexp.Backtrack
: backtracking combinatorsControl.Monad.Free.Control
: codensity encoding ofFree
monads using coexponentialsControl.Arrow.Coapply
: coarrowsData.Profunctor.Coclosed
: coclosed profunctors
The examples are implemented in the following modules.
Examples.SAT.Guess
: bruteforce SAT solver using continuationsExamples.SAT.Backtrack
: backtracking SAT solver using the coexponential combinatorsExamples.Eff.Toss
: Sam Lindley's drunken toss example of effect handlers encoded using codensityExamples.TS.Backtrack
: backtracking tree search using the coexponential combinators
There is a test suite which:
- benchmarks the brute-force SAT solver against the backtracking SAT solver, and
- runs some test cases on the drunken toss example,
- tests the tree search example.
$ cabal build all
$ cabal run coexp-test -- --quickcheck-tests 1000
Any contributions and suggestions are most welcome.
Here are some other repositories (that I know of), which also explore continuations and co-exponentials: