aboutsummaryrefslogtreecommitdiff
path: root/source/program.lux
diff options
context:
space:
mode:
authorEduardo Julian2015-09-02 08:11:14 -0400
committerEduardo Julian2015-09-02 08:11:14 -0400
commita0eb061edbbb8bca666add620e4c82c4f3bc5fdc (patch)
tree8528f1020939a01bd5217a747268480e7ad8e67c /source/program.lux
parentf270a49ce40829dc28c6254d7ed4eeb19f360f59 (diff)
- Added a new (albeit small) I/O library with host-dependent functions.
Diffstat (limited to 'source/program.lux')
-rw-r--r--source/program.lux30
1 files changed, 18 insertions, 12 deletions
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}!")))
))