[Haskell] threading mutable state through callbacks

Adrian Hey ahey at iee.org
Wed Oct 13 05:01:08 EDT 2004


On Wednesday 13 Oct 2004 3:36 am, Wolfgang Thaller wrote:
> b) Some predetermined order, with semantics like mdo:
>
> John Meacham wrote:
> > The basic idea is that your entire program behaves as if in a giant
> > 'mdo' block, ordered in module dependency order.
>
> What is module dependency order? There's no such thing when there are
> circular dependencies, and when there aren't any, it might still depend
> on the order of import directives, which is probably not something I
> want program semantics to depend on.
> I feel that In a large program, you'll probably get more surprises from
> this.
> The good thing is that you can always use unsafeInterleaveIO to get the
> other semantics back, so we should probably investigate this further.

Yes, this is something I wasn't too clear about, largely because I'm not
too certain about the precise semantics of mdo (never actually used it).

John's proposal seemed like a good formalisation of what a compiler might
do in reality to implement this. But if it means imposing some order on
things (other than the dependency "on demand" ordering that we currently
get with the unsafePerformIO hack) I'm not sure that's a good idea.

I would rather have the order unspecified and make it the programmers
responsibility to control this, if significant. Having the correctness
of programs dependent on ordering of top level definitions or imports
is not a discipline Haskellers are used to. If this is the case with
John's proposal, it seems like it could cause trouble in the long run :-(

Regards
--
Adrian Hey



More information about the Haskell mailing list