[Haskell-cafe] Trying to write 'safeFromInteger'

Neil Mitchell ndmitchell at gmail.com
Wed Apr 8 08:55:20 EDT 2009


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

No need for auxiliary function definitions.

Thanks

Neil


More information about the Haskell-Cafe mailing list