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

Ben Rudiak-Gould br276 at cl.cam.ac.uk
Sun Oct 17 12:11:02 EDT 2004


Remi Turk wrote:

>It definitely sounds nice, but is it actually possible to generalize e.g. MVar from "RealWorld" to "forall s" or are we always going to have to say:
>
>v <- unsafeIOToST (newMVar / newChan ... )
>  
>
I hadn't thought of that, but 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

and so on.

-- Ben



More information about the Haskell mailing list