diff --git a/examples/environment.js b/examples/environment.js new file mode 100644 index 0000000..d79748e --- /dev/null +++ b/examples/environment.js @@ -0,0 +1,19 @@ +import { compareTypes } from "../lib/compare/type.js"; +import { ModuleStd } from "../lib/stdlib.js"; +import { emptyDict, get, set } from "../lib/structures/dict.js"; +import { emptySet, add } from "../lib/structures/set.js"; +import { makeCompareFn } from "../lib/compare/dynamic.js" + +// console.log(ModuleStd); + +const typeDict = ModuleStd.reduce((typeDict, {i, t}) => { + try { + const instances = get(typeDict)(t) || emptySet(makeCompareFn(t)); + return set(typeDict)(t)(add(instances)(i)); + } catch (e) { + console.log('warning:',e.message); + return typeDict; + } +}, emptyDict(compareTypes)); + +console.log(typeDict); \ No newline at end of file