[Haskell-cafe] class Ref...

ajb at spamcop.net ajb at spamcop.net
Tue Jun 7 19:38:17 EDT 2005


G'day all.

Quoting Gracjan Polak <gracjan at acchsh.com>:

> class Monad m => Ref m r | m -> r where
>      newRef :: a -> m (r a)
>      readRef :: r a -> m a
>      writeRef :: r a -> a -> m ()
[...]

> Is there something like this in standard libraries?

No.

> Is there any reason why isn't it included?

Nobody could agree on the details.  For example, MVars are perfectly
respectable Refs on the IO monad.  So would it make sense to add an
instance for that?  If so, the functional dependency should go, which
introduces its own problems.

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list