UNPKG

effect-ts-folds

Version:
10 lines 521 B
import { succeedBy } from '#util'; import { getApplicative } from '@effect/typeclass/data/Effect'; import { Effect, pipe } from 'effect'; export const hyloE = (F) => (ψ, φ) => { const traverse = F.traverse(getApplicative()); const run = (a) => pipe(a, ψ, Effect.flatMap(self => Effect.suspend(() => pipe(self, traverse(run)))), Effect.flatMap(φ)); return run; }; export const hylo = F => (ψ, φ) => a => pipe(a, hyloE(F)(succeedBy(ψ), succeedBy(φ)), Effect.runSync); //# sourceMappingURL=schemes.js.map