Skip to content

Commit a5cf1b2

Browse files
committed
Lesson 22 rename and add comments
1 parent 2c4d908 commit a5cf1b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/leapfrogging-types-traversables.js renamed to examples/22-leapfrogging-types-traversables.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const { List } = require('immutable-ext')
66
// https://github.com/futurize/futurize
77
const FutureTask = require('futurize').futurize(Task)
88

9-
// lazy task for readFile
9+
// (lazy) task to read file
10+
// FutureTask simply applies to the callback-based function inside
1011
const readFileTask = FutureTask(fs.readFile)
1112

1213
// need to wrap into List that provides 'traverse'
@@ -16,6 +17,7 @@ files
1617

1718
// we have list of files but want task of lists
1819
// 1st argument 'Task.of' lifts to Task - applicative functor
19-
// 2nd argument
20+
// (needed as type hint in case of failure or never running the function)
21+
// 2nd argument is traversing function a -> f b
2022
.traverse( Task.of, fn => readFileTask(fn, 'utf-8') )
2123
.fork(console.error, console.log)

0 commit comments

Comments
 (0)