[Haskell-cafe] Couldn't match expected type `Integer' against inferred type `Int'

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Tue Aug 9 03:11:38 CEST 2011


On 9 August 2011 11:06, Paul Reiners <paul.reiners at gmail.com> wrote:
>
> On Aug 8, 2011, at 7:59 PM, Ivan Lazar Miljenovic wrote:
>
>> On 9 August 2011 10:49, Paul Reiners <paul.reiners at gmail.com> wrote:
>>>                  step acc x = acc * 10 + digitToInt x
>>
>> digitToInt returns an Int; as such the result of asInt_foldAux is an
>> Int, but you've specified in its type signature that it should be
>> returning an Integer.
>
> So is there something like digitToInteger?  Or can I somehow cast the Int to an Integer?

step acc x = acc * 10 + fromIntegral (digitToInt x)

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com



More information about the Haskell-Cafe mailing list