The Hybrid Type System
Row + Implicit arguments + MLF(WIP).
Notes about System F
Before implementing MLF:
choose: forall a. a -> a -> a
auto : forall a. a -> a
(choose auto) : (forall a. a —> a) -> (forall a. a -> a)
// if auto is defined without annotations, polymorphisms of lambdas get lost
auto2 : a -> a
(choose auto) : (a -> a) -> (a -> a)
Notes about System F-Omega
Kind checker is not implemented.
Usage
from hybridts.tc_state import TCState
from hybridts.type_encoding import row_of_map, record_of_row, poly_row, empty_row
tctx = {}
tcs = TCState(tctx)
x1 = tcs.new_var()
x2 = tcs.new_var()
int_t = tcs.mk_new_type("base.int") # nominal type
tcs.unify(x1, int_t)
tcs.unify(x1, x2)
assert tcs.infer(x1) == int_t
assert tcs.infer(x2) == int_t
x3 = tcs.new_var()
r1 = row_of_map({'a': x1, 'b': x3}, empty_row)
r1 = record_of_row(r1)
tho = tcs.new_var()
r2 = row_of_map({'a': x3}, poly_row(tho))
r2 = record_of_row(r2)
tcs.unify(r1, r2)
print(tcs.infer(r1))
print(tcs.infer(r2))
# (RecordT, (RowConsT, 'b', (NomT, 'base.int'), (RowConsT, 'a', (NomT, 'base.int'), (RowMonoT,))))
# (RecordT, (RowConsT, 'a', (NomT, 'base.int'), (RowPolyT, (RecordT, (RowConsT, 'b', (NomT, 'base.int'), (RowMonoT,)
Metadata
Release files for hybrid-type-system 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hybrid_type_system-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / hybrid_type_system-0.2-py3-none-any.whl
| Download URL | hybrid_type_system-0.2-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1728127f92a60cdd16b2c43bf5d688e675a9fd0b961ee7b7b93e0ae2e9ae43aa
|
|
BLAKE2b-256 checksum How to use checksums |
510144ea5d4396278290dbd86e9a773124f205f98e13ea973c3948b8c5588ed3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.7.4
|