
16 Apr
2010
16 Apr
'10
11:09 a.m.
Philip Scott wrote
The documentation says that, but it does appear to go deeper than just one level:
Debug.Trace Prelude Control.Exception> let a = trace "Hello" 42 Debug.Trace Prelude Control.Exception> let b = trace "Frank" (a * 2) Debug.Trace Prelude Control.Exception> evaluate b Frank Hello 84
Perhaps it specifies WHNF in case you 'evaluate' something which doesn't have a HNF (like a partially applied function?).
It is actually quite interesting what it does in this case:
let f x = trace "jingle" (x * 2) a <- evaluate (f) :t f f :: (Num a) => a -> a :t a a :: Integer -> Integer
So it does some sort of evaluation - it has decided we're going to be using Integers instead of Nums. I wonder what it is up to there.