aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/meta/archive/document.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-04-22 02:52:57 -0400
committerEduardo Julian2020-04-22 02:52:57 -0400
commita419ec66895e07fbb54ecc59f92e154126a10ac5 (patch)
tree54c282bb5dcdd2bb554dcd30abd71aa6b4bc5810 /stdlib/source/lux/tool/compiler/meta/archive/document.lux
parentd636f97db32f0ca3aa1705c5290afc07314adc53 (diff)
Now caching the documents generated after compiling each module.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive/document.lux36
1 files changed, 30 insertions, 6 deletions
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/lux/tool/compiler/meta/archive/document.lux
index e6d5c0dfe..19b8576a1 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive/document.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive/document.lux
@@ -1,11 +1,17 @@
(.module:
[lux (#- Module)
+ [abstract
+ [monad (#+ do)]]
[control
["." try (#+ Try)]
- ["ex" exception (#+ exception:)]]
+ ["." exception (#+ exception:)]
+ ["<>" parser
+ ["<b>" binary (#+ Parser)]]]
[data
[collection
- ["." dictionary (#+ Dictionary)]]]
+ ["." dictionary (#+ Dictionary)]]
+ [format
+ ["." binary (#+ Writer)]]]
[type (#+ :share)
abstract]]
[//
@@ -14,8 +20,9 @@
[descriptor (#+ Module)]])
(exception: #export (invalid-signature {expected Signature} {actual Signature})
- (ex.report ["Expected" (signature.description expected)]
- ["Actual" (signature.description actual)]))
+ (exception.report
+ ["Expected" (signature.description expected)]
+ ["Actual" (signature.description actual)]))
(abstract: #export (Document d)
{}
@@ -34,15 +41,32 @@
key}
{e
document//content}))
- (ex.throw invalid-signature [(key.signature key)
- document//signature]))))
+ (exception.throw ..invalid-signature [(key.signature key)
+ document//signature]))))
(def: #export (write key content)
(All [d] (-> (Key d) d (Document d)))
(:abstraction {#signature (key.signature key)
#content content}))
+ (def: #export (check key document)
+ (All [d] (-> (Key d) (Document Any) (Try (Document d))))
+ (do try.monad
+ [_ (..read key document)]
+ (wrap (:assume document))))
+
(def: #export signature
(-> (Document Any) Signature)
(|>> :representation (get@ #signature)))
+
+ (def: #export (writer content)
+ (All [d] (-> (Writer d) (Writer (Document d))))
+ (let [writer (binary.and signature.writer
+ content)]
+ (|>> :representation writer)))
+
+ (def: #export parser
+ (All [d] (-> (Parser d) (Parser (Document d))))
+ (|>> (<>.and signature.parser)
+ (:: <>.monad map (|>> :abstraction))))
)