Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coot/free-category
Free categories, free arrows and free categories with monadic actions
https://github.com/coot/free-category
category free state-machine
Last synced: about 1 month ago
JSON representation
Free categories, free arrows and free categories with monadic actions
- Host: GitHub
- URL: https://github.com/coot/free-category
- Owner: coot
- License: mpl-2.0
- Created: 2018-10-21T22:10:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-04T11:27:49.000Z (over 1 year ago)
- Last Synced: 2024-04-25T12:44:07.784Z (9 months ago)
- Topics: category, free, state-machine
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/free-category
- Size: 277 KB
- Stars: 22
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# Free Category
[![Maintainer: coot](https://img.shields.io/badge/maintainer-coot-lightgrey.svg?style=for-the-badge)](http://github.com/coot)
[![Haskell/CI](https://img.shields.io/github/actions/workflow/status/coot/free-category/ci.yaml?branch=master&label=Build&style=for-the-badge)](https://github.com/coot/free-category/actions)This package contains efficient implementations of free categories. There are
various representations available:* real-time queues (C. Okasaki 'Pure Functional Data Structures')
* type aligned lists
* continuation passing style (Church encoding)Free arrows and free Kleisli categories are also included.
Free categories are useful to model state machines in a simple yet type safe
manner. For that purpose `Kleisli` categories are a very useful target which
allows to include monadic computations. This package contains a useful
generalisation of `Kleisli` categories captured by `EffectCategory` class
(categories with effects), and a (free) transformer which lifts a category to
a category with effects.## Benchmarks
Check performance characteristics of various representations:
* [report-O0](/bench/report-O0.md)
* [report-O1](/bench/report-O1.md)
* [report-O2](/bench/report-O2.md)## Resources
* [LoginStateMachine](https://github.com/coot/free-category/blob/master/examples/src/LoginStateMachine.hs):
based on [State Machines All The Way
Down](https://www.youtube.com/watch?v=xq7ZuSRgCR4) by Edwin Bradly, 2017.
You can run it with `cabal new-run examples:login-state-machine`.
* Read more [here](https://coot.me/posts/finite-state-machines.html) on
a simple example of a finite state machine encoded using a free category
using a simple GADT.
* Another
[example](https://github.com/coot/free-algebras/blob/master/examples/src/Control/Category/Free.hs).
* [Blog post](https://coot.me/posts/kleisli-categories-and-free-monads.html) on Kleisli categories.