aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/generator/procedure.jvm.lux
blob: cc10e45aaf06ca04a047a321bd939d3abe4187c0 (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
(;module:
  lux
  (lux (control [monad #+ do])
       (data [maybe]
             text/format
             (coll [dict])))
  (luxc ["&" base]
        (lang ["ls" synthesis])
        (generator (host ["$" jvm])))
  (. ["./;" common]
     ["./;" host]))

(def: procedures
  ./common;Bundle
  (|> ./common;procedures
      (dict;merge ./host;procedures)))

(def: #export (generate-procedure generate name args)
  (-> (-> ls;Synthesis (Meta $;Inst)) Text (List ls;Synthesis)
      (Meta $;Inst))
  (<| (maybe;default (&;fail (format "Unknown procedure: " (%t name))))
      (do maybe;Monad<Maybe>
        [proc (dict;get name procedures)]
        (wrap (proc generate args)))))