-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy path37-readshow.hell
More file actions
22 lines (19 loc) · 885 Bytes
/
Copy path37-readshow.hell
File metadata and controls
22 lines (19 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Reading and showing numbers
main = do
-- Reading ints and floats
let mint = Int.readMaybe "123"
let mdouble = Double.readMaybe "123.456"
Maybe.maybe (IO.pure ()) IO.print mint
Maybe.maybe (IO.pure ()) IO.print mdouble
Text.putStrLn "Generic"
Text.putStrLn $ Double.show 123456789.123456789
Text.putStrLn $ Double.show 123.0
Text.putStrLn "Scientific"
Text.putStrLn $ Double.showEFloat Maybe.Nothing 123.0 ""
Text.putStrLn $ Double.showEFloat Maybe.Nothing 123456789.123456789 ""
Text.putStrLn $ Double.showEFloat (Maybe.Just 3) 123456789.123456789 ""
Text.putStrLn "Decimal"
Text.putStrLn $ Double.showFFloat Maybe.Nothing 123456789.123456789 ""
Text.putStrLn $ Double.showFFloat (Maybe.Just 3) 123456789.123456789 ""
Text.putStrLn $ Double.showFFloat (Maybe.Just 3) 123456789.0 ""
Text.putStrLn $ Double.showFFloat Maybe.Nothing 123456789.0 ""