-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
sequence(Either.of, [Either.of('wing')]); // Right(['wing']) : how is this supposed to work? Array does not have .sequence.
sequence(Either.of, new List([Either.of("wing")])) might work here.
Later
const firstWords = compose(join(' '), take(3), split(' '));
// tldr :: FileName -> Task Error String
const tldr = compose(map(firstWords), readFile);
traverse(Task.of, tldr, ['file1', 'file2']);
Two problems here. First is again with array being treated as a monad. And second that join which is defined in support\index.js is a monadic join
// join :: Monad m => m (m a) -> m a
const join = (m) => m.join();
whereas here the join needs to be an array join like:
// arrayJoin :: String -> [String] -> String
const arrayJoin = curry((sep, arr) => arr.join(sep));
exports.arrayJoin = arrayJoin;