ID2WJIDOVGFNLXEJQAEHCKZ425N2FOB6TO2MVMW475MYNR2ONE2QC
| TypeVar(string) // Ω,α
| TermAnnot(string, typ) // Ω,x:A
| ExistentialSolved(string, monotyp) // Ω,â=τ
| Marker(string) // Ω,🢒â
| CCTypeVar(string) // Ω,α
| CCTermAnnot(string, typ) // Ω,x:A
| CCExistentialSolved(string, monotyp) // Ω,â=τ
| CCMarker(string) // Ω,🢒â
| Unit => Unit
| Var(x) => Var(x)
| Existential(_) => failwith("TODO")
| Polytype(_) => failwith("TODO")
| Arrow(a, b) => Arrow(applyContext(ctx, a), applyContext(ctx, b))
| TUnit => TUnit
| TVar(x) => TVar(x)
| TExistential(_) => failwith("TODO")
| TPolytype(_) => failwith("TODO")
| TArrow(a, b) => TArrow(applyContext(ctx, a), applyContext(ctx, b))
{
"verbose": true,
"moduleFileExtensions": ["js", "mjs"],
"extensionsToTreatAsEsm": [".bs.mjs"],
"testMatch": ["**/__tests__/**/*_test.mjs", "**/__tests__/**/*_test.bs.js"],
"transform": {
"^.+.m?js$": "babel-jest"
},
"transformIgnorePatterns": ["node_modules/(?!(rescript)/)"]
}
= Expressions
- $ id : forall a. a arrow.r a $
module.exports = {
presets: [
[
"@babel/preset-env",
{ targets: { node: "current", esmodules: false }, modules: "cjs" },
],
],
plugins: [],
};
open Jest
open Belt
open Data
open Bidir
open Expect
open! Expect.Operators
let mapFirst = a => a->Result.map(((x, _)) => x)
test("id", () => {
let id: term = Lam("x", Var("x"))
let ctx = list{}
let typ = synthesize(ctx, id)->mapFirst
Js.Console.error2("output: ", typ)
expect(typ) === Ok(TPolytype("ex0", TArrow(TVar("ex0"), TVar("ex0"))))
})