UNPKG

fp-ts-std

Version:

The missing pseudo-standard library for fp-ts.

14 lines (13 loc) 452 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.altAllBy = exports.pureIf = void 0; const A = require("fp-ts/Array"); const function_1 = require("fp-ts/function"); function pureIf(F) { return x => y => (x ? F.of(y()) : F.zero()); } exports.pureIf = pureIf; function altAllBy(F) { return fs => x => (0, function_1.pipe)(fs, A.reduce(F.zero(), (m, f) => F.alt(m, () => f(x)))); } exports.altAllBy = altAllBy;