diff options
author | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
commit | 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 (patch) | |
tree | 115fab5bd8a5f53dc0d13ce5453095324a83496f /stdlib/source/library/lux/tool/compiler/meta | |
parent | f92c806ee8da63f04bbefbf558f6249bacdb47ea (diff) |
De-sigil-ification: suffix : [Part 13]
Diffstat (limited to '')
31 files changed, 165 insertions, 165 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/meta.lux b/stdlib/source/library/lux/tool/compiler/meta.lux index 4034a23c8..ef6e71986 100644 --- a/stdlib/source/library/lux/tool/compiler/meta.lux +++ b/stdlib/source/library/lux/tool/compiler/meta.lux @@ -4,6 +4,6 @@ [// [version (.only Version)]]) -(def: .public version +(def .public version Version 00,02,00) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index bdb87cb95..b3b213099 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -76,16 +76,16 @@ [#next module.ID #resolver (Dictionary descriptor.Module [module.ID (Maybe (Entry Any))])]) - (def: next + (def next (-> Archive module.ID) (|>> representation (the #next))) - (def: .public empty + (def .public empty Archive (abstraction [#next 0 #resolver (dictionary.empty text.hash)])) - (def: .public (id module archive) + (def .public (id module archive) (-> descriptor.Module Archive (Try module.ID)) (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) @@ -96,7 +96,7 @@ (exception.except ..unknown_document [module (dictionary.keys /#resolver)])))) - (def: .public (reserve module archive) + (def .public (reserve module archive) (-> descriptor.Module Archive (Try [module.ID Archive])) (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) @@ -111,7 +111,7 @@ (revised #next ++) abstraction)]}))) - (def: .public (has module entry archive) + (def .public (has module entry archive) (-> descriptor.Module (Entry Any) Archive (Try Archive)) (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) @@ -131,7 +131,7 @@ {.#None} (exception.except ..module_must_be_reserved_before_it_can_be_added [module])))) - (def: .public entries + (def .public entries (-> Archive (List [descriptor.Module [module.ID (Entry Any)]])) (|>> representation (the #resolver) @@ -139,7 +139,7 @@ (list.all (function (_ [module [module_id entry]]) (at maybe.monad each (|>> [module_id] [module]) entry))))) - (def: .public (find module archive) + (def .public (find module archive) (-> descriptor.Module Archive (Try (Entry Any))) (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) @@ -152,7 +152,7 @@ {.#None} (exception.except ..unknown_document [module (dictionary.keys /#resolver)])))) - (def: .public (archived? archive module) + (def .public (archived? archive module) (-> Archive descriptor.Module Bit) (case (..find module archive) {try.#Success _} @@ -161,7 +161,7 @@ {try.#Failure _} false)) - (def: .public archived + (def .public archived (-> Archive (List descriptor.Module)) (|>> representation (the #resolver) @@ -171,7 +171,7 @@ {.#Some _} {.#Some module} {.#None} {.#None}))))) - (def: .public (reserved? archive module) + (def .public (reserved? archive module) (-> Archive descriptor.Module Bit) (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) @@ -181,13 +181,13 @@ {.#None} false))) - (def: .public reserved + (def .public reserved (-> Archive (List descriptor.Module)) (|>> representation (the #resolver) dictionary.keys)) - (def: .public reservations + (def .public reservations (-> Archive (List [descriptor.Module module.ID])) (|>> representation (the #resolver) @@ -195,7 +195,7 @@ (list#each (function (_ [module [id _]]) [module id])))) - (def: .public (composite additions archive) + (def .public (composite additions archive) (-> Archive Archive Archive) (let [[+next +resolver] (representation additions)] (|> archive @@ -219,21 +219,21 @@ (type: Frozen [Version module.ID (List Reservation)]) - (def: reader + (def reader (Parser ..Frozen) (all <>.and <binary>.nat <binary>.nat (<binary>.list (<>.and <binary>.text <binary>.nat)))) - (def: writer + (def writer (Writer ..Frozen) (all \\format.and \\format.nat \\format.nat (\\format.list (\\format.and \\format.text \\format.nat)))) - (def: .public (export version archive) + (def .public (export version archive) (-> Version Archive Binary) (let [(open "/[0]") (representation archive)] (|> /#resolver @@ -251,7 +251,7 @@ "Expected" (%.nat expected) "Actual" (%.nat actual))) - (def: .public (import expected binary) + (def .public (import expected binary) (-> Version Binary (Try Archive)) (do try.monad [[actual next reservations] (<binary>.result ..reader binary) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux index f66a0a42f..252776c37 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -23,7 +23,7 @@ #category Category #mandatory? Bit])) -(def: .public equivalence +(def .public equivalence (Equivalence Artifact) (all product.equivalence nat.equivalence diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux index 9e00a5b51..d9801694c 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux @@ -19,7 +19,7 @@ (type: .public Definition [Text (Maybe [Arity [Nat Nat]])]) -(def: .public definition_equivalence +(def .public definition_equivalence (Equivalence Definition) (all product.equivalence text.equivalence @@ -40,10 +40,10 @@ {#Directive Text} {#Custom Text})) -(def: .public equivalence +(def .public equivalence (Equivalence Category) (implementation - (def: (= left right) + (def (= left right) (case [left right] [{#Anonymous} {#Anonymous}] true diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux index 445e44c72..0e35d6528 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux @@ -9,11 +9,11 @@ (primitive .public (Key k) Signature - (def: .public signature + (def .public signature (All (_ ?) (-> (Key ?) Signature)) (|>> representation)) - (def: .public (key signature sample) + (def .public (key signature sample) (All (_ d) (-> Signature d (Key d))) (abstraction signature)) ) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module.lux index 868009871..4e2757bb8 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module.lux @@ -8,7 +8,7 @@ (type: .public ID Nat) -(def: .public runtime +(def .public runtime ID 0) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux index b661a1587..92e8dcc60 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux @@ -24,7 +24,7 @@ (type: .public Module Text) -(def: .public runtime +(def .public runtime Module "") @@ -36,10 +36,10 @@ #state Module_State #references (Set Module)])) -(def: module_state_equivalence +(def module_state_equivalence (Equivalence Module_State) (implementation - (def: (= left right) + (def (= left right) (case [left right] (^.with_template [<tag>] [[{<tag>} {<tag>}] @@ -51,7 +51,7 @@ _ false)))) -(def: .public equivalence +(def .public equivalence (Equivalence Descriptor) (all product.equivalence text.equivalence @@ -61,7 +61,7 @@ set.equivalence )) -(def: .public writer +(def .public writer (Writer Descriptor) (all \\format.and \\format.text @@ -71,7 +71,7 @@ (\\format.set \\format.text) )) -(def: .public parser +(def .public parser (Parser Descriptor) (all <>.and <binary>.text diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux index 56dd787be..fe4977e8d 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux @@ -30,7 +30,7 @@ [#signature Signature #content d]) - (def: .public (content key document) + (def .public (content key document) (All (_ d) (-> (Key d) (Document Any) (Try d))) (let [[document//signature document//content] (representation document)] (if (at signature.equivalence = @@ -44,29 +44,29 @@ (exception.except ..invalid_signature [(key.signature key) document//signature])))) - (def: .public (document key content) + (def .public (document key content) (All (_ d) (-> (Key d) d (Document d))) (abstraction [#signature (key.signature key) #content content])) - (def: .public (marked? key document) + (def .public (marked? key document) (All (_ d) (-> (Key d) (Document Any) (Try (Document d)))) (do try.monad [_ (..content key document)] (in (as_expected document)))) - (def: .public signature + (def .public signature (-> (Document Any) Signature) (|>> representation (the #signature))) - (def: .public (writer content) + (def .public (writer content) (All (_ d) (-> (Writer d) (Writer (Document d)))) (let [writer (all binary.and signature.writer content)] (|>> representation writer))) - (def: .public (parser key it) + (def .public (parser key it) (All (_ d) (-> (Key d) (Parser d) (Parser (Document d)))) (do <>.monad [actual signature.parser diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux index 09cfc1190..9f23cad2e 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux @@ -34,20 +34,20 @@ [#artifacts (Sequence [Artifact (Set unit.ID)]) #resolver (Dictionary Text [ID (Maybe //category.Definition)])]) - (def: .public empty + (def .public empty Registry (abstraction [#artifacts sequence.empty #resolver (dictionary.empty text.hash)])) - (def: .public artifacts + (def .public artifacts (-> Registry (Sequence [Artifact (Set unit.ID)])) (|>> representation (the #artifacts))) - (def: next + (def next (-> Registry ID) (|>> ..artifacts sequence.size)) - (def: .public (resource mandatory? dependencies registry) + (def .public (resource mandatory? dependencies registry) (-> Bit (Set unit.ID) Registry [ID Registry]) (let [id (..next registry)] [id @@ -60,7 +60,7 @@ abstraction)])) (with_template [<tag> <create> <fetch> <type> <name> <+resolver>] - [(def: .public (<create> it mandatory? dependencies registry) + [(def .public (<create> it mandatory? dependencies registry) (-> <type> Bit (Set unit.ID) Registry [ID Registry]) (let [id (..next registry)] [id @@ -73,7 +73,7 @@ (revised #resolver (dictionary.has (<name> it) [id (is (Maybe //category.Definition) <+resolver>)])) abstraction)])) - (def: .public (<fetch> registry) + (def .public (<fetch> registry) (-> Registry (List <type>)) (|> registry representation @@ -94,17 +94,17 @@ [//category.#Custom custom customs Text |> {.#None}] ) - (def: .public (find_definition name registry) + (def .public (find_definition name registry) (-> Text Registry (Maybe [ID (Maybe //category.Definition)])) (|> (representation registry) (the #resolver) (dictionary.value name))) - (def: .public (id name registry) + (def .public (id name registry) (-> Text Registry (Maybe ID)) (maybe#each product.left (find_definition name registry))) - (def: .public writer + (def .public writer (Writer Registry) (let [definition (is (Writer //category.Definition) (all binary.and @@ -148,7 +148,7 @@ (exception.report "Tag" (%.nat tag))) - (def: .public parser + (def .public parser (Parser Registry) (let [definition (is (Parser //category.Definition) (all <>.and diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux index ac6a22c49..075e12c77 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux @@ -25,23 +25,23 @@ [#name Symbol #version Version])) -(def: .public equivalence +(def .public equivalence (Equivalence Signature) (all product.equivalence symbol.equivalence nat.equivalence)) -(def: .public (description signature) +(def .public (description signature) (-> Signature Text) (format (%.symbol (the #name signature)) " " (version.format (the #version signature)))) -(def: .public writer +(def .public writer (Writer Signature) (all binary.and (binary.and binary.text binary.text) binary.nat)) -(def: .public parser +(def .public parser (Parser Signature) (all <>.and (<>.and <binary>.text <binary>.text) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux index 9ce35e1b5..937f87043 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux @@ -22,21 +22,21 @@ [#module module.ID #artifact artifact.ID])) -(def: .public hash +(def .public hash (Hash ID) (all product.hash nat.hash nat.hash)) -(def: .public equivalence +(def .public equivalence (Equivalence ID) (at ..hash equivalence)) -(def: .public none +(def .public none (Set ID) (set.empty ..hash)) -(def: .public (format it) +(def .public (format it) (%.Format ID) (%.format (%.nat (the #module it)) "." diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache.lux b/stdlib/source/library/lux/tool/compiler/meta/cache.lux index 15cdef528..0ebd1e7d5 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache.lux @@ -15,18 +15,18 @@ [// ["[0]" version]]]) -(def: .public (path fs context) +(def .public (path fs context) (All (_ !) (-> (file.System !) Context file.Path)) (let [/ (at fs separator)] (format (the context.#target context) / (the context.#host context) / (version.format //.version)))) -(def: .public (enabled? fs context) +(def .public (enabled? fs context) (All (_ !) (-> (file.System !) Context (! Bit))) (at fs directory? (..path fs context))) -(def: .public (enable! ! fs context) +(def .public (enable! ! fs context) (All (_ !) (-> (Monad !) (file.System !) Context (! (Try Any)))) (do ! [? (..enabled? fs context)] diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/archive.lux index 4710ce851..8876e3e77 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/archive.lux @@ -13,12 +13,12 @@ [context (.only Context)] ["[0]" archive (.only Archive)]]]) -(def: .public (descriptor fs context) +(def .public (descriptor fs context) (All (_ !) (-> (file.System !) Context file.Path)) (%.format (//.path fs context) (at fs separator) "descriptor")) -(def: .public (cache! fs context it) +(def .public (cache! fs context it) (All (_ !) (-> (file.System !) Context Archive (! (Try Any)))) (at fs write (..descriptor fs context) (archive.export ///.version it))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/artifact.lux index 8494dba2c..69c131082 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/artifact.lux @@ -20,7 +20,7 @@ ["[0]" module] ["[0]" artifact]]]]) -(def: .public (path fs context @module @artifact) +(def .public (path fs context @module @artifact) (All (_ !) (-> (file.System !) Context module.ID artifact.ID file.Path)) (format (//module.path fs context @module) @@ -28,12 +28,12 @@ (%.nat @artifact) (the context.#artifact_extension context))) -(def: .public (cache fs context @module @artifact) +(def .public (cache fs context @module @artifact) (All (_ !) (-> (file.System !) Context module.ID artifact.ID (! (Try Binary)))) (at fs read (..path fs context @module @artifact))) -(def: .public (cache! fs context @module @artifact content) +(def .public (cache! fs context @module @artifact content) (All (_ !) (-> (file.System !) Context module.ID artifact.ID Binary (! (Try Any)))) (at fs write (..path fs context @module @artifact) content)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux index 373696de2..5640bdd7e 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux @@ -35,7 +35,7 @@ ["[0]" registry (.only Registry)] ["[0]" unit]]]]]]]) -(def: (path_references references) +(def (path_references references) (-> (-> Synthesis (List Constant)) (-> Path (List Constant))) (function (again path) @@ -75,7 +75,7 @@ {synthesis.#Then then} (references then)))) -(def: (references value) +(def (references value) (-> Synthesis (List Constant)) (case value {synthesis.#Simple value} @@ -162,7 +162,7 @@ (list#each references) list#conjoint))) -(def: .public (dependencies archive value) +(def .public (dependencies archive value) (All (_ anchor expression directive) (-> Archive Synthesis (Operation anchor expression directive (Set unit.ID)))) (let [! phase.monad] @@ -173,7 +173,7 @@ (monad.each ! (generation.remember archive)) (at ! each (set.of_list unit.hash))))) -(def: .public (path_dependencies archive value) +(def .public (path_dependencies archive value) (All (_ anchor expression directive) (-> Archive Path (Operation anchor expression directive (Set unit.ID)))) (let [! phase.monad] @@ -184,12 +184,12 @@ (monad.each ! (generation.remember archive)) (at ! each (set.of_list unit.hash))))) -(def: .public all +(def .public all (-> (List (Set unit.ID)) (Set unit.ID)) (list#mix set.union unit.none)) -(def: (immediate_dependencies archive) +(def (immediate_dependencies archive) (-> Archive [(List unit.ID) (Dictionary unit.ID (Set unit.ID))]) (|> archive @@ -213,7 +213,7 @@ [(list) (dictionary.empty unit.hash)]))) -(def: .public (necessary_dependencies archive) +(def .public (necessary_dependencies archive) (-> Archive (Set unit.ID)) (let [[mandatory immediate] (immediate_dependencies archive)] (loop (again [pending mandatory diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux index 5cad8e963..bdb09274d 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux @@ -26,18 +26,18 @@ (type: .public Ancestry (Set descriptor.Module)) -(def: fresh +(def fresh Ancestry (set.empty text.hash)) (type: .public Graph (Dictionary descriptor.Module Ancestry)) -(def: empty +(def empty Graph (dictionary.empty text.hash)) -(def: .public modules +(def .public modules (-> Graph (List descriptor.Module)) dictionary.keys) @@ -46,13 +46,13 @@ [#module descriptor.Module #imports Ancestry])) -(def: .public graph +(def .public graph (-> (List Dependency) Graph) (list#mix (function (_ [module imports] graph) (dictionary.has module imports graph)) ..empty)) -(def: (ancestry archive) +(def (ancestry archive) (-> Archive Graph) (let [memo (is (Memo descriptor.Module Ancestry) (function (_ again module) @@ -74,7 +74,7 @@ ..empty (archive.archived archive)))) -(def: (dependency? ancestry target source) +(def (dependency? ancestry target source) (-> Graph descriptor.Module descriptor.Module Bit) (let [target_ancestry (|> ancestry (dictionary.value target) @@ -84,7 +84,7 @@ (type: .public (Order a) (List [descriptor.Module [module.ID (archive.Entry a)]])) -(def: .public (load_order key archive) +(def .public (load_order key archive) (All (_ a) (-> (Key a) Archive (Try (Order a)))) (let [ancestry (..ancestry archive)] (|> ancestry diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux index 59c7f5b50..ea6c1a660 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux @@ -32,17 +32,17 @@ "Module ID" (%.nat @module) "Error" error)) -(def: .public (path fs context @module) +(def .public (path fs context @module) (All (_ !) (-> (file.System !) Context module.ID file.Path)) (format (//.path fs context) (at fs separator) (%.nat @module))) -(def: .public (enabled? fs context @module) +(def .public (enabled? fs context @module) (All (_ !) (-> (file.System !) Context module.ID (! Bit))) (at fs directory? (..path fs context @module))) -(def: .public (enable! ! fs context @module) +(def .public (enable! ! fs context @module) (All (_ !) (-> (Monad !) (file.System !) Context module.ID (! (Try Any)))) (do ! [.let [path (..path fs context @module)] @@ -68,25 +68,25 @@ success success)))))))))) -(def: file +(def file file.Path "descriptor") -(def: .public (descriptor fs context @module) +(def .public (descriptor fs context @module) (All (_ !) (-> (file.System !) Context module.ID file.Path)) (format (..path fs context @module) (at fs separator) ..file)) -(def: .public (cache! fs context @module content) +(def .public (cache! fs context @module content) (All (_ !) (-> (file.System !) Context module.ID Binary (! (Try Any)))) (at fs write (..descriptor fs context @module) content)) -(def: .public (cache fs context @module) +(def .public (cache fs context @module) (All (_ !) (-> (file.System !) Context module.ID (! (Try Binary)))) (at fs read (..descriptor fs context @module))) -(def: .public (artifacts ! fs context @module) +(def .public (artifacts ! fs context @module) (All (_ !) (-> (Monad !) (file.System !) Context module.ID (! (Try (Dictionary Text Binary))))) (do [! (try.with !)] [files (at fs directory_files (..path fs context @module)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux index addb97821..d538861e6 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux @@ -38,7 +38,7 @@ (Dictionary descriptor.Module module.ID)) ... TODO: Make the monad parameterizable. -(def: .public (purge! fs context @module) +(def .public (purge! fs context @module) (-> (file.System Async) Context module.ID (Async (Try Any))) (do [! (try.with async.monad)] [.let [cache (//module.path fs context @module)] @@ -48,7 +48,7 @@ (at ! conjoint))] (at fs delete cache))) -(def: .public (valid? expected actual) +(def .public (valid? expected actual) (-> Descriptor Input Bit) (and (text#= (the descriptor.#name expected) (the ////.#module actual)) @@ -57,7 +57,7 @@ (n.= (the descriptor.#hash expected) (the ////.#hash actual)))) -(def: initial +(def initial (-> (List Cache) Purge) (|>> (list.all (function (_ [valid? module_name @module _]) (if valid? @@ -65,7 +65,7 @@ {.#Some [module_name @module]}))) (dictionary.of_list text.hash))) -(def: .public (purge caches load_order) +(def .public (purge caches load_order) (-> (List Cache) (dependency.Order Any) Purge) (list#mix (function (_ [module_name [@module entry]] purge) (let [purged? (is (Predicate descriptor.Module) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux index ea10958bd..76c30f475 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux @@ -71,7 +71,7 @@ {#Export Export})) (with_template [<name> <long> <type> <parser>] - [(def: <name> + [(def <name> (Parser <type>) (<cli>.named <long> <parser>))] @@ -84,7 +84,7 @@ [configuration_parser "--configuration" Configuration (<text>.then configuration.parser <cli>.any)] ) -(def: .public service +(def .public service (Parser Service) (let [compilation (is (Parser Compilation) (all <>.and @@ -106,7 +106,7 @@ ..target_parser)) ))) -(def: .public target +(def .public target (-> Service Target) (|>> (pipe.case (^.or {#Compilation [host_dependencies libraries compilers sources target module]} diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux index 40ee7afe4..e8c4196dd 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux @@ -23,7 +23,7 @@ [#definition Symbol #parameters (List Text)])) -(def: .public equivalence +(def .public equivalence (Equivalence Compiler) (all product.equivalence symbol.equivalence @@ -31,7 +31,7 @@ )) (with_template [<ascii> <name>] - [(def: <name> + [(def <name> Text (text.of_char (hex <ascii>)))] @@ -39,16 +39,16 @@ ["03" end] ) -(def: parameter +(def parameter (-> Text Text) (text.enclosed [..start ..end])) -(def: .public (format [[module short] parameters]) +(def .public (format [[module short] parameters]) (%.Format Compiler) (%.format (..parameter module) (..parameter short) (text.together (list#each ..parameter parameters)))) -(def: .public parser +(def .public parser (Parser Compiler) (let [parameter (is (Parser Text) (<| (<>.after (<text>.this ..start)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/context.lux b/stdlib/source/library/lux/tool/compiler/meta/context.lux index cfacb3fe9..a2126c773 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/context.lux @@ -16,7 +16,7 @@ #artifact_extension Extension])) (with_template [<name> <host> <host_module_extension> <artifact_extension>] - [(def: .public (<name> target) + [(def .public (<name> target) (-> Path Context) [#host <host> #host_module_extension <host_module_extension> diff --git a/stdlib/source/library/lux/tool/compiler/meta/export.lux b/stdlib/source/library/lux/tool/compiler/meta/export.lux index 2871ecf8e..aab3dae55 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/export.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/export.lux @@ -28,16 +28,16 @@ [world ["[0]" file]]]]) -(def: .public file +(def .public file "library.tar") -(def: .public mode +(def .public mode (all tar.and tar.read_by_owner tar.write_by_owner tar.read_by_group tar.write_by_group tar.read_by_other)) -(def: .public ownership +(def .public ownership tar.Ownership (let [commons (is tar.Owner [tar.#name tar.anonymous @@ -45,7 +45,7 @@ [tar.#user commons tar.#group commons])) -(def: .public (library fs sources) +(def .public (library fs sources) (-> (file.System Async) (List Source) (Async (Try tar.Tar))) (|> sources (io.listing fs) @@ -65,7 +65,7 @@ (try#each sequence.of_list))) try#conjoint)))) -(def: .public (export fs [sources target]) +(def .public (export fs [sources target]) (-> (file.System Async) Export (Async (Try Any))) (do [! (try.with async.monad)] [tar (|> sources diff --git a/stdlib/source/library/lux/tool/compiler/meta/import.lux b/stdlib/source/library/lux/tool/compiler/meta/import.lux index dec6dde3b..d653afbac 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/import.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/import.lux @@ -26,7 +26,7 @@ [world ["[0]" file]]]]) -(def: Action +(def Action (type (All (_ a) (Async (Try a))))) (exception: .public useless_tar_entry) @@ -40,7 +40,7 @@ (type: .public Import (Dictionary file.Path Binary)) -(def: (import_library system library import) +(def (import_library system library import) (-> (file.System Async) Library Import (Action Import)) (let [! async.monad] (|> library @@ -65,7 +65,7 @@ import))) (at ! conjoint))))))) -(def: .public (import system libraries) +(def .public (import system libraries) (-> (file.System Async) (List Library) (Action Import)) (monad.mix (is (Monad Action) (try.with async.monad)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io.lux b/stdlib/source/library/lux/tool/compiler/meta/io.lux index efbdb599d..374e71ef3 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io.lux @@ -12,10 +12,10 @@ (type: .public Code Text) -(def: .public (safe system) +(def .public (safe system) (All (_ m) (-> (System m) Text Text)) (text.replaced "/" (at system separator))) -(def: .public lux_context +(def .public lux_context Context "lux") diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index a192cf58a..2cef8ada4 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -56,7 +56,7 @@ ["[0]" directive] ["[1]/[0]" program]]]]]]) -(def: (module_parser key parser) +(def (module_parser key parser) (All (_ document) (-> (Key document) (Parser document) (Parser (module.Module document)))) (all <>.and @@ -64,18 +64,18 @@ descriptor.parser (document.parser key parser))) -(def: (parser key parser) +(def (parser key parser) (All (_ document) (-> (Key document) (Parser document) (Parser [(module.Module document) Registry]))) (all <>.and (..module_parser key parser) registry.parser)) -(def: (fresh_analysis_state host configuration) +(def (fresh_analysis_state host configuration) (-> Target Configuration .Lux) (analysis.state (analysis.info version.latest host configuration))) -(def: (analysis_state host configuration archive) +(def (analysis_state host configuration archive) (-> Target Configuration Archive (Try .Lux)) (do [! try.monad] [modules (is (Try (List [descriptor.Module .Module])) @@ -101,14 +101,14 @@ Generators Directives]) -(def: empty_bundles +(def empty_bundles Bundles [(dictionary.empty text.hash) (dictionary.empty text.hash) (dictionary.empty text.hash) (dictionary.empty text.hash)]) -(def: (loaded_document extension host @module expected actual document) +(def (loaded_document extension host @module expected actual document) (All (_ expression directive) (-> Text (generation.Host expression directive) module.ID (Sequence [Artifact (Set unit.ID)]) (Dictionary Text Binary) (Document .Module) (Try [(Document .Module) Bundles Output]))) @@ -246,7 +246,7 @@ (in [(document.document $.key (has .#definitions definitions content)) bundles]))) -(def: (load_definitions fs context @module host_environment entry) +(def (load_definitions fs context @module host_environment entry) (All (_ expression directive) (-> (file.System Async) Context module.ID (generation.Host expression directive) (archive.Entry .Module) @@ -263,11 +263,11 @@ (has archive.#output output)) bundles]))) -(def: pseudo_module +(def pseudo_module Text "(Lux Caching System)") -(def: (cache_parser customs) +(def (cache_parser customs) (-> (List Custom) (Parser [(module.Module Any) Registry])) (case (for @.old (as (List (Custom Any Any Any)) customs) @@ -281,7 +281,7 @@ (cache_parser tail) ))) -(def: (valid_cache customs fs context import contexts [module_name @module]) +(def (valid_cache customs fs context import contexts [module_name @module]) (-> (List Custom) (file.System Async) Context Import (List //.Context) [descriptor.Module module.ID] (Async (Try Cache))) @@ -296,7 +296,7 @@ [input (//context.read fs ..pseudo_module import contexts (the context.#host_module_extension context) module_name)] (in [(cache/purge.valid? (the module.#descriptor module) input) <cache>])))))) -(def: (pre_loaded_caches customs fs context import contexts archive) +(def (pre_loaded_caches customs fs context import contexts archive) (-> (List Custom) (file.System Async) Context Import (List //.Context) Archive (Async (Try (List Cache)))) (do [! (try.with async.monad)] @@ -306,7 +306,7 @@ (monad.each ! (..valid_cache customs fs context import contexts)))] (in it))) -(def: (load_order archive pre_loaded_caches) +(def (load_order archive pre_loaded_caches) (-> Archive (List Cache) (Try (dependency.Order .Module))) (|> pre_loaded_caches @@ -321,7 +321,7 @@ (at try.monad each (dependency.load_order $.key)) (at try.monad conjoint))) -(def: (loaded_caches host_environment fs context purge load_order) +(def (loaded_caches host_environment fs context purge load_order) (All (_ expression directive) (-> (generation.Host expression directive) (file.System Async) Context Purge (dependency.Order .Module) @@ -343,7 +343,7 @@ <it>)))))))] (in it))) -(def: (load_every_reserved_module customs configuration host_environment fs context import contexts archive) +(def (load_every_reserved_module customs configuration host_environment fs context import contexts archive) (All (_ expression directive) (-> (List Custom) Configuration (generation.Host expression directive) (file.System Async) Context Import (List //.Context) Archive (Async (Try [Archive .Lux Bundles])))) @@ -374,7 +374,7 @@ ..empty_bundles loaded_caches)]))))) -(def: .public (thaw customs configuration host_environment fs context import contexts) +(def .public (thaw customs configuration host_environment fs context import contexts) (All (_ expression directive) (-> (List Custom) Configuration (generation.Host expression directive) (file.System Async) Context Import (List //.Context) (Async (Try [Archive .Lux Bundles])))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux index 6845f5cce..e79b60e7b 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -43,17 +43,17 @@ (type: .public Extension Text) -(def: .public lux_extension +(def .public lux_extension Extension ".lux") -(def: .public (path fs context module) +(def .public (path fs context module) (All (_ m) (-> (file.System m) Context Module file.Path)) (|> module (//.safe fs) (format context (at fs separator)))) -(def: (find_source_file fs importer contexts module extension) +(def (find_source_file fs importer contexts module extension) (-> (file.System Async) Module (List Context) Module Extension (Async (Try file.Path))) (case contexts @@ -68,11 +68,11 @@ (in {try.#Success path}) (find_source_file fs importer contexts' module extension)))))) -(def: (full_host_extension partial_host_extension) +(def (full_host_extension partial_host_extension) (-> Extension Extension) (format partial_host_extension ..lux_extension)) -(def: (find_local_source_file fs importer import contexts partial_host_extension module) +(def (find_local_source_file fs importer import contexts partial_host_extension module) (-> (file.System Async) Module Import (List Context) Extension Module (Async (Try [file.Path Binary]))) ... Preference is explicitly being given to Lux files that have a host extension. @@ -92,7 +92,7 @@ (at fs read) (at ! each (|>> [path]))))))) -(def: (find_library_source_file importer import partial_host_extension module) +(def (find_library_source_file importer import partial_host_extension module) (-> Module Import Extension Module (Try [file.Path Binary])) (let [path (format module (..full_host_extension partial_host_extension))] (case (dictionary.value path import) @@ -108,7 +108,7 @@ {.#None} (exception.except ..cannot_find_module [importer module])))))) -(def: (find_any_source_file fs importer import contexts partial_host_extension module) +(def (find_any_source_file fs importer import contexts partial_host_extension module) (-> (file.System Async) Module Import (List Context) Extension Module (Async (Try [file.Path Binary]))) ... Preference is explicitly being given to Lux files that have a host extension. @@ -122,7 +122,7 @@ {try.#Failure _} (in (..find_library_source_file importer import partial_host_extension module))))) -(def: .public (read fs importer import contexts partial_host_extension module) +(def .public (read fs importer import contexts partial_host_extension module) (-> (file.System Async) Module Import (List Context) Extension Module (Async (Try Input))) (do (try.with async.monad) @@ -140,7 +140,7 @@ (type: .public Enumeration (Dictionary file.Path Binary)) -(def: (context_listing fs context directory enumeration) +(def (context_listing fs context directory enumeration) (-> (file.System Async) Context file.Path Enumeration (Async (Try Enumeration))) (do [! (try.with async.monad)] [enumeration (|> directory @@ -158,10 +158,10 @@ (at ! each (monad.mix ! (context_listing fs context) enumeration)) (at ! conjoint)))) -(def: Action +(def Action (type (All (_ a) (Async (Try a))))) -(def: (canonical fs context) +(def (canonical fs context) (-> (file.System Async) Context (Action Context)) (do (try.with async.monad) [subs (at fs sub_directories context)] @@ -171,7 +171,7 @@ (file.parent fs) (maybe.else context))))) -(def: .public (listing fs contexts) +(def .public (listing fs contexts) (-> (file.System Async) (List Context) (Action Enumeration)) (let [! (is (Monad Action) (try.with async.monad))] diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager.lux b/stdlib/source/library/lux/tool/compiler/meta/packager.lux index 1543e082f..759cb26a5 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager.lux @@ -33,7 +33,7 @@ (type: .public Order (List [module.ID (List artifact.ID)])) -(def: .public order +(def .public order (-> (cache/module.Order Any) Order) (list#each (function (_ [module [module_id entry]]) (|> entry diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux index 47fb81088..ddc522426 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -118,21 +118,21 @@ (new [java/io/InputStream]) (getNextJarEntry [] "try" "?" java/util/jar/JarEntry)) -(def: byte +(def byte 1) ... https://en.wikipedia.org/wiki/Kibibyte -(def: kibi_byte +(def kibi_byte (n.* 1,024 byte)) ... https://en.wikipedia.org/wiki/Mebibyte -(def: mebi_byte +(def mebi_byte (n.* 1,024 kibi_byte)) -(def: manifest_version +(def manifest_version "1.0") -(def: (manifest program) +(def (manifest program) (-> (Maybe unit.ID) java/util/jar/Manifest) (let [manifest (java/util/jar/Manifest::new) attrs (do_to (java/util/jar/Manifest::getMainAttributes manifest) @@ -153,7 +153,7 @@ attrs) manifest))) -(def: (write_class static module artifact custom content sink) +(def (write_class static module artifact custom content sink) (-> Context module.ID artifact.ID (Maybe Text) Binary java/util/jar/JarOutputStream (Try java/util/jar/JarOutputStream)) (let [class_path (|> custom @@ -169,7 +169,7 @@ (java/io/Flushable::flush) (java/util/zip/ZipOutputStream::closeEntry)))))) -(def: (write_module static necessary_dependencies [module output] sink) +(def (write_module static necessary_dependencies [module output] sink) (-> Context (Set unit.ID) [module.ID Output] java/util/jar/JarOutputStream (Try java/util/jar/JarOutputStream)) (let [! try.monad] @@ -181,7 +181,7 @@ sink (sequence.list output)))) -(def: (read_jar_entry_with_unknown_size input) +(def (read_jar_entry_with_unknown_size input) (-> java/util/jar/JarInputStream [Nat Binary]) (let [chunk (binary.empty ..mebi_byte) chunk_size (.int ..mebi_byte) @@ -197,7 +197,7 @@ (java/io/OutputStream::write chunk (ffi.as_int +0) (ffi.as_int bytes_read) buffer) (again (|> bytes_read .nat (n.+ so_far)))))))) -(def: (read_jar_entry_with_known_size expected_size input) +(def (read_jar_entry_with_known_size expected_size input) (-> Nat java/util/jar/JarInputStream [Nat Binary]) (let [buffer (binary.empty expected_size)] (loop (again [so_far 0]) @@ -210,7 +210,7 @@ [expected_size buffer] (again so_far')))))) -(def: (read_jar_entry entry input) +(def (read_jar_entry entry input) (-> java/util/jar/JarEntry java/util/jar/JarInputStream [Nat Binary]) (case (ffi.of_long (java/util/zip/ZipEntry::getSize entry)) -1 @@ -219,7 +219,7 @@ entry_size (..read_jar_entry_with_known_size (.nat entry_size) input))) -(def: (write_host_dependency jar [entries duplicates sink]) +(def (write_host_dependency jar [entries duplicates sink]) (-> Binary [(Set file.Path) (Set file.Path) java/util/jar/JarOutputStream] (Try [(Set file.Path) (Set file.Path) java/util/jar/JarOutputStream])) @@ -267,7 +267,7 @@ duplicates sink)))))))) -(def: .public (package static) +(def .public (package static) (-> Context Packager) (function (_ host_dependencies archive program) (do [! try.monad] diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux index 0937615cc..cc5938094 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux @@ -44,7 +44,7 @@ [language ["$" lux]]]]]) -(def: (bundle_module module module_id necessary_dependencies output) +(def (bundle_module module module_id necessary_dependencies output) (-> descriptor.Module module.ID (Set unit.ID) Output (Try (Maybe _.Statement))) (do [! try.monad] [] @@ -73,11 +73,11 @@ artifacts)] (in {.#Some bundle}))))) -(def: module_file +(def module_file (-> module.ID file.Path) (|>> %.nat (text.suffix ".rb"))) -(def: (write_module mapping necessary_dependencies [module [module_id entry]] sink) +(def (write_module mapping necessary_dependencies [module [module_id entry]] sink) (-> (Dictionary descriptor.Module module.ID) (Set unit.ID) [descriptor.Module [module.ID (archive.Entry .Module)]] (List [module.ID [Text Binary]]) @@ -98,21 +98,21 @@ (in (list.partial [module_id [(..module_file module_id) entry_content]] sink)))))) -(def: .public main_file +(def .public main_file "main.rb") -(def: module_id_mapping +(def module_id_mapping (-> (Order .Module) (Dictionary descriptor.Module module.ID)) (|>> (list#each (function (_ [module [module_id entry]]) [module module_id])) (dictionary.of_list text.hash))) -(def: included_modules +(def included_modules (All (_ a) (-> (List [module.ID a]) (Set module.ID))) (|>> (list#each product.left) (list#mix set.has (set.empty nat.hash)))) -(def: .public (package host_dependencies archive program) +(def .public (package host_dependencies archive program) Packager (do [! try.monad] [.let [necessary_dependencies (cache/artifact.necessary_dependencies archive)] diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux index 1fed07990..70f595ff4 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -48,13 +48,13 @@ (type: (Action ! a) (! (Try a))) -(def: (then pre post) +(def (then pre post) (-> _.Expression _.Expression _.Expression) (_.manual (format (_.code pre) text.new_line (_.code post)))) -(def: bundle_module +(def bundle_module (-> Output (Try _.Expression)) (|>> sequence.list (list#each product.right) @@ -71,11 +71,11 @@ (..then so_far))))) (is _.Expression (_.manual ""))))) -(def: module_file +(def module_file (-> archive.ID file.Path) (|>> %.nat (text.suffix ".scm"))) -(def: mode +(def mode tar.Mode (all tar.and tar.read_by_group @@ -85,16 +85,16 @@ tar.write_by_group tar.write_by_owner)) -(def: owner +(def owner tar.Owner [tar.#name tar.anonymous tar.#id tar.no_id]) -(def: ownership +(def ownership [tar.#user ..owner tar.#group ..owner]) -(def: (write_module now mapping [module [module_id [descriptor document output]]]) +(def (write_module now mapping [module [module_id [descriptor document output]]]) (-> Instant (Dictionary Module archive.ID) [Module [archive.ID [Descriptor (Document .Module) Output]]] (Try tar.Entry)) @@ -115,7 +115,7 @@ module_file (tar.path (..module_file module_id))] (in {tar.#Normal [module_file now ..mode ..ownership entry_content]}))) -(def: .public (package now) +(def .public (package now) (-> Instant Packager) (function (package host_dependencies archive program) (do [! try.monad] diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux index 382536417..d68c344e5 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux @@ -34,7 +34,7 @@ [language ["$" lux]]]]]) -(def: (write_module necessary_dependencies sequence [module_id output] so_far) +(def (write_module necessary_dependencies sequence [module_id output] so_far) (All (_ directive) (-> (Set unit.ID) (-> directive directive directive) [module.ID Output] directive (Try directive))) @@ -57,7 +57,7 @@ (sequence so_far))))) so_far))) -(def: .public (package header code sequence scope) +(def .public (package header code sequence scope) (All (_ directive) (-> directive (-> directive Text) |