summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/Numeric/num006.hs
blob: f421ed72a2eea6aa7709af23818c4845b49f4307 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- Exercising the showing of positive numbers at various bases.
--
module Main(main) where

import Numeric
import Data.Char

--showDec :: Integral a => a -> ShowS
showDec = showInt

{-
--showBinary :: Integral a => a -> ShowS
showBinary n r = 
 showString "0b" $
 showIntAtBase 2 (toChr) n r
 where toChr d = chr (ord '0' + fromIntegral d)
-}

main = 
 do
  print (map (\ x -> showOct x []) [1..32])
  print (map (\ x -> showDec x []) [1..32])
  print (map (\ x -> showHex x []) [1..32])
--  print (map (\ x -> showBinary x []) [1..32])
  putStrLn (showOct (241324784::Int) [])
  putStrLn (showDec (241324784::Int) [])
  putStrLn (showHex (241324784::Int) [])
---  putStrLn (showBinary (241324784::Int) [])