suggestion: A common type class for mutable variables
Bertram Felgenhauer
bertram.felgenhauer at googlemail.com
Sun Jun 9 17:48:02 CEST 2013
Henning Thielemann wrote:
> On Mon, 3 Jun 2013, Edward Kmett wrote:
>
> >The first option is
> >
> >class Monad m => MonadRef r m | m -> r where
> > newRef :: a -> m (r a)
> > ...
>
> I thought the functional dependency should be the other way round:
> From the reference type to the monad where it lives in.
You can have it both ways.
class Monad m => RefM m r | m -> r, r -> m where
-- | Create a new reference.
newRef :: a -> m (r a)
[...]
Cheers,
Bertram
More information about the Libraries
mailing list