[Haskell-cafe] Ambiguous type variable

Jacek Generowicz jacek.generowicz at cern.ch
Fri Oct 15 19:18:55 EDT 2010

On 2010 Oct 16, at 01:14, Jacek Generowicz wrote:

> On 2010 Oct 16, at 00:51, Ivan Lazar Miljenovic wrote:
>> "2" is a generic number.  If you don't specify a type, it usually
>> defaults to Integer.  All Num instances that come in the Prelude have
>> Show instances, so no matter which gets picked "show 2" works.
>> However, when you say "view 2" ghc/ghci doesn't know that you want 2
>> to be an Int (as that's the only type you have an instance for View
>> for).
> On 2010 Oct 16, at 00:51, Christopher Done wrote:
>> Don't integral literals default to Integer, of which there is a Show
>> instance but no View instance?

An in both of the explanations above, it should then complain about  
the lack of an instance of View, rather than about ambiguous type  
variables, n'est-ce pas?

More information about the Haskell-Cafe mailing list