aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/generator/procedure.jvm.lux
blob: 524513eb522e09333afc417a3b062c656040ca10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(;module:
  lux
  (lux (control [monad #+ do])
       (data [maybe]
             text/format
             (coll ["d" dict])))
  (luxc ["&" base]
        (lang ["ls" synthesis])
        (generator (procedure ["&&;" common])
                   (host ["$" jvm]))))

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