
9 Apr
2002
9 Apr
'02
6:59 a.m.
On Tue, Apr 09, 2002, Simon Marlow wrote:
<muse> I did wonder once whether IO monad bindings should be allowed at the top-level of a module, so you could say
module M where ref <- newIORef 42
and the top-level IO would be executed as part of the module initialization code. This solves the problems with unsafePerformIO in a cleanish way, but would add some extra complexity to implementations. And I'm not sure what happens if one top-level IO action refers to other top-level IO bindings (modules can be recursive, so you could get loops too). </muse>
First-class modules could (I believe) solve this problem quite neatly. David