[Haskell-cafe] [] == []

Paul Keir pkeir at dcs.gla.ac.uk
Fri May 29 06:29:29 EDT 2009


f''' = ([]::[()]) == ([]::[()])

(Very pretty.)

So why doesn't ghc have 'default' instances?

-----Original Message-----
From: Eugene Kirpichov [mailto:ekirpichov at gmail.com]
Sent: Fri 29/05/2009 10:51
To: Paul Keir
Cc: haskell-cafe at haskell.org
Subject: Re: [Haskell-cafe] [] == [][MESSAGE NOT SCANNED]
 
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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090529/75f25bc8/attachment.html


More information about the Haskell-Cafe mailing list