diff --git a/TODO.md b/TODO.md index d328984..6a93fd5 100644 --- a/TODO.md +++ b/TODO.md @@ -1,9 +1,11 @@ +monads/nothing-monad +用 generic 函数定义 lift -- 删除 `skipIncompleteInputs` +monads/supported-monad -- 删除 `maybeUnwrapSupported` + > propagator 支持 dependencies for provenance > > - https://github.com/cicada-lang/propagator/issues/2 -fix `maybeUnwrapSupported` -- learn from `nary-unpacking` - `barometer` -- 的测试带上 `promises` -- 用论文中讲故事的方式来写测试 fix `isContradiction` for `Supported` diff --git a/src/monad/index.ts b/src/monad/index.ts new file mode 100644 index 0000000..52927c5 --- /dev/null +++ b/src/monad/index.ts @@ -0,0 +1,5 @@ +import { defineGeneric } from "../generic/index.js" + +export const fmap = defineGeneric({ default: (f, mx) => f(mx) }) +export const join = defineGeneric({ default: (mmx) => mmx }) +export const bind = (mx: any, f: (x: any) => any) => join(fmap(f, mx))