tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

configure.tri (1459B)


      1 !import prelude *
      2 !import io *
      3 !import source_module as M
      4 !import source_resolve as R
      5 !import consumers_validate as V
      6 !import consumers_lexical_worker as L
      7 !export *
      8 -- Checked publication of a configuration computation's named worker trees.
      9 -- Input code trust is established by the caller's build/import selection;
     10 -- shape checking here is only an output contract, never callable-code proof.
     11 
     12 configurationRows_ self rows seen = (triage
     13   (lazyBool (_ : err "configuration requires an export" t)
     14     (_ : ok (reverse seen) t) (emptyList? seen))
     15   (_ : err "improper configuration export list" t)
     16   (row rest : lazyBool
     17     (_ : lazyBool
     18       (_ : lazyMaybe
     19         (_ : self rest (pair row seen))
     20         (_ : err "duplicate configuration export" t)
     21         (R.sourceFindExternal seen (fst row)))
     22       (_ : err "invalid configuration export name or worker shape" t)
     23       (and? (M.sourceModuleExportNameValid (fst row))
     24         (L.lWorkerShape? (snd row))))
     25     (_ : err "invalid configuration export row" t)
     26     (V.vPair? row))
     27   rows)
     28 configurationRows rows = y configurationRows_ rows t
     29 configurationNames_ self rows = (lazyList
     30   (_ : t)
     31   (row rest : pair (fst row) (self rest))
     32   rows)
     33 configurationNames rows = y configurationNames_ rows
     34 configurationPublish root rows = (lazyResult
     35   (problem unused : pure (err problem t))
     36   (checked unused : M.sourceModulePublishNames root checked
     37     (configurationNames checked))
     38   (configurationRows rows))