I’m reading through Parallel and Concurrent Programming in Haskell and I find it super interesting (and practical). On page 32, he says:
[…] for example, to evaluate the pair (fib 35, fib 36) in parallel, we could write:
runEval (parPair (fib 35, fib 36))
In this case, parPair
is implemented as such:
parPair :: Strategy (a, b)
parPair (a, b) = do
a' <- rpar a
b' <- rpar b
return (a', b')
Notice that there is no force
in the definition. Why doesn’t that lead to a very little amount of parallelism? On page 22 he even notes that “Not evaluating deeply enough is a common mistake when using rpar
[…]”.