blob: 230498fcb5e775cc7c1fa2bbad1333f10ab14281 (
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
|
(.module:
lux
(lux (control pipe)
(data [number]
text/format)
[macro "meta/" Monad<Meta>])
(luxc (lang (host [lua #+ Lua Expression Statement]))))
(def: #export translate-bit
(-> Bit (Meta Expression))
(|>> lua.bool meta/wrap))
(def: #export translate-int
(-> Int (Meta Expression))
(|>> lua.int meta/wrap))
(def: #export translate-frac
(-> Frac (Meta Expression))
(|>> (cond> [(f/= number.positive-infinity)]
[(new> "math.huge")]
[(f/= number.negative-infinity)]
[(new> "(-1 * math.huge)")]
[(f/= number.not-a-number)]
[(new> "(0/0)")]
## else
[%f])
meta/wrap))
(def: #export translate-text
(-> Text (Meta Expression))
(|>> %t meta/wrap))
|