[Haskell-cafe] How to fix such a TYPE problem ?
zaxis
z_axis at 163.com
Tue Sep 1 01:01:44 EDT 2009
thanks!
Luke Palmer-2 wrote:
>
> On Mon, Aug 31, 2009 at 9:47 PM, zaxis<z_axis at 163.com> wrote:
>>
>>>let [y,m,d] = map (\x -> read x::Int) $ splitRegex (mkRegex "-")
>> "2009-08-31"
>>>fromGregorian y m d
>>
>> Couldn't match expected type `Integer' against inferred type `Int'
>> In the first argument of `fromGregorian', namely `y'
>> In the expression: fromGregorian y m d
>> In the definition of `it': it = fromGregorian y m d
>
> fromGregorian is expecting an Integer for y, and you gave it an Int.
> You just need to convert; fromIntegral works fine for this.
>
> fromGregorian (fromIntegral y) m d
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
View this message in context: http://www.nabble.com/How-to-fix-such-a-TYPE-problem---tp25233906p25234336.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list