add primitive string type
This commit is contained in:
parent
aee8d5b5e1
commit
e2e9bbdccd
3 changed files with 5 additions and 29 deletions
|
|
@ -5,34 +5,6 @@ import { makeConstructors, makeMatchFn } from "./enum.js";
|
|||
import { getLeft, getRight } from "./product.js";
|
||||
import { fnType } from "./type_constructors.types.js";
|
||||
|
||||
// 'variants' is an array of (name: string, type: Type) pairs.
|
||||
// e.g., the list of variants:
|
||||
// [ { l: "price" , r: Int },
|
||||
// { l: "prices" , r: [Int] },
|
||||
// { l: "not_found", r: Unit } ]
|
||||
// results in the type:
|
||||
// (Int | ([Int] | (Unit | ⊥)))
|
||||
|
||||
// const _enumType = rootSelf => variants => {
|
||||
// // console.log("enumType..", variants);
|
||||
// if (variants.length === 0) {
|
||||
// return Bottom; // empty enum is equal to Bottom-type (cannot be instantiated)
|
||||
// }
|
||||
// const [variant, ...rest] = variants;
|
||||
// const variantType = getRight(variant);
|
||||
// return sumType
|
||||
// (self => {
|
||||
// // console.log("requested left type (of enumType)")
|
||||
// return variantType(rootSelf || self);
|
||||
// })
|
||||
// (self => {
|
||||
// // console.log("requested right type (of enumType)")
|
||||
// return _enumType(self)(rest)
|
||||
// });
|
||||
// };
|
||||
|
||||
// export const enumType = _enumType(null);
|
||||
|
||||
export const makeConstructorTypes = type => variants => {
|
||||
return variants.map(variant => {
|
||||
const variantType = getRight(variant);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue