diff options
Diffstat (limited to 'stdlib/source/library/lux/world/console.lux')
-rw-r--r-- | stdlib/source/library/lux/world/console.lux | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index c10521e74..cf75af0a5 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - ["@" target] - ["[0]" ffi {"+" import:}] - [abstract - [monad {"+" do}]] - [control - ["[0]" maybe] - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - ["[0]" io {"+" IO io}] - [concurrency - ["[0]" async {"+" Async} ("[1]#[0]" monad)] - ["[0]" atom]]] - [data - ["[0]" text {"+" Char} - ["%" format {"+" format}]]]]]) + [library + [lux "*" + ["@" target] + ["[0]" ffi {"+" import:}] + [abstract + [monad {"+" do}]] + [control + ["[0]" maybe] + ["[0]" try {"+" Try} ("[1]#[0]" functor)] + ["[0]" exception {"+" exception:}] + ["[0]" io {"+" IO io} ("[1]#[0]" functor)] + [concurrency + ["[0]" async {"+" Async} ("[1]#[0]" monad)] + ["[0]" atom]]] + [data + ["[0]" text {"+" Char} + ["%" format {"+" format}]]]]]) (type: .public (Console !) (Interface @@ -82,13 +82,14 @@ (def: (read _) (|> jvm_input java/io/InputStream::read - (# (try.with io.monad) each .nat))) + (# (try.with io.monad) each (|>> ffi.of_int .nat)))) (def: (read_line _) - (java/io/Console::readLine jvm_console)) + (io#each (try#each (|>> ffi.of_string)) + (java/io/Console::readLine jvm_console))) (def: (write message) - (java/io/PrintStream::print message jvm_output)) + (java/io/PrintStream::print (ffi.as_string message) jvm_output)) (def: close (|>> (exception.except ..cannot_close) in)))))))))] |