On Wed, 8 Apr 2009, Neil Mitchell wrote:

That seems a really weird way to write it! Who decided all auxiliary
functions should be called go? (I think I'm blaming dons) - why not:

sffi :: (Integral a,Num a) => Integer -> Maybe a
sffi n | toInteger n2 == n = Just n2
       | otherwise = Nothing
    where n2 = fromInteger n

I think it is a bug, that 'fromInteger' is defined for numbers outside the range of the target type. Why is it necessary to have, say
  fromInteger 1000 == (232 :: Word8)
 ?

I would not rely on this behaviour and safeFromInteger should also work, when the fromInteger method yields undefined for some Integer input.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to