fork download
  1. import Data.List(sort)
  2.  
  3. main = mapM_ (putStrLn . (\n -> toStr (show n) ++ " " ++ toBar n)) $ sort [12, 25, 31, 54, 63, 26, 3, 6, 14, 1, 6, 31, 61, 6]
  4.  
  5. toBar :: Int -> String
  6. toBar n = replicate n '|'
  7.  
  8. toStr :: String -> String
  9. toStr str | len == 1 = str ++ " "
  10. | len == 2 = str
  11. | otherwise = ".."
  12. where len = length str
Success #stdin #stdout 0s 4332KB
stdin
Standard input is empty
stdout
1  |
3  |||
6  ||||||
6  ||||||
6  ||||||
12 ||||||||||||
14 ||||||||||||||
25 |||||||||||||||||||||||||
26 ||||||||||||||||||||||||||
31 |||||||||||||||||||||||||||||||
31 |||||||||||||||||||||||||||||||
54 ||||||||||||||||||||||||||||||||||||||||||||||||||||||
61 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
63 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||