[Haskell-cafe] Re: Begginer question

Maurício briqueabraque at yahoo.com
Thu Jan 6 11:50:59 EST 2005


Jules Bean wrote:
> 
>> (...) Why Haskell converts "4" to 
>> Complex but not a Float?
>>
> 
> The answer lies available to you in ghci:
> 
> Prelude> :t 4
> 4 :: forall t. (Num t) => t
> 
> The type of for is 'any type in the Num class'.  So '4' stands for the 
> Integer four as well as the Float four and the Double four and indeed 
> the Complex 4.
> 
> No conversion is actually happening.
> 

   Interesting. The tutorial I'm following didn't say anything about 
classes yet. I'll read about it and then go back to my problem.

   Thanks.



More information about the Haskell-Cafe mailing list