3 ms·
There is and it has been for quite some time, see chapter 4 of [1]. [1]: Runtime Support for Multicore Haskell, Simon Marlow, Simon Peyton Jones, Satnam Singh
by funcDropShadow 4y ago
There is and it has been for quite some time, see chapter 4 of [1].
[1]: Runtime Support for Multicore Haskell, Simon Marlow, Simon Peyton Jones, Satnam Singh (https://www.cs.tufts.edu/~nr/cs257/archive/simon-peyton-jones/multicore-ghc.pdf https://www.cs.tufts.edu/~nr/cs257/archive/simon-peyton-jone...)
- kaba0 4y agoThank you, I stand corrected. Will have to check the linked paper in depth later, but is IO async only or is CPU calculations made automatically concurrent? Last time I checked I don’t remember it being the case for the latter without explicitly requesting it.
- funcDropShadow 4y agoCPU bound calculations are not parallelized automatically. There are some operators (a.k.a strategies) to do that declaratively to pure code and there are monadic libraries to parallelize Haskell code.
- Quekid5 4y agoI'm not 100% sure, actually, but IIRC there is an automatic insertion of 'yield points' into ordinary chunks of Haskell code, so, yes, it will yield automatically even if CPU-bound. Regardless, it's never been a problem in practice. Doing this on the JVM is not possible without actually modifying the running bytecode, so that's why they have that caveat for Loom.