UNPKG

fp-ts-std

Version:

The missing pseudo-standard library for fp-ts.

14 lines (13 loc) 572 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.memptyUnless = exports.memptyWhen = exports.toMonoid = void 0; const function_1 = require("fp-ts/function"); const Boolean_1 = require("./Boolean"); function toMonoid(F) { return G => x => F.foldMap(G)(x, function_1.identity); } exports.toMonoid = toMonoid; const memptyWhen = (M) => (x) => (y) => x ? M.empty : y(); exports.memptyWhen = memptyWhen; const memptyUnless = (M) => (0, function_1.flow)(Boolean_1.invert, (0, exports.memptyWhen)(M)); exports.memptyUnless = memptyUnless;