2 ms·
> This works much better than say Go, because Haskell is immutable. The immutability has nothing to do with async. Async is for IO threads. If you want pure pa
by anon291 3y ago
> This works much better than say Go, because Haskell is immutable.
The immutability has nothing to do with async. Async is for IO threads. If you want pure parallelism you use `par`. But Haskell IO threads (forkIO and friends) are also green when run with GHC.
- xedrac 3y agoAsync is definitely nicer when things are immutable. On modern CPUs, async green threads can easily be backed by different OS threads running in parallel on different CPU cores, making data races a real problem for many languages. Async does not guarantee that things will not be run in parallel, although you shouldn't rely on it for explicit parallelism.
- anon291 3y agoHaskell async is run in IO though in which mutability is allowed. Async itself is mutable.