This is for Haskell-2:
is there any profound reason to prohibit the constant types in an
instance context?
This restriction seems reduce the power of the multiparametric
classes. Thus, the following very naturally set program occurs
illegal:
class Convertible a b where cv :: a -> b -> b
data SmallResidue = S Int Int
instance Convertible a Int => Convertible a SmallResidue
where
cv a (S _ b) = S (rem (cv a b) b) b
It can be "improved" by
data SmallResidue i = S i i
instance (Integral i,Convertible a i) =>
Convertible a (SmallResidue i) where ...
Only SmallResidue was introduced for Int specially.
----------------------------------------------------------------------
Another hard restriction for an instance context is that all its
variables have to appear after `=>' too.
Say,
class T a b where t :: a -> b
instance (T a b,T b c) => T a c where t x = t ((t x)::b)
is illegal.
This composition a->b, b->c => a->c is very important in theory and
needs to be exploited.
But the feature looks much more problematic than the above
constant-type rule relaxation.
Note this `::b'. Without it, one cannot decide where this first `t'
casts `x' to.
----------------------------------------------------------------------
What Haskell designers tell, can these extensions be supported?
------------------
Sergey Mechveliani
[EMAIL PROTECTED]