interactive prompt can handle polymorphic types

This commit is contained in:
Joeri Exelmans 2025-04-02 15:49:43 +02:00
parent a0e3aa0cb3
commit 4a4983f693
20 changed files with 485 additions and 276 deletions

View file

@ -1,5 +1,5 @@
import { prodType } from "./types.js";
import { Type } from "../primitives/types.js";
import { GenericType, Type } from "../primitives/types.js";
import { typedFnType } from "./types.js";
import { makeGeneric } from "../generics/generics.js";
import { sumType } from "./types.js";
@ -31,7 +31,7 @@ export const ModuleSum = {l:[
fnType
(a)
(sumType(a)(b))
)),
), GenericType),
// b -> a | b
...typedFnType(constructorRight, fnType =>
@ -39,7 +39,7 @@ export const ModuleSum = {l:[
fnType
(b)
(sumType(a)(b))
)),
), GenericType),
// a | b -> (a -> c, b-> c) -> c
...typedFnType(match, fnType =>
@ -53,5 +53,5 @@ export const ModuleSum = {l:[
)
(c)
)
)),
), GenericType),
]};