safeFromIntegral :: (Integral a, Integral b) => a -> Maybe b
safeFromIntegral x = let y = fromIntegral x
  in if (fromIntegral y == x) then Just y
  else Nothing
safeFromIntegral :: (Integral a, Integral b) => a -> Maybe b
safeFromIntegral x = let y = fromIntegral x
  in if (fromIntegral y == x) then Just y
  else Nothing
safeFromIntegral x = let y = fromIntegral x
  in if (fromIntegral y == x) then Just y
  else Nothing