Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreypopp/type-systems
Playing with type systems
https://github.com/andreypopp/type-systems
hindley-milner ocaml type-inference type-systems typeclasses
Last synced: 6 days ago
JSON representation
Playing with type systems
- Host: GitHub
- URL: https://github.com/andreypopp/type-systems
- Owner: andreypopp
- Created: 2021-10-15T18:59:35.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-29T19:36:39.000Z (23 days ago)
- Last Synced: 2025-01-08T12:52:16.601Z (13 days ago)
- Topics: hindley-milner, ocaml, type-inference, type-systems, typeclasses
- Language: OCaml
- Homepage:
- Size: 199 KB
- Stars: 48
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# type-systems
- `algo_w` - Algorithm W extended with "Extensible Records with Scoped Labels"
and Multi Parameter Typeclasses.This follows closely [tomprimozic/type-systems] and then [THIH][] (Typing
Haskell in Haskell). Note that this tries to support multi-parameter typeclasses
(MPTC) but generalization is currently buggy for typeclasses with multiple parameters.
See `hmx_tc` implementation for the bug-free HM + MPTC implementation.- `hmx` - [HM(X)][] style implementation of Hindley Minler type inference.
The main idea is to introduce constraint language and split the algo into two
phases — first generate constraints from terms, then solve those constraints.This implementation also does elaboration, the `infer` function has the
following signature:
```
val infer : env:Env.t -> expr -> (expr, Error.t) result
```
That means that `infer` returns not just the type of the expression but an
elaborated expression (an original expression annotated with types).The elaboration mechanism is shamelessly stolen from [inferno][].
- `hmx_tc` - extends [HM(X)][] with Multi-Parameter Typeclasses (MPTC).
Type inference and elaborator are implemented but the environment construction
doesn't check for overlapping instances yet.# Development
```
make init
make build
make test
```# References
- https://en.wikipedia.org/wiki/Hindley–Milner_type_system
- https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/scopedlabels.pdf
- https://www.cs.tufts.edu/~nr/cs257/archive/martin-odersky/hmx.pdf
- https://web.cecs.pdx.edu/~mpj/thih/thih.pdf
- https://github.com/tomprimozic/type-systems
- https://gitlab.inria.fr/fpottier/inferno/
- https://github.com/naominitel/hmx[HM(X)]: https://www.cs.tufts.edu/~nr/cs257/archive/martin-odersky/hmx.pdf
[inferno]: https://gitlab.inria.fr/fpottier/inferno/
[THIH]: https://web.cecs.pdx.edu/~mpj/thih/thih.pdf
[tomprimozic/type-systems]: https://github.com/tomprimozic/type-systems