replace 'prompt' example by 'environment'

This commit is contained in:
Joeri Exelmans 2025-05-09 14:53:43 +02:00
parent f8008aa25d
commit b1c2e7836d
15 changed files with 317 additions and 517 deletions

View file

@ -6,6 +6,6 @@ const mkType = getDefaultTypeParser();
export const ModuleDouble = [
newDynamic(addDouble)(mkType("Double -> Double -> Double")),
newDynamic(mulDouble)(mkType("Double -> Double -> Double") ),
newDynamic(eqDouble)(mkType("Double -> Double -> Bool") ),
newDynamic(mulDouble)(mkType("Double -> Double -> Double")),
newDynamic(eqDouble )(mkType("Double -> Double -> Bool" )),
];

View file

@ -1,5 +1,6 @@
import { inspect } from "node:util";
import { assignFn } from "../generics/generics.js";
import { select } from "@inquirer/prompts";
function inspectDynamic(_depth, options, inspect) {
return `${inspect(this.i, options)} :: ${inspect(this.t, options)}`;

View file

@ -2,29 +2,29 @@ import { newDynamic } from "./dynamic.js";
import { SymbolInt, UUID, SymbolBool, SymbolDouble, SymbolByte, SymbolChar, SymbolUnit, SymbolBottom, SymbolUUID, SymbolType, SymbolTop, Type, Int, Bool, Double, Byte, Char, Unit, Bottom, Top, SymbolDynamic, Dynamic } from "./primitive_types.js";
export const ModulePrimitiveSymbols = [
newDynamic(SymbolInt )(UUID ),
newDynamic(SymbolBool )(UUID ),
newDynamic(SymbolDouble )(UUID ),
newDynamic(SymbolByte )(UUID ),
newDynamic(SymbolChar )(UUID ),
newDynamic(SymbolUnit )(UUID ),
newDynamic(SymbolBottom )(UUID ),
newDynamic(SymbolUUID )(UUID ),
newDynamic(SymbolType )(UUID ),
newDynamic(SymbolTop )(UUID ),
newDynamic(SymbolDynamic )(UUID ),
newDynamic(SymbolInt )(UUID),
newDynamic(SymbolBool )(UUID),
newDynamic(SymbolDouble )(UUID),
newDynamic(SymbolByte )(UUID),
newDynamic(SymbolChar )(UUID),
newDynamic(SymbolUnit )(UUID),
newDynamic(SymbolBottom )(UUID),
newDynamic(SymbolUUID )(UUID),
newDynamic(SymbolType )(UUID),
newDynamic(SymbolTop )(UUID),
newDynamic(SymbolDynamic)(UUID),
];
export const ModulePrimitiveTypes = [
newDynamic(Int )(Type ),
newDynamic(Bool )(Type ),
newDynamic(Double )(Type ),
newDynamic(Byte )(Type ),
newDynamic(Char )(Type ),
newDynamic(Unit )(Type ),
newDynamic(Bottom )(Type ),
newDynamic(UUID )(Type ),
newDynamic(Type )(Type ),
newDynamic(Top )(Type ),
newDynamic(Dynamic )(Type ),
newDynamic(Int )(Type),
newDynamic(Bool )(Type),
newDynamic(Double )(Type),
newDynamic(Byte )(Type),
newDynamic(Char )(Type),
newDynamic(Unit )(Type),
newDynamic(Bottom )(Type),
newDynamic(UUID )(Type),
newDynamic(Type )(Type),
newDynamic(Top )(Type),
newDynamic(Dynamic)(Type),
];

View file

@ -3,4 +3,4 @@ import { compareTypes } from "../compare/type.js";
export const getSymbol = type => type.symbol;
export const getParams = type => type.params;
export const eqType = t1 => t2 => compareTypes(t1, t2) === 0;
export const eqType = t1 => t2 => compareTypes(t1)(t2) === 0;

View file

@ -1,7 +1,3 @@
import { inspect } from "node:util";
export const unit = {
[inspect.custom](depth, options, inspect){ return '()'; }
};
export const unit = {};
export const eqUnit = _ => _ => true;