[Haskell-beginners] the first argument of take is an Int and not Integral..

Dean Herington heringtonlacey at mindspring.com
Tue Aug 16 06:15:22 CEST 2011


At 12:28 AM +0530 8/11/11, Sunil S Nandihalli wrote:
>ah that is exactly what I wanted .. thanks Daniel.
>Sunil.
>
>On Thu, Aug 11, 2011 at 12:22 AM, Daniel Fischer 
><<mailto:daniel.is.fischer at googlemail.com>daniel.is.fischer at googlemail.com> 
>wrote:
>
>On Wednesday 10 August 2011, 20:42:05, Sunil S Nandihalli wrote:
>>  hmm.. I do agree that taking elements larger than say 2-billion is
>>  insane .. however, I have no intention of doing that. But the thing is
>>  the value I am getting is of type Integer but it actually very small
>>  and I am unable to pass it as is. So is there a way to convert a value
>>  of type Integer to Int ? This might be obvious.. But I am a newbie to
>>  the whole Haskell thing ...
>
>Use fromInteger or fromIntegral
>
>>
>>  Thanks,
>  > Sunil.

But realize that truncation can result:

Prelude> fromInteger 12345678900 :: Int
-539222988

Dean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110816/552432c6/attachment.htm>


More information about the Beginners mailing list