[Haskell-beginners] beginner's type error

Edward Z. Yang ezyang at MIT.EDU
Fri Mar 27 11:28:54 EDT 2009

On Fri, 27 Mar 2009, Brent Yorgey wrote:
>> thing n = n + fromIntegral (round (sqrt n))

thing :: Floating a => a -> a

>> thing n = n + round (sqrt (fromIntegral n))

thing :: Integral a => a -> a

That is, the return types of the method are different?

> Pop quiz for beginners: both of these solve the original problem, but
> they are not quite the same.  What is the difference?  (Do not answer
> this question if you are not a beginner!)

More information about the Beginners mailing list