
On 2003-08-11 at 11:44+0200 "David Sabel" wrote:
module Main(main) where
import System.IO.Unsafe
main = case unsafePerformIO (print "test") of () -> main
ok, probably I use unsafePerformIO in an "unsafe" way and so on, but executing the program prints infinitely often "test" on the screen, but I think it would be correct to do so one time?
It's correct behaviour to print "test" any number of
times. Haskell is non-strict, which only means that things
aren't evaluated unless needed. It's not (defined to be)
lazy, which would mean that named expressions would be
evaluated at most once (though ghc meets this). It's also
not defined to be "fully lazy" meaning that unnamed
expressions would be evaluated at most once in any given
closure. So GHC is entirely within its rights to evaluate
<