aboutsummaryrefslogtreecommitdiff
path: root/source/program.lux
blob: fa8b3a055fcd65af828f5b77d9ed2c270b595c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
##  Copyright (c) Eduardo Julian. All rights reserved.
##  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
##  If a copy of the MPL was not distributed with this file,
##  You can obtain one at http://mozilla.org/MPL/2.0/.

(;import lux
         (lux (control (monoid #as m)
                       functor
                       monad
                       comonad
                       bounded
                       eq
                       hash
                       (ord #as O)
                       (show #as S)
                       number
                       enum)
              (data bool
                    char
                    (either #as e)
                    id
                    io
                    list
                    maybe
                    (number (int #refer (#only) #open ("i:" Int/Show))
                            (real #refer (#only)))
                    (text #refer (#only <>) #open ("text:" Text/Monoid))
                    (writer #refer (#only))
                    (tuple #refer (#only))
                    )
              (codata (stream #as s)
                      (lazy #refer (#only))
                      (function #refer (#only))
                      (reader #as r)
                      (state #refer (#only)))
              (host jvm
                    io)
              (meta ast
                    lux
                    syntax
                    type)
              math
              ))

(program args
  (case args
    (\ (@list name))
    (write-line (<> "Hello, #{name}!"))

    _
    (do IO/Monad
      [_ (write "Please, tell me your name: ")
       name' read-line
       #let [name (? "???" name')]]
      (write-line (<> "Hello, #{name}!")))
    ))