@jsoldi/hkt
Version:
Higher kinded types for typescript and a few utility monads.
18 lines • 573 B
JavaScript
import { pipe } from "../../core/utils.js";
import { contCore } from "./contCore.js";
/** Creates a continuation monad where results are wrapped in the given monad. */
export function contMonad(m) {
return pipe(contCore(), base => {
const toVoid = base.mapCont(m.unit, _ => undefined);
const lift = ma => resolve => m.bind(ma, resolve);
const drop = ca => ca(m.unit);
return {
...base,
contMonad: m,
lift,
drop,
toVoid
};
});
}
//# sourceMappingURL=contMonad.js.map