aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/spec/compositor.lux
blob: 5f46aad84e8dd96a0537112f3cc2e146c55d36e1 (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
57
58
59
60
61
(.module:
  [lux #*
   ["_" test (#+ Test)]
   [abstract
    [monad (#+ do)]]
   [control
    ["." io (#+ IO)]]
   [data
    ["." error]]
   [math
    ["r" random]]
   [tool
    [compiler
     [phase
      [macro (#+ Expander)]
      [generation (#+ Bundle)]]
     [default
      [platform (#+ Platform)]]]]]
  ["." / #_
   ["#." common (#+ Runner Definer)]
   ["#./" generation #_
    ["#." primitive]
    ["#." structure]
    ["#." reference]
    ["#." case]
    ["#." function]
    ["#." common]]])

(def: (test runner definer)
  (-> Runner Definer Test)
  ($_ _.and
      (/generation/primitive.spec runner)
      (/generation/structure.spec runner)
      (/generation/reference.spec runner definer)
      (/generation/case.spec runner)
      (/generation/function.spec runner)
      (/generation/common.spec runner)
      ))

(def: #export (spec platform bundle expander program)
  (All [anchor expression statement]
    (-> (IO (Platform IO anchor expression statement))
        (Bundle anchor expression statement)
        Expander
        (-> expression statement)
        Test))
  (do r.monad
    [_ (wrap [])
     #let [?runner,definer (<| io.run
                               (do io.monad
                                 [platform platform])
                               (/common.executors platform
                                                  bundle
                                                  expander
                                                  program))]]
    (case ?runner,definer
      (#error.Success [runner definer])
      (..test runner definer)

      (#error.Failure error)
      (_.fail error))))