Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vikraman/hs-coexp
Continuations and Co-exponentials
https://github.com/vikraman/hs-coexp
category-theory continuations duality
Last synced: 3 days ago
JSON representation
Continuations and Co-exponentials
- Host: GitHub
- URL: https://github.com/vikraman/hs-coexp
- Owner: vikraman
- License: mit
- Created: 2023-05-12T22:58:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-16T09:18:14.000Z (3 months ago)
- Last Synced: 2024-10-18T00:45:59.941Z (3 months ago)
- Topics: category-theory, continuations, duality
- Language: Haskell
- Homepage:
- Size: 24.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# hs-coexp
[![ci](https://github.com/vikraman/hs-coexp/actions/workflows/ci.yml/badge.svg)](https://github.com/vikraman/hs-coexp)
This is a Haskell library which explores some ideas around continuations and co-exponentials.
## Modules
The library has the following modules:
- `Control.Monad.Coexp`: a monadic interface for coexponentials
- `Control.Monad.Control`: a monadic interface for control operators using coexponentials
- `Data.Coexp`: implementation of coexponential types using `Cont`
- `Data.Coexp.Backtrack`: backtracking combinators
- `Control.Monad.Free.Control`: codensity encoding of `Free` monads using coexponentials
- `Control.Arrow.Coapply`: coarrows
- `Data.Profunctor.Coclosed`: coclosed profunctorsThe examples are implemented in the following modules.
- `Examples.SAT.Guess`: bruteforce SAT solver using continuations
- `Examples.SAT.Backtrack`: backtracking SAT solver using the coexponential combinators
- `Examples.Eff.Toss`: Sam Lindley's drunken toss example of effect handlers encoded using codensity
- `Examples.TS.Backtrack`: backtracking tree search using the coexponential combinators## Usage
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.``` sh
$ cabal build all
$ cabal run coexp-test -- --quickcheck-tests 1000
```## Comments
Any contributions and suggestions are most welcome.
Here are some other repositories (that I know of), which also explore continuations and co-exponentials:
- https://github.com/mstewartgallus/prologish/
- https://github.com/fresnel/fresnel
- https://github.com/robrix/sequoia
- https://github.com/jmanuel1/idris-stuff/