That javascript code is awful (and yet probably typical). There are three asynchronous readdirs that don't depend on each other (and should be able to run parallel) which now depend on each other and any asynchronous benefit is lost. Maybe haskell is smart enough to run them in parallel. For javascript, Promise.all would be better and avoid the pyramid of doom. Or, just use synchronous code for your, well, synchronous code.