21 Dec
2001
21 Dec
'01
12:29 p.m.
Ian Lynagh writes:
Sorry, I meant "hugs and ghci only seem to print the warning the first time I run the program", e.g. with
module Main where
import IOExts
main :: IO() main = trace "foo" (putStrLn "bar")
in hugs:
[...] Type :? for help Main> main foobar
Main> main bar [snip] and in ghci:
Skipping Main ( q.lhs, ./q.o ) Main> main foo bar Main> main bar [snip]
This is because 'main' is a CAF: the act of reducing it to normal form the first time forces the warning to be printed, but thereafter the evaluated version is returned immediately. To subvert this behaviour, in GHCi you can say ':set +r' which causes all CAFs to be reverted between evaluations. Cheers, Simon