How does an `Aff` monad work?

Aff is in the same space as Promises, but with additional support for cancellation (async exceptions) and resource management (bracket). It’s cooperative multi-tasking which yields on async constructors (makeAff).

For node specifically, you can try https://github.com/natefaubion/purescript-node-workerbees which is a bit of hack, but really convenient. I used workerbees in purs-tidy to distribute formatting multiple files over several actual threads.

2 Likes