[Haskell-cafe] Re: ACIO versus Execution Contexts

Adrian Hey ahey at iee.org
Tue Nov 30 09:51:49 EST 2004

On Tuesday 30 Nov 2004 12:53 pm, George Russell wrote:
> Adrian Hey wrote (snipped):
>  > They are for use in situations where you need to represent
>  > state associated with a genuinely unique resource (eg top level
>  > stateful C library or hardware IO device).
> In my experience this is only true quite rarely.

Well it's true there probably aren't many people actually writing
hardware device drivers in Haskell at the moment, but it is
something that should be possible to do safely.

But the case of C libraries is far more typical at the moment
I think. Hardly any (like none that I have ever used) can be safely
used without precautions which require top level mutable state,
one way or another. 

> I think Keean and Lennart
> have already said most of what I have to say here.

Oh no, not you as well :-). As I observed in an earlier post,
you still have the same basic problem even if you a multiple
but finite supply of these resources. The problem is slightly
different, but is still insoluble without top level TWIs.

Keean and Lennart are just hiding the problem in a hypothetical
"operating system" which is simply assumed to be correct (it just
doesn't do any of the dangerous things that might otherwise be done).

I don't dispute that top level TWIs are arguably unnecessary, in the
sense that there's no *program* that can be written with them that
couldn't be written without them (in principle).

The issue is *modularity*. Without top level TWIs there are certain
safety guarantees that I cannot make from within my module. Instead
I have to "beg" for safe use from outside my module. Begging a
hypothetical "operating system" doesn't really help much.

Adrian Hey

More information about the Haskell-Cafe mailing list