Reference types

Ashley Yakeley ashley@semantic.org
Thu, 7 Feb 2002 02:03:39 -0800


At 2002-02-07 00:52, John Hughes wrote:

>Hmm. Yes. But you still haven't addressed dropping references created in the
>transformed monad back into the underlying one again. 

Oh that's easy:

	    liftedNewSTRef :: (LiftedMonad (ST s) m) => a -> m (Ref (ST s) a);
     liftedNewSTRef = lift . newSTRef;

>And this does seem to
>be getting rather complicated and expensive... are you sure it's worth the
>candle? 

I suspect any alternative will be at least as complicated. Bear in mind 
you are still going to need a type for your references and also get and 
set functions that work in all your monads.

>I'm quite happy to have references depend on a state identifier myself.

For instance...?

-- 
Ashley Yakeley, Seattle WA