UNPKG

@jsoldi/hkt

Version:

Higher kinded types for typescript and a few utility monads.

17 lines 483 B
import { monad } from "./monad.js"; import { unfold } from "./unfold.js"; const is_unfoldable = Symbol('is_unfoldable'); /** Creates an `IUnfoldable` from an `IUnfoldableBase`. */ export function unfoldable(base) { if (is_unfoldable in base) return base; return { ...{ [is_unfoldable]: true }, ...unfold({ scalar: monad.trivial, ...base }), scalar: monad.trivial, }; } //# sourceMappingURL=unfoldable.js.map