Module Initialisation? (was Re: [Haskell] (no subject))

Ben Rudiak-Gould br276 at
Sun Oct 17 14:20:28 EDT 2004

Remi Turk wrote:

>  On Sun, Oct 17, 2004 at 05:11:02PM +0100, Ben Rudiak-Gould wrote:
> > I don't think there's any problem with
> >
> > type MVar = STMVar RealWorld
> >
> > newMVar :: a -> ST s (STMVar s a)
 >>     withMVar :: STMVar s a -> (a -> ST s b) -> ST s b ...
> >
> > For that matter it seems like we could (should?) have
> >
> > forkST :: ST s () -> ST s (STThreadId s) forkIO = forkST
>  But what semantics would they have? It cannot be the normal
>  concurrency as AFAIK runST is supposed to be deterministic.

Okay, so I'm being silly. Forget forkST then. But STMVar is still okay, 
isn't it? The only MVars you could use in a state thread would be those 
you'd created in the same state thread, and without forkST they can't be 
accessed in a nondeterministic way. Their presence is pointless, true, 
but at least not unsafe.

It does seem a bit of a hack, but it still seems preferable to the other 
alternatives currently on the table (namely unrestricted IO, a new 
SafeIO, or unsafeIOToST.newMVar).

-- Ben

More information about the Haskell mailing list