
22 Apr
2009
22 Apr
'09
5:57 p.m.
I'm having difficulty to understand the difference between WHNF and HNF. Is this explanationhttp://encyclopedia2.thefreedictionary.com/Weak+Head+Normal+Form the correct one? Or is WHNF and HNF equivalent in Haskell land? The GHC documentation of seq says: Evaluates its first argument to head normal form, and then returns its second argument as the result. Let's try in GHCi *Main> let f = trace "\\x" $ \x -> ((trace "\\y" $ \y -> trace "y" y + trace "x" x) $ trace "2" 2) *Main> f `seq` () \x () *Main> That did not evaluate anything inside the body of the first lambda, so according to the article, seq reduces to weak head normal form, not hnf...