typeclass - Haskell Type Class Implied -
i want able types b
class g f :: g -> int class b g h :: g -> int instance g => b g h = f
i'm getting compile error:
illegal instance declaration `b g' … (all instance types must of form (t a1 ... an) a1 ... *distinct type variables*, , each type variable appears @ once in instance head.
you should not this. however, it's reasonable write like
class b g => g f :: g -> int
this produces useful entailment. defaultsignatures
extension (which dislike various reasons), can write
class b g h :: g -> int default h :: g => g -> int h = f
Comments
Post a Comment