This commit is contained in:
Joeri Exelmans 2025-03-24 08:25:53 +01:00
parent 3596e01c28
commit 6af72e525c
3 changed files with 31 additions and 5 deletions

View file

@ -1,4 +1,4 @@
import { typedFnType } from "./types.js";
import { fnType, typedFnType } from "./types.js";
import { Type } from "../type.js";
import { Int } from "../primitives/types.js";
import { makeGeneric } from "../generics/generics.js";
@ -8,7 +8,7 @@ import { lsType } from "./types.js";
const emptyList = {l:[]};
const get = ls => i => ls.l[i];
const put = ls => i => elem => ({l: ls.l.with(Number(i), elem)});
// const push = ls => elem => ({l:ls.l.concat([elem])});
const push = ls => elem => ({l:ls.l.concat([elem])});
export const ModuleList = {l:[
// Type -> Type
@ -43,4 +43,16 @@ export const ModuleList = {l:[
/* out */ (lsType(a))
)
))),
// [a] -> a -> [a]
...typedFnType(push, fnType =>
makeGeneric(a =>
fnType
(lsType(a))
(fnType
(a)
(lsType(a))
)
)
),
]};