aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/compositor
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/program/compositor')
-rw-r--r--stdlib/source/program/compositor/import.lux25
1 files changed, 20 insertions, 5 deletions
diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux
index 318c3705c..edc0160f5 100644
--- a/stdlib/source/program/compositor/import.lux
+++ b/stdlib/source/program/compositor/import.lux
@@ -1,5 +1,5 @@
(.module:
- [lux #*
+ [lux (#- Module)
[abstract
["." monad (#+ Monad do)]]
[control
@@ -13,12 +13,18 @@
["<b>" binary]]]
[data
[binary (#+ Binary)]
- ["." text]
+ ["." text
+ ["%" format (#+ format)]]
[collection
["." dictionary (#+ Dictionary)]
["." row]]
[format
["." tar]]]
+ [tool
+ [compiler
+ [meta
+ [archive
+ [descriptor (#+ Module)]]]]]
[world
["." file (#+ Path File)]]]
[//
@@ -29,6 +35,11 @@
(exception: #export useless-tar-entry)
+(exception: #export (duplicate {library Library} {module Module})
+ (exception.report
+ ["Module" (%.text module)]
+ ["Library" (%.text library)]))
+
(type: #export Import
(Dictionary Path Binary))
@@ -44,9 +55,13 @@
(monad.fold ! (function (_ entry import)
(case entry
(#tar.Normal [path instant mode ownership content])
- (dictionary.try-put (tar.from-path path)
- (tar.data content)
- import)
+ (let [path (tar.from-path path)]
+ (case (dictionary.try-put path (tar.data content) import)
+ (#try.Success import)
+ (wrap import)
+
+ (#try.Failure error)
+ (exception.throw ..duplicate [library path])))
_
(exception.throw ..useless-tar-entry [])))