[project @ 2001-03-29 14:35:20 by simonmar]
[ghc-hetmet.git] / ghc / tests / numeric / should_run / num006.hs
1 -- Exercising the showing of positive numbers at various bases.
2 --
3 module Main(main) where
4
5 import Numeric
6 import Char
7 import NumExts
8
9 --showDec :: Integral a => a -> ShowS
10 showDec = showInt
11
12 {-
13 --showBinary :: Integral a => a -> ShowS
14 showBinary n r = 
15  showString "0b" $
16  showIntAtBase 2 (toChr) n r
17  where toChr d = chr (ord '0' + fromIntegral d)
18 -}
19
20 main = 
21  do
22   print (map (\ x -> showOct x []) [1..32])
23   print (map (\ x -> showDec x []) [1..32])
24   print (map (\ x -> showHex x []) [1..32])
25 --  print (map (\ x -> showBinary x []) [1..32])
26   putStrLn (showOct (241324784::Int) [])
27   putStrLn (showDec (241324784::Int) [])
28   putStrLn (showHex (241324784::Int) [])
29 ---  putStrLn (showBinary (241324784::Int) [])