blob: caa2d09dcb2db19068079c509a23079c2f00dae9 (
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
|
(;module:
lux
(lux (data [bool "bool/" Eq<Bool>]
[text "text/" Eq<Text>])
(macro [code])
["r" math/random "r/" Monad<Random>])
(luxc (lang ["la" analysis]
["ls" synthesis])))
(def: #export gen-primitive
(r;Random la;Analysis)
(r;either (r;either (r;either (r/wrap (' []))
(r/map code;bool r;bool))
(r;either (r/map code;nat r;nat)
(r/map code;int r;int)))
(r;either (r;either (r/map code;deg r;deg)
(r/map code;frac r;frac))
(r/map code;text (r;text +5)))))
(def: #export (corresponds? analysis synthesis)
(-> la;Analysis ls;Synthesis Bool)
(case [analysis synthesis]
(^ [(^code []) (^code [])])
true
(^template [<tag> <test>]
[[_ (<tag> valueA)] [_ (<tag> valueS)]]
(<test> valueA valueS))
([#;Bool bool/=]
[#;Nat n.=]
[#;Int i.=]
[#;Deg d.=]
[#;Frac f.=]
[#;Text text/=])
_
false))
|