Ashley Yakeley wrote:
foo :: (Monad m) => [m a] -> m [a]
instance Integral a => Eq (Ratio a)
class Monad m <= MonadPlus m
I think the most consistent (not most convenient!) syntax would be
foo :: forall m a. (Monad m) => [m a] -> m [a]
instance forall a. (Integral a) => Eq (Ratio a) where {...}
class MonadPlus m. (Monad m) && {...}
There's implicit forall quantification in instance declarations. It's
currently never necessary to make it explicit because there are never type
variables in scope at an instance declaration, but there's no theoretical
reason that there couldn't be. There's no implicit quantification in class
declarations---if you added a quantifier, it would always introduce exactly
the type variables that follow the class name. I think it's better to treat
the class itself as the quantifier. (And it's more like existential
quantification than universal, hence the && instead of =>.)
As far as syntax goes, I like
foo :: forall m a | Monad m. [m a] -> m [a]
class MonadPlus m | Monad m where {...}
but I'm not sure what to do about the instance case, since I agree with the
OP that the interesting part ought to come first instead of last.
-- Ben
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime