0
我希望能够说的是一个A的所有类型它们也是BHaskell的类型类隐含
class A g where
f :: g -> Int
class B g where
h :: g -> Int
instance A g => B g where
h = f
我得到的编译错误:
Illegal instance declaration for `B g' …
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
的可能的复制[你可以做一个类的实例不是一个类型,但在Haskell中全班同学?( http://stackoverflow.com/questions/32769112/can-you-make-an-instance-of-a-class-not-for-a-type-but-for-a-whole-class-in-hask) – dfeuer
特别参见[Mike Benfield的答案](http://stackoverflow.com/a/32769655/1477667)。 – dfeuer