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