UNPKG
fp-ts-std
Version:
beta (0.20.0-beta.1)
latest (1.0.0)
1.0.0
0.20.0-beta.1
0.20.0-beta.0
0.19.1
0.19.0
0.19.0-beta.0
0.18.0
0.18.0-beta.4
0.18.0-beta.3
0.18.0-beta.2
0.18.0-beta.1
0.18.0-beta.0
0.17.1
0.17.0
0.17.0-beta.0
0.16.0
0.15.1
0.15.0
0.14.2
0.14.1
0.14.0
0.13.1
0.13.0
0.13.0-beta.0
0.12.0
0.12.0-beta.0
0.11.0
0.10.1
0.10.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.0
0.3.0
0.2.0
0.1.2
0.1.1
0.1.0
The missing pseudo-standard library for fp-ts.
github.com/samhh/fp-ts-std
samhh/fp-ts-std
fp-ts-std
/
dist
/
esm
/
Monoid.js
8 lines
(7 loc)
•
295 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
import
{ flow, identity }
from
"fp-ts/function"
;
import
{ invert }
from
"./Boolean"
;
export
function
toMonoid
(
F
) {
return
G
=>
x
=>
F.
foldMap
(G)(x, identity); }
export
const
memptyWhen
= (
M
) =>
(
x
) =>
(
y
) =>
x ? M.
empty
:
y
();
export
const
memptyUnless
= (
M
) =>
flow
(invert,
memptyWhen
(M));