Haskell Language FlexibleInstances


Example

Regular instances require:

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.

That means that, for example, while you can create an instance for [a] you can't create an instance for specifically [Int].; FlexibleInstances relaxes that:

class C a where

-- works out of the box
instance C [a] where

-- requires FlexibleInstances
instance C [Int] where