[Haskell-cafe] [] == []

Eugene Kirpichov ekirpichov at gmail.com
Fri May 29 05:51:10 EDT 2009


2009/5/29 Paul Keir <pkeir at dcs.gla.ac.uk>:
> Hi all,
>
> GHC is not happy with this:
>
> f = [] == []

This fails because GHC doesn't know which 'a' you mean, and can't
choose an Eq instance.

>
> nor this:
>
> f' = ([]::(Eq a) => [a]) == ([]::(Eq a) => [a])
>

This fails for the same reason.

> but this is OK:
>
> f'' = ([]::[Integer]) == ([]::[Integer])
>
> GHCI is comfortable with [] == [], so why not GHC? 'Just curious.

Because GHCI has some 'default' instances, whereas GHC doesn't. This
time, it probably chooses a=().

>
> Cheers,
> Paul
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>



-- 
Eugene Kirpichov
Web IR developer, market.yandex.ru


More information about the Haskell-Cafe mailing list