Open dotnetCarpenter opened 3 years ago
By using the improved traverse function from https://github.com/MostlyAdequate/mostly-adequate-guide/issues/581#issuecomment-668274810 and adding toString since the nodejs fs.readFile returns a Buffer and not a String.
traverse
toString
fs.readFile
Buffer
String
// readFile :: FileName -> Task Error String // firstWords :: String -> String const firstWords = compose(intercalate(' '), take(3), split(' '), toString); // tldr :: FileName -> Task Error String const tldr = compose(map(firstWords), readFile); traverse(Task.of, tldr, ['file1', 'file2']); // Task(['hail the monarchy', 'smash the patriarchy']);
Before the traverse function threw a TypeError: f.traverse is not a function, on traverse(Task.of, tldr, ['file1', 'file2']);.
TypeError: f.traverse is not a function
traverse(Task.of, tldr, ['file1', 'file2']);
Thanks to @antonklimov.
Blocks #607
By using the improved
traverse
function from https://github.com/MostlyAdequate/mostly-adequate-guide/issues/581#issuecomment-668274810 and addingtoString
since the nodejsfs.readFile
returns aBuffer
and not aString
.Before the
traverse
function threw aTypeError: f.traverse is not a function
, ontraverse(Task.of, tldr, ['file1', 'file2']);
.Thanks to @antonklimov.