Checkpoint type signatures

node v18.11.0
version: 1.0.0
endpointsharetweet
const ObjectOwnPropertyKeys = Reflect.ownKeys; const given = f => f(); const { assign: ObjectAssign, create: ObjectCreate, keys: ObjectKeys, entries: ObjectEntries, freeze: ObjectFreeze, fromEntries: ObjectFromEntries, hasOwn: ObjectHasOwn, getPrototypeOf: ObjectGetPrototypeOf, setPrototypeOf: ObjectSetPrototypeOf, } = Object; const { isArray: ArrayIsArray } = Array; const { join: ArrayPrototypeJoin, map: ArrayPrototypeMap } = Array.prototype; const ArrayF = ObjectFromEntries(["filter", "map", "join", "reduce"] .map(name => given(( f = Array.prototype[name]) => [name, (array, ...args) => Call(f, array, ...args)]))); const { toString: ObjectPrototypeToString } = Object.prototype; const ObjectFilter = (object, f) => ObjectFilterEntries(object, ([key, value]) => f(value, key)); const ObjectFilterKeys = (object, f) => ObjectFilter(object, (_, key) => f(key)); const ObjectFilterEntries = (object, f) => ObjectFromEntries(ObjectEntries(object).filter(f)); const ObjectMap = (object, f) => ObjectMapEntries(object, ([key, value]) => [key, f(value, key)]); const ObjectMapEntries = (object, f) => ObjectFromEntries(ObjectOwnPropertyKeys(object) .map(key => f([key, object[key]]))); const { has: WeakMapProrotypeHas, get: WeakMapPrototypeGet, set: WeakMapPrototypeSet } = WeakMap.prototype; const { entries: MapPrototypeEntries, get: MapPrototypeGet, has: MapPrototypeHas, keys: MapPrototypeKeys, values: MapPrototypeValues } = Map.prototype;
const IsNull = V => V === null; const IsString = V => typeof V === "string"; const IsCallable = V => typeof V === "function"; const IsNonCallableObject = V => !IsNull(V) && typeof V === "object"; const IsObject = value => !IsNull(value) && typeof value === "object" || typeof value === "function"; const Call = Function.prototype.call.bind(Function.prototype.call); const IsNotNull = value => value !== null;
const { IsReifiedObject, GetInternalSlot, GetInstanceData, ReifiedObjectClaim, } = given(( InternalSlotsForReifiedObjects = new WeakMap(), WeakMapHas = (WM, K, V) => WM.has(K, V), WeakMapKey = (WM, K, V) => (WM.set(K, V), K), WeakMapSet = (WM, K, V) => WM.set(K, V), WeakMapGet = (WM, K, f) => WM.get(K)) => ({ IsReifiedObject: O => WeakMapHas(InternalSlotsForReifiedObjects, O), GetInternalSlot: (ReifiedObject, InternalSlot) => WeakMapGet(InternalSlotsForReifiedObjects, ReifiedObject)[InternalSlot], GetInstanceData: ReifiedObject => GetInternalSlot(ReifiedObject, "[[InstanceData]]"), ReifiedObjectClaim: ( ImmutablePlatformPrototype, /* :: Immutable<PlatformPrototype> */ [Type, TypeId], /* :: Left [Type] | Right [false, TypeId] */ CaseName, /* :: string */ InstanceData, /* :: Immutable<PlatformObject> | null */ UnreachablePlatformNucleus /* :: Unreachable<PlatformObject> */, OptionalPropertiesToCopy /* :: PlatformObject | null | undefined */) => given(( nucleusPrototype = ObjectGetPrototypeOf(UnreachablePlatformNucleus), needsSetPrototypeOf = nucleusPrototype !== ImmutablePlatformPrototype, targetPrototyped = needsSetPrototypeOf ? ObjectSetPrototypeOf( UnreachablePlatformNucleus, ImmutablePlatformPrototype) : UnreachablePlatformNucleus, targetDetailed = !!OptionalPropertiesToCopy ? ObjectAssign( targetPrototyped, OptionalPropertiesToCopy) : targetPrototyped, targetImmutable = ObjectFreeze(targetDetailed)) => WeakMapKey( InternalSlotsForReifiedObjects, targetImmutable, ObjectFreeze(ObjectSetPrototypeOf( { "[[Type]]": [Type, TypeId], "[[Case]]": CaseName, "[[InstanceData]]": InstanceData }, null)))) }));
const ToUnreachablePlatformFunction = given(( AdditionalParameterNames = { "LEXICAL": [], "STRICT": ["Call"], "CONSTRUCTOR": ["Call"] }, TargetFunctionSourceText = { "LEXICAL": `: (...args) => FunctionBody(...args)`, "STRICT": `(...args) { return Call(FunctionBody, this, ...args) }`, "CONSTRUCTOR": `: function (...args) { return Call( FunctionBody, this, new.target, ...args) }` }, FIXME_quote = x => `"${x}"`) => (ThisMode, FunctionName, FunctionBody, PropertiesToCopy) => given(( quotedFunctionName = FIXME_quote(FunctionName), toUnreachablePlatformFunction = new Function( "FunctionBody", ...AdditionalParameterNames[ThisMode], `return { ${quotedFunctionName}` + TargetFunctionSourceText[ThisMode] + `}[${quotedFunctionName}]`), platformFunction = ThisMode === "LEXICAL" ? toUnreachablePlatformFunction(FunctionBody) : toUnreachablePlatformFunction(FunctionBody, Call), propertiedFunction = PropertiesToCopy ? ObjectAssign(platformFunction, PropertiesToCopy) : platformFunction) => propertiedFunction));
/* [1, "Hello"] [1, "Bye", []] const TypeExpression = ["TypeReference", "TypeFunctionCall"] .map(kind => ToUnreachablePlatformFunction(kind, (level, ...args) => ({ kind, level }) ))*/
const ToBridgePrototype = given(( toString = ToUnreachablePlatformFunction( "STRICT", "toString", ObjectPrototypeToString), toStringTag = Symbol.toStringTag, toPrototypeProperties = (ToStringTag, PropertiesToCopy) => PropertiesToCopy ? { [toStringTag]: ToStringTag, toString, ...PropertiesToCopy } : { [toStringTag]: ToStringTag, toString }) => ( ConstructorName, PropertiesToCopy, BasePrototype) =>(console.log(ConstructorName)) || ObjectFreeze( ObjectAssign( ObjectSetPrototypeOf( ToUnreachablePlatformFunction( "CONSTRUCTOR", ConstructorName, () => { throw "OH NO!" }).prototype, null), toPrototypeProperties( ConstructorName, PropertiesToCopy)))); const IsSelfApplicable = value => IsCallable(value) && /^(?:\(\s*)?(?:self|callee)(?=[,\s\)])/.test(value + "");
const BootstrapTypeSchemas = { "Maybe": { "parameters": ["of"], "cases": { "Just": T๐‘ => T๐‘(1).CaseDefinition({ "value": { "domain": () => T๐‘.parameter("of"), "fallback": () => T๐‘.Maybe.None(T๐‘.parameter("of")), "variadic": false } }), "None": T๐‘ => T๐‘(1).CaseDefinition({ }) }, "prototype": { fromMaybe: (self, fallback) => caseof(self, { Just: self => self.value, None: () => fallback }) } }, "Function": { "parameters": ["returning"],//, "parameters"] "cases": { "": T๐‘ => T๐‘(1).CaseDefinition({ }) }, "prototype": { } }, "Dictionary": { "parameters": ["key", "value"], "cases": { "": T๐‘ => T๐‘(1).CaseDefinition({ "count": T๐‘(1).FieldDefinition.Parameter({ "domain": () => T๐‘.number, "initializer": () => 0, "variadic": false }), /*"platformDictionary": { "domain": }*/ }) }, "prototype": { get: (self, key) => self.platformDictionary.get(key), has: (self, key) => self.platformDictionary.has(key), entries: self => self.platformDictionary.entries(), keys: self => self.platformDictionary.keys(self), map: (self, f) => Universe(L).CaseDefinitionDictionary( self.entries().map(([key, value]) => [key, f(value, key)])) } }, "FieldDefinition": { "cases": { "Parameter": T๐‘ => T๐‘(1).CaseDefinition({ "domain": T๐‘(1).FieldDefinition.Parameter({ // For some U(L).Field(L), the domain will be Type(L) // Which means that the *domain of the domain* needs to // be able to store Type(L), which requires Type(L + 1). // // [1, "Function", [[1, "Type"], [1, "Type"]], () => ] // (I๐‘, L) => I๐‘.ToFunction( // L + 1, [[L + 1, "Type"]], () => Universe(L).Type), // domain: Type(0). We always defer, so that means the VALUE is // () => Type(0). // "domain": [1, "Function", [[1, "Type"], [1, "Type"]], "", [0, "Type", 0]], "domain": () => T๐‘.ฦ’(T๐‘.Type), // Someone making a different domain field would still have to return // SOMETHING of Type(1), so we provide no fallback function. Thus: // Maybe(Function(Type(1))).None // You must provide a type of type Type(0), so we have no fallback. // Thus, Maybe(() -> Type(0)).None // "fallback": [1, "Maybe", [[1, "Function", [[1, "Type"], [1, "Type"]]], "None"], "fallback": () => T๐‘.Maybe.None(T๐‘.ฦ’(T๐‘.Type0)), "variadic": false }), "fallback": T๐‘(1).FieldDefinition.Parameter({ // () => T๐‘.Maybe(T๐‘.ฦ’(domain())) // domain: Maybe(() -> domain.domain()T) "domain": ({ domain }) => T๐‘.Maybe(T๐‘.ฦ’(domain())), // T๐‘.Maybe.Just(({ domain }) => "fallback": ({ domain }) => T๐‘.Maybe.Just(T๐‘.Maybe.None(T๐‘.ฦ’(domain()))), //T๐‘.Maybe.Just(T๐‘.Maybe.None(T๐‘.ฦ’(T๐‘.Type0))), "variadic": false }), "variadic": T๐‘(1).FieldDefinition.Parameter({ "domain": () => T๐‘.boolean, "fallback": () => T๐‘.Maybe.Just(false), "variadic": false }) }), "Computed": T๐‘ => T๐‘(1).CaseDefinition.Parameter({ "domain": T๐‘(1).FieldDefinition({ // [1, "Function", [[1, "Type"], [1, "Type"]], "", [0, "Type", 0]], "domain": () => T๐‘.ฦ’(T๐‘.Type0), // [1, "Maybe", [[1, "Function", [[1, "Type"], [1, "Type"]]], "None"] "fallback": () => T๐‘.Maybe.None(T๐‘.ฦ’(T๐‘.Type0)), "variadic": false }), "initializer": T๐‘(1).FieldDefinition.Parameter({ // Since we returned Type(0) for our domain above, the domain of our initializer is // any function that returns Type(0). Again, we have to "thunk" this, so we wrap it in // a function... The type of that function is Function(Function(Type(1))) and thus returns // the TYPE () -> Type(0) "domain": ({ domain }) => T๐‘.ฦ’(domain()), // [1, "Function", [[1, "Function", [[1, "Type"], []]]], "", // [1, "Function", [[0, "Type"], [1, "Type"]], ""]] "fallback": ({ domain }) => T๐‘.Maybe.None(T๐‘.ฦ’(domain())), //"fallback": [1, "Maybe", [[1, "Function", [[1, "Function", [[1, "Type"], []]]]]], "None"], "variadic": false }) }) }, "prototype": { } }, "CaseDefinition": { "cases": { "": T๐‘ => T๐‘(1).CaseDefinition({ "fields": T๐‘(1).FieldDefinition.Parameter({ // The domain of FieldDefiniton0's domain is Type(0), meaning it can // hold any Type(0) type. What the means is that the TYPE of domain // is Type(1), since it needs to be able to hold Type(0). We additionally // then "thunk" it, so it's actually () => Type(0), so the type is // () => Type(1), since () => Type(0) ISA Type(1) // // The fields field in CaseDefinitions must hold FieldDefinition of the same // level. CaseDefinition0 holds a Dictionary of FieldDefiniton0's. // CaseDefinition0 ISA Type(1) and is itself of course described by // FieldDefinition1's. So, domain's type is () => Type(1). However, it // still returns Dictionary0(string, FieldDefinition0) // [1, "Function", [[1, "Function", [[1, "Type"]]]]] // T๐‘.ฦ’1 // T๐‘.ฦ’1(T๐‘.Type(1))(T๐‘.Dictionary0(T๐‘.string, T๐‘.FieldDefinition0)), /* T๐‘.Maybe(T๐‘.ฦ’(T๐‘.Dictionary0(T๐‘.string, T๐‘.FieldDefinition0))) .Just(T๐‘.ฦ’(T๐‘.Dictionary0(T๐‘.string, T๐‘.FieldDefinition0))( T๐‘.Dictionary0(T๐‘.string, T๐‘.FieldDefinition0))()),*/ "domain": () => T๐‘.Dictionary0(T๐‘.string, T๐‘.FieldDefinition0), "fallback": () => T๐‘.Maybe.Just( T๐‘.Dictionary0(T๐‘.string, T๐‘.FieldDefinition0, 0)), "variadic": false }) }) }, "prototype": { } }, "TypeDefinition": { "cases": { "": T๐‘ => T๐‘(1).CaseDefinition({ "name": T๐‘(1).FieldDefinition.Parameter({ "domain": () => T๐‘.Maybe1(T๐‘.string), "fallback": () => T๐‘.Maybe.Just(T๐‘.Maybe(T๐‘.string).None), "variadic": false }), "cases": T๐‘(1).FieldDefinition({ "domain": () => T๐‘.Dictionary0(T๐‘.string, T๐‘.CaseDefinition0), "fallback": () => T๐‘.Maybe.Just(() => T๐‘.Dictionary0(T๐‘.string, T๐‘.CaseDefinition0, 0)), "variadic": false }) }) }, "prototype": { } }, };
const ToImmutableFunction = ( FunctionName, FunctionBody, PropertiesToCopy) => ToUnreachablePlatformFunction( "LEXICAL", FunctionName, FunctionBody, PropertiesToCopy); const [Universe, U, T๐‘] = given(( PrimitiveTypeNames = [ "bigint", "boolean", "number", "null", "string", "symbol", "undefined" ], EncodedPrimitiveTypes = ObjectFromEntries( ArrayF.map( PrimitiveTypeNames, TypeName => [TypeName, [0, TypeName]])), SkeletonSchemas = BootstrapTypeSchemas, ToDeepestTypeLevel = EncodedTypes => ArrayF.reduce( ArrayF.map(EncodedTypes, ([Level]) => Level), (L1, L2) => Math.max(L1, L2), 0), IsEncodedType = EncodedObject => EncodedObject.length <= 3, IsEncodedBaseType = EncodedObject => IsEncodedType(EncodedObject) && EncodedObject[1] === "Type", GetEncodedTypeLevel = EncodedObject => EncodedObject[0], GetPrimitiveTypeName = V => IsNull(V) ? "null" : typeof V, GetEncodedTypeOf = EncodedObject => !ArrayIsArray(EncodedObject) ? [0, GetPrimitiveTypeName(EncodedObject)] : IsEncodedBaseType(EncodedObject) ? [GetEncodedTypeLevel(EncodedObject) + 1, "Type"] : IsEncodedType(EncodedObject) ? [GetEncodedTypeLevel(EncodedObject), "Type"] : ArrayF.slice(EncodedObject, 0, 3), IsNotPrimaryCase = CaseName => CaseName !== "", ToEncodedCaseConstructor = (EncodedType, CaseName, PropertiesToCopy) => ToImmutableFunction(`${EncodedType[1]}.${CaseName}`, Nucleus => [...EncodedType, CaseName, Nucleus], PropertiesToCopy), ToEncodedTypeShorthand = (EncodedType, cases) => given(( NamedConstructors = ObjectFilterKeys(cases, IsNotPrimaryCase)) => ToEncodedCaseConstructor(EncodedType, "", ObjectMap(NamedConstructors, (_, CaseName) => ToEncodedCaseConstructor(EncodedType, CaseName)))), ToEncodedTypeFunction = ({ parameters, cases }, TypeName) => ToImmutableFunction(TypeName, (...TypeArguments) => given(( DeepestTypeLevel = ToDeepestTypeLevel(TypeArguments), EncodedType = [DeepestTypeLevel, TypeName, TypeArguments]) => ToEncodedTypeShorthand(EncodedType, cases))), IsTypeFunctionSchema = Schema => ObjectHasOwn(Schema, "parameters"), EncodedTypeFunctions = ObjectMap( ObjectFilter(SkeletonSchemas, IsTypeFunctionSchema), ToEncodedTypeFunction), TypeSchemas = ObjectFilter( SkeletonSchemas, Schema => !IsTypeFunctionSchema(Schema)), EncodedTypes = ObjectAssign(...ArrayF.map( [0, 1], Level => ObjectMapEntries( TypeSchemas, ([TypeName, { cases }]) => [ `${TypeName}${Level}`, ToEncodedTypeShorthand([Level, TypeName, 0], cases)]))), Schemas = ObjectAssign( EncodedPrimitiveTypes, EncodedTypeFunctions, EncodedTypes), IsTypeIdentifier = typeExpression => IsString(typeExpression[1]), IsTypeFunctionCall = typeExpression => ArrayIsArray(typeExpression[1]), ToTypeIdentifier = (L, TypeName) => [L, TypeName], ToTypeFunctionCall = (TypeCallee, TypeArguments) => [TypeCallee, TypeArguments], ToTypePrototypeKey = typeExpression => IsTypeFunctionCall(typeExpression) ? ToTypePrototypeKey(typeExpression[0]) : typeExpression[0], ToTypeExpressionString = given(( ToLevelSubscript = given(( subscripts = "โ‚€โ‚โ‚‚โ‚ƒโ‚„โ‚…โ‚†โ‚‡โ‚ˆโ‚‰") => L => (L + "").replace(/\d/g, d => subscripts[d]))) => typeExpression => IsTypeIdentifier(typeExpression) ? given(( [L, TypeName] = typeExpression) => L === 0 ? TypeName : `${TypeName}${ToLevelSubscript(L)}`) : `${ToTypeExpressionString(typeExpression[0])}(${ ArrayF.join( ArrayF.map(typeExpression[1], ToTypeExpressionString), ", ")})`), ToTypeCaseName = (TypeSignature, CaseName) => CaseName === "" ? ToTypeExpressionString(TypeSignature) : `${ToTypeExpressionString(TypeSignature)}.${CaseName}`, ToUniverse = f => given(( Universes = ObjectCreate(null)) => L => GetOrSetOwnProperty(Universes, L, f)), TypeUniverse = ToUniverse(L => given(( S = BootstrapTypeSchemas) => S)), /* ToPrototypeKey = TypeSignature => TypeSignature.TypeFunctionName ? TypeSignature.TypeFunctionName : TypeSignature.TypeName*/ ToCaseDefinition = (TypeSignature, CaseName, PropertiesToCopy) => ToImmutableFunction( ToTypeCaseName(TypeSignature, CaseName), Nucleus => ReifiedObjectClaim( ToBridgePrototype( ToTypeCaseName(TypeSignature, CaseName), null, { hi: "hello" }), //PrototypeUniverse(1)[ToTypePrototypeKey(TypeSignature)][CaseName], [false, TypeSignature], CaseName, null, Nucleus, null), PropertiesToCopy), ToToCaseDefinition = (TypeSignature, CaseName, PropertiesToCopy) => ToImmutableFunction( ToTypeCaseName(TypeSignature, CaseName), Nucleus => ReifiedObjectClaim( ToBridgePrototype( ToTypeCaseName(TypeSignature, CaseName), null, { hi: "hello" }), //PrototypeUniverse(1)[ToTypePrototypeKey(TypeSignature)][CaseName], [false, TypeSignature], CaseName, null, Nucleus, null), PropertiesToCopy), /* PrototypeUniverse = ToUniverse(L => ObjectMap( BootstrapTypeSchemas, ({ cases, prototype }, TypeName) => given(( //TypeExpression = TypeNameL = ToTypeCaseName(L, TypeName), TypePrototype = ToBridgePrototype( TypeNameL, ObjectMap(prototype, (value, name) => IsSelfApplicable(value) ? ToUnreachablePlatformFunction( "STRICT", value.name, function (...args) { return value(this, ...args); }) : valeu), null), OnlyHasPrimaryCase = ObjectKeys(cases).length === 1 && ObjectHasOwn(cases, "")) => OnlyHasPrimaryCase ? { "": TypePrototype } : ObjectMap(cases, (_, CaseName) => ToBridgePrototype( ToTypeCaseName(L, TypeName, CaseName), null, TypePrototype))))),*/ /*TypeSchemas = ObjectFilter( SkeletonSchemas, Schema => !IsTypeFunctionSchema(Schema)),*/ // ToTypeName = typeSignature => TypeFunctionSchemas = ObjectFilter( SkeletonSchemas, IsTypeFunctionSchema), ToTypeDefinition = ({ cases }, TypeSignature) => given(( NamedConstructors = ObjectFilterKeys(cases, IsNotPrimaryCase)) => ToToCaseDefinition(TypeSignature, "", ObjectMap(NamedConstructors, (_, CaseName) => ToToCaseDefinition(TypeSignature, CaseName)))), ToToType = ({ cases }, TypeSignature) => given(( NamedConstructors = ObjectFilterKeys(cases, IsNotPrimaryCase)) => ToToCaseDefinition(TypeSignature, "", ObjectMap(NamedConstructors, (_, CaseName) => ToToCaseDefinition(TypeSignature, CaseName)))), ToToTypeFunction = ({ parameters, cases }, TypeFunctionIdentifier) => ToImmutableFunction( ToTypeExpressionString(TypeFunctionIdentifier), (...TypeArguments) =>(console.log(TypeArguments), ToToType({ cases }, ToTypeFunctionCall( TypeFunctionIdentifier, ArrayF.map(TypeArguments, T => [0, T.name]))))), PrimitiveTypes = ObjectFromEntries(ArrayF .map(PrimitiveTypeNames, PrimitiveTypeName => [ PrimitiveTypeName, ToToType({ cases: {} }, [0, PrimitiveTypeName])])), TypeUniverse2 = ObjectAssign(ToUniverse(L => ObjectAssign( ObjectMap(TypeSchemas, (schema, name) => ToToType(schema, ToTypeIdentifier(L, name))), ObjectMap(TypeFunctionSchemas, (schema, name) => ToToTypeFunction(schema, ToTypeIdentifier(L, name))))), PrimitiveTypes), /* given(( definitionTemplates = ObjectMap( BootstrapTypeSchemas, ToToType)) => definitionTemplates)),*/ I๐‘ = ToUnreachablePlatformFunction("LEXICAL", "I๐‘", ( Level, TypeName, TypeArguments, OptionalCaseName, OptionalNucleus) => [ Level, TypeName, TypeArguments, OptionalCaseName, OptionalNucleus ], ObjectAssign( EncodedPrimitiveTypes, EncodedTypeFunctions, EncodedTypes))) => [I๐‘, TypeUniverse, TypeUniverse2]); const GetOrSetOwnProperty = (O, P, fallback) => ObjectHasOwn(O, P) ? O[P] : (O[P] = fallback(P)); /* Generators = { TypeDefinition = (L, name, schema) => U๐‘(L + 1).TypeDefinition({ name, }) I๐‘(L, "TypeDefinition", "", { "name": name, "cases": ToDictionary( L, "CaseDefinition", cases, ToCaseDefinition(L)) }), รฅรŸโˆ‚ฦ’ยฉห™โˆ†หšโ‰คยฌโ‰ฅรทฮฉโ‰ˆรงโˆšโˆซหœยตโ‰คโ‰ฅรทล“โˆ‘ยดยฎโ€ ยฅยจห†รธฯ€โ€ฆโ€œรฆยกโ„ขยฃยขโˆžยงยถโ€ขยชยบโ€“โ€œ "TypeDefinition": โˆ†U(+1).TypeDefinition({ name: "", cases: U.Dictionary(U(0).string, U(0).string)({ }) }) "TypeDefinition": { "cases": { "": { "name": { "domain": () => T๐‘.Maybe1(T๐‘.string), "fallback": () => T๐‘.Maybe.Just(T๐‘.Maybe(T๐‘.string).None), "variadic": false }, "cases": { "domain": () => T๐‘.Dictionary0(T๐‘.string, T๐‘.CaseDefinition0), "fallback": () => T๐‘.Maybe.Just(() => T๐‘.Dictionary0(T๐‘.string, T๐‘.CaseDefinition0, 0)), "variadic": false } } }, "prototype": { } }, (name, { cases }) => L => I๐‘.TypeDefinition(L + 1, { name, cases: I๐‘.Dictionary(L, )}) [[1, "TypeDefinition", []], "", ["name", GET_NAME], [""] /* { TypeLink: TypeAddress: ToTypeDefinitionReviver ToTypeReviver = ObjectTemplate { Type: { Name: "Type", โˆ†Level: 0, Arguments: }, Case: "", Data: { name: "", cases: { } } } TypeRelative: { Name: "Type", Level: 0 } TypeDefinition: } I๐‘ = Universe; L => { cases: blah ... } _ = console.log(BootstrapTypeSchemas(I๐‘)) I๐‘.Maybe(I๐‘.string).Just({ value: "hello" }) { Level: 0, Type: [1, TypeDefinition, []], Type: TypeDefinition0, } /* (...args) => I๐‘(0, TypeName, ConstructorArguments)), given(( InferredParameterTypes = ArrayF.map(args, GetEncodedTypeOf) ToTypeFunction = ({ parameters, cases }, Level = ToDeepestTypeLevel(...args), InferredParameterTypes = ArrayF.map(args, EO => ) ToTypeFunction = ({ parameters, cases }, TypeName) => ObjectHasOwn(cases, "") ? (...args) => { } : ObjectMap(cases, (_, CaseName) => (...args) => I๐‘(0, TypeName, ConstructorArguments)), PrimitiveTypes = ObjectFromEntries([ "bigint", "boolean", "number", "null", "string", "symbol", "undefined" ].map(TypeName => [TypeName, ToType(0, ToTypeDefinition(0, TypeName))])), ToLazyUniverse = f => given(( Universes = ObjectCreate(null)) => L => GetOrSetOwnProperty(Universes, L, f)), // Relative Name ToBootstrapTypes = L => ObjectMap( BootstrapTypeSchemas, (TypeSchema, TypeFamilyName) => ToType(L, ToTypeDefinition(L + 1, TypeFamilyName, TypeSchema.cases))), Universes = ObjectCreate(null)) => L => GetOrSetOwnProperty(Universes, L, L => L === 0 ? ObjectAssign(ToBootstrapTypes(0), PrimitiveTypes) : ToBootstrapTypes(L)))*/ I๐‘ = Universe;
T๐‘(1)
T๐‘(1).TypeDefinition //({ name: "hello" })
T๐‘(1).TypeDefinition({ name: "hello" })
T๐‘.string
T๐‘(1).Maybe(T๐‘.string).Just({ value: "hello" })
T๐‘(1).Dictionary(T๐‘.string, T๐‘(1).CaseDefinition)({})
T๐‘(1).Maybe(T๐‘.string).Just({ value: "hello" })
T๐‘(1).FieldDefinition.Parameter({ name: "hello" })
I๐‘
U(0)
I๐‘.Dictionary(I๐‘.string, I๐‘.string)({ })
ToUnreachablePlatformFunction( "LEXICAL", "hello", () => 10, { a: 20 });
I๐‘.Maybe(I๐‘.boolean).Just(false)
I๐‘
I๐‘.TypeDefinition1({ name: "hello", cases: "yay!" })
Loadingโ€ฆ

no comments

    sign in to comment