Just for your fun and horror
Fri, 16 Feb 2001 20:00:50 -0500
Matthias Felleisen wrote:
>When a C programmer thinks about the
>'return' type of a C function, he thinks about the value-return half
>of a return statement's denotation. The other half, the modified store,
>remains entirely implicit as far as types are concerned.
Just because the type system of C keeps store implicit, it doesn't
change the match between the meaning of 'return' in the two languages.
The IO monad provides a refined way of typing imperative-style
functions, including return statements.
If you want to use a return statement in Haskell, you can, and it's called
(A reasonable alternative would be for 'return' to have second class
status, as syntactic sugar for 'unit', analgous to otherwise=True).