[Haskell-cafe] Principal type in Haskell
Jerzy Karczmarczuk
jerzy.karczmarczuk at info.unicaen.fr
Thu Jun 22 06:16:51 EDT 2006
william kim wrote:
> I am confused by the notion of principal type in Haskell with type
> classes. Consider a simple example:
>
> f x y = [x] == [y]
>
> GHCi yields type f :: (Eq [a]) => a -> a -> Bool.
>
> But according to the paper "Type classes: an exploration of the design
> space", predicate Eq [a] should be reduced to Eq a.
Does it mean that nobody is entitled to override the standard instance, and,
say, declare:
instance Eq [a] where
x==y = length x == length y
?
Jerzy Karczmarczuk
More information about the Haskell-Cafe
mailing list