
On 21 June 2015 at 15:55, Michael Walker
Hi all,
I was wondering about constraints in class declarations. Suppose we have something like this:
class Monad m => Store m where type Var m :: * -> *
new :: a -> m (Var m a) read :: Var m a -> m a write :: Var m a -> a -> m ()
[snip]
... it would be nice to be able to specify that all instances of our Store class have this property. Something like,
class (Monad m, Eq (Var m a)) => Store m where ...
But we can't write this! The `a` isn't in scope! What I really want to do is to be able to write class constraints like this,
Edward Kmett's constraints package has a Forall constraint that can be used for cases like this (but may require some fiddling when this constraint is used/required). -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com