[Haskell-cafe] Trying to write 'safeFromInteger'

david48 dav.vire+haskell at gmail.com
Wed Apr 8 08:36:11 EDT 2009


What about :

sffi :: (Integral a,Num a) => Integer -> Maybe a
sffi n = go n (fromInteger n)
   where
       go a b | toInteger b == a  = Just b
              | otherwise         = Nothing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090408/7a56d906/attachment.htm


More information about the Haskell-Cafe mailing list