In article <[EMAIL PROTECTED]>,
 "Tim Sweeney" <[EMAIL PROTECTED]> wrote:

> class Monad m => RefMonad m r | m -> r where
>     newRef :: a -> m (r a)
>     readRef :: r a -> m a
>     writeRef :: r a -> a -> m ()
> 
> Is it possible to actually implement a working instance of RefMonad in 
> Haskell, without making use of a built-in monad like IO or ST?  If so, I'd 
> love any tips -- I've been making good use of monads for a while, but can't 
> figure this one out.

You certainly wouldn't be able to do this for any monad M which had:

  performM :: forall a. M a -> a;

...because it wouldn't be type-safe: you'd be able to construct coerce 
:: a -> b just as you can with unsafePerformIO.

-- 
Ashley Yakeley, Seattle WA

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to