[Haskell-cafe] Numerics and Warnings

Barak A. Pearlmutter barak at cs.nuim.ie
Thu Apr 11 01:56:05 CEST 2013


> ... in most of the cases I do want this warnings. It's possible to get
> something default to Integer when it should be Int. There are only few
> cases when it's not appropriate. Only ^ and ^^ with literals I think

There are a few other cases, albeit less annoying.  Like this:

c = fromIntegral 2 :: Int

Granted this is silly code, but the same case arises inside pretty much
any code that is generic over Integral, in which case the warning you
get is not the *right* warning.  Example:

genericTake n xs = take (fromIntegral n) xs
genericTake 444444444444444444444444444444 "foobar"

					--Barak.



More information about the Haskell-Cafe mailing list