diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/tool/compiler/meta/archive.lux | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/stdlib/source/lux/tool/compiler/meta/archive.lux b/stdlib/source/lux/tool/compiler/meta/archive.lux index a0a4b5bf2..49358065b 100644 --- a/stdlib/source/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/lux/tool/compiler/meta/archive.lux @@ -149,6 +149,18 @@ (#.Some _) (#.Some module) #.None #.None))))) + (def: #export reserved + (-> Archive (List Module)) + (|>> :representation + dictionary.keys)) + + (def: #export reservations + (-> Archive (List [Module ID])) + (|>> :representation + dictionary.entries + (list@map (function (_ [module [id _]]) + [module id])))) + (def: #export (merge additions archive) (-> Archive Archive (Try Archive)) (monad.fold try.monad @@ -164,8 +176,8 @@ archive (dictionary.entries (:representation additions)))) - (type: Reservations (List [Module ID])) - (type: Frozen [Version Reservations]) + (type: Reservation [Module ID]) + (type: Frozen [Version (List Reservation)]) (def: reader (Parser ..Frozen) @@ -182,10 +194,10 @@ (|> archive :representation dictionary.entries - (list@map (function (_ [module [id _]]) - [module id])) - (list.sort (function (_ [moduleL idL] [moduleR idR]) - (n.< idL idR))) + (list.search-all (function (_ [module [id descriptor+document]]) + (case descriptor+document + (#.Some _) (#.Some [module id]) + #.None #.None))) [version] (binary.run ..writer))) @@ -197,7 +209,7 @@ (exception: #export corrupt-data) (def: (correct-modules? reservations) - (-> Reservations Bit) + (-> (List Reservation) Bit) (n.= (list.size reservations) (|> reservations (list@map product.left) @@ -205,7 +217,7 @@ set.size))) (def: (correct-ids? reservations) - (-> Reservations Bit) + (-> (List Reservation) Bit) (n.= (list.size reservations) (|> reservations (list@map product.right) @@ -213,7 +225,7 @@ set.size))) (def: (correct-reservations? reservations) - (-> Reservations Bit) + (-> (List Reservation) Bit) (and (correct-modules? reservations) (correct-ids? reservations))) |