Anonymous Anonymous <temp.pub...@gmail.com> writes:

> fromIntToString :: Int -> String

...

> PS: if possible please do not use any casting functions that are predefined.

This is a rather simplified version of the Show instance of Int from the
libs:

itos :: Int -> String
itos x | x < 0     = '-' : itos (negate x)
       | x < 10    = "0123456789" !! x : ""
       | otherwise = let (q, r) = x `quotRem` 10
                     in itos q ++ itos r

-- 

Gökhan San
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to