Hello Michael,
you are correct. Only
> * (a `seq` return a) = evaluate a *right now*, then produce an IO action
> which, when executed, returns the result of evaluating a. Thus, if
> a is undefined, throws an exception right now.
is a bit misleading as there is no evaluation "right now". It's better
to say that (a `seq` return a) is _|_ ("bottom", i.e. undefined) when a
== _|_.
The subtle point is the difference between the action of throwing an
exception (throw some_error :: IO a) and an undefined value (_|_).
(throw ..) will cause your program to crash when "executed", but it's
still a well defined value of type (IO a).
For a more detailed semantics of exceptions in Haskell, see
" Tackling the awkward squad: monadic input/output, concurrency,
exceptions, and foreign-language calls in Haskell"
http://research.microsoft.com/%7Esimonpj/Papers/marktoberdorf/
I further think (evaluate x) can be implemented as follows:
evaluate x = catch (x `seq` return x) throw
Regards,
apfelmus