0 | module Control.App.Console
 1 |
 2 | import public Control.App
 3 |
 4 | %default total
 5 |
 6 | public export
 7 | interface Console e where
 8 |   putChar : Char -> App {l} e ()
 9 |   putStr : String -> App {l} e ()
10 |   getChar : App {l} e Char
11 |   getLine : App {l} e String
12 |
13 | export
14 | PrimIO e => Console e where
15 |   putChar c = primIO $ putChar c
16 |   putStr str = primIO $ putStr str
17 |   getChar = primIO getChar
18 |   getLine = primIO getLine
19 |
20 | export
21 | putStrLn : Console e => String -> App {l} e ()
22 | putStrLn str = putStr (str ++ "\n")
23 |
24 | export
25 | putCharLn : Console e => Char -> App {l} e ()
26 | putCharLn c = putStrLn $ strCons c ""
27 |
28 | export
29 | print : Show a => Console e => a -> App {l} e ()
30 | print x = putStr $ show x
31 |
32 | export
33 | printLn : Show a => Console e => a -> App {l} e ()
34 | printLn x = putStrLn $ show x
35 |