3 ms·
Pure functions allow the runtime to make an entire set of assumptions that aren't safe with other languages.
by wtracy 13y ago
Pure functions allow the runtime to make an entire set of assumptions that aren't safe with other languages.
- thirsteh 13y agoGiven that you 'forkIO' functions in the IO monad, i.e. impure functions, what do you mean by that? 'forkIO' in Haskell is essentially the same as dispatching a green thread in any other language, e.g. the same as 'go' in Go. Haskell/GHC's threads are primarily a concurrency construct, not a parallelism one. You 'forkIO' a bunch of impure functions and communicate between them using channels, STM, etc., exactly the same as in other languages. For parallelism in pure functions there are much better tools--par seq, parallel strategies, repa, Data Parallel Haskell, etc.
- wtracy 13y agoI didn't realize that Haskell supported M:N threading in IO contexts. In that case, I don't have an answer to the original question.
- deleted 13y ago[deleted]