UNPKG

fp-ts-std

Version:

The missing pseudo-standard library for fp-ts.

9 lines (8 loc) 268 B
import * as A from "fp-ts/Array"; import { pipe } from "fp-ts/function"; export function pureIf(F) { return x => y => (x ? F.of(y()) : F.zero()); } export function altAllBy(F) { return fs => x => pipe(fs, A.reduce(F.zero(), (m, f) => F.alt(m, () => f(x)))); }