I understand ( I think ) that Haskell seq will (usually) reduce its first WHNF argument, and see how this happens in GHCi:
λ> let x = (trace "foo" Foo (trace "bar" Bar 100)) in seq x 0 foo 0
However, although the documentation for evaluate suggests that it also reduces its argument to WHNF, it looks like it actually completely reduces the argument to normal form:
λ> let x = (trace "foo" Foo (trace "bar" Bar 100)) in evaluate x foo Foo bar (Bar 100)
I can confirm this (obvious) mismatch with
λ> let y = (trace "foo" Foo (trace "bar" Bar 100)) λ> seq y 0 foo 0 λ> :sprint y y = <Foo> _
and
λ> let z = (trace "foo" Foo (trace "bar" Bar 100)) λ> evaluate z foo Foo bar (Bar 100) λ> :sprint z z = <Foo> (<Bar> 100)
If the documentation for evaluate correct, should the behavior of seq and evaluate not match? What am I missing here (as a beginner Haskell)?
haskell lazy-evaluation denotational-semantics
orome
source share