We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2abd1bc commit 9c641e2Copy full SHA for 9c641e2
examples/lazy-box.js renamed to examples/11-lazy-box.js
@@ -1,17 +1,15 @@
1
// leaving old Box for comparison
2
-const Box = x => (
3
- {
+const Box = x => ({
4
map: f => Box(f(x)),
5
fold: f => f(x),
6
- inspect: () => `Box(${x})`
7
- }
8
-)
+ inspect: _ => `Box(${x})`,
+})
9
10
-// wraps a function without executing its call
+// wraps a function returning value without executing its call
11
const LazyBox = g => ({
12
13
// compose with f from outside
14
- map: f => LazyBox( () => f(g()) ),
+ map: f => LazyBox( _ => f(g()) ),
15
16
// compose and evaluate
17
fold: f => f(g())
0 commit comments