@@ -8,17 +8,19 @@ const eitherToTask = e =>
88 e . fold ( Task . rejected , Task . of )
99
1010
11- console . log (
12- `eitherToTask(Right('nightingale')).fork(..., ...) : `
11+ console . log ( `
12+ eitherToTask(Right('nightingale'))
13+ .fork(..., ...) : `
1314)
1415eitherToTask ( Right ( 'nightingale' ) )
1516. fork (
1617 e => console . error ( 'Error: ' , e ) ,
1718 res => console . log ( 'Result: ' , res )
1819)
1920
20- console . log (
21- `eitherToTask(Left('errrr')).fork(..., ...) : `
21+ console . log ( `
22+ eitherToTask(Left('errrr'))
23+ .fork(..., ...) : `
2224)
2325eitherToTask ( Left ( 'errrr' ) )
2426. fork (
@@ -44,12 +46,16 @@ const res2 = boxToEither(
4446)
4547
4648// results should be the same!
47- console . log (
48- `boxToEither(Box(100)).map( x => x * 2 ) : ` ,
49+ console . log ( `
50+ boxToEither(Box(100))
51+ .map( x => x * 2 ) :
52+ ` ,
4953 res1
5054)
51- console . log (
52- `boxToEither(Box(100).map( x => x * 2 )) : ` ,
55+ console . log ( `
56+ boxToEither(Box(100)
57+ .map( x => x * 2 )) :
58+ ` ,
5359 res2
5460)
5561
@@ -72,12 +78,14 @@ const res22 = boxToEitherBad(
7278)
7379
7480// natural transformation law is violated!
75- console . log (
76- `boxToEitherBad(Box(100)).map( x => x * 2 ) : ` ,
81+ console . log ( `
82+ boxToEitherBad(Box(100))
83+ .map( x => x * 2 ) : ` ,
7784 res21
7885)
79- console . log (
80- `boxToEitherBad(Box(100).map( x => x * 2 )) : ` ,
86+ console . log ( `
87+ boxToEitherBad(Box(100)
88+ .map( x => x * 2 )) : ` ,
8189 res22
8290)
8391
@@ -93,12 +101,14 @@ const res31 = first([1,2,3]).map( x => x + 1 )
93101const res32 = first ( [ 1 , 2 , 3 ] . map ( x => x + 1 ) )
94102
95103// results are equal!
96- console . log (
97- `first([1,2,3]).map( x => x + 1 ) : ` ,
104+ console . log ( `
105+ first([1,2,3])
106+ .map( x => x + 1 ) : ` ,
98107 res31
99108)
100- console . log (
101- `first([1,2,3].map( x => x + 1 ))` ,
109+ console . log ( `
110+ first([1,2,3]
111+ .map( x => x + 1 )) :` ,
102112 res32
103113)
104114
0 commit comments