
25 Dec
2012
25 Dec
'12
2:08 p.m.
On Dienstag, 25. Dezember 2012, 19:07:33, Emmanuel Touzery wrote:
Thank you. I think you are as clear as possible, and complete. I do wonder though, isn't there an annotation or technique that would force the parameters of a constructor to be evaluated to WHNF when the constructor is evaluated?
That's what strictness annotations do.
In my case i believe the constructor is evaluated immediately because it's in a do block of the IO monad.
IO is still nonstrict in the values, data Strict = S !Int *Strict> do { putStrLn "Strictly"; return (S undefined); } Strictly *Strict> do { putStrLn "Strictly"; return $! (S undefined); } Strictly *** Exception: Prelude.undefined returning a value doesn't force its evaluation to WHNF.