From a0eb061edbbb8bca666add620e4c82c4f3bc5fdc Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 2 Sep 2015 08:11:14 -0400 Subject: - Added a new (albeit small) I/O library with host-dependent functions. --- source/program.lux | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'source/program.lux') diff --git a/source/program.lux b/source/program.lux index 1b6c6f398..69b9e811d 100644 --- a/source/program.lux +++ b/source/program.lux @@ -19,32 +19,38 @@ (either #as e) id io - (list #refer #all #open ("list:" List/Functor)) + list maybe - (number (int #refer #all #open ("" Int/Show)) - real) + (number (int #refer (#only)) + (real #refer (#only))) (text #refer (#only <>) #open ("text:" Text/Monoid)) - writer - tuple + (writer #refer (#only)) + (tuple #refer (#only)) ) (codata (stream #as s) - lazy - function + (lazy #refer (#only)) + (function #refer (#only)) (reader #as r) - state) - (host jvm) + (state #refer (#only))) + (host jvm + io) (meta ast lux macro - syntax) + syntax + type) math )) (program args (case args (\ (@list name)) - (println (<> "Hello, #{name}!")) + (write-line (<> "Hello, #{name}!")) _ - (println "Hello, world!") + (do IO/Monad + [_ (write "Please, tell me your name: ") + name' read-line + #let [name (? "???" name')]] + (write-line (<> "Hello, #{name}!"))) )) -- cgit v1.2.3