interactive prompt can handle polymorphic types
This commit is contained in:
parent
a0e3aa0cb3
commit
4a4983f693
20 changed files with 485 additions and 276 deletions
|
|
@ -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),
|
||||
]};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue