aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/meta/archive
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive.lux30
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive/artifact.lux29
2 files changed, 35 insertions, 24 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)))
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
index 7f3e1654d..28f01bbcb 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
@@ -9,8 +9,8 @@
["." product]
["." text]
[collection
- ["." list ("#@." functor fold)]
- ["." row (#+ Row)]
+ ["." list]
+ ["." row (#+ Row) ("#@." functor fold)]
["." dictionary (#+ Dictionary)]]
[format
["." binary (#+ Writer)]]]
@@ -75,23 +75,22 @@
(def: #export writer
(Writer Registry)
- (let [writer|artifacts (binary.list (binary.maybe binary.text))]
+ (let [writer|artifacts (binary.row/64 (binary.maybe binary.text))]
(|>> :representation
(get@ #artifacts)
- row.to-list
- (list@map (get@ #name))
+ (row@map (get@ #name))
writer|artifacts)))
(def: #export parser
(Parser Registry)
- (|> (<b>.list (<b>.maybe <b>.text))
- (:: <>.monad map (list@fold (function (_ artifact registry)
- (product.right
- (case artifact
- #.None
- (..resource registry)
-
- (#.Some name)
- (..definition name registry))))
- ..empty))))
+ (|> (<b>.row/64 (<b>.maybe <b>.text))
+ (:: <>.monad map (row@fold (function (_ artifact registry)
+ (product.right
+ (case artifact
+ #.None
+ (..resource registry)
+
+ (#.Some name)
+ (..definition name registry))))
+ ..empty))))
)