I'm trying to understand parallelism in Haskell and one thing that I'm curious about is the signature difference between seq
/ rseq
and par
/ rpar
seq :: a -> b -> b
par :: a -> b -> b
rseq :: a -> Eval a
rpar :: a -> Eval a
I understand that rseq
and rpar
are monadic versions so they bear the Eval
part. But why aren't seq
and par
both just a -> a
? Kind of like strict identities... A reason for "encomplication" should exist.
There also seems to be a lot of mystery around seq
. Some sources say a
is evaluated when b
is evaluated (to WHNF). Other sources say a
is evaluated at call time. It's really confusing! While it's possible to test-drive some things with actual tests I'm afraid I can easily misinterpret the results.