An open API service indexing awesome lists of open source software.

https://github.com/lynn/yuki

in which I play around with bidirectional typechecking
https://github.com/lynn/yuki

Last synced: 2 months ago
JSON representation

in which I play around with bidirectional typechecking

Awesome Lists containing this project

README

        

# yuki ❄️
in which I play around with bidirectional typechecking

`pip3 install mypy parsy`, then `mypy yuki.py` and `python3 yuki.py`

it's very WIP, but one day this kind of thing will typecheck:

```ml
(* this is the very cool and good type of integer multiplication in this type system *)
(* & is taking the intersection of function types: *)
mul : (pos ->pos ->pos ) & (pos ->zero->zero) & (pos ->neg ->neg )
& (zero->pos ->zero) & (zero->zero->zero) & (zero->neg ->zero)
& (neg ->pos ->neg ) & (neg ->zero->zero) & (neg ->neg ->pos )
mul = __builtin_mul

(* and | is taking the union of value types: *)
square : (zero|pos|neg) -> (zero|pos)
square = fn x => mul x x
```

(so, the integer type is a union `zero|pos|neg`, and we infer from the type of `mul` that a `square` is indeed never `neg`ative.)