FlexibleInstances
常規例項需要:
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.
這意味著,例如,雖然你可以為 [a]
建立例項,但你無法為 [Int]
建立例項。FlexibleInstances
放鬆了:
class C a where
-- works out of the box
instance C [a] where
-- requires FlexibleInstances
instance C [Int] where