id summary reporter owner description type status priority milestone component version resolution keywords cc os architecture failure testcase blockedby blocking related differential wikipage
8021 Multiple constraint classes - the alternative to superclass wvv "This is alternative to SuperClasses - multiple constraint Classes
Now:
{{{
class Monoid a where ...
class Monad m => MonadPlus m where ...
}}}
It could be:
{{{
class Monoid a where ...
class Monad m => Monoid m where ...
class Arrow c => Monoid c where ...
foo :: Monad m => Monoid m => m a
}}}
all classes must have same functions with same kind.
And if you wish to write superclass, it would be easy to write
{{{
class BeforeNum a where ....
class BeforeNum a => Num a where ...
foo :: BeforeNum a => Num a => a
}}}
'''Backward compatibility'''
If class have single constraint, you could write without it.
If class have many constrains, you could write without it, if it is empty one.
{{{
bar :: MonadPlus m => m a <<==>> bar :: Monad m => MonadPlus m => m a
foo :: Monoid a => a <<==>> foo :: () => Monoid a => a
}}}
" feature request closed normal Compiler 7.6.3 invalid Unknown/Multiple Unknown/Multiple None/Unknown