strange behaviour

Simon Marlow simonmar@microsoft.com
Mon, 11 Aug 2003 11:35:17 +0100


=20
> 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
> <<unsafePerformIO (print "test")>> any number of times, or
> possible even none, since it knows that that expression
> always returns the same value ().

It wouldn't be correct to not evaluate it at all: it might be _|_ or
raise an exception.

Cheers,
	Simon