@@ -25,33 +25,58 @@ import IO
26---- some basic io
26---- some basic io
28+||| Output a string to stdout without a trailing newline, for any FFI
30+putStr' : String -> IO' ffi ()
31+putStr' x = do prim_write x
28||| Output a string to stdout without a trailing newline
34||| Output a string to stdout without a trailing newline
29−putStr : String -> IO' ffi ()
35+putStr : String -> IO ()
30−putStr x = do prim_write x
36+putStr = putStr'
38+||| Output a string to stdout with a trailing newline, for any FFI
40+putStrLn' : String -> IO' ffi ()
41+putStrLn' x = putStr' (x ++ "\n")
33||| Output a string to stdout with a trailing newline
43||| Output a string to stdout with a trailing newline
34−putStrLn : String -> IO' ffi ()
44+putStrLn : String -> IO ()
47+||| Output something showable to stdout, without a trailing newline, for any FFI
49+print' : Show a => a -> IO' ffi ()
35−putStrLn x = putStr (x ++ "\n")
50+print' x = putStr' (show x)
37||| Output something showable to stdout, without a trailing newline
52||| Output something showable to stdout, without a trailing newline
38−print : Show a => a -> IO' ffi ()
53+print : Show a => a -> IO ()
39−print x = putStr (show x)
54+print = print'
41−||| Output something showable to stdout, with a trailing newline
56+||| Output something showable to stdout, with a trailing newline, for any FFI
42−printLn : Show a => a -> IO' ffi ()
58+printLn' : Show a => a -> IO' ffi ()
43−printLn x = putStrLn (show x)
59+printLn' x = putStrLn' (show x)
61+||| Output something showable to stdout, with a trailing newline
62+printLn : Show a => a -> IO ()
45−||| Read one line of input from stdin, without the trailing newline
65+||| Read one line of input from stdin, without the trailing newline, for any FFI
46−getLine : IO' ffi String
67+getLine' : IO' ffi String
47−getLine = do x <- prim_read
68+getLine' = do x <- prim_read
48− return (reverse (trimNL (reverse x)))
69+ return (reverse (trimNL (reverse x)))
49 where trimNL : String -> String
70 where trimNL : String -> String
50 trimNL str with (strM str)
71 trimNL str with (strM str)
51 trimNL "" | StrNil = ""
72 trimNL "" | StrNil = ""
52 trimNL (strCons '\n' xs) | StrCons _ _ = xs
73 trimNL (strCons '\n' xs) | StrCons _ _ = xs
53 trimNL (strCons x xs) | StrCons _ _ = strCons x xs
74 trimNL (strCons x xs) | StrCons _ _ = strCons x xs
76+||| Read one line of input from stdin, without the trailing newline
55||| Write a single character to stdout
80||| Write a single character to stdout
56putChar : Char -> IO ()
81putChar : Char -> IO ()
57putChar c = foreign FFI_C "putchar" (Int -> IO ()) (cast c)
82putChar c = foreign FFI_C "putchar" (Int -> IO ()) (cast c)