f''' = ([]::[()]) == ([]::[()]) (Very pretty.) So why doesn't ghc have 'default' instances? -----Original Message----- From: Eugene Kirpichov [mailto:ekirpichov@gmail.com] Sent: Fri 29/05/2009 10:51 To: Paul Keir Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] [] == [][MESSAGE NOT SCANNED] 2009/5/29 Paul Keir <pkeir@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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Eugene Kirpichov Web IR developer, market.yandex.ru