diff options
author | Eduardo Julian | 2021-08-08 17:56:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-08 17:56:15 -0400 |
commit | f621a133e6e0a516c0586270fea8eaffb4829d82 (patch) | |
tree | 399396ee2f6a10df10cea9b78c51c76679b70e59 /stdlib/source | |
parent | 17e7566be51df5e428a6b10e6469201a8a9468da (diff) |
No more #export magic syntax.
Diffstat (limited to '')
769 files changed, 6452 insertions, 6111 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index e9b0278e5..ec1eac721 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -23,7 +23,7 @@ [dummy_location (9 #1 (0 #0))] #1) -## (type: #export Any +## (type: .public Any ## (Ex [a] a)) ("lux def" Any ("lux type check type" @@ -37,7 +37,7 @@ (0 #0)))] #1) -## (type: #export Nothing +## (type: .public Nothing ## (All [a] a)) ("lux def" Nothing ("lux type check type" @@ -51,7 +51,7 @@ (0 #0)))] #1) -## (type: #export (List a) +## (type: .public (List a) ## #End ## (#Item a (List a))) ("lux def type tagged" List @@ -156,7 +156,7 @@ #End))] #1) -## (type: #export (Maybe a) +## (type: .public (Maybe a) ## #None ## (#Some a)) ("lux def type tagged" Maybe @@ -175,7 +175,7 @@ ["None" "Some"] #1) -## (type: #export #rec Type +## (type: .public #rec Type ## (#Primitive Text (List Type)) ## (#Sum Type Type) ## (#Product Type Type) @@ -229,7 +229,7 @@ ["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"] #1) -## (type: #export Location +## (type: .public Location ## {#module Text ## #line Nat ## #column Nat}) @@ -243,7 +243,7 @@ ["module" "line" "column"] #1) -## (type: #export (Ann m v) +## (type: .public (Ann m v) ## {#meta m ## #datum v}) ("lux def type tagged" Ann @@ -261,7 +261,7 @@ ["meta" "datum"] #1) -## (type: #export (Code' w) +## (type: .public (Code' w) ## (#Bit Bit) ## (#Nat Nat) ## (#Int Int) @@ -313,7 +313,7 @@ ["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"] #1) -## (type: #export Code +## (type: .public Code ## (Ann Location (Code' (Ann Location)))) ("lux def" Code (#Named ["library/lux" "Code"] @@ -326,6 +326,38 @@ #End))] #1) +("lux def" private + #0 + [dummy_location + (#Record (#Item [[dummy_location (#Tag ["library/lux" "doc"])] + [dummy_location (#Text "The export policy for private/local definitions.")]] + #End))] + #1) + +("lux def" public + #1 + [dummy_location + (#Record (#Item [[dummy_location (#Tag ["library/lux" "doc"])] + [dummy_location (#Text "The export policy for public/global definitions.")]] + #End))] + #1) + +("lux def" local + #0 + [dummy_location + (#Record (#Item [[dummy_location (#Tag ["library/lux" "doc"])] + [dummy_location (#Text "The export policy for private/local definitions.")]] + #End))] + #1) + +("lux def" global + #1 + [dummy_location + (#Record (#Item [[dummy_location (#Tag ["library/lux" "doc"])] + [dummy_location (#Text "The export policy for public/global definitions.")]] + #End))] + #1) + ("lux def" _ann ("lux type check" (#Function (#Apply (#Apply Location Ann) @@ -414,7 +446,7 @@ [dummy_location (#Record #End)] #0) -## (type: #export Definition +## (type: .public Definition ## [Bit Type Code Any]) ("lux def" Definition ("lux type check type" @@ -425,7 +457,7 @@ #End)) #1) -## (type: #export Alias +## (type: .public Alias ## Name) ("lux def" Alias ("lux type check type" @@ -434,7 +466,7 @@ (record$ #End) #1) -## (type: #export Global +## (type: .public Global ## (#Alias Alias) ## (#Definition Definition)) ("lux def type tagged" Global @@ -447,7 +479,7 @@ ["Alias" "Definition"] #1) -## (type: #export (Bindings k v) +## (type: .public (Bindings k v) ## {#counter Nat ## #mappings (List [k v])}) ("lux def type tagged" Bindings @@ -466,7 +498,7 @@ ["counter" "mappings"] #1) -## (type: #export Ref +## (type: .public Ref ## (#Local Nat) ## (#Captured Nat)) ("lux def type tagged" Ref @@ -479,7 +511,7 @@ ["Local" "Captured"] #1) -## (type: #export Scope +## (type: .public Scope ## {#name (List Text) ## #inner Nat ## #locals (Bindings Text [Type Nat]) @@ -504,7 +536,7 @@ (record$ #End) #0) -## (type: #export (Either l r) +## (type: .public (Either l r) ## (#Left l) ## (#Right r)) ("lux def type tagged" Either @@ -523,7 +555,7 @@ ["Left" "Right"] #1) -## (type: #export Source +## (type: .public Source ## [Location Nat Text]) ("lux def" Source ("lux type check type" @@ -532,7 +564,7 @@ (record$ #End) #1) -## (type: #export Module_State +## (type: .public Module_State ## #Active ## #Compiled ## #Cached) @@ -550,7 +582,7 @@ ["Active" "Compiled" "Cached"] #1) -## (type: #export Module +## (type: .public Module ## {#module_hash Nat ## #module_aliases (List [Text Text]) ## #definitions (List [Text Global]) @@ -592,7 +624,7 @@ ["module_hash" "module_aliases" "definitions" "imports" "tags" "types" "module_annotations" "module_state"] #1) -## (type: #export Type_Context +## (type: .public Type_Context ## {#ex_counter Nat ## #var_counter Nat ## #var_bindings (List [Nat (Maybe Type)])}) @@ -609,7 +641,7 @@ ["ex_counter" "var_counter" "var_bindings"] #1) -## (type: #export Mode +## (type: .public Mode ## #Build ## #Eval ## #Interpreter) @@ -627,7 +659,7 @@ ["Build" "Eval" "Interpreter"] #1) -## (type: #export Info +## (type: .public Info ## {#target Text ## #version Text ## #mode Mode}) @@ -647,7 +679,7 @@ ["target" "version" "mode"] #1) -## (type: #export Lux +## (type: .public Lux ## {#info Info ## #source Source ## #location Location @@ -696,7 +728,7 @@ ["info" "source" "location" "current_module" "modules" "scopes" "type_context" "expected" "seed" "scope_type_vars" "extensions" "host"] #1) -## (type: #export (Meta a) +## (type: .public (Meta a) ## (-> Lux (Either Text [Lux a]))) ("lux def" Meta ("lux type check type" @@ -714,7 +746,7 @@ #End))) #1) -## (type: #export Macro' +## (type: .public Macro' ## (-> (List Code) (Meta (List Code)))) ("lux def" Macro' ("lux type check type" @@ -723,7 +755,7 @@ (record$ #End) #1) -## (type: #export Macro +## (type: .public Macro ## (primitive "#Macro")) ("lux def" Macro ("lux type check type" @@ -839,9 +871,9 @@ #0) ("lux def" as_def - ("lux type check" (#Function Code (#Function Code (#Function Code (#Function Bit Code)))) - (function'' [name value annotations exported?] - (form$ (#Item (text$ "lux def") (#Item name (#Item value (#Item annotations (#Item (bit$ exported?) #End)))))))) + ("lux type check" (#Function Code (#Function Code (#Function Code (#Function Code Code)))) + (function'' [name value annotations export_policy] + (form$ (#Item (text$ "lux def") (#Item name (#Item value (#Item annotations (#Item export_policy #End)))))))) (record$ #End) #0) @@ -874,39 +906,22 @@ ("lux def" def:'' ("lux macro" (function'' [tokens] - ({(#Item [[_ (#Tag ["" "export"])] + ({(#Item [export_policy (#Item [[_ (#Form (#Item [name args]))] (#Item [meta (#Item [type (#Item [body #End])])])])]) (in_meta (#Item [(as_def name (as_checked type (as_function name args body)) (form$ (#Item (identifier$ ["library/lux" "record$"]) (#Item meta #End))) - #1) + export_policy) #End])) - (#Item [[_ (#Tag ["" "export"])] (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])]) + (#Item [export_policy (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])]) (in_meta (#Item [(as_def name (as_checked type body) (form$ (#Item (identifier$ ["library/lux" "record$"]) (#Item meta #End))) - #1) - #End])) - - (#Item [[_ (#Form (#Item [name args]))] - (#Item [meta (#Item [type (#Item [body #End])])])]) - (in_meta (#Item [(as_def name (as_checked type (as_function name args body)) - (form$ (#Item (identifier$ ["library/lux" "record$"]) - (#Item meta - #End))) - #0) - #End])) - - (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])]) - (in_meta (#Item [(as_def name (as_checked type body) - (form$ (#Item (identifier$ ["library/lux" "record$"]) - (#Item meta - #End))) - #0) + export_policy) #End])) _ @@ -918,28 +933,20 @@ ("lux def" macro:' ("lux macro" (function'' [tokens] - ({(#Item [_ (#Form (#Item name args))] (#Item body #End)) + ({(#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item body #End))) (in_meta (#Item (as_def name (as_macro (as_function name args body)) (form$ (#Item (identifier$ ["library/lux" "record$"]) (#Item (tag$ ["library/lux" "End"]) #End))) - #0) + export_policy) #End)) - (#Item [_ (#Tag ["" "export"])] (#Item [_ (#Form (#Item name args))] (#Item body #End))) - (in_meta (#Item (as_def name (as_macro (as_function name args body)) - (form$ (#Item (identifier$ ["library/lux" "record$"]) - (#Item (tag$ ["library/lux" "End"]) - #End))) - #1) - #End)) - - (#Item [_ (#Tag ["" "export"])] (#Item [_ (#Form (#Item name args))] (#Item meta_data (#Item body #End)))) + (#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item meta_data (#Item body #End)))) (in_meta (#Item (as_def name (as_macro (as_function name args body)) (form$ (#Item (identifier$ ["library/lux" "record$"]) (#Item meta_data #End))) - #1) + export_policy) #End)) _ @@ -948,7 +955,7 @@ (record$ #.End) #0) -(macro:' #export (comment tokens) +(macro:' .public (comment tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Throws away any code given to it." __paragraph) @@ -958,7 +965,7 @@ #End) (in_meta #End)) -(macro:' ($' tokens) +(macro:' .private ($' tokens) ({(#Item x #End) (in_meta tokens) @@ -973,7 +980,7 @@ (failure "Wrong syntax for $'")} tokens)) -(def:'' (list\map f xs) +(def:'' .private (list\map f xs) #End (#UnivQ #End (#UnivQ #End @@ -987,12 +994,12 @@ (#Item (f x) (list\map f xs'))} xs)) -(def:'' Replacement_Environment +(def:'' .private Replacement_Environment #End Type ($' List (#Product Text Code))) -(def:'' (replacement_environment xs ys) +(def:'' .private (replacement_environment xs ys) #End (#Function ($' List Text) (#Function ($' List Code) Replacement_Environment)) ({[(#Item x xs') (#Item y ys')] @@ -1002,12 +1009,12 @@ #End} [xs ys])) -(def:'' (text\= reference sample) +(def:'' .private (text\= reference sample) #End (#Function Text (#Function Text Bit)) ("lux text =" reference sample)) -(def:'' (replacement for environment) +(def:'' .private (replacement for environment) #End (#Function Text (#Function Replacement_Environment ($' Maybe Code))) ({#End @@ -1022,7 +1029,7 @@ (text\= k for))} environment)) -(def:'' (with_replacements reps syntax) +(def:'' .private (with_replacements reps syntax) #End (#Function Replacement_Environment (#Function Code Code)) ({[_ (#Identifier "" name)] @@ -1051,7 +1058,7 @@ syntax} syntax)) -(def:'' (n/* param subject) +(def:'' .private (n/* param subject) #.End (#Function Nat (#Function Nat Nat)) ("lux type as" Nat @@ -1059,7 +1066,7 @@ ("lux type as" Int param) ("lux type as" Int subject)))) -(def:'' (nested_quantification code) +(def:'' .private (nested_quantification code) #End (#Function Code Code) ({[_ (#Tuple members)] @@ -1082,7 +1089,7 @@ code} code)) -(def:'' (quantified_args_parser args next) +(def:'' .private (quantified_args_parser args next) #End ## (-> (List Code) (-> (List Text) (Meta (List Code))) (Meta (List Code))) (#Function ($' List Code) @@ -1099,12 +1106,12 @@ (failure "Expected identifier.")} args)) -(def:'' (type_parameter idx) +(def:'' .private (type_parameter idx) #End (#Function Nat Code) (form$ (#Item (tag$ ["library/lux" "Parameter"]) (#Item (nat$ idx) #End)))) -(def:'' (list\fold f init xs) +(def:'' .private (list\fold f init xs) #End ## (All [a b] (-> (-> b a a) a (List b) a)) (#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1) @@ -1120,13 +1127,13 @@ (list\fold f (f x init) xs')} xs)) -(def:'' (list\size list) +(def:'' .private (list\size list) #End (#UnivQ #End (#Function ($' List (#Parameter 1)) Nat)) (list\fold (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) -(macro:' #export (All tokens) +(macro:' .public (All tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Universal quantification." __paragraph) @@ -1171,7 +1178,7 @@ (failure "Wrong syntax for All")} tokens))) -(macro:' #export (Ex tokens) +(macro:' .public (Ex tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Existential quantification." __paragraph) @@ -1216,7 +1223,7 @@ (failure "Wrong syntax for Ex")} tokens))) -(def:'' (list\reverse list) +(def:'' .private (list\reverse list) #End (All [a] (#Function ($' List a) ($' List a))) (list\fold ("lux type check" (All [a] (#Function a (#Function ($' List a) ($' List a)))) @@ -1224,7 +1231,7 @@ #End list)) -(macro:' #export (-> tokens) +(macro:' .public (-> tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Function types:" __paragraph) @@ -1243,7 +1250,7 @@ (failure "Wrong syntax for ->")} (list\reverse tokens))) -(macro:' #export (list xs) +(macro:' .public (list xs) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## List-construction macro." __paragraph) @@ -1257,7 +1264,7 @@ (list\reverse xs)) #End))) -(macro:' #export (list& xs) +(macro:' .public (list& xs) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## List-construction macro, with the last element being a tail-list." __paragraph) @@ -1276,7 +1283,7 @@ (failure "Wrong syntax for list&")} (list\reverse xs))) -(macro:' #export (Tuple tokens) +(macro:' .public (Tuple tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Tuple types:" __paragraph) @@ -1295,7 +1302,7 @@ prevs)))} (list\reverse tokens))) -(macro:' #export (Variant tokens) +(macro:' .public (Variant tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Variant types:" __paragraph) @@ -1314,7 +1321,7 @@ prevs)))} (list\reverse tokens))) -(macro:' (function' tokens) +(macro:' .private (function' tokens) (let'' [name tokens'] ({(#Item [[_ (#Identifier ["" name])] tokens']) [name tokens'] @@ -1340,8 +1347,8 @@ (failure "Wrong syntax for function'")} tokens'))) -(macro:' (def:''' tokens) - ({(#Item [[_ (#Tag ["" "export"])] +(macro:' .private (def:''' tokens) + ({(#Item [export_policy (#Item [[_ (#Form (#Item [name args]))] (#Item [meta (#Item [type (#Item [body #End])])])])]) (in_meta (list (form$ (list (text$ "lux def") @@ -1355,9 +1362,9 @@ (form$ (#Item (identifier$ ["library/lux" "record$"]) (#Item meta #End))) - (bit$ #1))))) + export_policy)))) - (#Item [[_ (#Tag ["" "export"])] (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])]) + (#Item [export_policy (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])]) (in_meta (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") @@ -1366,47 +1373,23 @@ (form$ (#Item (identifier$ ["library/lux" "record$"]) (#Item meta #End))) - (bit$ #1))))) - - (#Item [[_ (#Form (#Item [name args]))] - (#Item [meta (#Item [type (#Item [body #End])])])]) - (in_meta (list (form$ (list (text$ "lux def") - name - (form$ (list (text$ "lux type check") - type - (form$ (list (identifier$ ["library/lux" "function'"]) - name - (tuple$ args) - body)))) - (form$ (#Item (identifier$ ["library/lux" "record$"]) - (#Item meta - #End))) - (bit$ #0))))) - - (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])]) - (in_meta (list (form$ (list (text$ "lux def") - name - (form$ (list (text$ "lux type check") type body)) - (form$ (#Item (identifier$ ["library/lux" "record$"]) - (#Item meta - #End))) - (bit$ #0))))) + export_policy)))) _ (failure "Wrong syntax for def:'''")} tokens)) -(def:''' #export Or +(def:''' .public Or #End Macro ..Variant) -(def:''' #export And +(def:''' .public And #End Macro ..Tuple) -(def:''' (pairs xs) +(def:''' .private (pairs xs) #End (All [a] (-> ($' List a) ($' List (Tuple a a)))) ({(#Item x (#Item y xs')) @@ -1416,7 +1399,7 @@ #End} xs)) -(macro:' (let' tokens) +(macro:' .private (let' tokens) ({(#Item [[_ (#Tuple bindings)] (#Item [body #End])]) (in_meta (list (list\fold ("lux type check" (-> (Tuple Code Code) Code Code) @@ -1431,7 +1414,7 @@ (failure "Wrong syntax for let'")} tokens)) -(def:''' (any? p xs) +(def:''' .private (any? p xs) #End (All [a] (-> (-> a Bit) ($' List a) Bit)) @@ -1444,13 +1427,13 @@ (p x))} xs)) -(def:''' (with_location content) +(def:''' .private (with_location content) #End (-> Code Code) (tuple$ (list (tuple$ (list (text$ "") (nat$ 0) (nat$ 0))) content))) -(def:''' (untemplated_list tokens) +(def:''' .private (untemplated_list tokens) #End (-> ($' List Code) Code) ({#End @@ -1460,7 +1443,7 @@ (_ann (#Form (list (_ann (#Tag ["library/lux" "Item"])) token (untemplated_list tokens'))))} tokens)) -(def:''' (list\compose xs ys) +(def:''' .private (list\compose xs ys) #End (All [a] (-> ($' List a) ($' List a) ($' List a))) ({(#Item x xs') @@ -1470,7 +1453,7 @@ ys} xs)) -(def:''' (right_associativity op a1 a2) +(def:''' .private (right_associativity op a1 a2) #End (-> Code Code Code Code) ({[_ (#Form parts)] @@ -1480,14 +1463,14 @@ (form$ (list op a1 a2))} op)) -(def:''' (function\flip func) +(def:''' .private (function\flip func) #End (All [a b c] (-> (-> a b c) (-> b a c))) (function' [right left] (func left right))) -(macro:' #export (_$ tokens) +(macro:' .public (_$ tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Left-association for the application of binary functions over variadic arguments." ..\n) @@ -1509,7 +1492,7 @@ (failure "Wrong syntax for _$")} tokens)) -(macro:' #export ($_ tokens) +(macro:' .public ($_ tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Right-association for the application of binary functions over variadic arguments." ..\n) @@ -1547,7 +1530,7 @@ ["in" "bind"] #0) -(def:''' maybe_monad +(def:''' .private maybe_monad #End ($' Monad Maybe) {#in @@ -1559,7 +1542,7 @@ (#Some a) (f a)} ma))}) -(def:''' meta_monad +(def:''' .private meta_monad #End ($' Monad Meta) {#in @@ -1577,7 +1560,7 @@ (f a state')} (ma state))))}) -(macro:' (do tokens) +(macro:' .private (do tokens) ({(#Item monad (#Item [_ (#Tuple bindings)] (#Item body #End))) (let' [g!in (local_identifier$ "in") g!bind (local_identifier$ " bind ") @@ -1610,7 +1593,7 @@ (failure "Wrong syntax for do")} tokens)) -(def:''' (monad\map m f xs) +(def:''' .private (monad\map m f xs) #End ## (All [m a b] ## (-> (Monad m) (-> a (m b)) (List a) (m (List b)))) @@ -1630,7 +1613,7 @@ (in (#Item y ys)))} xs))) -(def:''' (monad\fold m f y xs) +(def:''' .private (monad\fold m f y xs) #End ## (All [m a b] ## (-> (Monad m) (-> a b (m b)) b (List a) (m b))) @@ -1650,7 +1633,7 @@ (monad\fold m f y' xs'))} xs))) -(macro:' #export (if tokens) +(macro:' .public (if tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "Picks which expression to evaluate based on a bit test value." __paragraph @@ -1665,12 +1648,12 @@ (failure "Wrong syntax for if")} tokens)) -(def:''' PList +(def:''' .private PList #End Type (All [a] ($' List (Tuple Text a)))) -(def:''' (get k plist) +(def:''' .private (get k plist) #End (All [a] (-> Text ($' PList a) ($' Maybe a))) @@ -1683,7 +1666,7 @@ #None} plist)) -(def:''' (put k v dict) +(def:''' .private (put k v dict) #End (All [a] (-> Text a ($' PList a) ($' PList a))) @@ -1696,12 +1679,12 @@ (#Item [[k' v'] (put k v dict')]))} dict)) -(def:''' (text\compose x y) +(def:''' .private (text\compose x y) #End (-> Text Text Text) ("lux text concat" x y)) -(def:''' (name\encode full_name) +(def:''' .private (name\encode full_name) #End (-> Name Text) (let' [[module name] full_name] @@ -1709,7 +1692,7 @@ _ ($_ text\compose module "." name)} module))) -(def:''' (get_meta tag def_meta) +(def:''' .private (get_meta tag def_meta) #End (-> Name Code ($' Maybe Code)) (let' [[prefix name] tag] @@ -1736,7 +1719,7 @@ #None} def_meta))) -(def:''' (global_identifier full_name state) +(def:''' .private (global_identifier full_name state) #End (-> Name ($' Meta Name)) (let' [[module name] full_name @@ -1761,7 +1744,7 @@ (#Left ($_ text\compose "Unknown module: " module " @ " (name\encode full_name)))} (get module modules)))) -(def:''' (code_list expression) +(def:''' .private (code_list expression) #End (-> Code Code) (let' [type (form$ (list (tag$ ["library/lux" "Apply"]) @@ -1769,7 +1752,7 @@ (identifier$ ["library/lux" "List"])))] (form$ (list (text$ "lux type check") type expression)))) -(def:''' (spliced replace? untemplate elems) +(def:''' .private (spliced replace? untemplate elems) #End (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ({#1 @@ -1809,12 +1792,12 @@ (in (untemplated_list =elems)))} replace?)) -(def:''' (untemplated_text value) +(def:''' .private (untemplated_text value) #End (-> Text Code) (with_location (form$ (list (tag$ ["library/lux" "Text"]) (text$ value))))) -(def:''' (untemplate replace? subst token) +(def:''' .private (untemplate replace? subst token) #End (-> Bit Text Code ($' Meta Code)) ({[_ [_ (#Bit value)]] @@ -1905,7 +1888,7 @@ (in (with_location (form$ (list (tag$ ["library/lux" "Record"]) (untemplated_list =fields))))))} [replace? token])) -(macro:' #export (primitive tokens) +(macro:' .public (primitive tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Macro to treat define new primitive types." __paragraph @@ -1921,7 +1904,7 @@ (failure "Wrong syntax for primitive")} tokens)) -(def:'' (current_module_name state) +(def:'' .private (current_module_name state) #End ($' Meta Text) ({{#info info #source source #current_module current_module #modules modules @@ -1936,7 +1919,7 @@ current_module)} state)) -(macro:' #export (` tokens) +(macro:' .public (` tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Hygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph @@ -1954,7 +1937,7 @@ (failure "Wrong syntax for `")} tokens)) -(macro:' #export (`' tokens) +(macro:' .public (`' tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Unhygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph @@ -1968,7 +1951,7 @@ (failure "Wrong syntax for `")} tokens)) -(macro:' #export (' tokens) +(macro:' .public (' tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Quotation as a macro." __paragraph @@ -1982,7 +1965,7 @@ (failure "Wrong syntax for '")} tokens)) -(macro:' #export (|> tokens) +(macro:' .public (|> tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Piping macro." __paragraph @@ -2008,7 +1991,7 @@ (failure "Wrong syntax for |>")} tokens)) -(macro:' #export (<| tokens) +(macro:' .public (<| tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Reverse piping macro." __paragraph @@ -2034,14 +2017,14 @@ (failure "Wrong syntax for <|")} (list\reverse tokens))) -(def:''' (compose f g) +(def:''' .private (compose f g) (list [(tag$ ["library/lux" "doc"]) (text$ "Function composition.")]) (All [a b c] (-> (-> b c) (-> a b) (-> a c))) (function' [x] (f (g x)))) -(def:''' (get_name x) +(def:''' .private (get_name x) #End (-> Code ($' Maybe Name)) ({[_ (#Identifier sname)] @@ -2051,7 +2034,7 @@ #None} x)) -(def:''' (get_tag x) +(def:''' .private (get_tag x) #End (-> Code ($' Maybe Name)) ({[_ (#Tag sname)] @@ -2061,7 +2044,7 @@ #None} x)) -(def:''' (get_short x) +(def:''' .private (get_short x) #End (-> Code ($' Maybe Text)) ({[_ (#Identifier "" sname)] @@ -2071,7 +2054,7 @@ #None} x)) -(def:''' (tuple_list tuple) +(def:''' .private (tuple_list tuple) #End (-> Code ($' Maybe ($' List Code))) ({[_ (#Tuple members)] @@ -2081,7 +2064,7 @@ #None} tuple)) -(def:''' (apply_template env template) +(def:''' .private (apply_template env template) #End (-> Replacement_Environment Code Code) ({[_ (#Identifier "" sname)] @@ -2109,28 +2092,28 @@ template} template)) -(def:''' (every? p xs) +(def:''' .private (every? p xs) #End (All [a] (-> (-> a Bit) ($' List a) Bit)) (list\fold (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) -(def:''' (high_bits value) +(def:''' .private (high_bits value) (list) (-> ($' I64 Any) I64) ("lux i64 right-shift" 32 value)) -(def:''' low_mask +(def:''' .private low_mask (list) I64 (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))) -(def:''' (low_bits value) +(def:''' .private (low_bits value) (list) (-> ($' I64 Any) I64) ("lux i64 and" low_mask value)) -(def:''' (n/< reference sample) +(def:''' .private (n/< reference sample) (list) (-> Nat Nat Bit) (let' [referenceH (high_bits reference) @@ -2143,25 +2126,25 @@ (low_bits sample)) #0)))) -(def:''' (n/<= reference sample) +(def:''' .private (n/<= reference sample) (list) (-> Nat Nat Bit) (if (n/< reference sample) #1 ("lux i64 =" reference sample))) -(def:''' (list\join xs) +(def:''' .private (list\join xs) #End (All [a] (-> ($' List ($' List a)) ($' List a))) (list\fold list\compose #End (list\reverse xs))) -(macro:' #export (template tokens) +(macro:' .public (template tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." __paragraph "(template [<name> <diff>]" ..\n - " " "[(def: #export <name> (-> Int Int) (+ <diff>))]" __paragraph + " " "[(def: .public <name> (-> Int Int) (+ <diff>))]" __paragraph " " "[inc +1]" ..\n " " "[dec -1]"))]) ({(#Item [[_ (#Tuple bindings)] (#Item [[_ (#Tuple templates)] data])]) @@ -2186,7 +2169,7 @@ (failure "Wrong syntax for template")} tokens)) -(def:''' (n// param subject) +(def:''' .private (n// param subject) (list) (-> Nat Nat Nat) (if ("lux i64 <" +0 ("lux type as" Int param)) @@ -2205,7 +2188,7 @@ quotient ("lux i64 +" 1 quotient))))) -(def:''' (n/% param subject) +(def:''' .private (n/% param subject) (list) (-> Nat Nat Nat) (let' [flat ("lux i64 *" @@ -2213,19 +2196,19 @@ ("lux type as" Int (n// param subject)))] ("lux i64 -" flat subject))) -(def:''' (n/min left right) +(def:''' .private (n/min left right) (list) (-> Nat Nat Nat) (if (n/< right left) left right)) -(def:''' (bit\encode x) +(def:''' .private (bit\encode x) #End (-> Bit Text) (if x "#1" "#0")) -(def:''' (digit::format digit) +(def:''' .private (digit::format digit) #End (-> Nat Text) ({0 "0" @@ -2235,7 +2218,7 @@ _ ("lux io error" "@digit::format Undefined behavior.")} digit)) -(def:''' (nat\encode value) +(def:''' .private (nat\encode value) #End (-> Nat Text) ({0 @@ -2252,14 +2235,14 @@ (loop value ""))} value)) -(def:''' (int\abs value) +(def:''' .private (int\abs value) #End (-> Int Int) (if ("lux i64 <" +0 value) ("lux i64 *" -1 value) value)) -(def:''' (int\encode value) +(def:''' .private (int\encode value) #End (-> Int Text) (if ("lux i64 =" +0 value) @@ -2277,17 +2260,17 @@ (|> value ("lux i64 /" +10) int\abs) (|> value ("lux i64 %" +10) int\abs ("lux type as" Nat) digit::format))))) -(def:''' (frac\encode x) +(def:''' .private (frac\encode x) #End (-> Frac Text) ("lux f64 encode" x)) -(def:''' (multiple? div n) +(def:''' .private (multiple? div n) #End (-> Nat Nat Bit) (|> n (n/% div) ("lux i64 =" 0))) -(def:''' #export (not x) +(def:''' .public (not x) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Bit negation." __paragraph @@ -2296,7 +2279,7 @@ (-> Bit Bit) (if x #0 #1)) -(def:''' (macro_type? type) +(def:''' .private (macro_type? type) (list) (-> Type Bit) ({(#Named ["library/lux" "Macro"] (#Primitive "#Macro" #End)) @@ -2306,7 +2289,7 @@ #0} type)) -(def:''' (macro' modules current_module module name) +(def:''' .private (macro' modules current_module module name) #End (-> ($' List (Tuple Text Module)) Text Text Text @@ -2328,7 +2311,7 @@ #None)} ("lux type check" Global gdef)))) -(def:''' (normal name) +(def:''' .private (normal name) #End (-> Name ($' Meta Name)) ({["" name] @@ -2340,7 +2323,7 @@ (in_meta name)} name)) -(def:''' (macro full_name) +(def:''' .private (macro full_name) #End (-> Name ($' Meta ($' Maybe Macro))) (do meta_monad @@ -2355,7 +2338,7 @@ (#Right state (macro' modules current_module module name))} state))))) -(def:''' (macro? name) +(def:''' .private (macro? name) #End (-> Name ($' Meta Bit)) (do meta_monad @@ -2365,7 +2348,7 @@ #None #0} output)))) -(def:''' (interpose sep xs) +(def:''' .private (interpose sep xs) #End (All [a] (-> a ($' List a) ($' List a))) @@ -2379,7 +2362,7 @@ (list& x sep (interpose sep xs'))} xs)) -(def:''' (single_expansion token) +(def:''' .private (single_expansion token) #End (-> Code ($' Meta ($' List Code))) ({[_ (#Form (#Item [_ (#Identifier name)] args))] @@ -2397,7 +2380,7 @@ (in_meta (list token))} token)) -(def:''' (expansion token) +(def:''' .private (expansion token) #End (-> Code ($' Meta ($' List Code))) ({[_ (#Form (#Item [_ (#Identifier name)] args))] @@ -2418,7 +2401,7 @@ (in_meta (list token))} token)) -(def:''' (full_expansion syntax) +(def:''' .private (full_expansion syntax) #End (-> Code ($' Meta ($' List Code))) ({[_ (#Form (#Item [_ (#Identifier name)] args))] @@ -2467,7 +2450,7 @@ (in_meta (list syntax))} syntax)) -(def:''' (normal_type type) +(def:''' .private (normal_type type) #End (-> Code Code) ({[_ (#Form (#Item [_ (#Tag tag)] parts))] @@ -2495,7 +2478,7 @@ type} type)) -(macro:' #export (type tokens) +(macro:' .public (type tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Takes a type expression and returns its representation as data-structure." __paragraph @@ -2514,7 +2497,7 @@ (failure "Wrong syntax for type")} tokens)) -(macro:' #export (: tokens) +(macro:' .public (: tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## The type-annotation macro." __paragraph @@ -2526,7 +2509,7 @@ (failure "Wrong syntax for :")} tokens)) -(macro:' #export (:as tokens) +(macro:' .public (:as tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## The type-coercion macro." __paragraph @@ -2538,7 +2521,7 @@ (failure "Wrong syntax for :as")} tokens)) -(def:''' (empty? xs) +(def:''' .private (empty? xs) #End (All [a] (-> ($' List a) Bit)) ({#End #1 @@ -2546,7 +2529,7 @@ xs)) (template [<name> <type> <value>] - [(def:''' (<name> xy) + [(def:''' .private (<name> xy) #End (All [a b] (-> (Tuple a b) <type>)) (let' [[x y] xy] <value>))] @@ -2554,7 +2537,7 @@ [first a x] [second b y]) -(def:''' (type_declaration type_codes) +(def:''' .private (type_declaration type_codes) #End (-> ($' List Code) ($' Meta (Tuple Code ($' Maybe ($' List Text))))) ({(#Item [_ (#Record pairs)] #End) @@ -2608,7 +2591,7 @@ (failure "Improper type-definition syntax")} type_codes)) -(def:''' (gensym prefix state) +(def:''' .private (gensym prefix state) #End (-> Text ($' Meta Code)) ({{#info info #source source #current_module _ #modules modules @@ -2624,7 +2607,7 @@ (local_identifier$ ($_ text\compose "__gensym__" prefix (nat\encode seed))))} state)) -(macro:' #export (Rec tokens) +(macro:' .public (Rec tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Parameter-less recursive types." __paragraph @@ -2640,7 +2623,7 @@ (failure "Wrong syntax for Rec")} tokens)) -(macro:' #export (exec tokens) +(macro:' .public (exec tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Sequential execution of expressions (great for side-effects)." __paragraph @@ -2661,30 +2644,24 @@ (failure "Wrong syntax for exec")} (list\reverse tokens))) -(macro:' (def:' tokens) - (let' [[export? tokens'] ({(#Item [_ (#Tag ["" "export"])] tokens') - [#1 tokens'] - - _ - [#0 tokens]} - tokens) - parts (: (Maybe [Code (List Code) (Maybe Code) Code]) - ({(#Item [_ (#Form (#Item name args))] (#Item type (#Item body #End))) - (#Some name args (#Some type) body) +(macro:' .private (def:' tokens) + (let' [parts (: (Maybe [Code Code (List Code) (Maybe Code) Code]) + ({(#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item type (#Item body #End)))) + (#Some [export_policy name args (#Some type) body]) - (#Item name (#Item type (#Item body #End))) - (#Some name #End (#Some type) body) + (#Item export_policy (#Item name (#Item type (#Item body #End)))) + (#Some [export_policy name #End (#Some type) body]) - (#Item [_ (#Form (#Item name args))] (#Item body #End)) - (#Some name args #None body) + (#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item body #End))) + (#Some [export_policy name args #None body]) - (#Item name (#Item body #End)) - (#Some name #End #None body) + (#Item export_policy (#Item name (#Item body #End))) + (#Some [export_policy name #End #None body]) _ #None} - tokens'))] - ({(#Some name args ?type body) + tokens))] + ({(#Some [export_policy name args ?type body]) (let' [body' ({#End body @@ -2701,17 +2678,17 @@ (~ body'') [(~ location_code) (#.Record #.End)] - (~ (bit$ export?))))))) + (~ export_policy)))))) #None (failure "Wrong syntax for def'")} parts))) -(def:' (text\encode original) +(def:' .private (text\encode original) (-> Text Text) ($_ text\compose ..double_quote original ..double_quote)) -(def:' (code\encode code) +(def:' .private (code\encode code) (-> Code Text) ({[_ (#Bit value)] (bit\encode value) @@ -2764,7 +2741,7 @@ (list\fold text\compose "")) "}")} code)) -(def:' (expander branches) +(def:' .private (expander branches) (-> (List Code) (Meta (List Code))) ({(#Item [_ (#Form (#Item [_ (#Identifier name)] args))] (#Item body @@ -2797,7 +2774,7 @@ (list\fold text\compose ""))))} branches)) -(macro:' #export (case tokens) +(macro:' .public (case tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## The pattern-matching macro." ..\n @@ -2816,7 +2793,7 @@ (failure "Wrong syntax for case")} tokens)) -(macro:' #export (^ tokens) +(macro:' .public (^ tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Macro-expanding patterns." ..\n @@ -2841,7 +2818,7 @@ _ (failure "Wrong syntax for ^ macro"))) -(macro:' #export (^or tokens) +(macro:' .public (^or tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Or-patterns." ..\n @@ -2870,7 +2847,7 @@ _ (failure "Wrong syntax for ^or"))) -(def:' (identifier? code) +(def:' .private (identifier? code) (-> Code Bit) (case code [_ (#Identifier _)] @@ -2879,7 +2856,7 @@ _ #0)) -(macro:' #export (let tokens) +(macro:' .public (let tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Creates local bindings." ..\n @@ -2905,7 +2882,7 @@ _ (failure "Wrong syntax for let"))) -(macro:' #export (function tokens) +(macro:' .public (function tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Syntax for creating functions." ..\n @@ -2937,7 +2914,7 @@ #None (failure "Wrong syntax for function"))) -(def:' (definition_annotation_value code) +(def:' .private (definition_annotation_value code) (-> Code Code) (case code [_ (#Bit value)] @@ -2980,7 +2957,7 @@ (meta_code ["library/lux" "Record"])) )) -(def:' (definition_annotations kvs) +(def:' .private (definition_annotations kvs) (-> (List [Code Code]) Code) (untemplated_list (list\map (: (-> [Code Code] Code) (function (_ [k v]) @@ -2988,40 +2965,189 @@ (~ (definition_annotation_value v))]))) kvs))) -(def:' (with_func_args args meta) +(def:' .private (with_function_parameters parameters meta) (-> (List Code) Code Code) - (case args + (case parameters #End meta _ (` (#.Item [[(~ location_code) (#.Tag ["library/lux" "func_args"])] - [(~ location_code) (#.Tuple (.list (~+ (list\map (function (_ arg) - (` [(~ location_code) (#.Text (~ (text$ (code\encode arg))))])) - args))))]] + [(~ location_code) (#.Tuple (.list (~+ (list\map (function (_ parameter) + (` [(~ location_code) (#.Text (~ (text$ (code\encode parameter))))])) + parameters))))]] (~ meta))))) -(def:' (with_type_args args) +(def:' .private (with_type_args args) (-> (List Code) Code) (` {#.type_args [(~+ (list\map (function (_ arg) (text$ (code\encode arg))) args))]})) -(def:' (export^ tokens) - (-> (List Code) [Bit (List Code)]) +(def:' .private (endP tokens) + (-> (List Code) (Maybe Any)) + (case tokens + (^ (list)) + (#.Some []) + + _ + #None)) + +(def:' .private (anyP tokens) + (-> (List Code) (Maybe [(List Code) Code])) + (case tokens + (^ (list& code tokens')) + (#Some [tokens' code]) + + _ + #.None)) + +(def:' .private (local_identifierP tokens) + (-> (List Code) (Maybe [(List Code) Text])) + (case tokens + (^ (list& [_ (#Identifier ["" local_identifier])] tokens')) + (#Some [tokens' local_identifier]) + + _ + #.None)) + +(template [<parser> <item_type> <item_parser>] + [(def:' .private (<parser> tokens) + (-> (List Code) (Maybe (List <item_type>))) + (case tokens + #End + (#.Some #End) + + _ + (do maybe_monad + [% (<item_parser> tokens) + .let' [[tokens head] %] + tail (<parser> tokens)] + (in (#Item head tail)))))] + + [parametersP Text local_identifierP] + [enhanced_parametersP Code anyP] + ) + +(template [<parser> <parameter_type> <parameters_parser>] + [(def:' .private (<parser> tokens) + (-> (List Code) (Maybe [(List Code) [Text (List <parameter_type>)]])) + (case tokens + (^ (list& [_ (#Form local_declaration)] tokens')) + (do maybe_monad + [% (local_identifierP local_declaration) + .let' [[local_declaration name] %] + parameters (<parameters_parser> local_declaration)] + (in [tokens' [name parameters]])) + + _ + (do maybe_monad + [% (local_identifierP tokens) + .let' [[tokens' name] %]] + (in [tokens' [name #End]]))))] + + [local_declarationP Text parametersP] + [enhanced_local_declarationP Code enhanced_parametersP] + ) + +(template [<parser> <parameter_type> <local>] + [(def:' .private (<parser> tokens) + (-> (List Code) (Maybe [(List Code) [Code Text (List <parameter_type>)]])) + (do maybe_monad + [% (anyP tokens) + .let' [[tokens export_policy] %] + % (<local> tokens) + .let' [[tokens [name parameters]] %]] + (in [tokens [export_policy name parameters]])))] + + [declarationP Text local_declarationP] + [enhanced_declarationP Code enhanced_local_declarationP] + ) + +(def:' .private (annotationsP tokens) + (-> (List Code) (Maybe [(List Code) (List [Code Code])])) (case tokens - (#Item [_ (#Tag [_ "export"])] tokens') - [#1 tokens'] + (^ (list& [_ (#Record annotations)] tokens')) + (#Some [tokens' annotations]) + + tokens' + #None)) + +(def:' .private (bodyP tokens) + (-> (List Code) (Maybe [(List Code) [(Maybe Code) Code]])) + (case tokens + ## TB + (^ (list& type body tokens')) + (#Some [tokens' [(#Some type) body]]) + + ## B + (^ (list& body tokens')) + (#Some [tokens' [#None body]]) _ - [#0 tokens])) + #None)) + +(macro:' .private (maybe\else' tokens) + (case tokens + (^ (list else then)) + (do meta_monad + [g!_ (gensym "g!_")] + (in (list (` (..case (~ then) + (#..Some (~ g!_)) + (#..Some (~ g!_)) -(def:' (export ?) - (-> Bit (List Code)) - (if ? - (list (' #export)) - (list))) + #..None + (~ else)))))) -(macro:' #export (def: tokens) + _ + (failure "Wrong syntax for maybe\else'"))) + +(def:' .private (definitionP tokens) + (-> (List Code) (Maybe [Code Text (List Code) (List [Code Code]) (Maybe Code) Code])) + (|> (do maybe_monad + [% (anyP tokens) + .let' [[tokens export_policy] %] + % (enhanced_local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + % (bodyP tokens) + .let' [[tokens [?type body]] %] + _ (endP tokens)] + (in [export_policy name parameters annotations ?type body])) + ## (^ (list _export_policy _declaration _annotations _type _body)) + ## (^ (list _export_policy _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [% (enhanced_local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (bodyP tokens) + .let' [[tokens [?type body]] %] + _ (endP tokens)] + (in [(` ..private) name parameters #End ?type body]))) + ## (^ (list _declaration _type _body)) + ## (^ (list _declaration _body)) + (maybe\else' (do maybe_monad + [% (enhanced_local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + % (bodyP tokens) + .let' [[tokens [?type body]] %] + _ (endP tokens)] + (in [(` ..private) name parameters annotations ?type body]))) + ## (^ (list _declaration _annotations _type _body)) + ## (^ (list _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [% (enhanced_declarationP tokens) + .let' [[tokens [export_policy name parameters]] %] + % (bodyP tokens) + .let' [[tokens [?type body]] %] + _ (endP tokens)] + (in [export_policy name parameters #End ?type body]))) + ## (^ (list _export_policy _declaration _type _body)) + ## (^ (list _export_policy _declaration _body)) + )) + +(macro:' .public (def: tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Defines global constants/functions." ..\n @@ -3033,67 +3159,40 @@ "(def: branching_exponent" ..\n " Int" ..\n " +5)"))]) - (let [[exported? tokens'] (export^ tokens) - parts (: (Maybe [Code (List Code) (Maybe Code) Code (List [Code Code])]) - (case tokens' - (^ (list [_ (#Form (#Item name args))] [_ (#Record meta_kvs)] type body)) - (#Some [name args (#Some type) body meta_kvs]) - - (^ (list name [_ (#Record meta_kvs)] type body)) - (#Some [name #End (#Some type) body meta_kvs]) - - (^ (list [_ (#Form (#Item name args))] [_ (#Record meta_kvs)] body)) - (#Some [name args #None body meta_kvs]) - - (^ (list name [_ (#Record meta_kvs)] body)) - (#Some [name #End #None body meta_kvs]) - - (^ (list [_ (#Form (#Item name args))] type body)) - (#Some [name args (#Some type) body #End]) - - (^ (list name type body)) - (#Some [name #End (#Some type) body #End]) - - (^ (list [_ (#Form (#Item name args))] body)) - (#Some [name args #None body #End]) - - (^ (list name body)) - (#Some [name #End #None body #End]) + (case (definitionP tokens) + (#Some [export_policy name parameters annotations ?type body]) + (let [body (case parameters + #End + body - _ - #None))] - (case parts - (#Some name args ?type body meta) - (let [body (case args - #End - body - - _ - (` (function ((~ name) (~+ args)) (~ body)))) - body (case ?type - (#Some type) - (` (: (~ type) (~ body))) - - #None - body) - =meta (definition_annotations meta)] - (in_meta (list (` ("lux def" (~ name) - (~ body) - [(~ location_code) - (#.Record (~ (with_func_args args =meta)))] - (~ (bit$ exported?))))))) - - #None - (failure "Wrong syntax for def:")))) + _ + (` (function ((~ (..local_identifier$ name)) (~+ parameters)) + (~ body)))) + body (case ?type + (#Some type) + (` (: (~ type) + (~ body))) + + #None + body) + =annotations (definition_annotations annotations)] + (in_meta (list (` ("lux def" (~ (..local_identifier$ name)) + (~ body) + [(~ location_code) + (#.Record (~ (with_function_parameters parameters =annotations)))] + (~ export_policy)))))) + + #None + (failure "Wrong syntax for def:"))) -(def: (with_definition_annotation addition meta) +(def: (with_definition_annotation addition annotations) (-> [Code Code] Code Code) - (case [addition meta] + (case [addition annotations] [[name value] [location (#Record pairs)]] [location (#Record (#Item [name value] pairs))] _ - meta)) + annotations)) (def: (merged_definition_annotations addition base) (-> Code Code Code) @@ -3104,11 +3203,53 @@ _ base)) -(macro:' #export (macro: tokens) +(def:' .private (macroP tokens) + (-> (List Code) (Maybe [Code Text (List Text) (List [Code Code]) Code])) + (|> (do maybe_monad + [% (anyP tokens) + .let' [[tokens export_policy] %] + % (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + % (anyP tokens) + .let' [[tokens body] %] + _ (endP tokens)] + (in [export_policy name parameters annotations body])) + ## (^ (list _export_policy _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [% (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (anyP tokens) + .let' [[tokens body] %] + _ (endP tokens)] + (in [(` ..private) name parameters #End body]))) + ## (^ (list _declaration _body)) + (maybe\else' (do maybe_monad + [% (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + % (anyP tokens) + .let' [[tokens body] %] + _ (endP tokens)] + (in [(` ..private) name parameters annotations body]))) + ## (^ (list _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [% (declarationP tokens) + .let' [[tokens [export_policy name parameters]] %] + % (anyP tokens) + .let' [[tokens body] %] + _ (endP tokens)] + (in [export_policy name parameters #End body]))) + ## (^ (list _export_policy _declaration _body)) + )) + +(macro:' .public (macro: tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" "## Macro-definition macro." ..\n - "(macro: #export (name_of tokens)" ..\n + "(macro: .public (name_of tokens)" ..\n " (case tokens" ..\n " (^template [<tag>]" ..\n " [(^ (list [_ (<tag> [prefix name])]))" ..\n @@ -3117,108 +3258,25 @@ __paragraph " _" ..\n " (failure ''Wrong syntax for name_of'')))"))]) - (let [[exported? tokens] (export^ tokens) - name+args+meta+body?? (: (Maybe [Name (List Code) (List [Code Code]) Code]) - (case tokens - (^ (list [_ (#Form (list& [_ (#Identifier name)] args))] body)) - (#Some [name args (list) body]) - - (^ (list [_ (#Identifier name)] body)) - (#Some [name #End (list) body]) - - (^ (list [_ (#Form (list& [_ (#Identifier name)] args))] [_ (#Record meta_rec_parts)] body)) - (#Some [name args meta_rec_parts body]) - - (^ (list [_ (#Identifier name)] [_ (#Record meta_rec_parts)] body)) - (#Some [name #End meta_rec_parts body]) - - _ - #None))] - (case name+args+meta+body?? - (#Some [name args meta body]) - (let [name (identifier$ name) - body (case args - #End - body + (case (macroP tokens) + (#Some [export_policy name args annotations body]) + (let [name (local_identifier$ name) + body (case args + #End + body - _ - (` ("lux macro" - (function ((~ name) (~+ args)) (~ body))))) - =meta (definition_annotations meta)] - (in_meta (list (` ("lux def" (~ name) - (~ body) - [(~ location_code) - (#Record (~ =meta))] - (~ (bit$ exported?))))))) - - #None - (failure "Wrong syntax for macro:")))) - -(macro: #export (interface: tokens) - {#.doc (text$ ($_ "lux text concat" - "## Definition of signatures ala ML." ..\n - "(interface: #export (Ord a)" ..\n - " (: (Equivalence a)" ..\n - " eq)" ..\n - " (: (-> a a Bit)" ..\n - " <)" ..\n - " (: (-> a a Bit)" ..\n - " <=)" ..\n - " (: (-> a a Bit)" ..\n - " >)" ..\n - " (: (-> a a Bit)" ..\n - " >=))"))} - (let [[exported? tokens'] (export^ tokens) - ?parts (: (Maybe [Name (List Code) Code (List Code)]) - (case tokens' - (^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] [meta_rec_location (#Record meta_rec_parts)] sigs)) - (#Some name args [meta_rec_location (#Record meta_rec_parts)] sigs) - - (^ (list& [_ (#Identifier name)] [meta_rec_location (#Record meta_rec_parts)] sigs)) - (#Some name #End [meta_rec_location (#Record meta_rec_parts)] sigs) - - (^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] sigs)) - (#Some name args (` {}) sigs) - - (^ (list& [_ (#Identifier name)] sigs)) - (#Some name #End (` {}) sigs) - - _ - #None))] - (case ?parts - (#Some name args meta sigs) - (do meta_monad - [name+ (normal name) - sigs' (monad\map meta_monad expansion sigs) - members (: (Meta (List [Text Code])) - (monad\map meta_monad - (: (-> Code (Meta [Text Code])) - (function (_ token) - (case token - (^ [_ (#Form (list [_ (#Text "lux type check")] type [_ (#Identifier ["" name])]))]) - (in [name type]) - - _ - (failure "Signatures require typed members!")))) - (list\join sigs'))) - .let [[_module _name] name+ - def_name (identifier$ name) - sig_type (record$ (list\map (: (-> [Text Code] [Code Code]) - (function (_ [module_name m_type]) - [(local_tag$ module_name) m_type])) - members)) - sig_meta (merged_definition_annotations (` {#.interface? #1}) - meta) - usage (case args - #End - def_name - - _ - (` ((~ def_name) (~+ args))))]] - (in_meta (list (` (..type: (~+ (export exported?)) (~ usage) (~ sig_meta) (~ sig_type)))))) - - #None - (failure "Wrong syntax for interface:")))) + _ + (` ("lux macro" + (function ((~ name) (~+ (list\map local_identifier$ args))) (~ body))))) + =annotations (definition_annotations annotations)] + (in_meta (list (` ("lux def" (~ name) + (~ body) + [(~ location_code) + (#Record (~ =annotations))] + (~ export_policy)))))) + + #.None + (failure "Wrong syntax for macro:"))) (def: (find f xs) (All [a b] @@ -3236,7 +3294,7 @@ (#Some y)))) (template [<name> <form> <message> <documentation>] - [(macro: #export (<name> tokens) + [(macro: .public (<name> tokens) {#.doc <documentation>} (case (list\reverse tokens) (^ (list& last init)) @@ -3255,7 +3313,7 @@ (-> Text Text (Maybe Nat)) ("lux text index" 0 part text)) -(def: #export (error! message) +(def: .public (error! message) {#.doc (text$ ($_ "lux text concat" "## Causes an error, with the given error message." ..\n "(error! ''OH NO!'')"))} @@ -3506,7 +3564,7 @@ #None (#Left "Not expecting any type."))))) -(macro: #export (implementation tokens) +(macro: .public (implementation tokens) {#.doc "Not meant to be used directly. Prefer 'implementation:'."} (do meta_monad [tokens' (monad\map meta_monad expansion tokens) @@ -3526,7 +3584,7 @@ (: (-> Code (Meta [Code Code])) (function (_ token) (case token - (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag_name)] value meta [_ (#Bit #0)]))]) + (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag_name)] value meta export_policy))]) (case (get tag_name tag_mappings) (#Some tag) (in [tag value]) @@ -3551,10 +3609,53 @@ head tail))) -(macro: #export (implementation: tokens) +(def: (remainderP tokens) + (-> (List Code) (Maybe (List Code))) + (case tokens + #End + #None + + _ + (#Item tokens))) + +(def:' .private (implementationP tokens) + (-> (List Code) (Maybe [Code Text (List Code) (List [Code Code]) Code (List Code)])) + (|> (do maybe_monad + [% (enhanced_declarationP tokens) + .let' [[tokens [export_policy name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + % (anyP tokens) + .let' [[tokens type] %] + tokens (remainderP tokens)] + (in [export_policy name parameters annotations type tokens])) + ## (^ (list _export_policy _declaration _annotations _type _body)) + ## (^ (list _declaration _annotations _type _body)) + (maybe\else' (do maybe_monad + [% (enhanced_local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (anyP tokens) + .let' [[tokens type] %] + tokens (remainderP tokens)] + (in [(` ..private) name parameters #End type tokens]))) + ## (^ (list _declaration _type _body)) + (maybe\else' (do maybe_monad + [% (anyP tokens) + .let' [[tokens export_policy] %] + % (enhanced_local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (anyP tokens) + .let' [[tokens type] %] + tokens (remainderP tokens)] + (in [export_policy name parameters #End type tokens]))) + ## (^ (list _export_policy _declaration _type _body)) + )) + +(macro: .public (implementation: tokens) {#.doc (text$ ($_ "lux text concat" "## Definition of structures ala ML." ..\n - "(implementation: #export order (Order Int)" ..\n + "(implementation: .public order" ..\n + " (Order Int)" ..\n " (def: &equivalence equivalence)" ..\n " (def: (< test subject)" ..\n " (< test subject))" ..\n @@ -3566,135 +3667,207 @@ " (def: (>= test subject)" ..\n " (or (> test subject)" ..\n " (= test subject))))"))} - (let [[exported? tokens'] (export^ tokens) - ?parts (: (Maybe [Code (List Code) Code Code (List Code)]) - (case tokens' - (^ (list& [_ (#Form (list& name args))] [meta_rec_location (#Record meta_rec_parts)] type definitions)) - (#Some name args type [meta_rec_location (#Record meta_rec_parts)] definitions) - - (^ (list& name [meta_rec_location (#Record meta_rec_parts)] type definitions)) - (#Some name #End type [meta_rec_location (#Record meta_rec_parts)] definitions) + (case (implementationP tokens) + (#Some [export_policy name args annotations type definitions]) + (let [usage (case args + #End + (local_identifier$ name) - (^ (list& [_ (#Form (list& name args))] type definitions)) - (#Some name args type (` {}) definitions) - - (^ (list& name type definitions)) - (#Some name #End type (` {}) definitions) - - _ - #None))] - (case ?parts - (#Some [name args type meta definitions]) - (let [usage (case args - #End - name - - _ - (` ((~ name) (~+ args))))] - (in_meta (list (` (..def: (~+ (export exported?)) (~ usage) - (~ (merged_definition_annotations (` {#.implementation? #1}) - meta)) - (~ type) - (implementation (~+ definitions))))))) + _ + (` ((~ (local_identifier$ name)) (~+ args))))] + (in_meta (list (` (..def: (~ export_policy) (~ usage) + (~ (merged_definition_annotations (` {#.implementation? #1}) + (record$ annotations))) + (~ type) + (implementation (~+ definitions))))))) - #None - (failure "Wrong syntax for implementation:")))) + #None + (failure "Wrong syntax for implementation:"))) (def: (function\identity value) (All [a] (-> a a)) value) -(macro: #export (type: tokens) +(def: (recP tokens) + (-> (List Code) [(List Code) Bit]) + (case tokens + (^ (list& [_ (#Tag ["" "rec"])] tokens')) + [tokens' #1] + + _ + [tokens #0])) + +(def:' .private (typeP tokens) + (-> (List Code) (Maybe [Code Bit Text (List Text) (List [Code Code]) (List Code)])) + (|> (do maybe_monad + [% (anyP tokens) + .let' [[tokens export_policy] %] + .let' [[tokens rec?] (recP tokens)] + % (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + tokens (remainderP tokens)] + (in [export_policy rec? name parameters annotations tokens])) + ## (^ (list _export_policy _rec _declaration _annotations _body)) + ## (^ (list _export_policy _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [.let' [[tokens rec?] (recP tokens)] + % (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + tokens (remainderP tokens)] + (in [(` ..private) rec? name parameters annotations tokens]))) + ## (^ (list _rec _declaration _annotations _body)) + ## (^ (list _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [.let' [[tokens rec?] (recP tokens)] + % (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + tokens (remainderP tokens)] + (in [(` ..private) rec? name parameters #End tokens]))) + ## (^ (list _rec _declaration _body)) + ## (^ (list _declaration _body)) + (maybe\else' (do maybe_monad + [% (anyP tokens) + .let' [[tokens export_policy] %] + .let' [[tokens rec?] (recP tokens)] + % (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + tokens (remainderP tokens)] + (in [export_policy rec? name parameters #End tokens]))) + ## (^ (list _export_policy _rec _declaration _body)) + ## (^ (list _export_policy _declaration _body)) + )) + +(macro: .public (type: tokens) {#.doc (text$ ($_ "lux text concat" "## The type-definition macro." ..\n - "(type: (List a) #End (#Item a (List a)))"))} - (let [[exported? tokens'] (export^ tokens) - [rec? tokens'] (case tokens' - (#Item [_ (#Tag [_ "rec"])] tokens') - [#1 tokens'] + "(type: (List a)" ..\n + " {#.doc (doc (: (List Nat) (list 0 1 2 3)))}" ..\n + " #End" ..\n + " (#Item a (List a)))"))} + (case (typeP tokens) + (#Some [export_policy rec? name args meta type_codes]) + (do meta_monad + [type+tags?? (..type_declaration type_codes) + module_name current_module_name] + (let [type_name (local_identifier$ name) + [type tags??] type+tags?? + type' (: (Maybe Code) + (if rec? + (if (empty? args) + (let [g!param (local_identifier$ "") + prime_name (local_identifier$ name) + type+ (with_replacements (list [name (` ((~ prime_name) .Nothing))]) + type)] + (#Some (` ((All (~ prime_name) [(~ g!param)] (~ type+)) + .Nothing)))) + #None) + (case args + #End + (#Some type) _ - [#0 tokens']) - parts (: (Maybe [Text (List Code) (List [Code Code]) (List Code)]) - (case tokens' - (^ (list [_ (#Identifier "" name)] [meta_location (#Record meta_parts)] [type_location (#Record type_parts)])) - (#Some [name #End meta_parts (list [type_location (#Record type_parts)])]) - - (^ (list& [_ (#Identifier "" name)] [meta_location (#Record meta_parts)] type_code1 type_codes)) - (#Some [name #End meta_parts (#Item type_code1 type_codes)]) - - (^ (list& [_ (#Identifier "" name)] type_codes)) - (#Some [name #End (list) type_codes]) - - (^ (list [_ (#Form (#Item [_ (#Identifier "" name)] args))] [meta_location (#Record meta_parts)] [type_location (#Record type_parts)])) - (#Some [name args meta_parts (list [type_location (#Record type_parts)])]) - - (^ (list& [_ (#Form (#Item [_ (#Identifier "" name)] args))] [meta_location (#Record meta_parts)] type_code1 type_codes)) - (#Some [name args meta_parts (#Item type_code1 type_codes)]) + (#Some (` (.All (~ type_name) [(~+ (list\map local_identifier$ args))] (~ type))))))) + total_meta (let [meta (definition_annotations meta) + meta (if rec? + (` (#.Item (~ (flag_meta "type_rec?")) (~ meta))) + meta)] + (` [(~ location_code) + (#.Record (~ meta))]))] + (case type' + (#Some type'') + (let [typeC (` (#.Named [(~ (text$ module_name)) + (~ (text$ name))] + (.type (~ type''))))] + (in_meta (list (case tags?? + (#Some tags) + (` ("lux def type tagged" (~ type_name) + (~ typeC) + (~ total_meta) + [(~+ (list\map text$ tags))] + (~ export_policy))) + + _ + (` ("lux def" (~ type_name) + ("lux type check type" + (~ typeC)) + (~ total_meta) + (~ export_policy))))))) - (^ (list& [_ (#Form (#Item [_ (#Identifier "" name)] args))] type_codes)) - (#Some [name args (list) type_codes]) + #None + (failure "Wrong syntax for type:")))) - _ - #None))] - (case parts - (#Some name args meta type_codes) - (do meta_monad - [type+tags?? (..type_declaration type_codes) - module_name current_module_name] - (let [type_name (local_identifier$ name) - [type tags??] type+tags?? - type' (: (Maybe Code) - (if rec? - (if (empty? args) - (let [g!param (local_identifier$ "") - prime_name (local_identifier$ name) - type+ (with_replacements (list [name (` ((~ prime_name) .Nothing))]) - type)] - (#Some (` ((All (~ prime_name) [(~ g!param)] (~ type+)) - .Nothing)))) - #None) - (case args - #End - (#Some type) + #None + (failure "Wrong syntax for type:"))) + +(def:' .private (interfaceP tokens) + (-> (List Code) (Maybe [Code Text (List Text) (List [Code Code]) (List Code)])) + (|> (do maybe_monad + [% (declarationP tokens) + .let' [[tokens [export_policy name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %]] + (in [export_policy name parameters annotations tokens])) + ## (^ (list _export_policy _declaration _annotations _body)) + ## (^ (list _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [% (local_declarationP tokens) + .let' [[tokens [name parameters]] %]] + (in [(` ..private) name parameters #End tokens]))) + ## (^ (list _declaration _body)) + (maybe\else' (do maybe_monad + [% (declarationP tokens) + .let' [[tokens [export_policy name parameters]] %]] + (in [export_policy name parameters #End tokens]))) + ## (^ (list _export_policy _declaration _body)) + )) + +(macro: .public (interface: tokens) + {#.doc (text$ ($_ "lux text concat" + "## Definition of interfaces/signatures ala ML." ..\n + "(interface: .public (Order a)" ..\n + " (: (Equivalence a)" ..\n + " &equivalence)" ..\n + " (: (-> a a Bit)" ..\n + " <))"))} + (case (interfaceP tokens) + (#Some [export_policy name args annotations methods]) + (do meta_monad + [methods' (monad\map meta_monad expansion methods) + members (: (Meta (List [Text Code])) + (monad\map meta_monad + (: (-> Code (Meta [Text Code])) + (function (_ token) + (case token + (^ [_ (#Form (list [_ (#Text "lux type check")] type [_ (#Identifier ["" name])]))]) + (in [name type]) - _ - (#Some (` (.All (~ type_name) [(~+ args)] (~ type))))))) - total_meta (let [meta (definition_annotations meta) - meta (if rec? - (` (#.Item (~ (flag_meta "type_rec?")) (~ meta))) - meta)] - (` [(~ location_code) - (#.Record (~ meta))]))] - (case type' - (#Some type'') - (let [typeC (` (#.Named [(~ (text$ module_name)) - (~ (text$ name))] - (.type (~ type''))))] - (in_meta (list (case tags?? - (#Some tags) - (` ("lux def type tagged" (~ type_name) - (~ typeC) - (~ total_meta) - [(~+ (list\map text$ tags))] - (~ (bit$ exported?)))) - - _ - (` ("lux def" (~ type_name) - ("lux type check type" - (~ typeC)) - (~ total_meta) - (~ (bit$ exported?)))))))) + _ + (failure "Interfaces require typed members!")))) + (list\join methods'))) + .let [def_name (local_identifier$ name) + interface_type (record$ (list\map (: (-> [Text Code] [Code Code]) + (function (_ [module_name m_type]) + [(local_tag$ module_name) m_type])) + members)) + interface_annotations (merged_definition_annotations (` {#.interface? #1}) + (record$ annotations)) + usage (case args + #End + def_name - #None - (failure "Wrong syntax for type:")))) + _ + (` ((~ def_name) (~+ (list\map local_identifier$ args)))))]] + (in_meta (list (` (..type: (~ export_policy) (~ usage) (~ interface_annotations) (~ interface_type)))))) - #None - (failure "Wrong syntax for type:")) - )) + #None + (failure "Wrong syntax for interface:"))) (template [<name> <to>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> (I64 Any) <to>) (:as <to> value))] @@ -3821,7 +3994,7 @@ (replace_all ..self_reference self) (replace_all ..contextual_reference context))) -(def: #export module_separator +(def: .public module_separator "/") (def: parallel_hierarchy_sigil @@ -4234,11 +4407,11 @@ (name\encode name) )) -(macro: #export (^open tokens) +(macro: .public (^open tokens) {#.doc (text$ ($_ "lux text concat" "## Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings." ..\n "## Takes an 'alias' text for the generated local bindings." ..\n - "(def: #export (range (^open ''.'') minimum additional)" ..\n + "(def: .public (range (^open ''.'') minimum additional)" ..\n " (All [a] (-> (Enum a) a a (List a)))" ..\n " (range' <= succ minimum additional))"))} (case tokens @@ -4285,7 +4458,7 @@ _ (failure "Wrong syntax for ^open"))) -(macro: #export (cond tokens) +(macro: .public (cond tokens) {#.doc (text$ ($_ "lux text concat" "## Branching structures with multiple test conditions." ..\n "(cond (even? num) ''even''" ..\n @@ -4320,7 +4493,7 @@ (All [a] (-> (List a) (List [Nat a]))) (enumeration' 0 xs)) -(macro: #export (get@ tokens) +(macro: .public (get@ tokens) {#.doc (text$ ($_ "lux text concat" "## Accesses the value of a record at a given tag." ..\n "(get@ #field my_record)" @@ -4399,7 +4572,7 @@ [(~ location_code) (#.Record #End)] #0))))))) -(macro: #export (open: tokens) +(macro: .public (open: tokens) {#.doc (text$ ($_ "lux text concat" "## Opens a implementation and generates a definition for each of its members (including nested members)." __paragraph @@ -4442,7 +4615,7 @@ _ (failure "Wrong syntax for open:"))) -(macro: #export (|>> tokens) +(macro: .public (|>> tokens) {#.doc (text$ ($_ "lux text concat" "## Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n "(|>> (list\map int\encode) (interpose '' '') (fold text\compose ''''))" ..\n @@ -4453,7 +4626,7 @@ g!arg (gensym "arg")] (in_meta (list (` (function ((~ g!_) (~ g!arg)) (|> (~ g!arg) (~+ tokens)))))))) -(macro: #export (<<| tokens) +(macro: .public (<<| tokens) {#.doc (text$ ($_ "lux text concat" "## Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n "(<<| (fold text\compose '''') (interpose '' '') (list\map int\encode))" ..\n @@ -4538,7 +4711,7 @@ list\join)]] (in (list\compose defs openings)))) -(macro: #export (refer tokens) +(macro: .public (refer tokens) (case tokens (^ (list& [_ (#Text module_name)] options)) (do meta_monad @@ -4575,7 +4748,7 @@ (~+ localizations) (~+ openings))))) -(macro: #export (module: tokens) +(macro: .public (module: tokens) {#.doc (text$ ($_ "lux text concat" "## Module_definition macro." __paragraph @@ -4617,7 +4790,7 @@ (~ =imports)))]] (in (#Item =module =refers)))) -(macro: #export (\ tokens) +(macro: .public (\ tokens) {#.doc (text$ ($_ "lux text concat" "## Allows accessing the value of a implementation's member." ..\n "(\ codec encode)" @@ -4634,7 +4807,7 @@ _ (failure "Wrong syntax for \"))) -(macro: #export (set@ tokens) +(macro: .public (set@ tokens) {#.doc (text$ ($_ "lux text concat" "## Sets the value of a record at a given tag." ..\n "(set@ #name ''Lux'' lang)" @@ -4723,7 +4896,7 @@ _ (failure "Wrong syntax for set@"))) -(macro: #export (update@ tokens) +(macro: .public (update@ tokens) {#.doc (text$ ($_ "lux text concat" "## Modifies the value of a record at a given tag, based on some function." ..\n "(update@ #age inc person)" @@ -4798,7 +4971,7 @@ _ (failure "Wrong syntax for update@"))) -(macro: #export (^template tokens) +(macro: .public (^template tokens) {#.doc (text$ ($_ "lux text concat" "## It's similar to template, but meant to be used during pattern-matching." ..\n "(def: (reduced env type)" ..\n @@ -4902,7 +5075,7 @@ (#Documentation_Example code))) (template [<name> <extension> <doc>] - [(def: #export <name> + [(def: .public <name> {#.doc <doc>} (All [s] (-> (I64 s) (I64 s))) (|>> (<extension> 1)))] @@ -5006,7 +5179,7 @@ [_ text] (..example_documentation (with_baseline baseline location) baseline example)] (text\compose text __paragraph)))) -(macro: #export (doc tokens) +(macro: .public (doc tokens) {#.doc (text$ ($_ "lux text concat" "## Creates code documentation, embedding text as comments and properly formatting the forms it's being given." __paragraph @@ -5069,7 +5242,7 @@ ## (~ (type_code anonymous)))) (identifier$ [module name]))) -(macro: #export (loop tokens) +(macro: .public (loop tokens) {#.doc (doc "Allows arbitrary looping, using the 'recur' form to re-start the loop." "Can be used in monadic code to create monadic loops." (loop [count +0 @@ -5126,7 +5299,7 @@ #.None (failure "Wrong syntax for loop")))) -(macro: #export (^slots tokens) +(macro: .public (^slots tokens) {#.doc (doc "Allows you to extract record members as local variables with the same names." "For example:" (let [(^slots [#foo #bar #baz]) quux] @@ -5204,7 +5377,7 @@ pairs)] (in (list [location (#Record =pairs)]))))) -(macro: #export (with_expansions tokens) +(macro: .public (with_expansions tokens) {#.doc (doc "Controlled macro-expansion." "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings." "Wherever a binding appears, the bound Code nodes will be spliced in there." @@ -5322,7 +5495,7 @@ ## (\ meta_monad in token) )) -(macro: #export (static tokens) +(macro: .public (static tokens) (case tokens (^ (list pattern)) (do meta_monad @@ -5376,7 +5549,7 @@ (: (List [Code Code]) (list\reverse levels)))] (list init_pattern inner_pattern_body))) -(macro: #export (^multi tokens) +(macro: .public (^multi tokens) {#.doc (doc "Multi-level pattern matching." "Useful in situations where the result of a branch depends on further refinements on the values being matched." "For example:" @@ -5436,7 +5609,7 @@ (|>> name\encode (text\compose "Wrong syntax for "))) -(macro: #export (name_of tokens) +(macro: .public (name_of tokens) {#.doc (doc "Given an identifier or a tag, gives back a 2 tuple with the prefix and name parts, both as Text." (name_of #.doc) "=>" @@ -5460,10 +5633,10 @@ (#Right state scope_type_vars) )) -(macro: #export (:parameter tokens) +(macro: .public (:parameter tokens) {#.doc (doc "Allows you to refer to the type-variables in a polymorphic function's type, by their index." "In the example below, 0 corresponds to the 'a' variable." - (def: #export (of_list list) + (def: .public (of_list list) (All [a] (-> (List a) (Row a))) (list\fold add (: (Row (:parameter 0)) @@ -5483,7 +5656,7 @@ _ (failure (..wrong_syntax_error (name_of ..$))))) -(def: #export (is? reference sample) +(def: .public (is? reference sample) {#.doc (doc "Tests whether the 2 values are identical (not just 'equal')." "This one should succeed:" (let [value +5] @@ -5494,7 +5667,7 @@ (All [a] (-> a a Bit)) ("lux is" reference sample)) -(macro: #export (^@ tokens) +(macro: .public (^@ tokens) {#.doc (doc "Allows you to simultaneously bind and de-structure a value." (def: (hash (^@ set [Hash<a> _])) (list\fold (function (_ elem acc) (+ (\ Hash<a> hash elem) acc)) @@ -5510,7 +5683,7 @@ _ (failure (..wrong_syntax_error (name_of ..^@))))) -(macro: #export (^|> tokens) +(macro: .public (^|> tokens) {#.doc (doc "Pipes the value being pattern-matched against prior to binding it to a variable." (case input (^|> value [inc (% 10) (max 1)]) @@ -5526,7 +5699,7 @@ _ (failure (..wrong_syntax_error (name_of ..^|>))))) -(macro: #export (:assume tokens) +(macro: .public (:assume tokens) {#.doc (doc "Coerces the given expression to the type of whatever is expected." (: Dinosaur (:assume (list +1 +2 +3))))} (case tokens @@ -5544,7 +5717,7 @@ (function (_ compiler) (#Right [compiler (get@ #location compiler)]))) -(macro: #export (undefined tokens) +(macro: .public (undefined tokens) {#.doc (doc "Meant to be used as a stand-in for functions with undefined implementations." "Undefined expressions will type-check against everything, so they make good dummy implementations." "However, if an undefined expression is ever evaluated, it will raise a runtime error." @@ -5563,7 +5736,7 @@ _ (failure (..wrong_syntax_error (name_of ..undefined))))) -(macro: #export (:of tokens) +(macro: .public (:of tokens) {#.doc (doc "Generates the type corresponding to a given expression." "Example #1:" (let [my_num +123] @@ -5590,107 +5763,82 @@ _ (failure (..wrong_syntax_error (name_of ..:of))))) -(def: (complex_declaration_parser tokens) - (-> (List Code) (Meta [[Text (List Text)] (List Code)])) - (case tokens - (^ (list& [_ (#Form (list& [_ (#Identifier ["" name])] args'))] tokens')) - (do meta_monad - [args (monad\map meta_monad - (function (_ arg') - (case arg' - [_ (#Identifier ["" arg_name])] - (in arg_name) - - _ - (failure "Could not parse an argument."))) - args')] - (in [[name args] tokens'])) - - _ - (failure "Could not parse a complex declaration.") - )) - -(def: (any_parser tokens) - (-> (List Code) (Meta [Code (List Code)])) +(def: (tupleP tokens) + (-> (List Code) (Maybe [(List Code) (List Code)])) (case tokens - (^ (list& token tokens')) - (in_meta [token tokens']) - - _ - (failure "Could not parse anything.") - )) - -(def: (many_parser tokens) - (-> (List Code) (Meta [(List Code) (List Code)])) - (case tokens - (^ (list& head tail)) - (in_meta [tokens (list)]) - - _ - (failure "Could not parse anything.") - )) + (^ (list& [_ (#Tuple tuple)] tokens')) + (#Some [tokens' tuple]) -(def: (end_parser tokens) - (-> (List Code) (Meta Any)) - (case tokens - (^ (list)) - (in_meta []) - _ - (failure "Expected input Codes to be empty.") - )) - -(def: (anns_parser tokens) - (-> (List Code) (Meta [Code (List Code)])) - (case tokens - (^ (list& [_ (#Record _anns)] tokens')) - (in_meta [(record$ _anns) tokens']) - - _ - (in_meta [(' {}) tokens]) - )) + #None)) -(macro: #export (template: tokens) +(def:' .private (templateP tokens) + (-> (List Code) (Maybe [Code Text (List Text) (List [Code Code]) (List Code)])) + (|> (do maybe_monad + [% (declarationP tokens) + .let' [[tokens [export_policy name parameters]] %] + % (annotationsP tokens) + .let' [[tokens annotations] %] + % (tupleP tokens) + .let' [[tokens templates] %] + _ (endP tokens)] + (in [export_policy name parameters annotations templates])) + ## (^ (list _export_policy _declaration _annotations _body)) + ## (^ (list _declaration _annotations _body)) + (maybe\else' (do maybe_monad + [% (declarationP tokens) + .let' [[tokens [export_policy name parameters]] %] + % (tupleP tokens) + .let' [[tokens templates] %] + _ (endP tokens)] + (in [export_policy name parameters #End templates]))) + ## (^ (list _export_policy _declaration _body)) + (maybe\else' (do maybe_monad + [% (local_declarationP tokens) + .let' [[tokens [name parameters]] %] + % (tupleP tokens) + .let' [[tokens templates] %] + _ (endP tokens)] + (in [(` ..private) name parameters #End templates]))) + ## (^ (list _declaration _body)) + )) + +(macro: .public (template: tokens) {#.doc (doc "Define macros in the style of template and ^template." "For simple macros that do not need any fancy features." (template: (square x) (* x x)))} - (do meta_monad - [.let [[export? tokens] (export^ tokens)] - name+args|tokens (complex_declaration_parser tokens) - .let [[[name args] tokens] name+args|tokens] - anns|tokens (anns_parser tokens) - .let [[anns tokens] anns|tokens] - input_templates|tokens (many_parser tokens) - .let [[input_templates tokens] input_templates|tokens] - _ (end_parser tokens) - g!tokens (gensym "tokens") - g!compiler (gensym "compiler") - g!_ (gensym "_") - .let [rep_env (list\map (function (_ arg) - [arg (` ((~' ~) (~ (local_identifier$ arg))))]) - args)] - this_module current_module_name] - (in (list (` (macro: (~+ (export export?)) - ((~ (local_identifier$ name)) (~ g!tokens) (~ g!compiler)) - (~ anns) - (case (~ g!tokens) - (^ (list (~+ (list\map local_identifier$ args)))) - (#.Right [(~ g!compiler) - (list (~+ (list\map (function (_ template) - (` (`' (~ (with_replacements rep_env - template))))) - input_templates)))]) - - (~ g!_) - (#.Left (~ (text$ (..wrong_syntax_error [this_module name])))) - ))))) - )) - -(macro: #export (as_is tokens compiler) + (case (templateP tokens) + (#.Some [export_policy name args anns input_templates]) + (do meta_monad + [g!tokens (gensym "tokens") + g!compiler (gensym "compiler") + g!_ (gensym "_") + .let [rep_env (list\map (function (_ arg) + [arg (` ((~' ~) (~ (local_identifier$ arg))))]) + args)] + this_module current_module_name] + (in (list (` (macro: (~ export_policy) + ((~ (local_identifier$ name)) (~ g!tokens) (~ g!compiler)) + (~ (record$ anns)) + (case (~ g!tokens) + (^ (list (~+ (list\map local_identifier$ args)))) + (#.Right [(~ g!compiler) + (list (~+ (list\map (function (_ template) + (` (`' (~ (with_replacements rep_env + template))))) + input_templates)))]) + + (~ g!_) + (#.Left (~ (text$ (..wrong_syntax_error [this_module name])))))))))) + + #.None + (failure (..wrong_syntax_error (name_of ..template:))))) + +(macro: .public (as_is tokens compiler) (#Right [compiler tokens])) -(macro: #export (char tokens compiler) +(macro: .public (char tokens compiler) (case tokens (^multi (^ (list [_ (#Text input)])) (|> input "lux text size" ("lux i64 =" 1))) @@ -5750,7 +5898,7 @@ (in_meta (list pick)) (target_pick target options' default))))) -(macro: #export (for tokens) +(macro: .public (for tokens) (do meta_monad [target ..target] (case tokens @@ -5804,7 +5952,7 @@ _ (in_meta [(list) code]))) -(macro: #export (`` tokens) +(macro: .public (`` tokens) (case tokens (^ (list raw)) (do meta_monad @@ -5897,7 +6045,7 @@ (..untemplated_record g!meta untemplated_pattern fields) ))) -(macro: #export (^code tokens) +(macro: .public (^code tokens) (case tokens (^ (list& [_meta (#Form (list template))] body branches)) (do meta_monad @@ -5912,15 +6060,15 @@ _ (failure (..wrong_syntax_error (name_of ..^code))))) -(def: #export false +(def: .public false Bit #0) -(def: #export true +(def: .public true Bit #1) -(macro: #export (:let tokens) +(macro: .public (:let tokens) (case tokens (^ (list [_ (#Tuple bindings)] bodyT)) (if (multiple? 2 (list\size bindings)) @@ -5935,7 +6083,7 @@ _ (..failure (..wrong_syntax_error (name_of ..:let))))) -(macro: #export (try tokens) +(macro: .public (try tokens) {#.doc (doc (case (try (risky_computation input)) (#.Right success) (do_something success) diff --git a/stdlib/source/library/lux/abstract/algebra.lux b/stdlib/source/library/lux/abstract/algebra.lux index ca126b064..9a4ea848d 100644 --- a/stdlib/source/library/lux/abstract/algebra.lux +++ b/stdlib/source/library/lux/abstract/algebra.lux @@ -4,14 +4,14 @@ [control [functor (#+ Fix)]]]]) -(type: #export (Algebra f a) +(type: .public (Algebra f a) (-> (f a) a)) -(type: #export (CoAlgebra f a) +(type: .public (CoAlgebra f a) (-> a (f a))) -(type: #export (RAlgebra f a) +(type: .public (RAlgebra f a) (-> (f (Tuple (Fix f) a)) a)) -(type: #export (RCoAlgebra f a) +(type: .public (RCoAlgebra f a) (-> a (f (Or (Fix f) a)))) diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux index 38e4772e4..dc9d71f0f 100644 --- a/stdlib/source/library/lux/abstract/apply.lux +++ b/stdlib/source/library/lux/abstract/apply.lux @@ -5,7 +5,7 @@ [monad (#+ Monad)] ["." functor (#+ Functor)]]) -(interface: #export (Apply f) +(interface: .public (Apply f) {#.doc "Applicative functors."} (: (Functor f) &functor) @@ -13,7 +13,7 @@ (-> (f (-> a b)) (f a) (f b))) apply)) -(implementation: #export (compose f_monad f_apply g_apply) +(implementation: .public (compose f_monad f_apply g_apply) {#.doc "Applicative functor composition."} (All [F G] (-> (Monad F) (Apply F) (Apply G) diff --git a/stdlib/source/library/lux/abstract/codec.lux b/stdlib/source/library/lux/abstract/codec.lux index 097c8ca84..bf6da6f54 100644 --- a/stdlib/source/library/lux/abstract/codec.lux +++ b/stdlib/source/library/lux/abstract/codec.lux @@ -7,14 +7,14 @@ [monad (#+ do)] ["." functor]]) -(interface: #export (Codec m a) +(interface: .public (Codec m a) {#.doc "A way to move back-and-forth between a type and an alternative representation for it."} (: (-> a m) encode) (: (-> m (Try a)) decode)) -(implementation: #export (compose cb_codec ba_codec) +(implementation: .public (compose cb_codec ba_codec) {#.doc "Codec composition."} (All [a b c] (-> (Codec c b) (Codec b a) diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 869eb3de5..589ed47f2 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -12,7 +12,7 @@ [// [functor (#+ Functor)]]) -(interface: #export (CoMonad w) +(interface: .public (CoMonad w) {#.doc (doc "CoMonads are the opposite/complement to monads." "CoMonadic structures are often infinite in size and built upon lazily-evaluated functions.")} (: (Functor w) @@ -24,7 +24,7 @@ (-> (w a) (w (w a)))) split)) -(macro: #export (be tokens state) +(macro: .public (be tokens state) {#.doc (doc "A co-monadic parallel to the 'do' macro." (let [square (function (_ n) (* n n))] (be comonad diff --git a/stdlib/source/library/lux/abstract/comonad/cofree.lux b/stdlib/source/library/lux/abstract/comonad/cofree.lux index 096a48feb..271795e14 100644 --- a/stdlib/source/library/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/library/lux/abstract/comonad/cofree.lux @@ -5,17 +5,17 @@ [// [functor (#+ Functor)]]]) -(type: #export (CoFree F a) +(type: .public (CoFree F a) {#.doc (doc "The CoFree CoMonad.")} [a (F (CoFree F a))]) -(implementation: #export (functor dsl) +(implementation: .public (functor dsl) (All [F] (-> (Functor F) (Functor (CoFree F)))) (def: (map f [head tail]) [(f head) (\ dsl map (map f) tail)])) -(implementation: #export (comonad dsl) +(implementation: .public (comonad dsl) (All [F] (-> (Functor F) (CoMonad (CoFree F)))) (def: &functor (..functor dsl)) diff --git a/stdlib/source/library/lux/abstract/enum.lux b/stdlib/source/library/lux/abstract/enum.lux index 4cb27558a..d1fec7f7f 100644 --- a/stdlib/source/library/lux/abstract/enum.lux +++ b/stdlib/source/library/lux/abstract/enum.lux @@ -4,13 +4,13 @@ [// ["." order (#+ Order)]]) -(interface: #export (Enum e) +(interface: .public (Enum e) {#.doc "Enumerable types, with a notion of moving forward and backwards through a type's instances."} (: (Order e) &order) (: (-> e e) succ) (: (-> e e) pred)) -(def: #export (range enum from to) +(def: .public (range enum from to) {#.doc "An inclusive [from, to] range of values."} (All [a] (-> (Enum a) a a (List a))) (let [(^open "/\.") enum] diff --git a/stdlib/source/library/lux/abstract/equivalence.lux b/stdlib/source/library/lux/abstract/equivalence.lux index b1e570713..7834363bf 100644 --- a/stdlib/source/library/lux/abstract/equivalence.lux +++ b/stdlib/source/library/lux/abstract/equivalence.lux @@ -5,19 +5,19 @@ [functor ["." contravariant]]]) -(interface: #export (Equivalence a) +(interface: .public (Equivalence a) {#.doc "Equivalence for a type's instances."} (: (-> a a Bit) =)) -(def: #export (rec sub) +(def: .public (rec sub) {#.doc (doc "A recursive equivalence combinator.")} (All [a] (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) (implementation (def: (= left right) (sub = left right)))) -(implementation: #export functor +(implementation: .public functor (contravariant.Functor Equivalence) (def: (map f equivalence) diff --git a/stdlib/source/library/lux/abstract/fold.lux b/stdlib/source/library/lux/abstract/fold.lux index fca10ecb2..b2ce974da 100644 --- a/stdlib/source/library/lux/abstract/fold.lux +++ b/stdlib/source/library/lux/abstract/fold.lux @@ -4,13 +4,13 @@ [// [monoid (#+ Monoid)]]) -(interface: #export (Fold F) +(interface: .public (Fold F) {#.doc "Iterate over a structure's values to build a summary value."} (: (All [a b] (-> (-> b a a) a (F b) a)) fold)) -(def: #export (with_monoid monoid fold value) +(def: .public (with_monoid monoid fold value) {#.doc (doc "Fold over a foldable structure using the monoid's identity as the initial value.")} (All [F a] (-> (Monoid a) (Fold F) (F a) a)) diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux index 140376477..32e1c6671 100644 --- a/stdlib/source/library/lux/abstract/functor.lux +++ b/stdlib/source/library/lux/abstract/functor.lux @@ -2,19 +2,19 @@ [library [lux (#- Or And)]]) -(interface: #export (Functor f) +(interface: .public (Functor f) (: (All [a b] (-> (-> a b) (-> (f a) (f b)))) map)) -(type: #export (Fix f) +(type: .public (Fix f) (f (Fix f))) -(type: #export (Or f g) +(type: .public (Or f g) (All [a] (.Or (f a) (g a)))) -(def: #export (sum (^open "f\.") (^open "g\.")) +(def: .public (sum (^open "f\.") (^open "g\.")) {#.doc (doc "Co-product (sum) composition for functors.")} (All [F G] (-> (Functor F) (Functor G) (Functor (..Or F G)))) (implementation @@ -26,10 +26,10 @@ (#.Right ga) (#.Right (g\map f ga)))))) -(type: #export (And f g) +(type: .public (And f g) (All [a] (.And (f a) (g a)))) -(def: #export (product (^open "f\.") (^open "g\.")) +(def: .public (product (^open "f\.") (^open "g\.")) {#.doc (doc "Product composition for functors.")} (All [F G] (-> (Functor F) (Functor G) (Functor (..And F G)))) (implementation @@ -37,10 +37,10 @@ [(f\map f fa) (g\map f ga)]))) -(type: #export (Then f g) +(type: .public (Then f g) (All [a] (f (g a)))) -(def: #export (compose (^open "f\.") (^open "g\.")) +(def: .public (compose (^open "f\.") (^open "g\.")) {#.doc "Functor composition."} (All [F G] (-> (Functor F) (Functor G) (Functor (..Then F G)))) (implementation diff --git a/stdlib/source/library/lux/abstract/functor/contravariant.lux b/stdlib/source/library/lux/abstract/functor/contravariant.lux index f7df0a73d..659105afa 100644 --- a/stdlib/source/library/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/library/lux/abstract/functor/contravariant.lux @@ -2,7 +2,7 @@ [library [lux #*]]) -(interface: #export (Functor f) +(interface: .public (Functor f) {#.doc (doc "The contravariant functor.")} (: (All [a b] diff --git a/stdlib/source/library/lux/abstract/hash.lux b/stdlib/source/library/lux/abstract/hash.lux index 2cc18f3e4..84f80723c 100644 --- a/stdlib/source/library/lux/abstract/hash.lux +++ b/stdlib/source/library/lux/abstract/hash.lux @@ -6,7 +6,7 @@ [functor ["." contravariant]]]) -(interface: #export (Hash a) +(interface: .public (Hash a) {#.doc (doc "A way to produce hash-codes for a type's instances." "A necessity when working with some data-structures, such as dictionaries or sets.")} (: (Equivalence a) @@ -14,7 +14,7 @@ (: (-> a Nat) hash)) -(implementation: #export functor +(implementation: .public functor (contravariant.Functor Hash) (def: (map f super) diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux index 4d4e5f643..7c2b2ca35 100644 --- a/stdlib/source/library/lux/abstract/interval.lux +++ b/stdlib/source/library/lux/abstract/interval.lux @@ -7,7 +7,7 @@ ["." order] [enum (#+ Enum)]]) -(interface: #export (Interval a) +(interface: .public (Interval a) {#.doc "A representation of top and bottom boundaries for an ordered type."} (: (Enum a) &enum) @@ -18,14 +18,14 @@ (: a top)) -(def: #export (between enum bottom top) +(def: .public (between enum bottom top) (All [a] (-> (Enum a) a a (Interval a))) (implementation (def: &enum enum) (def: bottom bottom) (def: top top))) -(def: #export (singleton enum elem) +(def: .public (singleton enum elem) {#.doc (doc "An interval where both top and bottom are the same value.")} (All [a] (-> (Enum a) a (Interval a))) (implementation @@ -34,7 +34,7 @@ (def: top elem))) (template [<name> <comp>] - [(def: #export (<name> interval) + [(def: .public (<name> interval) (All [a] (-> (Interval a) Bit)) (let [(^open ",\.") interval] (<comp> ,\bottom ,\top)))] @@ -44,7 +44,7 @@ [singleton? ,\=] ) -(def: #export (within? interval elem) +(def: .public (within? interval elem) (All [a] (-> (Interval a) a Bit)) (let [(^open ",\.") interval] (cond (inner? interval) @@ -60,7 +60,7 @@ (,\= ,\top elem))))) (template [<name> <limit>] - [(def: #export (<name> elem interval) + [(def: .public (<name> elem interval) (All [a] (-> a (Interval a) Bit)) (let [(^open ".") interval] (= <limit> elem)))] @@ -69,13 +69,13 @@ [ends_with? top] ) -(def: #export (borders? interval elem) +(def: .public (borders? interval elem) {#.doc (doc "Where a value is at the border of an interval.")} (All [a] (-> (Interval a) a Bit)) (or (starts_with? elem interval) (ends_with? elem interval))) -(implementation: #export (union left right) +(implementation: .public (union left right) {#.doc (doc "An interval that spans both predecessors.")} (All [a] (-> (Interval a) (Interval a) (Interval a))) @@ -83,7 +83,7 @@ (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom))) (def: top (order.max (\ right &order) (\ left top) (\ right top)))) -(implementation: #export (intersection left right) +(implementation: .public (intersection left right) {#.doc (doc "An interval spanned by both predecessors.")} (All [a] (-> (Interval a) (Interval a) (Interval a))) @@ -91,7 +91,7 @@ (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom))) (def: top (order.min (\ right &order) (\ left top) (\ right top)))) -(implementation: #export (complement interval) +(implementation: .public (complement interval) {#.doc (doc "The inverse of an interval.")} (All [a] (-> (Interval a) (Interval a))) @@ -99,19 +99,19 @@ (def: bottom (\ interval succ (\ interval top))) (def: top (\ interval pred (\ interval bottom)))) -(def: #export (precedes? reference sample) +(def: .public (precedes? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open ".") reference limit (\ reference bottom)] (and (< limit (\ sample bottom)) (< limit (\ sample top))))) -(def: #export (succeeds? reference sample) +(def: .public (succeeds? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (precedes? sample reference)) (template [<name> <comp>] - [(def: #export (<name> reference sample) + [(def: .public (<name> reference sample) (All [a] (-> a (Interval a) Bit)) (let [(^open ",\.") sample] (and (<comp> reference ,\bottom) @@ -121,7 +121,7 @@ [after? (order.> ,\&order)] ) -(def: #export (meets? reference sample) +(def: .public (meets? reference sample) {#.doc (doc "Whether an interval meets another one on its bottom/lower side.")} (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open ",\.") reference @@ -129,13 +129,13 @@ (and (,\= limit (\ sample top)) (order.<= ,\&order limit (\ sample bottom))))) -(def: #export (touches? reference sample) +(def: .public (touches? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (or (meets? reference sample) (meets? sample reference))) (template [<name> <eq_side> <ineq> <ineq_side>] - [(def: #export (<name> reference sample) + [(def: .public (<name> reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open ",\.") reference] (and (,\= (\ reference <eq_side>) @@ -148,7 +148,7 @@ [finishes? ,\top order.>= ,\bottom] ) -(implementation: #export equivalence +(implementation: .public equivalence (All [a] (Equivalence (Interval a))) (def: (= reference sample) @@ -156,7 +156,7 @@ (and (,\= ,\bottom (\ sample bottom)) (,\= ,\top (\ sample top)))))) -(def: #export (nested? reference sample) +(def: .public (nested? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (cond (or (singleton? sample) (and (inner? reference) (inner? sample)) @@ -177,7 +177,7 @@ (order.<= ,\&order (\ reference top) (\ sample top))))) )) -(def: #export (overlaps? reference sample) +(def: .public (overlaps? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open ",\.") reference] (and (not (\ ..equivalence = reference sample)) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index 0bbb58149..01e22b7a7 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -43,7 +43,7 @@ _ #.End)) -(interface: #export (Monad m) +(interface: .public (Monad m) {#.doc (doc "A monad is a monoid in the category of endofunctors." "What's the problem?")} @@ -56,7 +56,7 @@ (-> (m (m a)) (m a))) join)) -(macro: #export (do tokens state) +(macro: .public (do tokens state) {#.doc (doc "Macro for easy concatenation of monadic operations." (do monad [y (f1 x) @@ -113,7 +113,7 @@ #.None (#.Left "Wrong syntax for 'do'"))) -(def: #export (bind monad f) +(def: .public (bind monad f) {#.doc (doc "Apply a function with monadic effects to a monadic value and yield a new monadic value.")} (All [! a b] (-> (Monad !) (-> a (! b)) @@ -121,7 +121,7 @@ (|>> (\ monad map f) (\ monad join))) -(def: #export (seq monad) +(def: .public (seq monad) {#.doc "Run all the monadic values in the list and produce a list of the base values."} (All [M a] (-> (Monad M) (List (M a)) @@ -138,7 +138,7 @@ (!\map (|>> (#.Item _x)) (recur xs')))) !\join))))) -(def: #export (map monad f) +(def: .public (map monad f) {#.doc "Apply a monadic function to all values in a list."} (All [M a b] (-> (Monad M) (-> a (M b)) (List a) @@ -155,7 +155,7 @@ (!\map (|>> (#.Item _x)) (recur xs')))) !\join))))) -(def: #export (only monad f) +(def: .public (only monad f) {#.doc "Filter the values in a list with a monadic function."} (All [! a b] (-> (Monad !) (-> a (! Bit)) (List a) @@ -176,7 +176,7 @@ (recur xs')))) !\join))))) -(def: #export (fold monad f init xs) +(def: .public (fold monad f init xs) {#.doc "Fold a list with a monadic function."} (All [M a b] (-> (Monad M) (-> b a (M a)) a (List b) diff --git a/stdlib/source/library/lux/abstract/monad/free.lux b/stdlib/source/library/lux/abstract/monad/free.lux index a4f5733df..d954c5581 100644 --- a/stdlib/source/library/lux/abstract/monad/free.lux +++ b/stdlib/source/library/lux/abstract/monad/free.lux @@ -6,12 +6,12 @@ [apply (#+ Apply)] [monad (#+ Monad)]]) -(type: #export (Free F a) +(type: .public (Free F a) {#.doc "The Free Monad."} (#Pure a) (#Effect (F (Free F a)))) -(implementation: #export (functor dsl) +(implementation: .public (functor dsl) (All [F] (-> (Functor F) (Functor (Free F)))) (def: (map f ea) @@ -22,7 +22,7 @@ (#Effect value) (#Effect (\ dsl map (map f) value))))) -(implementation: #export (apply dsl) +(implementation: .public (apply dsl) (All [F] (-> (Functor F) (Apply (Free F)))) (def: &functor (..functor dsl)) @@ -43,7 +43,7 @@ ff)) ))) -(implementation: #export (monad dsl) +(implementation: .public (monad dsl) (All [F] (-> (Functor F) (Monad (Free F)))) (def: &functor (..functor dsl)) diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index 120e33a7d..290db1419 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -12,7 +12,7 @@ ["." code]]]] ["." //]) -(interface: #export (IxMonad m) +(interface: .public (IxMonad m) (: (All [p a] (-> a (m p p a))) in) @@ -59,7 +59,7 @@ (\ <>.monad map (|>> [#.None]) <code>.any))) -(syntax: #export (do {[?name monad] ..named_monad} +(syntax: .public (do {[?name monad] ..named_monad} {context (<code>.tuple (<>.some context))} expression) (macro.with_gensyms [g!_ g!bind] diff --git a/stdlib/source/library/lux/abstract/monoid.lux b/stdlib/source/library/lux/abstract/monoid.lux index 87f155848..800a14c50 100644 --- a/stdlib/source/library/lux/abstract/monoid.lux +++ b/stdlib/source/library/lux/abstract/monoid.lux @@ -2,7 +2,7 @@ [library [lux #*]]) -(interface: #export (Monoid a) +(interface: .public (Monoid a) {#.doc (doc "A way to compose values." "Includes an identity value which does not alter any other value when combined with.")} (: a @@ -10,7 +10,7 @@ (: (-> a a a) compose)) -(def: #export (compose left right) +(def: .public (compose left right) (All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r]))) (implementation (def: identity diff --git a/stdlib/source/library/lux/abstract/order.lux b/stdlib/source/library/lux/abstract/order.lux index 280226ccd..2dbd078e3 100644 --- a/stdlib/source/library/lux/abstract/order.lux +++ b/stdlib/source/library/lux/abstract/order.lux @@ -8,7 +8,7 @@ [functor ["." contravariant]]]) -(interface: #export (Order a) +(interface: .public (Order a) {#.doc "A signature for types that possess some sense of ordering among their elements."} (: (Equivalence a) @@ -18,42 +18,42 @@ <) ) -(type: #export (Comparison a) +(type: .public (Comparison a) {#.doc (doc "An arbitrary comparison between two values, with the knowledge of how to order them.")} (-> (Order a) a a Bit)) -(def: #export (<= order parameter subject) +(def: .public (<= order parameter subject) {#.doc (doc "Less than or equal.")} Comparison (or (\ order < parameter subject) (\ order = parameter subject))) -(def: #export (> order parameter subject) +(def: .public (> order parameter subject) {#.doc (doc "Greater than.")} Comparison (\ order < subject parameter)) -(def: #export (>= order parameter subject) +(def: .public (>= order parameter subject) {#.doc (doc "Greater than or equal.")} Comparison (or (\ order < subject parameter) (\ order = subject parameter))) -(type: #export (Choice a) +(type: .public (Choice a) {#.doc (doc "A choice comparison between two values, with the knowledge of how to order them.")} (-> (Order a) a a a)) -(def: #export (min order x y) +(def: .public (min order x y) {#.doc (doc "Minimum.")} Choice (if (\ order < y x) x y)) -(def: #export (max order x y) +(def: .public (max order x y) {#.doc (doc "Maximum.")} Choice (if (\ order < y x) y x)) -(implementation: #export functor +(implementation: .public functor (contravariant.Functor Order) (def: (map f order) diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux index 1d1bfd848..625cd42ec 100644 --- a/stdlib/source/library/lux/abstract/predicate.lux +++ b/stdlib/source/library/lux/abstract/predicate.lux @@ -8,18 +8,18 @@ [functor ["." contravariant]]]) -(type: #export (Predicate a) +(type: .public (Predicate a) {#.doc (doc "A question that can be asked of a value, yield either false (#0) or true (#1).")} (-> a Bit)) (template [<identity_name> <identity_value> <composition_name> <composition> <identity_doc> <composition_doc>] - [(def: #export <identity_name> + [(def: .public <identity_name> {#.doc <identity_doc>} Predicate (function.constant <identity_value>)) - (def: #export (<composition_name> left right) + (def: .public (<composition_name> left right) {#.doc <composition_doc>} (All [a] (-> (Predicate a) (Predicate a) (Predicate a))) (function (_ value) @@ -35,7 +35,7 @@ ) (template [<name> <identity> <composition>] - [(implementation: #export <name> + [(implementation: .public <name> (All [a] (Monoid (Predicate a))) (def: identity <identity>) @@ -45,19 +45,19 @@ [intersection ..all ..and] ) -(def: #export (complement predicate) +(def: .public (complement predicate) {#.doc (doc "The opposite of a predicate.")} (All [a] (-> (Predicate a) (Predicate a))) (|>> predicate not)) -(def: #export (difference sub base) +(def: .public (difference sub base) {#.doc (doc "A predicate that meeds 'base', but not 'sub'.")} (All [a] (-> (Predicate a) (Predicate a) (Predicate a))) (function (_ value) (.and (base value) (not (sub value))))) -(def: #export (rec predicate) +(def: .public (rec predicate) {#.doc (doc "Ties the knot for a recursive predicate.")} (All [a] (-> (-> (Predicate a) (Predicate a)) @@ -65,7 +65,7 @@ (function (recur input) (predicate recur input))) -(implementation: #export functor +(implementation: .public functor (contravariant.Functor Predicate) (def: (map f fb) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 2cf1c5e10..3005596ee 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -14,7 +14,6 @@ ["." code] ["." template] [syntax (#+ syntax:) - ["|.|" export] ["|.|" annotations]]] [math [number @@ -24,7 +23,7 @@ ["f" frac]]]]] [// ["<>" parser ("#\." monad) - ["<c>" code (#+ Parser)]]]) + ["<.>" code (#+ Parser)]]]) (type: Alias [Text Code]) @@ -34,19 +33,19 @@ (def: aliases^ (Parser (List Alias)) - (|> (<>.and <c>.local_identifier <c>.any) + (|> (<>.and <code>.local_identifier <code>.any) <>.some - <c>.record + <code>.record (<>.else (list)))) (def: bottom^ (Parser Nat) - (<c>.form (<>.after (<c>.this! (` #.Parameter)) <c>.nat))) + (<code>.form (<>.after (<code>.this! (` #.Parameter)) <code>.nat))) (def: stack^ (Parser Stack) (<>.either (<>.and (<>.maybe bottom^) - (<c>.tuple (<>.some <c>.any))) + (<code>.tuple (<>.some <code>.any))) (<>.and (|> bottom^ (<>\map (|>> #.Some))) (<>\in (list))))) @@ -69,7 +68,7 @@ (meta.failure (format "Cannot expand to more than a single AST/Code node:" text.new_line (|> expansion (list\map %.code) (text.join_with " "))))))) -(syntax: #export (=> {aliases aliases^} +(syntax: .public (=> {aliases aliases^} {inputs stack^} {outputs stack^}) {#.doc (doc "Concatenative function types." @@ -111,7 +110,7 @@ (function (_ [_ top]) top)) -(syntax: #export (||> {commands (<>.some <c>.any)}) +(syntax: .public (||> {commands (<>.some <code>.any)}) {#.doc (doc "A self-contained sequence of concatenative instructions." (is? value (||> (..push sample))) @@ -121,24 +120,33 @@ n/=))} (in (list (` (|> (~! ..begin!) (~+ commands) ((~! ..end!))))))) -(syntax: #export (word: - {export |export|.parser} - {name <c>.local_identifier} - {annotations (<>.else |annotations|.empty |annotations|.parser)} - type - {commands (<>.some <c>.any)}) +(def: word + (Parser [Code Text |annotations|.Annotations Code (List Code)]) + (let [private (: (Parser [Text |annotations|.Annotations Code (List Code)]) + ($_ <>.and + <code>.local_identifier + (<>.else |annotations|.empty |annotations|.parser) + <code>.any + (<>.many <code>.any)))] + ($_ <>.either + (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private) + ))) + +(syntax: .public (word: + {[export_policy name annotations type commands] ..word}) {#.doc (doc "A named concatenative function." (word: square (=> [Nat] [Nat]) dup (apply/2 n.*)))} - (in (list (` (def: (~+ (|export|.format export)) (~ (code.local_identifier name)) + (in (list (` (def: (~ export_policy) (~ (code.local_identifier name)) (~ (|annotations|.format annotations)) (~ type) (|>> (~+ commands))))))) -(syntax: #export (apply {arity (|> <c>.nat (<>.only (n.> 0)))}) +(syntax: .public (apply {arity (<>.only (n.> 0) <code>.nat)}) {#.doc (doc "A generator for functions that turn arity N functions into arity N concatenative functions." (: (=> [Nat] [Nat]) ((apply 1) inc)))} @@ -156,7 +164,7 @@ [(with_expansions [<name> (template.identifier ["apply/" <arity>]) <doc> (template.text ["Lift a function of arity " <arity> " into a concatenative function of arity " <arity> "."])] - (def: #export <name> + (def: .public <name> {#.doc (doc <doc>)} (apply <arity>)))] @@ -164,68 +172,68 @@ [5] [6] [7] [8] ) -(def: #export (push x) +(def: .public (push x) {#.doc (doc "Push a value onto the stack.")} (All [a] (-> a (=> [] [a]))) (function (_ stack) [stack x])) -(def: #export drop +(def: .public drop {#.doc (doc "Drop/pop a value from the top of the stack.")} (All [t] (=> [t] [])) (function (_ [stack top]) stack)) -(def: #export nip +(def: .public nip {#.doc (doc "Drop the second-to-last value from the top of the stack.")} (All [_ a] (=> [_ a] [a])) (function (_ [[stack _] top]) [stack top])) -(def: #export dup +(def: .public dup {#.doc (doc "Duplicate the top of the stack.")} (All [a] (=> [a] [a a])) (function (_ [stack top]) [[stack top] top])) -(def: #export swap +(def: .public swap {#.doc (doc "Swaps the 2 topmost stack values.")} (All [a b] (=> [a b] [b a])) (function (_ [[stack l] r]) [[stack r] l])) -(def: #export rotL +(def: .public rotL {#.doc (doc "Rotes the 3 topmost stack values to the left.")} (All [a b c] (=> [a b c] [b c a])) (function (_ [[[stack a] b] c]) [[[stack b] c] a])) -(def: #export rotR +(def: .public rotR {#.doc (doc "Rotes the 3 topmost stack values to the right.")} (All [a b c] (=> [a b c] [c a b])) (function (_ [[[stack a] b] c]) [[[stack c] a] b])) -(def: #export && +(def: .public && {#.doc (doc "Groups the 2 topmost stack values as a 2-tuple.")} (All [a b] (=> [a b] [(Tuple a b)])) (function (_ [[stack l] r]) [stack [l r]])) -(def: #export ||L +(def: .public ||L {#.doc (doc "Left-injects the top into sum.")} (All [a b] (=> [a] [(Or a b)])) (function (_ [stack l]) [stack (0 #0 l)])) -(def: #export ||R +(def: .public ||R {#.doc (doc "Right-injects the top into sum.")} (All [a b] (=> [b] [(Or a b)])) (function (_ [stack r]) [stack (0 #1 r)])) (template [<input> <output> <word> <func>] - [(`` (def: #export <word> + [(`` (def: .public <word> {#.doc (doc (~~ (template.text [<func> " for " <input> " arithmetic."])))} (=> [<input> <input>] [<output>]) (function (_ [[stack subject] param]) @@ -276,7 +284,7 @@ [Frac Bit f/>= f.>=] ) -(def: #export if +(def: .public if {#.doc (doc "If expression." (is? "then" (||> (push true) @@ -292,7 +300,7 @@ (then stack) (else stack)))) -(def: #export call +(def: .public call {#.doc (doc "Executes an anonymous block on the stack.")} (All [___a ___z] (=> {quote (=> ___a ___z)} @@ -300,7 +308,7 @@ (function (_ [stack quote]) (quote stack))) -(def: #export loop +(def: .public loop {#.doc (doc "Executes a block as a loop until it yields #0 to stop.")} (All [___] (=> {test (=> ___ ___ [Bit])} @@ -311,7 +319,7 @@ (loop [stack' pred]) stack')))) -(def: #export dip +(def: .public dip {#.doc (doc "Executes a block on the stack, save for the topmost value.")} (All [___ a] (=> ___ [a (=> ___ ___)] @@ -319,7 +327,7 @@ (function (_ [[stack a] quote]) [(quote stack) a])) -(def: #export dip/2 +(def: .public dip/2 {#.doc (doc "Executes a block on the stack, save for the 2 topmost values.")} (All [___ a b] (=> ___ [a b (=> ___ ___)] @@ -327,7 +335,7 @@ (function (_ [[[stack a] b] quote]) [[(quote stack) a] b])) -(def: #export do +(def: .public do {#.doc (doc "Do-while loop expression." (n.= (inc sample) (||> (push sample) @@ -342,7 +350,7 @@ (function (_ [[stack pred] body]) [[(body stack) pred] body])) -(def: #export while +(def: .public while {#.doc (doc "While loop expression." (n.= (n.+ distance start) (||> (push start) @@ -362,7 +370,7 @@ (while [[(body stack') pred] body]) stack')))) -(def: #export compose +(def: .public compose {#.doc (doc "Function composition." (n.= (n.+ 2 sample) (||> (push sample) @@ -376,7 +384,7 @@ (function (_ [[stack f] g]) [stack (|>> f g)])) -(def: #export partial +(def: .public partial {#.doc (doc "Partial application." (n.= (n.+ sample sample) (||> (push sample) @@ -390,7 +398,7 @@ (function (_ [[stack arg] quote]) [stack (|>> (push arg) quote)])) -(word: #export when +(word: .public when {#.doc (doc "Only execute the block when #1.")} (All [___] (=> {body (=> ___ ___)} @@ -401,7 +409,7 @@ (push ..drop) if) -(word: #export ? +(word: .public ? {#.doc (doc "Choose the top value when #0 and the second-to-top when #1.")} (All [a] (=> [Bit a a] [a])) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index eff114796..74dab7eda 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -11,7 +11,7 @@ ["." try (#+ Try)] ["." exception (#+ exception:)] ["." io (#+ IO io)] - ["<>" parser + ["<>" parser ("#\." monad) ["<.>" code (#+ Parser)]]] [data ["." bit] @@ -24,7 +24,6 @@ ["." code] [syntax (#+ syntax:) ["|.|" input] - ["|.|" export] ["|.|" annotations]]] [math [number @@ -38,8 +37,8 @@ ["." async (#+ Async Resolver) ("#\." monad)] ["." frp (#+ Channel)]]) -(exception: #export poisoned) -(exception: #export dead) +(exception: .public poisoned) +(exception: .public dead) (with_expansions [<Mail> (as_is (-> s (Actor s) (Async (Try s)))) @@ -64,27 +63,27 @@ #.None (in #.End)))) - (abstract: #export (Actor s) + (abstract: .public (Actor s) + {#.doc (doc "An entity that can react to messages (mail) sent to it concurrently.")} + {#obituary [(Async <Obituary>) (Resolver <Obituary>)] #mailbox (Atom <Mailbox>)} - {#.doc (doc "An entity that can react to messages (mail) sent to it concurrently.")} - - (type: #export (Mail s) + (type: .public (Mail s) {#.doc (doc "A one-way message sent to an actor, without expecting a reply.")} <Mail>) - (type: #export (Obituary s) + (type: .public (Obituary s) {#.doc (doc "Details on the death of an actor.")} <Obituary>) - (type: #export (Behavior o s) + (type: .public (Behavior o s) {#.doc (doc "An actor's behavior when mail is received and when a fatal error occurs.")} {#on_init (-> o s) #on_mail (-> (Mail s) s (Actor s) (Async (Try s)))}) - (def: #export (spawn! behavior init) + (def: .public (spawn! behavior init) {#.doc (doc "Given a behavior and initial state, spawns an actor and returns it.")} (All [o s] (-> (Behavior o s) o (IO (Actor s)))) (io (let [[on_init on_mail] behavior @@ -113,7 +112,7 @@ (recur state' tail))))] self))) - (def: #export (alive? actor) + (def: .public (alive? actor) (All [s] (-> (Actor s) (IO Bit))) (let [[obituary _] (get@ #obituary (:representation actor))] (|> obituary @@ -125,19 +124,19 @@ _ bit.no)))))) - (def: #export (obituary actor) + (def: .public (obituary actor) (All [s] (-> (Actor s) (IO (Maybe (Obituary s))))) (let [[obituary _] (get@ #obituary (:representation actor))] (async.poll obituary))) - (def: #export await + (def: .public await {#.doc (doc "Await for an actor to end working.")} (All [s] (-> (Actor s) (Async (Obituary s)))) (|>> :representation (get@ #obituary) product.left)) - (def: #export (mail! mail actor) + (def: .public (mail! mail actor) {#.doc (doc "Send mail to an actor.")} (All [s] (-> (Mail s) (Actor s) (IO (Try Any)))) (do {! io.monad} @@ -163,7 +162,7 @@ (recur |mailbox|')))))) (in (exception.except ..dead []))))) - (type: #export (Message s o) + (type: .public (Message s o) {#.doc (doc "A two-way message sent to an actor, expecting a reply.")} (-> s (Actor s) (Async (Try [s o])))) @@ -189,7 +188,7 @@ (exec (io.run (resolve (#try.Failure error))) (async.resolved (#try.Failure error))))))])) - (def: #export (tell! message actor) + (def: .public (tell! message actor) {#.doc (doc "Communicate with an actor through message-passing.")} (All [s o] (-> (Message s o) (Actor s) (Async (Try o)))) (let [[async mail] (..mail message)] @@ -208,13 +207,13 @@ (All [s] (-> (Mail s) s (Actor s) (Async (Try s)))) (mail state self)) -(def: #export default +(def: .public default {#.doc (doc "Default actor behavior.")} (All [s] (Behavior s s)) {#on_init function.identity #on_mail ..default_on_mail}) -(def: #export (poison! actor) +(def: .public (poison! actor) {#.doc (doc "Kills the actor by sending mail that will kill it upon processing," "but allows the actor to handle previous mail.")} (All [s] (-> (Actor s) (IO (Try Any)))) @@ -258,7 +257,20 @@ (~ (code.local_identifier selfN))) (~ bodyC))))) -(with_expansions [<examples> (as_is (actor: #export (Stack a) +(def: actorP + (Parser [Code [Text (List Text)] |annotations|.Annotations Code BehaviorC]) + (let [private ($_ <>.and + ..actor_decl^ + |annotations|.parser + <code>.any + behavior^)] + ($_ <>.either + (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private)))) + +(with_expansions [<examples> (as_is (actor: .public (stack a) + {} + (List a) ((on_mail mail state self) @@ -268,28 +280,26 @@ .let [_ (debug.log! "AFTER")]] (in output))) - (message: #export (push {value a} state self) + (message: .public (push {value a} state self) (List a) (let [state' (#.Item value state)] (async.resolved (#try.Success [state' state']))))) - (actor: #export Counter + (actor: .public counter + {} + Nat - (message: #export (count! {increment Nat} state self) + (message: .public (count! {increment Nat} state self) Any (let [state' (n.+ increment state)] (async.resolved (#try.Success [state' state'])))) - (message: #export (read! state self) + (message: .public (read! state self) Nat (async.resolved (#try.Success [state state])))))] - (syntax: #export (actor: - {export |export|.parser} - {[name vars] actor_decl^} - {annotations (<>.else |annotations|.empty |annotations|.parser)} - state_type - {[?on_mail messages] behavior^}) + (syntax: .public (actor: + {[export_policy [name vars] annotations state_type [?on_mail messages]] ..actorP}) {#.doc (doc "Defines a named actor, with its behavior and internal state." "Messages for the actor must be defined after the on_mail handler." <examples>)} @@ -298,10 +308,12 @@ [g!type (macro.gensym (format name "_abstract_type")) .let [g!actor (code.local_identifier name) g!vars (list\map code.local_identifier vars)]] - (in (list (` ((~! abstract:) (~+ (|export|.format export)) ((~ g!type) (~+ g!vars)) + (in (list (` ((~! abstract:) (~ export_policy) ((~ g!type) (~+ g!vars)) + {} + (~ state_type) - (def: (~+ (|export|.format export)) (~ g!actor) + (def: (~ export_policy) (~ g!actor) (All [(~+ g!vars)] (..Behavior (~ state_type) ((~ g!type) (~+ g!vars)))) {#..on_init (|>> ((~! abstract.:abstraction) (~ g!type))) @@ -309,7 +321,7 @@ (~+ messages)))))))) - (syntax: #export (actor {[state_type init] (<code>.record (<>.and <code>.any <code>.any))} + (syntax: .public (actor {[state_type init] (<code>.record (<>.and <code>.any <code>.any))} {[?on_mail messages] behavior^}) {#.doc (doc "Defines an anonymous actor, with its behavior and internal state." "Messages for the actor must be defined after the on_mail handler." @@ -346,12 +358,19 @@ (<>.either (<code>.form (<>.and <code>.identifier (<>.some <code>.local_identifier))) (<>.and <code>.identifier (\ <>.monad in (list))))) - (syntax: #export (message: - {export |export|.parser} - {signature signature^} - {annotations (<>.else |annotations|.empty |annotations|.parser)} - output_type - body) + (def: messageP + (Parser [Code Signature |annotations|.Annotations Code Code]) + (let [private ($_ <>.and + ..signature^ + (<>.else |annotations|.empty |annotations|.parser) + <code>.any + <code>.any)] + ($_ <>.either + (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private)))) + + (syntax: .public (message: + {[export_policy signature annotations output_type body] ..messageP}) {#.doc (doc "A message can access the actor's state through the state parameter." "A message can also access the actor itself through the self parameter." "A message's output must be an async containing a 2-tuple with the updated state and a return value." @@ -369,7 +388,7 @@ g!inputsT (|> signature (get@ #inputs) (list\map product.right)) g!state (|> signature (get@ #state) code.local_identifier) g!self (|> signature (get@ #self) code.local_identifier)]] - (in (list (` (def: (~+ (|export|.format export)) ((~ g!message) (~+ g!inputsC)) + (in (list (` (def: (~ export_policy) ((~ g!message) (~+ g!inputsC)) (~ (|annotations|.format annotations)) (All [(~+ g!all_vars)] (-> (~+ g!inputsT) @@ -385,14 +404,14 @@ (~ output_type)])))))))) )))))) -(type: #export Stop +(type: .public Stop {#.doc (doc "A signal to stop an actor from observing a channel.")} (IO Any)) (def: continue! true) (def: stop! false) -(def: #export (observe action channel actor) +(def: .public (observe action channel actor) {#.doc (doc "Use an actor to observe a channel by transforming each datum" "flowing through the channel into mail the actor can process." "Can stop observing the channel by executing the Stop value.")} diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 243d7327f..cc1757a31 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -17,12 +17,12 @@ ["." thread] ["." atom (#+ Atom atom)]]) -(abstract: #export (Async a) - (Atom [(Maybe a) (List (-> a (IO Any)))]) - +(abstract: .public (Async a) {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."} - (type: #export (Resolver a) + (Atom [(Maybe a) (List (-> a (IO Any)))]) + + (type: .public (Resolver a) {#.doc (doc "The function used to give a value to an async." "Will signal 'true' if the async has been resolved for the 1st time, 'false' otherwise.")} (-> a (IO Bit))) @@ -49,25 +49,25 @@ (in #1)) (resolve value)))))))) - (def: #export (resolved value) + (def: .public (resolved value) {#.doc (doc "Produces an async that has already been resolved to the given value.")} (All [a] (-> a (Async a))) (:abstraction (atom [(#.Some value) (list)]))) - (def: #export (async _) + (def: .public (async _) {#.doc (doc "Creates a fresh async that has not been resolved yet.")} (All [a] (-> Any [(Async a) (Resolver a)])) (let [async (:abstraction (atom [#.None (list)]))] [async (..resolver async)])) - (def: #export poll + (def: .public poll {#.doc "Polls an async for its value."} (All [a] (-> (Async a) (IO (Maybe a)))) (|>> :representation atom.read (\ io.functor map product.left))) - (def: #export (await f async) + (def: .public (await f async) {#.doc (doc "Executes the given function as soon as the async has been resolved.")} (All [a] (-> (-> a (IO Any)) (Async a) (IO Any))) (do {! io.monad} @@ -86,7 +86,7 @@ (await f (:abstraction async)))))))) ) -(def: #export resolved? +(def: .public resolved? {#.doc "Checks whether an async's value has already been resolved."} (All [a] (-> (Async a) (IO Bit))) (|>> ..poll @@ -97,7 +97,7 @@ (#.Some _) #1))))) -(implementation: #export functor +(implementation: .public functor (Functor Async) (def: (map f fa) @@ -105,7 +105,7 @@ (exec (io.run (..await (|>> f resolve) fa)) fb)))) -(implementation: #export apply +(implementation: .public apply (Apply Async) (def: &functor ..functor) @@ -117,7 +117,7 @@ ff)) fb)))) -(implementation: #export monad +(implementation: .public monad (Monad Async) (def: &functor ..functor) @@ -129,7 +129,7 @@ (exec (io.run (..await (..await resolve) mma)) ma)))) -(def: #export (and left right) +(def: .public (and left right) {#.doc (doc "Combines the results of both asyncs, in-order.")} (All [a b] (-> (Async a) (Async b) (Async [a b]))) (let [[read! write!] (:sharing [a b] @@ -146,7 +146,7 @@ left))] read!)) -(def: #export (or left right) +(def: .public (or left right) {#.doc (doc "Yields the results of whichever async gets resolved first." "You can tell which one was resolved first through pattern-matching.")} (All [a b] (-> (Async a) (Async b) (Async (Or a b)))) @@ -161,7 +161,7 @@ (exec <sides> a|b)))) -(def: #export (either left right) +(def: .public (either left right) {#.doc (doc "Yields the results of whichever async gets resolved first." "You cannot tell which one was resolved first.")} (All [a] (-> (Async a) (Async a) (Async a))) @@ -173,7 +173,7 @@ [right])) left||right)))) -(def: #export (schedule millis_delay computation) +(def: .public (schedule millis_delay computation) {#.doc (doc "Runs an I/O computation on its own thread (after a specified delay)." "Returns a aromise that will eventually host its result.")} (All [a] (-> Nat (IO a) (Async a))) @@ -185,23 +185,23 @@ io.run) !out))) -(def: #export future +(def: .public future {#.doc (doc "Runs an I/O computation on its own thread." "Returns an async that will eventually host its result.")} (All [a] (-> (IO a) (Async a))) (..schedule 0)) -(def: #export (delay time_millis value) +(def: .public (delay time_millis value) {#.doc "Delivers a value after a certain period has passed."} (All [a] (-> Nat a (Async a))) (..schedule time_millis (io value))) -(def: #export (wait time_millis) +(def: .public (wait time_millis) {#.doc "Returns an async that will be resolved after the specified amount of milliseconds."} (-> Nat (Async Any)) (..delay time_millis [])) -(def: #export (time_out time_millis async) +(def: .public (time_out time_millis async) {#.doc "Wait for an async to be resolved within the specified amount of milliseconds."} (All [a] (-> Nat (Async a) (Async (Maybe a)))) (..or (wait time_millis) async)) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 9a86f191b..c6c993561 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -46,29 +46,29 @@ @.php "php array read" @.scheme "scheme array read"} (as_is))] - (abstract: #export (Atom a) + (abstract: .public (Atom a) + {#.doc "Atomic references that are safe to mutate concurrently."} + (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference a)] (for {@.old <jvm> @.jvm <jvm>} (array.Array a))) - {#.doc "Atomic references that are safe to mutate concurrently."} - - (def: #export (atom value) + (def: .public (atom value) (All [a] (-> a (Atom a))) (:abstraction (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::new value)] (for {@.old <jvm> @.jvm <jvm>} (<write> 0 value (<new> 1)))))) - (def: #export (read atom) + (def: .public (read atom) (All [a] (-> (Atom a) (IO a))) (io (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::get (:representation atom))] (for {@.old <jvm> @.jvm <jvm>} (<read> 0 (:representation atom)))))) - (def: #export (compare_and_swap current new atom) + (def: .public (compare_and_swap current new atom) {#.doc (doc "Only mutates an atom if you can present its current value." "That guarantees that atom was not updated since you last read from it.")} (All [a] (-> a a (Atom a) (IO Bit))) @@ -82,7 +82,7 @@ false)))))) )) -(def: #export (update f atom) +(def: .public (update f atom) {#.doc (doc "Updates an atom by applying a function to its current value." "If it fails to update it (because some other process wrote to it first), it will retry until it succeeds." "The retries will be done with the new values of the atom, as they show up.")} @@ -96,7 +96,7 @@ (in [old new]) (recur []))))) -(def: #export (write value atom) +(def: .public (write value atom) {#.doc (doc "Writes the given value to an atom." "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds.")} (All [a] (-> a (Atom a) (IO a))) diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index 14b4013d3..3b1a0a4bd 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -18,13 +18,13 @@ ["." atom (#+ Atom)] ["." async (#+ Async) ("#\." functor)]]) -(type: #export (Channel a) +(type: .public (Channel a) {#.doc "An asynchronous channel to distribute values."} (Async (Maybe [a (Channel a)]))) -(exception: #export channel_is_already_closed) +(exception: .public channel_is_already_closed) -(interface: #export (Sink a) +(interface: .public (Sink a) {#.doc (doc "The tail-end of a channel, which can be written-to to fee the channel.")} (: (IO (Try Any)) close) @@ -80,13 +80,13 @@ ## Someone else fed the sink. (recur [])))))))))) -(def: #export (channel _) +(def: .public (channel _) {#.doc (doc "Creates a brand-new channel and hands it over, along with the sink to write to it.")} (All [a] (-> Any [(Channel a) (Sink a)])) (let [[async resolve] (async.async [])] [async (..sink resolve)])) -(implementation: #export functor +(implementation: .public functor (Functor Channel) (def: (map f) @@ -95,7 +95,7 @@ (function (_ [head tail]) [(f head) (map f tail)]))))) -(implementation: #export apply +(implementation: .public apply (Apply Channel) (def: &functor ..functor) @@ -115,7 +115,7 @@ Channel (async.resolved #.None)) -(implementation: #export monad +(implementation: .public monad (Monad Channel) (def: &functor ..functor) @@ -148,11 +148,11 @@ (in (: Any (io.run (\ sink close)))))))) output)))) -(type: #export (Subscriber a) +(type: .public (Subscriber a) {#.doc (doc "A function that can receive every value fed into a channel.")} (-> a (IO (Maybe Any)))) -(def: #export (subscribe subscriber channel) +(def: .public (subscribe subscriber channel) (All [a] (-> (Subscriber a) (Channel a) (IO Any))) (io (exec (: (Async Any) (loop [channel channel] @@ -171,7 +171,7 @@ (in []))))) []))) -(def: #export (only pass? channel) +(def: .public (only pass? channel) {#.doc (doc "Produces a new channel based on the old one, only with values" "that pass the test.")} (All [a] (-> (-> a Bit) (Channel a) (Channel a))) @@ -187,14 +187,14 @@ #.None (in #.None)))) -(def: #export (of_async async) +(def: .public (of_async async) {#.doc (doc "A one-element channel containing the output from an async.")} (All [a] (-> (Async a) (Channel a))) (async\map (function (_ value) (#.Some [value ..empty])) async)) -(def: #export (fold f init channel) +(def: .public (fold f init channel) {#.doc "Asynchronous fold over channels."} (All [a b] (-> (-> b a (Async a)) a (Channel b) @@ -210,7 +210,7 @@ [init' (f head init)] (fold f init' tail))))) -(def: #export (folds f init channel) +(def: .public (folds f init channel) (All [a b] (-> (-> b a (Async a)) a (Channel b) (Channel a))) @@ -225,7 +225,7 @@ [init' (f head init)] (in (#.Some [init (folds f init' tail)])))))) -(def: #export (poll milli_seconds action) +(def: .public (poll milli_seconds action) (All [a] (-> Nat (IO a) [(Channel a) (Sink a)])) (let [[output sink] (channel [])] @@ -236,11 +236,11 @@ (async.await recur (async.wait milli_seconds))))) [output sink]))) -(def: #export (periodic milli_seconds) +(def: .public (periodic milli_seconds) (-> Nat [(Channel Any) (Sink Any)]) (..poll milli_seconds (io []))) -(def: #export (iterations f init) +(def: .public (iterations f init) (All [s o] (-> (-> s (Async (Maybe [s o]))) s (Channel o))) (do async.monad [?next (f init)] @@ -264,7 +264,7 @@ #.None (in #.None)))) -(def: #export (distinct equivalence channel) +(def: .public (distinct equivalence channel) (All [a] (-> (Equivalence a) (Channel a) (Channel a))) (do async.monad [item channel] @@ -275,7 +275,7 @@ #.None (in #.None)))) -(def: #export (consume channel) +(def: .public (consume channel) (All [a] (-> (Channel a) (Async (List a)))) (do {! async.monad} [item channel] @@ -287,7 +287,7 @@ #.None (in #.End)))) -(def: #export (sequential milli_seconds values) +(def: .public (sequential milli_seconds values) {#.doc (doc "Transforms the given list into a channel with the same elements.")} (All [a] (-> Nat (List a) (Channel a))) (case values diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index f4e094d3b..f01af9336 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -29,15 +29,15 @@ #open_positions Int #waiting_list (Queue (Resolver Any))}) -(abstract: #export Semaphore - (Atom State) - +(abstract: .public Semaphore {#.doc "A tool for controlling access to resources by multiple concurrent processes."} + (Atom State) + (def: most_positions_possible (.nat (\ i.interval top))) - (def: #export (semaphore initial_open_positions) + (def: .public (semaphore initial_open_positions) (-> Nat Semaphore) (let [max_positions (n.min initial_open_positions ..most_positions_possible)] @@ -45,7 +45,7 @@ #open_positions (.int max_positions) #waiting_list queue.empty})))) - (def: #export (wait semaphore) + (def: .public (wait semaphore) {#.doc (doc "Wait on a semaphore until there are open positions." "After finishing your work, you must 'signal' to the semaphore that you're done.")} (Ex [k] (-> Semaphore (Async Any))) @@ -67,11 +67,11 @@ <get_in_line>))))) signal))) - (exception: #export (semaphore_is_maxed_out {max_positions Nat}) + (exception: .public (semaphore_is_maxed_out {max_positions Nat}) (exception.report ["Max Positions" (%.nat max_positions)])) - (def: #export (signal semaphore) + (def: .public (signal semaphore) {#.doc (doc "Signal to a semaphore that you're done with your work, and that there is a new open position.")} (Ex [k] (-> Semaphore (Async (Try Int)))) (let [semaphore (:representation semaphore)] @@ -97,12 +97,12 @@ (in (#try.Success (get@ #open_positions post))))))))) ) -(abstract: #export Mutex - Semaphore - +(abstract: .public Mutex {#.doc "A mutual-exclusion lock that can only be acquired by one process at a time."} - (def: #export (mutex _) + Semaphore + + (def: .public (mutex _) {#.doc (doc "Creates a brand-new mutex.")} (-> Any Mutex) (:abstraction (semaphore 1))) @@ -115,7 +115,7 @@ (-> Mutex (Async Any)) (|>> :representation ..signal)) - (def: #export (synchronize mutex procedure) + (def: .public (synchronize mutex procedure) {#.doc (doc "Runs the procedure with exclusive control of the mutex.")} (All [a] (-> Mutex (IO (Async a)) (Async a))) (do async.monad @@ -125,23 +125,23 @@ (in output))) ) -(def: #export limit +(def: .public limit {#.doc (doc "Produce a limit for a barrier.")} (refinement.refinement (n.> 0))) -(type: #export Limit +(type: .public Limit {#.doc (doc "A limit for barriers.")} (:~ (refinement.type limit))) -(abstract: #export Barrier +(abstract: .public Barrier + {#.doc "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier."} + {#limit Limit #count (Atom Nat) #start_turnstile Semaphore #end_turnstile Semaphore} - {#.doc "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier."} - - (def: #export (barrier limit) + (def: .public (barrier limit) (-> Limit Barrier) (:abstraction {#limit limit #count (atom.atom 0) @@ -173,7 +173,7 @@ [end dec 0 #end_turnstile] ) - (def: #export (block barrier) + (def: .public (block barrier) {#.doc (doc "Wait on a barrier until all processes have arrived and met the barrier's limit.")} (-> Barrier (Async Any)) (do async.monad diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 29979e17e..6308a2c84 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -23,12 +23,12 @@ (type: (Observer a) (-> a (IO Any))) -(abstract: #export (Var a) - (Atom [a (List (Sink a))]) - +(abstract: .public (Var a) {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."} - (def: #export (var value) + (Atom [a (List (Sink a))]) + + (def: .public (var value) {#.doc "Creates a new STM var, with a default value."} (All [a] (-> a (Var a))) (:abstraction (atom.atom [value (list)]))) @@ -66,7 +66,7 @@ (in [])) (write! new_value var)))) - (def: #export (follow target) + (def: .public (follow target) {#.doc "Creates a channel that will receive all changes to the value of the given var."} (All [a] (-> (Var a) (IO [(Channel a) (Sink a)]))) (do io.monad @@ -85,7 +85,7 @@ (type: Tx (List (Ex [a] (Tx_Frame a)))) -(type: #export (STM a) +(type: .public (STM a) {#.doc "A computation which updates a transaction and produces a value."} (-> Tx [Tx a])) @@ -100,7 +100,7 @@ (:assume) )) -(def: #export (read var) +(def: .public (read var) (All [a] (-> (Var a) (STM a))) (function (_ tx) (case (var_value var tx) @@ -130,7 +130,7 @@ #current _current} (update_tx_value var value tx'))))) -(def: #export (write value var) +(def: .public (write value var) (All [a] (-> a (Var a) (STM Any))) (function (_ tx) (case (var_value var tx) @@ -142,7 +142,7 @@ [(#.Item [var (..read! var) value] tx) []]))) -(implementation: #export functor +(implementation: .public functor (Functor STM) (def: (map f fa) @@ -150,7 +150,7 @@ (let [[tx' a] (fa tx)] [tx' (f a)])))) -(implementation: #export apply +(implementation: .public apply (Apply STM) (def: &functor ..functor) @@ -161,7 +161,7 @@ [tx'' a] (fa tx')] [tx'' (f a)])))) -(implementation: #export monad +(implementation: .public monad (Monad STM) (def: &functor ..functor) @@ -175,7 +175,7 @@ (let [[tx' ma] (mma tx)] (ma tx'))))) -(def: #export (update f var) +(def: .public (update f var) {#.doc "Update a var's value, and return a tuple with the old and the new values."} (All [a] (-> (-> a a) (Var a) (STM [a a]))) (do ..monad @@ -261,7 +261,7 @@ (in []))) ))) -(def: #export (commit stm_proc) +(def: .public (commit stm_proc) {#.doc (doc "Commits a transaction and returns its result (asynchronously)." "Note that a transaction may be re-run an indeterminate number of times if other transactions involving the same variables successfully commit first." "For this reason, it's important to note that transactions must be free from side-effects, such as I/O.")} diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 0a2a2c547..8c3a273d4 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -64,7 +64,7 @@ #action (IO Any)}) )) -(def: #export parallelism +(def: .public parallelism {#.doc (doc "How many processes can run in parallel.")} Nat (with_expansions [<jvm> (|> (java/lang/Runtime::getRuntime) @@ -101,7 +101,7 @@ (#try.Success _) [])) -(def: #export (schedule milli_seconds action) +(def: .public (schedule milli_seconds action) {#.doc (doc "Executes an I/O procedure after some milli-seconds.")} (-> Nat (IO Any) (IO Any)) (with_expansions [<jvm> (as_is (let [runnable (ffi.object [] [java/lang/Runnable] @@ -142,10 +142,10 @@ @.python (as_is)} ## Default - (as_is (exception: #export cannot_continue_running_threads) + (as_is (exception: .public cannot_continue_running_threads) ## https://en.wikipedia.org/wiki/Event_loop - (def: #export run! + (def: .public run! {#.doc (doc "Starts the event-loop.")} (IO Any) (loop [_ []] diff --git a/stdlib/source/library/lux/control/continuation.lux b/stdlib/source/library/lux/control/continuation.lux index 16f789010..ef0392fe9 100644 --- a/stdlib/source/library/lux/control/continuation.lux +++ b/stdlib/source/library/lux/control/continuation.lux @@ -13,21 +13,21 @@ [syntax (#+ syntax:)] ["." code]]]]) -(type: #export (Cont i o) +(type: .public (Cont i o) {#.doc "Continuations."} (-> (-> i o) o)) -(def: #export (continue next cont) +(def: .public (continue next cont) {#.doc "Continues a continuation thunk."} (All [i o] (-> (-> i o) (Cont i o) o)) (cont next)) -(def: #export (run cont) +(def: .public (run cont) {#.doc "Forces a continuation thunk to be evaluated."} (All [a] (-> (Cont a a) a)) (cont function.identity)) -(def: #export (call/cc f) +(def: .public (call/cc f) {#.doc "Call with current continuation."} (All [a b z] (-> (-> (-> a (Cont b z)) @@ -37,18 +37,18 @@ (f (function (_ a) (function (_ _) (k a))) k))) -(syntax: #export (pending expr) +(syntax: .public (pending expr) {#.doc (doc "Turns any expression into a function that is pending a continuation." (pending (some_function some_input)))} (with_gensyms [g!_ g!k] (in (list (` (.function ((~ g!_) (~ g!k)) ((~ g!k) (~ expr)))))))) -(def: #export (reset scope) +(def: .public (reset scope) (All [i o] (-> (Cont i i) (Cont i o))) (function (_ k) (k (run scope)))) -(def: #export (shift f) +(def: .public (shift f) (All [a] (-> (-> (-> a (Cont a a)) (Cont a a)) @@ -57,13 +57,13 @@ (f (function (_ a) (function (_ ic) (ic (oc a)))) function.identity))) -(implementation: #export functor +(implementation: .public functor (All [o] (Functor (All [i] (Cont i o)))) (def: (map f fv) (function (_ k) (fv (function.compose k f))))) -(implementation: #export apply +(implementation: .public apply (All [o] (Apply (All [i] (Cont i o)))) (def: &functor ..functor) @@ -74,7 +74,7 @@ (function (_ v)) fv (function (_ f)) ff)))) -(implementation: #export monad +(implementation: .public monad (All [o] (Monad (All [i] (Cont i o)))) (def: &functor ..functor) @@ -86,7 +86,7 @@ (function (_ k) (ffa (continue k))))) -(def: #export (portal init) +(def: .public (portal init) (All [i o z] (-> i (Cont [(-> i (Cont o z)) diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 7515cb9fb..a7d5a5871 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -7,8 +7,8 @@ [abstract [monad (#+ do)]] [control - ["p" parser - ["s" code (#+ Parser)]]] + ["<>" parser ("#\." monad) + ["<.>" code (#+ Parser)]]] [data ["." maybe] ["." product] @@ -18,7 +18,6 @@ [macro ["." code] [syntax (#+ syntax:) - ["|.|" export] ["|.|" input] ["." type #_ ["|#_.|" variable]]]] @@ -28,17 +27,17 @@ [// ["//" try (#+ Try)]]) -(type: #export (Exception a) +(type: .public (Exception a) {#.doc "An exception provides a way to decorate error messages."} {#label Text #constructor (-> a Text)}) -(def: #export (match? exception error) +(def: .public (match? exception error) {#.doc (doc "Is this exception the cause of the error message?")} (All [e] (-> (Exception e) Text Bit)) (text.starts_with? (get@ #label exception) error)) -(def: #export (catch exception then try) +(def: .public (catch exception then try) {#.doc (doc "If a particular exception is detected on a possibly-erroneous value, handle it." "If no exception was detected, or a different one from the one being checked, then pass along the original value.")} (All [e a] @@ -57,7 +56,7 @@ then)) (#//.Failure error))))) -(def: #export (otherwise else try) +(def: .public (otherwise else try) {#.doc "If no handler could be found to catch the exception, then run a function as a last-resort measure."} (All [a] (-> (-> Text a) (Try a) a)) @@ -68,47 +67,57 @@ (#//.Failure error) (else error))) -(def: #export (return value) +(def: .public (return value) {#.doc "A way to lift normal values into the error-handling context."} (All [a] (-> a (Try a))) (#//.Success value)) -(def: #export (error exception message) +(def: .public (error exception message) {#.doc "Constructs an error message from an exception."} (All [e] (-> (Exception e) e Text)) ((get@ #..constructor exception) message)) -(def: #export (except exception message) +(def: .public (except exception message) {#.doc "Decorate an error message with an Exception and lift it into the error-handling context."} (All [e a] (-> (Exception e) e (Try a))) (#//.Failure (..error exception message))) -(def: #export (assertion exception message test) +(def: .public (assertion exception message test) (All [e] (-> (Exception e) e Bit (Try Any))) (if test (#//.Success []) (..except exception message))) -(syntax: #export (exception: {export |export|.parser} - {t_vars (p.else (list) (s.tuple (p.some |type_variable|.parser)))} - {[name inputs] (p.either (p.and s.local_identifier (in (list))) - (s.form (p.and s.local_identifier (p.some |input|.parser))))} - {body (p.maybe s.any)}) +(def: exception + (Parser [Code (List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) + (let [private (: (Parser [(List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) + ($_ <>.and + (<>.else (list) (<code>.tuple (<>.some |type_variable|.parser))) + (<>.either (<code>.form (<>.and <code>.local_identifier (<>.some |input|.parser))) + (<>.and <code>.local_identifier (<>\in (list)))) + (<>.maybe <code>.any) + ))] + ($_ <>.either + (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private) + ))) + +(syntax: .public (exception: {[export_policy t_vars [name inputs] body] ..exception}) {#.doc (doc "Define a new exception type." "It mostly just serves as a way to tag error messages for later catching." "" "Simple case:" - (exception: #export some_exception) + (exception: .public some_exception) "" "Complex case:" - (exception: #export [arbitrary type variables] (some_exception {optional Text} {arguments Int}) + (exception: .public [arbitrary type variables] (some_exception {optional Text} {arguments Int}) optional_body))} (macro.with_gensyms [g!descriptor] (do meta.monad [current_module meta.current_module_name .let [descriptor ($_ text\compose "{" current_module "." name "}" text.new_line) g!self (code.local_identifier name)]] - (in (list (` (def: (~+ (|export|.format export)) + (in (list (` (def: (~ export_policy) (~ g!self) (All [(~+ (list\map |type_variable|.format t_vars))] (..Exception [(~+ (list\map (get@ #|input|.type) inputs))])) @@ -149,7 +158,7 @@ (on_entry head) tail)))) -(syntax: #export (report {entries (p.many (s.tuple (p.and s.any s.any)))}) +(syntax: .public (report {entries (<>.many (<code>.tuple (<>.and <code>.any <code>.any)))}) {#.doc (doc "An error report." (: Text (report ["Row 0" value/0] @@ -160,7 +169,7 @@ (list\map (function (_ [header message]) (` [(~ header) (~ message)]))))))))))) -(def: #export (listing format entries) +(def: .public (listing format entries) {#.doc (doc "A numbered report of the entries on a list." "NOTE: 0-based numbering.")} (All [a] @@ -190,7 +199,7 @@ ..separator error)) -(def: #export (with exception message computation) +(def: .public (with exception message computation) {#.doc (doc "If a computation fails, prepends the exception to the error.")} (All [e a] (-> (Exception e) e (Try a) (Try a))) (case computation diff --git a/stdlib/source/library/lux/control/function.lux b/stdlib/source/library/lux/control/function.lux index 32d3633ef..3e0669133 100644 --- a/stdlib/source/library/lux/control/function.lux +++ b/stdlib/source/library/lux/control/function.lux @@ -4,7 +4,7 @@ [abstract [monoid (#+ Monoid)]]]]) -(def: #export identity +(def: .public identity {#.doc (doc "Identity function." "Does nothing to its argument and just returns it." (is? (identity value) @@ -12,7 +12,7 @@ (All [a] (-> a a)) (|>>)) -(def: #export (compose f g) +(def: .public (compose f g) {#.doc (doc "Function composition." (= ((compose f g) "foo") (f (g "foo"))))} @@ -20,14 +20,14 @@ (-> (-> b c) (-> a b) (-> a c))) (|>> g f)) -(def: #export (constant value) +(def: .public (constant value) {#.doc (doc "Create constant functions." (= ((constant "foo") "bar") "foo"))} (All [o] (-> o (All [i] (-> i o)))) (function (_ _) value)) -(def: #export (flip f) +(def: .public (flip f) {#.doc (doc "Flips the order of the arguments of a function." (= ((flip f) "foo" "bar") (f "bar" "foo")))} @@ -35,13 +35,13 @@ (-> (-> a b c) (-> b a c))) (function (_ x y) (f y x))) -(def: #export (apply input function) +(def: .public (apply input function) {#.doc (doc "Simple 1-argument function application.")} (All [i o] (-> i (-> i o) o)) (function input)) -(implementation: #export monoid +(implementation: .public monoid (All [a] (Monoid (-> a a))) (def: identity ..identity) diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux index 59ad5b681..8b0baca0f 100644 --- a/stdlib/source/library/lux/control/function/contract.lux +++ b/stdlib/source/library/lux/control/function/contract.lux @@ -28,7 +28,7 @@ [] (error! message))) -(syntax: #export (pre test expr) +(syntax: .public (pre test expr) {#.doc (doc "Pre-conditions." "Given a test and an expression to run, only runs the expression if the test passes." "Otherwise, an error is raised." @@ -39,7 +39,7 @@ (~ test)) (~ expr)))))) -(syntax: #export (post test expr) +(syntax: .public (post test expr) {#.doc (doc "Post-conditions." "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." "If the predicate returns #1, returns the value of the expression." diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index 9b66afa50..311f1e433 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -16,7 +16,7 @@ ["." // #_ ["#" mixin (#+ Mixin Recursive)]]) -(def: #export memoization +(def: .public memoization (All [i o] (Mixin i (State (Dictionary i o) o))) (function (_ delegate recur) @@ -33,10 +33,10 @@ _ (state.update (dictionary.put input output))] (in output))))))) -(type: #export (Memo i o) +(type: .public (Memo i o) (Recursive i (State (Dictionary i o) o))) -(def: #export (open memo) +(def: .public (open memo) {#.doc (doc "Memoization where the memoized results can be re-used accross invocations.")} (All [i o] (:let [Memory (Dictionary i o)] @@ -45,7 +45,7 @@ (function (_ [memory input]) (|> input memo (state.run memory))))) -(def: #export (closed hash memo) +(def: .public (closed hash memo) {#.doc (doc "Memoization confined to a single invocation to the function (not counting any subsequent recursive invocations)." "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.")} (All [i o] @@ -54,7 +54,7 @@ empty (dictionary.empty hash)] (|>> memo (state.run empty) product.right))) -(def: #export (none hash memo) +(def: .public (none hash memo) {#.doc (doc "No memoization at all." "This is useful as a test control when measuring the effect of using memoization.")} (All [i o] diff --git a/stdlib/source/library/lux/control/function/mixin.lux b/stdlib/source/library/lux/control/function/mixin.lux index 796c04057..50e26ef55 100644 --- a/stdlib/source/library/lux/control/function/mixin.lux +++ b/stdlib/source/library/lux/control/function/mixin.lux @@ -9,35 +9,35 @@ [predicate (#+ Predicate)] [monad (#+ Monad do)]]]]) -(type: #export (Mixin i o) +(type: .public (Mixin i o) {#.doc (doc "A function which can be mixed with others to inherit their behavior.")} (-> (-> i o) (-> i o) (-> i o))) -(def: #export (mixin f) +(def: .public (mixin f) {#.doc (doc "Given a mixin, produces a normal function.")} (All [i o] (-> (Mixin i o) (-> i o))) (function (mix input) ((f mix mix) input))) -(def: #export nothing +(def: .public nothing {#.doc (doc "A mixin that does nothing and just delegates work to the next mixin.")} Mixin (function (_ delegate recur) delegate)) -(def: #export (inherit parent child) +(def: .public (inherit parent child) {#.doc (doc "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent.")} (All [i o] (-> (Mixin i o) (Mixin i o) (Mixin i o))) (function (_ delegate recur) (parent (child delegate recur) recur))) -(implementation: #export monoid +(implementation: .public monoid (All [i o] (Monoid (Mixin i o))) (def: identity ..nothing) (def: compose ..inherit)) -(def: #export (advice when then) +(def: .public (advice when then) {#.doc (doc "Only apply then mixin when the input meets some criterion.")} (All [i o] (-> (Predicate i) (Mixin i o) (Mixin i o))) (function (_ delegate recur input) @@ -45,7 +45,7 @@ ((then delegate recur) input) (delegate input)))) -(def: #export (before monad action) +(def: .public (before monad action) {#.doc (doc "Executes an action before doing the main work.")} (All [! i o] (-> (Monad !) (-> i (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) @@ -53,7 +53,7 @@ [_ (action input)] (delegate input)))) -(def: #export (after monad action) +(def: .public (after monad action) {#.doc (doc "Executes an action after doing the main work.")} (All [! i o] (-> (Monad !) (-> i o (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) @@ -62,11 +62,11 @@ _ (action input output)] (in output)))) -(type: #export (Recursive i o) +(type: .public (Recursive i o) {#.doc (doc "An indirectly recursive function.")} (-> (-> i o) (-> i o))) -(def: #export (of_recursive recursive) +(def: .public (of_recursive recursive) {#.doc (doc "Transform an indirectly recursive function into a mixin.")} (All [i o] (-> (Recursive i o) (Mixin i o))) (function (_ delegate recur) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index e292f19ee..6f0479cc6 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -22,7 +22,6 @@ ["." local] ["." code] [syntax (#+ syntax:) - ["." export] ["." declaration (#+ Declaration)]]]]] ["." //]) @@ -53,7 +52,7 @@ (function (_ parameters) (\ meta.monad in (list (` (((~ g!self) (~ g!context)) (~+ parameters)))))))) -(syntax: #export (let {functions (<code>.tuple (<>.some ..mutual))} +(syntax: .public (let {functions (<code>.tuple (<>.some ..mutual))} body) {#.doc (doc "Locally-defined mutually-recursive functions." (let [(even? number) @@ -111,24 +110,24 @@ (~ g!output)))))))))) (type: Definition - {#exported? Bit + {#export_policy Code #mutual Mutual}) (.def: definition (Parser Definition) - (<code>.tuple (<>.and export.parser - ..mutual))) + (<code>.tuple (<>.either (<>.and <code>.any ..mutual) + (<>.and (<>\in (` .private)) ..mutual)))) -(syntax: #export (def: {functions (<>.many ..definition)}) +(syntax: .public (def: {functions (<>.many ..definition)}) {#.doc (doc "Globally-defined mutually-recursive functions." (def: - [#export (even? number) + [.public (even? number) (-> Nat Bit) (case number 0 true _ (odd? (dec number)))] - [#export (odd? number) + [.public (odd? number) (-> Nat Bit) (case number 0 false @@ -138,11 +137,9 @@ (in (list)) (#.Item definition #.End) - (.let [(^slots [#exported? #mutual]) definition + (.let [(^slots [#export_policy #mutual]) definition (^slots [#declaration #type #body]) mutual] - (in (list (` (.def: - (~+ (export.format exported?)) - (~ (declaration.format declaration)) + (in (list (` (.def: (~ export_policy) (~ (declaration.format declaration)) (~ type) (~ body)))))) @@ -178,7 +175,7 @@ (list\map (function (_ mutual) (.let [g!name (|> mutual (get@ [#mutual #declaration #declaration.name]) code.local_identifier)] (` (.def: - (~+ (export.format (get@ #exported? mutual))) + (~ (get@ #export_policy mutual)) (~ g!name) (~ (get@ [#mutual #type] mutual)) (.let [[(~+ user_names)] (~ g!context)] diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index b3d5893bd..843170c4c 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -15,25 +15,25 @@ [syntax (#+ syntax:)] ["." template]]]]) -(abstract: #export (IO a) - (-> Any a) - +(abstract: .public (IO a) {#.doc "A type that represents synchronous, effectful computations that may interact with the outside world."} + (-> Any a) + (def: label (All [a] (-> (-> Any a) (IO a))) (|>> :abstraction)) (template: (!io computation) - (:abstraction (template.with_locals [g!func g!arg] - (function (g!func g!arg) - computation)))) + [(:abstraction (template.with_locals [g!func g!arg] + (function (g!func g!arg) + computation)))]) (template: (!run io) ## creatio ex nihilo - ((:representation io) [])) + [((:representation io) [])]) - (syntax: #export (io computation) + (syntax: .public (io computation) {#.doc (doc "Delays the evaluation of an expression, by wrapping it in an IO 'thunk'." "Great for wrapping effectful computations (which will not be performed until the IO is 'run')." (io (exec @@ -43,18 +43,18 @@ (in (list (` ((~! ..label) (function ((~ g!func) (~ g!arg)) (~ computation)))))))) - (def: #export run + (def: .public run {#.doc "A way to execute IO computations and perform their side-effects."} (All [a] (-> (IO a) a)) (|>> !run)) - (implementation: #export functor + (implementation: .public functor (Functor IO) (def: (map f) (|>> !run f !io))) - (implementation: #export apply + (implementation: .public apply (Apply IO) (def: &functor ..functor) @@ -62,7 +62,7 @@ (def: (apply ff fa) (!io ((!run ff) (!run fa))))) - (implementation: #export monad + (implementation: .public monad (Monad IO) (def: &functor ..functor) diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index ad639f00f..8ddce370f 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -16,11 +16,11 @@ [number ["n" nat]]]]]) -(type: #export (Parser s a) +(type: .public (Parser s a) {#.doc "A generic parser."} (-> s (Try [s a]))) -(implementation: #export functor +(implementation: .public functor (All [s] (Functor (Parser s))) (def: (map f ma) @@ -32,7 +32,7 @@ (#try.Success [input' a]) (#try.Success [input' (f a)]))))) -(implementation: #export apply +(implementation: .public apply (All [s] (Apply (Parser s))) (def: &functor ..functor) @@ -51,7 +51,7 @@ (#try.Failure msg) (#try.Failure msg))))) -(implementation: #export monad +(implementation: .public monad (All [s] (Monad (Parser s))) (def: &functor ..functor) @@ -69,7 +69,7 @@ (#try.Success [input' ma]) (ma input'))))) -(def: #export (assertion message test) +(def: .public (assertion message test) {#.doc "Fails with the given message if the test is #0."} (All [s] (-> Text Bit (Parser s Any))) (function (_ input) @@ -77,7 +77,7 @@ (#try.Success [input []]) (#try.Failure message)))) -(def: #export (maybe parser) +(def: .public (maybe parser) {#.doc "Optionality combinator."} (All [s a] (-> (Parser s a) (Parser s (Maybe a)))) @@ -89,7 +89,7 @@ (#try.Success [input' x]) (#try.Success [input' (#.Some x)])))) -(def: #export (run parser input) +(def: .public (run parser input) {#.doc (doc "Executes the parser on the input." "Does not verify that all of the input has been consumed by the parser." "Returns both the parser's output, and a value that represents the remaining input.")} @@ -97,7 +97,7 @@ (-> (Parser s a) s (Try [s a]))) (parser input)) -(def: #export (and first second) +(def: .public (and first second) {#.doc "Sequencing combinator."} (All [s a b] (-> (Parser s a) (Parser s b) (Parser s [a b]))) @@ -105,7 +105,7 @@ [head first] (\ ! map (|>> [head]) second))) -(def: #export (or left right) +(def: .public (or left right) {#.doc "Heterogeneous alternative combinator."} (All [s a b] (-> (Parser s a) (Parser s b) (Parser s (Or a b)))) @@ -122,7 +122,7 @@ (#try.Failure error) (#try.Failure error))))) -(def: #export (either this that) +(def: .public (either this that) {#.doc "Homogeneous alternative combinator."} (All [s a] (-> (Parser s a) (Parser s a) (Parser s a))) @@ -134,7 +134,7 @@ output output))) -(def: #export (some parser) +(def: .public (some parser) {#.doc "0-or-more combinator."} (All [s a] (-> (Parser s a) (Parser s (List a)))) @@ -148,7 +148,7 @@ (some parser)) input')))) -(def: #export (many parser) +(def: .public (many parser) {#.doc "1-or-more combinator."} (All [s a] (-> (Parser s a) (Parser s (List a)))) @@ -156,7 +156,7 @@ (..and parser) (\ ..monad map (|>> #.Item)))) -(def: #export (exactly amount parser) +(def: .public (exactly amount parser) {#.doc "Parse exactly N times."} (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) (case amount @@ -167,14 +167,14 @@ (exactly (dec amount)) (\ ! map (|>> (#.Item x))))))) -(def: #export (at_least amount parser) +(def: .public (at_least amount parser) {#.doc "Parse at least N times."} (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) (do {! ..monad} [minimum (..exactly amount parser)] (\ ! map (list\compose minimum) (..some parser)))) -(def: #export (at_most amount parser) +(def: .public (at_most amount parser) {#.doc "Parse at most N times."} (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) (case amount @@ -189,7 +189,7 @@ (at_most (dec amount) parser)) input'))))) -(def: #export (between minimum additional parser) +(def: .public (between minimum additional parser) (All [s a] (-> Nat Nat (Parser s a) (Parser s (List a)))) (do {! ..monad} [minimum (..exactly minimum parser)] @@ -198,7 +198,7 @@ _ (\ ! map (list\compose minimum) (..at_most additional parser))))) -(def: #export (separated_by separator parser) +(def: .public (separated_by separator parser) {#.doc "Parses instances of 'parser' that are separated by instances of 'separator'."} (All [s a b] (-> (Parser s b) (Parser s a) (Parser s (List a)))) (do {! ..monad} @@ -213,7 +213,7 @@ ..some (\ ! map (|>> (list\map product.right) (#.Item x))))))) -(def: #export (not parser) +(def: .public (not parser) {#.doc (doc "Only succeeds when the underlying parser fails.")} (All [s a] (-> (Parser s a) (Parser s Any))) (function (_ input) @@ -224,13 +224,13 @@ _ (#try.Failure "Expected to fail; yet succeeded.")))) -(def: #export (failure message) +(def: .public (failure message) {#.doc (doc "Always fail with this 'message'.")} (All [s a] (-> Text (Parser s a))) (function (_ input) (#try.Failure message))) -(def: #export (lift operation) +(def: .public (lift operation) {#.doc (doc "Lift a potentially failed computation into a parser.")} (All [s a] (-> (Try a) (Parser s a))) (function (_ input) @@ -241,7 +241,7 @@ (#try.Failure error) (#try.Failure error)))) -(def: #export (else value parser) +(def: .public (else value parser) {#.doc "If the given parser fails, returns the default value."} (All [s a] (-> a (Parser s a) (Parser s a))) (function (_ input) @@ -252,26 +252,26 @@ (#try.Success [input' output]) (#try.Success [input' output])))) -(def: #export remaining +(def: .public remaining {#.doc (doc "Yield the remaining input (without consuming it).")} (All [s] (Parser s s)) (function (_ inputs) (#try.Success [inputs inputs]))) -(def: #export (rec parser) +(def: .public (rec parser) {#.doc "Combinator for recursive parsers."} (All [s a] (-> (-> (Parser s a) (Parser s a)) (Parser s a))) (function (_ inputs) (..run (parser (rec parser)) inputs))) -(def: #export (after param subject) +(def: .public (after param subject) {#.doc (doc "Run the parser after another one (whose output is ignored).")} (All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad [_ param] subject)) -(def: #export (before param subject) +(def: .public (before param subject) {#.doc (doc "Run the parser before another one (whose output is ignored).")} (All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad @@ -279,7 +279,7 @@ _ param] (in output))) -(def: #export (only test parser) +(def: .public (only test parser) {#.doc (doc "Only succeed when the parser's output passes a test.")} (All [s a] (-> (-> a Bit) (Parser s a) (Parser s a))) (do ..monad @@ -287,7 +287,7 @@ _ (..assertion "Constraint failed." (test output))] (in output))) -(def: #export (parses? parser) +(def: .public (parses? parser) {#.doc (doc "Ignore a parser's output and just verify that it succeeds.")} (All [s a] (-> (Parser s a) (Parser s Bit))) (function (_ input) @@ -298,7 +298,7 @@ (#try.Success [input' _]) (#try.Success [input' true])))) -(def: #export (parses parser) +(def: .public (parses parser) {#.doc (doc "Ignore a parser's output and just execute it.")} (All [s a] (-> (Parser s a) (Parser s Any))) (function (_ input) @@ -309,7 +309,7 @@ (#try.Success [input' _]) (#try.Success [input' []])))) -(def: #export (speculative parser) +(def: .public (speculative parser) {#.doc (doc "Executes a parser, without actually consuming the input." "That way, the same input can be consumed again by another parser.")} (All [s a] (-> (Parser s a) (Parser s a))) @@ -321,7 +321,7 @@ output output))) -(def: #export (codec codec parser) +(def: .public (codec codec parser) {#.doc (doc "Decode the output of a parser using a codec.")} (All [s a z] (-> (Codec a z) (Parser s a) (Parser s z))) (function (_ input) diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux index 738960e55..7d64289bc 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Variant Tuple nat int rev) + [lux (#- Variant Tuple nat int rev local) [abstract [monad (#+ do)]] [control @@ -40,19 +40,19 @@ (list.interpose " ") (text.join_with "")))) -(exception: #export (cannot_parse {input (List Analysis)}) +(exception: .public (cannot_parse {input (List Analysis)}) (exception.report ["Input" (exception.listing /.%analysis input)])) -(exception: #export (unconsumed_input {input (List Analysis)}) +(exception: .public (unconsumed_input {input (List Analysis)}) (exception.report ["Input" (exception.listing /.%analysis input)])) -(type: #export Parser +(type: .public Parser {#.doc (doc "A parser for Lux code analysis nodes.")} (//.Parser (List Analysis))) -(def: #export (run parser input) +(def: .public (run parser input) {#.doc (doc "Executes a parser and makes sure no inputs go unconsumed.")} (All [a] (-> (Parser a) (List Analysis) (Try a))) (case (parser input) @@ -65,7 +65,7 @@ (#try.Success [unconsumed _]) (exception.except ..unconsumed_input unconsumed))) -(def: #export any +(def: .public any {#.doc (doc "Matches any value, without discrimination.")} (Parser Analysis) (function (_ input) @@ -76,7 +76,7 @@ (#.Item [head tail]) (#try.Success [tail head])))) -(def: #export end! +(def: .public end! {#.doc "Ensures there are no more inputs."} (Parser Any) (function (_ tokens) @@ -85,7 +85,7 @@ _ (#try.Failure (format "Expected list of tokens to be empty!" (remaining_inputs tokens)))))) -(def: #export end? +(def: .public end? {#.doc "Checks whether there are no more inputs."} (Parser Bit) (function (_ tokens) @@ -94,7 +94,7 @@ _ false)]))) (template [<query> <assertion> <tag> <type> <eq>] - [(`` (as_is (def: #export <query> + [(`` (as_is (def: .public <query> {#.doc (doc (~~ (template.text ["Queries for a " <query> " value."])))} (Parser <type>) (function (_ input) @@ -105,7 +105,7 @@ _ (exception.except ..cannot_parse input)))) - (def: #export (<assertion> expected) + (def: .public (<assertion> expected) {#.doc (doc (~~ (template.text ["Assert a specific " <query> " value."])))} (-> <type> (Parser Any)) (function (_ input) @@ -129,7 +129,7 @@ [constant constant! /.constant Name name.equivalence] ) -(def: #export (tuple parser) +(def: .public (tuple parser) {#.doc (doc "Parses only within the context of a tuple's contents.")} (All [a] (-> (Parser a) (Parser a))) (function (_ input) diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index fd4e1880a..fe10ed1ee 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -26,20 +26,20 @@ ["." frac]]]]] ["." // ("#\." monad)]) -(type: #export Offset +(type: .public Offset {#.doc (doc "An offset for reading within binary data.")} Nat) -(type: #export Parser +(type: .public Parser {#.doc (doc "A parser for raw binary data.")} (//.Parser [Offset Binary])) -(exception: #export (binary_was_not_fully_read {binary_length Nat} {bytes_read Nat}) +(exception: .public (binary_was_not_fully_read {binary_length Nat} {bytes_read Nat}) (exception.report ["Binary length" (%.nat binary_length)] ["Bytes read" (%.nat bytes_read)])) -(def: #export (run parser input) +(def: .public (run parser input) {#.doc (doc "Runs a parser and checks that all the binary data was read by it.")} (All [a] (-> (Parser a) Binary (Try a))) (case (parser [0 input]) @@ -52,35 +52,35 @@ (#try.Success output) (exception.except ..binary_was_not_fully_read [length end]))))) -(def: #export end? +(def: .public end? {#.doc (doc "Checks whether there is no more data to read.")} (Parser Bit) (function (_ (^@ input [offset data])) (#try.Success [input (n.= offset (/.size data))]))) -(def: #export offset +(def: .public offset {#.doc (doc "The current offset (i.e. how much data has been read).")} (Parser Offset) (function (_ (^@ input [offset data])) (#try.Success [input offset]))) -(def: #export remaining +(def: .public remaining {#.doc (doc "How much of the data remains to be read.")} (Parser Nat) (function (_ (^@ input [offset data])) (#try.Success [input (n.- offset (/.size data))]))) -(type: #export Size +(type: .public Size {#.doc (doc "The size of a chunk of data within a binary array.")} Nat) -(def: #export size/8 Size 1) -(def: #export size/16 Size (n.* 2 size/8)) -(def: #export size/32 Size (n.* 2 size/16)) -(def: #export size/64 Size (n.* 2 size/32)) +(def: .public size/8 Size 1) +(def: .public size/16 Size (n.* 2 size/8)) +(def: .public size/32 Size (n.* 2 size/16)) +(def: .public size/64 Size (n.* 2 size/32)) (template [<name> <size> <read>] - [(def: #export <name> + [(def: .public <name> (Parser I64) (function (_ [offset binary]) (case (<read> offset binary) @@ -97,55 +97,55 @@ ) (template [<name> <type>] - [(def: #export <name> (Parser <type>) ..bits/64)] + [(def: .public <name> (Parser <type>) ..bits/64)] [nat Nat] [int Int] [rev Rev] ) -(def: #export frac +(def: .public frac (Parser Frac) (//\map frac.of_bits ..bits/64)) -(exception: #export (invalid_tag {range Nat} {byte Nat}) +(exception: .public (invalid_tag {range Nat} {byte Nat}) (exception.report ["Tag range" (%.nat range)] ["Tag value" (%.nat byte)])) (template: (!variant <case>+) - (do {! //.monad} - [flag (: (Parser Nat) - ..bits/8)] - (`` (case flag - (^template [<number> <tag> <parser>] - [<number> (\ ! map (|>> <tag>) <parser>)]) - ((~~ (template.spliced <case>+))) - _ (//.lift (exception.except ..invalid_tag [(~~ (template.amount <case>+)) flag])))))) - -(def: #export (or left right) + [(do {! //.monad} + [flag (: (Parser Nat) + ..bits/8)] + (`` (case flag + (^template [<number> <tag> <parser>] + [<number> (\ ! map (|>> <tag>) <parser>)]) + ((~~ (template.spliced <case>+))) + _ (//.lift (exception.except ..invalid_tag [(~~ (template.amount <case>+)) flag])))))]) + +(def: .public (or left right) (All [l r] (-> (Parser l) (Parser r) (Parser (Or l r)))) (!variant [[0 #.Left left] [1 #.Right right]])) -(def: #export (rec body) +(def: .public (rec body) {#.doc (doc "Tie the knot for a recursive parser.")} (All [a] (-> (-> (Parser a) (Parser a)) (Parser a))) (function (_ input) (let [parser (body (rec body))] (parser input)))) -(def: #export any +(def: .public any {#.doc (doc "Does no parsing, and just returns a dummy value.")} (Parser Any) (//\in [])) -(exception: #export (not_a_bit {value Nat}) +(exception: .public (not_a_bit {value Nat}) (exception.report ["Expected values" "either 0 or 1"] ["Actual value" (%.nat value)])) -(def: #export bit +(def: .public bit (Parser Bit) (do //.monad [value (: (Parser Nat) @@ -155,7 +155,7 @@ 1 (in #1) _ (//.lift (exception.except ..not_a_bit [value]))))) -(def: #export (segment size) +(def: .public (segment size) {#.doc (doc "Parses a chunk of data of a given size.")} (-> Nat (Parser Binary)) (function (_ [offset binary]) @@ -166,7 +166,7 @@ (\ try.monad map (|>> [[(n.+ size offset) binary]])))))) (template [<size> <name> <bits>] - [(`` (def: #export <name> + [(`` (def: .public <name> {#.doc (doc (~~ (template.text ["Parses a block of data prefixed with a size that is " <size> " bytes long."])))} (Parser Binary) (do //.monad @@ -180,7 +180,7 @@ ) (template [<size> <name> <binary>] - [(`` (def: #export <name> + [(`` (def: .public <name> {#.doc (doc (~~ (template.text ["Parses a block of (UTF-8 encoded) text prefixed with a size that is " <size> " bytes long."])))} (Parser Text) (do //.monad @@ -193,10 +193,10 @@ [64 utf8/64 ..binary/64] ) -(def: #export text ..utf8/64) +(def: .public text ..utf8/64) (template [<size> <name> <bits>] - [(def: #export (<name> valueP) + [(def: .public (<name> valueP) {#.doc (doc (~~ (template.text ["Parses a row of values prefixed with a size that is " <size> " bytes long."])))} (All [v] (-> (Parser v) (Parser (Row v)))) (do //.monad @@ -222,20 +222,20 @@ [64 row/64 ..bits/64] ) -(def: #export maybe +(def: .public maybe (All [a] (-> (Parser a) (Parser (Maybe a)))) (..or ..any)) -(def: #export (list value) +(def: .public (list value) {#.doc (doc "Parses an arbitrarily long list of values.")} (All [a] (-> (Parser a) (Parser (List a)))) (..rec (|>> (//.and value) (..or ..any)))) -(exception: #export set_elements_are_not_unique) +(exception: .public set_elements_are_not_unique) -(def: #export (set hash value) +(def: .public (set hash value) (All [a] (-> (Hash a) (Parser a) (Parser (Set a)))) (do //.monad [raw (..list value) @@ -245,11 +245,11 @@ (set.size output)))] (in output))) -(def: #export name +(def: .public name (Parser Name) (//.and ..text ..text)) -(def: #export type +(def: .public type (Parser Type) (..rec (function (_ type) @@ -268,11 +268,11 @@ [9 #.Apply pair] [10 #.Named (//.and ..name type)]]))))) -(def: #export location +(def: .public location (Parser Location) ($_ //.and ..text ..nat ..nat)) -(def: #export code +(def: .public code (Parser Code) (..rec (function (_ recur) diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index df59dbd44..b4051eb43 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -10,11 +10,11 @@ ["%" format (#+ format)]]]]] ["." //]) -(type: #export (Parser a) +(type: .public (Parser a) {#.doc "A command-line interface parser."} (//.Parser (List Text) a)) -(def: #export (run parser inputs) +(def: .public (run parser inputs) {#.doc (doc "Executes the parser and verifies that all inputs are processed.")} (All [a] (-> (Parser a) (List Text) (Try a))) (case (//.run parser inputs) @@ -29,7 +29,7 @@ (#try.Failure try) (#try.Failure try))) -(def: #export any +(def: .public any {#.doc "Just returns the next input without applying any logic."} (Parser Text) (function (_ inputs) @@ -40,7 +40,7 @@ _ (#try.Failure "Cannot parse empty arguments.")))) -(def: #export (parse parser) +(def: .public (parse parser) {#.doc "Parses the next input with a parsing function."} (All [a] (-> (-> Text (Try a)) (Parser a))) (function (_ inputs) @@ -49,7 +49,7 @@ output (parser raw)] (in [remaining output])))) -(def: #export (this reference) +(def: .public (this reference) {#.doc "Checks that a token is in the inputs."} (-> Text (Parser Any)) (function (_ inputs) @@ -59,7 +59,7 @@ (in [remaining []]) (#try.Failure (format "Missing token: '" reference "'")))))) -(def: #export (somewhere cli) +(def: .public (somewhere cli) {#.doc "Given a parser, tries to parse it somewhere in the inputs (i.e. not necessarily parsing the immediate inputs)."} (All [a] (-> (Parser a) (Parser a))) (function (_ inputs) @@ -79,7 +79,7 @@ (in [(#.Item to_omit remaining) output]))))))) -(def: #export end +(def: .public end {#.doc "Ensures there are no more inputs."} (Parser Any) (function (_ inputs) @@ -87,14 +87,14 @@ #.End (#try.Success [inputs []]) _ (#try.Failure (format "Unknown parameters: " (text.join_with " " inputs)))))) -(def: #export (named name value) +(def: .public (named name value) {#.doc (doc "Parses a named parameter and yields its value.")} (All [a] (-> Text (Parser a) (Parser a))) (|> value (//.after (..this name)) ..somewhere)) -(def: #export (parameter [short long] value) +(def: .public (parameter [short long] value) {#.doc (doc "Parses a parameter that can have either a short or a long name.")} (All [a] (-> [Text Text] (Parser a) (Parser a))) (|> value diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index 6edbb9ed1..c3ac5dca0 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- nat int rev) + [lux (#- nat int rev local) [abstract ["." monad (#+ do)]] [control @@ -27,7 +27,7 @@ #.End #.End (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) -(type: #export Parser +(type: .public Parser {#.doc "A Lux code parser."} (//.Parser (List Code))) @@ -36,7 +36,7 @@ ($_ text\compose text.new_line "Remaining input: " (|> codes (list\map code.format) (list.interpose " ") (text.join_with "")))) -(def: #export any +(def: .public any {#.doc "Yields the next input without applying any logic."} (Parser Code) (function (_ tokens) @@ -49,7 +49,7 @@ (template [<query> <check> <type> <tag> <eq> <desc>] [(with_expansions [<failure> (as_is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining_inputs tokens))))] - (def: #export <query> + (def: .public <query> {#.doc (code.text ($_ text\compose "Parses the next " <desc> " input."))} (Parser <type>) (function (_ tokens) @@ -60,7 +60,7 @@ _ <failure>))) - (def: #export (<check> expected) + (def: .public (<check> expected) {#.doc (code.text ($_ text\compose "Checks for a specific " <desc> " input."))} (-> <type> (Parser Any)) (function (_ tokens) @@ -83,7 +83,7 @@ [tag tag! Name #.Tag name.equivalence "tag"] ) -(def: #export (this! code) +(def: .public (this! code) {#.doc "Ensures the given Code is the next input."} (-> Code (Parser Any)) (function (_ tokens) @@ -99,7 +99,7 @@ (template [<query> <check> <tag> <eq> <desc>] [(with_expansions [<failure> (as_is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining_inputs tokens))))] - (def: #export <query> + (def: .public <query> {#.doc (code.text ($_ text\compose "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))} (Parser Text) (function (_ tokens) @@ -110,7 +110,7 @@ _ <failure>))) - (def: #export (<check> expected) + (def: .public (<check> expected) {#.doc (code.text ($_ text\compose "Checks for a specific local " <desc> " (a " <desc> " that has no module prefix)."))} (-> Text (Parser Any)) (function (_ tokens) @@ -128,7 +128,7 @@ ) (template [<name> <tag> <desc>] - [(def: #export (<name> p) + [(def: .public (<name> p) {#.doc (code.text ($_ text\compose "Parses the contents of a " <desc> "."))} (All [a] (-> (Parser a) (Parser a))) @@ -146,7 +146,7 @@ [tuple #.Tuple "tuple"] ) -(def: #export (record p) +(def: .public (record p) {#.doc "Parses the contents of a record."} (All [a] (-> (Parser a) (Parser a))) @@ -160,7 +160,7 @@ _ (#try.Failure ($_ text\compose "Cannot parse record" (remaining_inputs tokens)))))) -(def: #export end! +(def: .public end! {#.doc "Verifies there are no more inputs."} (Parser Any) (function (_ tokens) @@ -168,7 +168,7 @@ #.End (#try.Success [tokens []]) _ (#try.Failure ($_ text\compose "Expected list of tokens to be empty!" (remaining_inputs tokens)))))) -(def: #export end? +(def: .public end? {#.doc "Checks whether there are no more inputs."} (Parser Bit) (function (_ tokens) @@ -176,7 +176,7 @@ #.End true _ false)]))) -(def: #export (run parser inputs) +(def: .public (run parser inputs) {#.doc (doc "Executes a parser against a stream of code, and verifies all the inputs are consumed.")} (All [a] (-> (Parser a) (List Code) (Try a))) (case (parser inputs) @@ -193,7 +193,7 @@ (|> (list\map code.format unconsumed) (text.join_with ", "))))))) -(def: #export (local inputs parser) +(def: .public (local inputs parser) {#.doc "Runs parser against the given list of inputs."} (All [a] (-> (List Code) (Parser a) (Parser a))) (function (_ real) diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux index b7d2d8ebf..fe7c0ea59 100644 --- a/stdlib/source/library/lux/control/parser/environment.lux +++ b/stdlib/source/library/lux/control/parser/environment.lux @@ -12,28 +12,28 @@ ["." dictionary (#+ Dictionary)]]]]] ["." //]) -(type: #export Property +(type: .public Property {#.doc (doc "A property in the environment.")} Text) -(type: #export Environment +(type: .public Environment {#.doc (doc "An abstraction for environment variables of a program.")} (Dictionary Property Text)) -(exception: #export (unknown_property {property Property}) +(exception: .public (unknown_property {property Property}) (exception.report ["Property" (%.text property)])) -(type: #export (Parser a) +(type: .public (Parser a) {#.doc (doc "A parser of environment variables of a program.")} (//.Parser Environment a)) -(def: #export empty +(def: .public empty {#.doc (doc "An empty environment.")} Environment (dictionary.empty text.hash)) -(def: #export (property name) +(def: .public (property name) (-> Property (Parser Text)) (function (_ environment) (case (dictionary.get name environment) @@ -43,7 +43,7 @@ #.None (exception.except ..unknown_property [name])))) -(def: #export (run parser environment) +(def: .public (run parser environment) {#.doc (doc "Executes a parser against the given environment variables." "Does not check whether all environment variables were parsed, since they're usually an open set.")} (All [a] (-> (Parser a) Environment (Try a))) diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 74747195d..f1112ffbe 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -22,17 +22,17 @@ ["." frac]]]]] ["." // ("#\." functor)]) -(type: #export (Parser a) +(type: .public (Parser a) {#.doc "A JSON parser."} (//.Parser (List JSON) a)) -(exception: #export (unconsumed_input {input (List JSON)}) +(exception: .public (unconsumed_input {input (List JSON)}) (exception.report ["Input" (exception.listing /.format input)])) -(exception: #export empty_input) +(exception: .public empty_input) -(def: #export (run parser json) +(def: .public (run parser json) {#.doc (doc "Executes the parser against a JSON object." "Verifies that all of the JSON was consumed by the parser.")} (All [a] (-> (Parser a) JSON (Try a))) @@ -48,7 +48,7 @@ (#try.Failure error) (#try.Failure error))) -(def: #export any +(def: .public any {#.doc "Just returns the JSON input without applying any logic."} (Parser JSON) (<| (function (_ inputs)) @@ -59,12 +59,12 @@ (#.Item head tail) (#try.Success [tail head])))) -(exception: #export (unexpected_value {value JSON}) +(exception: .public (unexpected_value {value JSON}) (exception.report ["Value" (/.format value)])) (template [<name> <type> <tag> <desc>] - [(def: #export <name> + [(def: .public <name> {#.doc (code.text ($_ text\compose "Reads a JSON value as " <desc> "."))} (Parser <type>) (do //.monad @@ -82,13 +82,13 @@ [string /.String #/.String "string"] ) -(exception: #export [a] (value_mismatch {reference JSON} {sample JSON}) +(exception: .public [a] (value_mismatch {reference JSON} {sample JSON}) (exception.report ["Reference" (/.format reference)] ["Sample" (/.format sample)])) (template [<test> <check> <type> <equivalence> <tag> <desc>] - [(def: #export (<test> test) + [(def: .public (<test> test) {#.doc (code.text ($_ text\compose "Asks whether a JSON value is a " <desc> "."))} (-> <type> (Parser Bit)) (do //.monad @@ -100,7 +100,7 @@ _ (//.failure (exception.error ..unexpected_value [head]))))) - (def: #export (<check> test) + (def: .public (<check> test) {#.doc (code.text ($_ text\compose "Ensures a JSON value is a " <desc> "."))} (-> <type> (Parser Any)) (do //.monad @@ -119,13 +119,13 @@ [string? string! /.String text.equivalence #/.String "string"] ) -(def: #export (nullable parser) +(def: .public (nullable parser) {#.doc (doc "Enhances parser by adding NULL-handling.")} (All [a] (-> (Parser a) (Parser (Maybe a)))) (//.or ..null parser)) -(def: #export (array parser) +(def: .public (array parser) {#.doc "Parses the contents of a JSON array."} (All [a] (-> (Parser a) (Parser a))) (do //.monad @@ -147,7 +147,7 @@ _ (//.failure (exception.error ..unexpected_value [head]))))) -(def: #export (object parser) +(def: .public (object parser) {#.doc (doc "Parses the contents of a JSON object." "Use this with the 'field' combinator.")} (All [a] (-> (Parser a) (Parser a))) @@ -175,7 +175,7 @@ _ (//.failure (exception.error ..unexpected_value [head]))))) -(def: #export (field field_name parser) +(def: .public (field field_name parser) {#.doc (doc "Parses a field inside a JSON object." "Use this inside the 'object' combinator.")} (All [a] (-> Text (Parser a) (Parser a))) @@ -203,7 +203,7 @@ _ (exception.except ..unconsumed_input inputs)))) -(def: #export dictionary +(def: .public dictionary {#.doc "Parses a dictionary-like JSON object."} (All [a] (-> (Parser a) (Parser (Dictionary Text a)))) (|>> (//.and ..string) diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index 1ecdaab9e..cde50518e 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Variant Tuple function loop i64) + [lux (#- Variant Tuple function loop i64 local) [abstract [monad (#+ do)]] [control @@ -29,30 +29,30 @@ ["/" synthesis (#+ Synthesis Abstraction)]]]]]]] ["." //]) -(exception: #export (cannot_parse {input (List Synthesis)}) +(exception: .public (cannot_parse {input (List Synthesis)}) (exception.report ["Input" (exception.listing /.%synthesis input)])) -(exception: #export (unconsumed_input {input (List Synthesis)}) +(exception: .public (unconsumed_input {input (List Synthesis)}) (exception.report ["Input" (exception.listing /.%synthesis input)])) -(exception: #export (expected_empty_input {input (List Synthesis)}) +(exception: .public (expected_empty_input {input (List Synthesis)}) (exception.report ["Input" (exception.listing /.%synthesis input)])) -(exception: #export (wrong_arity {expected Arity} {actual Arity}) +(exception: .public (wrong_arity {expected Arity} {actual Arity}) (exception.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) -(exception: #export empty_input) +(exception: .public empty_input) -(type: #export Parser +(type: .public Parser {#.doc (doc "A parser for the Lux compiler's synthesis nodes using during optimization.")} (//.Parser (List Synthesis))) -(def: #export (run parser input) +(def: .public (run parser input) {#.doc (doc "Executes the parser against the inputs." "Ensures all inputs are consumed by the parser.")} (All [a] (-> (Parser a) (List Synthesis) (Try a))) @@ -66,7 +66,7 @@ (#try.Success [unconsumed _]) (exception.except ..unconsumed_input unconsumed))) -(def: #export any +(def: .public any {#.doc (doc "Yields a synthesis node without subjecting it to any analysis.")} (Parser Synthesis) (.function (_ input) @@ -77,7 +77,7 @@ (#.Item [head tail]) (#try.Success [tail head])))) -(def: #export end! +(def: .public end! {#.doc "Ensures there are no more inputs."} (Parser Any) (.function (_ tokens) @@ -85,7 +85,7 @@ #.End (#try.Success [tokens []]) _ (exception.except ..expected_empty_input [tokens])))) -(def: #export end? +(def: .public end? {#.doc "Checks whether there are no more inputs."} (Parser Bit) (.function (_ tokens) @@ -94,7 +94,7 @@ _ false)]))) (template [<query> <assertion> <tag> <type> <eq>] - [(`` (def: #export <query> + [(`` (def: .public <query> {#.doc (doc (~~ (template.text ["Queries for a " <query> " synthesis node."])))} (Parser <type>) (.function (_ input) @@ -105,7 +105,7 @@ _ (exception.except ..cannot_parse input))))) - (`` (def: #export (<assertion> expected) + (`` (def: .public (<assertion> expected) {#.doc (doc (~~ (template.text ["Checks for a specific " <query> " synthesis node."])))} (-> <type> (Parser Any)) (.function (_ input) @@ -127,7 +127,7 @@ [constant constant! /.constant Name name.equivalence] ) -(def: #export (tuple parser) +(def: .public (tuple parser) {#.doc (doc "Parses the contents of a tuple.")} (All [a] (-> (Parser a) (Parser a))) (.function (_ input) @@ -140,7 +140,7 @@ _ (exception.except ..cannot_parse input)))) -(def: #export (function expected parser) +(def: .public (function expected parser) {#.doc (doc "Parses the body of a function with the 'expected' arity.")} (All [a] (-> Arity (Parser a) (Parser [(Environment Synthesis) a]))) (.function (_ input) @@ -155,7 +155,7 @@ _ (exception.except ..cannot_parse input)))) -(def: #export (loop init_parsers iteration_parser) +(def: .public (loop init_parsers iteration_parser) {#.doc (doc "Parses the initial values and the body of a loop.")} (All [a b] (-> (Parser a) (Parser b) (Parser [Register a b]))) (.function (_ input) diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index fcabe68ab..f593f311f 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- or and not) + [lux (#- or and not local) [abstract [monad (#+ Monad do)]] [control @@ -20,7 +20,7 @@ ["n" nat ("#\." decimal)]]]]] ["." //]) -(type: #export Offset +(type: .public Offset {#.doc (doc "An offset into a block of text.")} Nat) @@ -28,11 +28,11 @@ Offset 0) -(type: #export Parser +(type: .public Parser {#.doc (doc "A parser for text.")} (//.Parser [Offset Text])) -(type: #export Slice +(type: .public Slice {#.doc (doc "A slice of a block of text.")} {#basis Offset #distance Offset}) @@ -41,21 +41,21 @@ (-> Offset Text Text) (|> tape (/.split offset) maybe.assume product.right)) -(exception: #export (unconsumed_input {offset Offset} {tape Text}) +(exception: .public (unconsumed_input {offset Offset} {tape Text}) (exception.report ["Offset" (n\encode offset)] ["Input size" (n\encode (/.size tape))] ["Remaining input" (remaining' offset tape)])) -(exception: #export (expected_to_fail {offset Offset} {tape Text}) +(exception: .public (expected_to_fail {offset Offset} {tape Text}) (exception.report ["Offset" (n\encode offset)] ["Input" (remaining' offset tape)])) -(exception: #export cannot_parse) -(exception: #export cannot_slice) +(exception: .public cannot_parse) +(exception: .public cannot_slice) -(def: #export (run parser input) +(def: .public (run parser input) {#.doc (doc "Executes a parser against a block of text." "Verifies that the entire input has been processed.")} (All [a] (-> (Parser a) Text (Try a))) @@ -68,7 +68,7 @@ (#try.Success output) (exception.except ..unconsumed_input [end_offset input])))) -(def: #export offset +(def: .public offset {#.doc (doc "Yields the current offset into the input.")} (Parser Offset) (function (_ (^@ input [offset tape])) @@ -86,7 +86,7 @@ #distance 0} slices)))) -(def: #export any +(def: .public any {#.doc "Yields the next character without applying any logic."} (Parser Text) (function (_ [offset tape]) @@ -97,7 +97,7 @@ _ (exception.except ..cannot_parse [])))) -(def: #export any! +(def: .public any! {#.doc "Yields the next character (as a slice) without applying any logic."} (Parser Slice) (function (_ [offset tape]) @@ -111,7 +111,7 @@ (exception.except ..cannot_slice [])))) (template [<name> <type> <any> <caveat>] - [(`` (def: #export (<name> parser) + [(`` (def: .public (<name> parser) {#.doc (doc (~~ (template.text ["Produce a character" <caveat> " if the parser fails."])))} (All [a] (-> (Parser a) (Parser <type>))) (function (_ input) @@ -126,11 +126,11 @@ [not! Slice ..any! " (as a slice)"] ) -(exception: #export (cannot_match {reference Text}) +(exception: .public (cannot_match {reference Text}) (exception.report ["Reference" (/.format reference)])) -(def: #export (this reference) +(def: .public (this reference) {#.doc (doc "Checks that a specific text shows up in the input.")} (-> Text (Parser Any)) (function (_ [offset tape]) @@ -144,7 +144,7 @@ _ (exception.except ..cannot_match [reference])))) -(def: #export end! +(def: .public end! {#.doc "Ensure the parser's input is empty."} (Parser Any) (function (_ (^@ input [offset tape])) @@ -152,7 +152,7 @@ (#try.Success [input []]) (exception.except ..unconsumed_input input)))) -(def: #export peek +(def: .public peek {#.doc "Yields the next character (without consuming it from the input)."} (Parser Text) (function (_ (^@ input [offset tape])) @@ -163,13 +163,13 @@ _ (exception.except ..cannot_parse [])))) -(def: #export remaining +(def: .public remaining {#.doc "Get all of the remaining input (without consuming it)."} (Parser Text) (function (_ (^@ input [offset tape])) (#try.Success [input (remaining' offset tape)]))) -(def: #export (range bottom top) +(def: .public (range bottom top) {#.doc "Only yields characters within a range."} (-> Nat Nat (Parser Text)) (do //.monad @@ -181,7 +181,7 @@ (in char))) (template [<name> <bottom> <top> <desc>] - [(def: #export <name> + [(def: .public <name> {#.doc (code.text ($_ /\compose "Only yields " <desc> " characters."))} (Parser Text) (..range (char <bottom>) (char <top>)))] @@ -192,17 +192,17 @@ [octal "0" "7" "octal"] ) -(def: #export alpha +(def: .public alpha {#.doc "Yields alphabetic characters."} (Parser Text) (//.either lower upper)) -(def: #export alpha_num +(def: .public alpha_num {#.doc "Yields alphanumeric characters."} (Parser Text) (//.either alpha decimal)) -(def: #export hexadecimal +(def: .public hexadecimal {#.doc "Yields hexadecimal digits."} (Parser Text) ($_ //.either @@ -211,7 +211,7 @@ (range (char "A") (char "F")))) (template [<name>] - [(exception: #export (<name> {options Text} {character Char}) + [(exception: .public (<name> {options Text} {character Char}) (exception.report ["Options" (/.format options)] ["Character" (/.format (/.of_char character))]))] @@ -221,7 +221,7 @@ ) (template [<name> <modifier> <exception> <description_modifier>] - [(def: #export (<name> options) + [(def: .public (<name> options) {#.doc (code.text ($_ /\compose "Yields characters that are" <description_modifier> " part of a piece of text."))} (-> Text (Parser Text)) (function (_ [offset tape]) @@ -240,7 +240,7 @@ ) (template [<name> <modifier> <exception> <description_modifier>] - [(def: #export (<name> options) + [(def: .public (<name> options) {#.doc (code.text ($_ /\compose "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))} (-> Text (Parser Slice)) (function (_ [offset tape]) @@ -260,11 +260,11 @@ [none_of! .not ..character_should_not_be " not"] ) -(exception: #export (character_does_not_satisfy_predicate {character Char}) +(exception: .public (character_does_not_satisfy_predicate {character Char}) (exception.report ["Character" (/.format (/.of_char character))])) -(def: #export (satisfies parser) +(def: .public (satisfies parser) {#.doc "Yields characters that satisfy a predicate."} (-> (-> Char Bit) (Parser Text)) (function (_ [offset tape]) @@ -277,12 +277,12 @@ _ (exception.except ..cannot_parse [])))) -(def: #export space +(def: .public space {#.doc "Yields white-space."} (Parser Text) (..satisfies /.space?)) -(def: #export (and left right) +(def: .public (and left right) {#.doc (doc "Yields the outputs of both parsers composed together.")} (-> (Parser Text) (Parser Text) (Parser Text)) (do //.monad @@ -290,7 +290,7 @@ =right right] (in ($_ /\compose =left =right)))) -(def: #export (and! left right) +(def: .public (and! left right) {#.doc (doc "Yields the outputs of both parsers composed together (as a slice).")} (-> (Parser Slice) (Parser Slice) (Parser Slice)) (do //.monad @@ -299,7 +299,7 @@ (in [left::basis ("lux i64 +" left::distance right::distance)]))) (template [<name> <base> <doc_modifier>] - [(def: #export (<name> parser) + [(def: .public (<name> parser) {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " characters as a single continuous text (as a slice)."))} (-> (Parser Text) (Parser Text)) (|> parser <base> (\ //.monad map /.concat)))] @@ -309,7 +309,7 @@ ) (template [<name> <base> <doc_modifier>] - [(def: #export (<name> parser) + [(def: .public (<name> parser) {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " characters as a single continuous text (as a slice)."))} (-> (Parser Slice) (Parser Slice)) (with_slices (<base> parser)))] @@ -319,7 +319,7 @@ ) (template [<name> <base> <doc_modifier>] - [(def: #export (<name> amount parser) + [(def: .public (<name> amount parser) {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))} (-> Nat (Parser Text) (Parser Text)) (|> parser @@ -332,7 +332,7 @@ ) (template [<name> <base> <doc_modifier>] - [(def: #export (<name> amount parser) + [(def: .public (<name> amount parser) {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))} (-> Nat (Parser Slice) (Parser Slice)) (with_slices @@ -343,24 +343,24 @@ [at_least! //.at_least "at least"] ) -(def: #export (between minimum additional parser) +(def: .public (between minimum additional parser) (-> Nat Nat (Parser Text) (Parser Text)) (|> parser (//.between minimum additional) (\ //.monad map /.concat))) -(def: #export (between! minimum additional parser) +(def: .public (between! minimum additional parser) (-> Nat Nat (Parser Slice) (Parser Slice)) (with_slices (//.between minimum additional parser))) -(def: #export (enclosed [start end] parser) +(def: .public (enclosed [start end] parser) (All [a] (-> [Text Text] (Parser a) (Parser a))) (|> parser (//.before (this end)) (//.after (this start)))) -(def: #export (local local_input parser) +(def: .public (local local_input parser) {#.doc "Applies a parser against the given input."} (All [a] (-> Text (Parser a) (Parser a))) (function (_ real_input) @@ -371,7 +371,7 @@ (#try.Success value) (#try.Success [real_input value])))) -(def: #export (slice parser) +(def: .public (slice parser) {#.doc (doc "Converts a slice to a block of text.")} (-> (Parser Slice) (Parser Text)) (do //.monad @@ -384,7 +384,7 @@ #.None (exception.except ..cannot_slice []))))) -(def: #export (then structured text) +(def: .public (then structured text) {#.doc (doc "Embeds a text parser into an arbitrary parser that yields text.")} (All [s a] (-> (Parser a) diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index ad2015624..6daf1129e 100644 --- a/stdlib/source/library/lux/control/parser/tree.lux +++ b/stdlib/source/library/lux/control/parser/tree.lux @@ -12,32 +12,32 @@ ["." zipper (#+ Zipper)]]]]]] ["." //]) -(type: #export (Parser t a) +(type: .public (Parser t a) {#.doc (doc "A parser of arbitrary trees.")} (//.Parser (Zipper t) a)) -(def: #export (run' parser zipper) +(def: .public (run' parser zipper) {#.doc (doc "Applies the parser against a tree zipper.")} (All [t a] (-> (Parser t a) (Zipper t) (Try a))) (do try.monad [[zipper output] (//.run parser zipper)] (in output))) -(def: #export (run parser tree) +(def: .public (run parser tree) {#.doc (doc "Applies the parser against a tree.")} (All [t a] (-> (Parser t a) (Tree t) (Try a))) (run' parser (zipper.zipper tree))) -(def: #export value +(def: .public value {#.doc (doc "Yields the value inside the current tree node.")} (All [t] (Parser t t)) (function (_ zipper) (#try.Success [zipper (zipper.value zipper)]))) -(exception: #export cannot_move_further) +(exception: .public cannot_move_further) (template [<name> <direction> <doc>] - [(def: #export <name> + [(def: .public <name> {#.doc (doc <doc>)} (All [t] (Parser t [])) (function (_ zipper) diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index 0e07c633c..6e5c0f005 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -2,7 +2,7 @@ {#.doc (.doc "Parsing of Lux types." "Used mostly for polytypic programming.")} [library - [lux (#- function) + [lux (#- function local) [abstract ["." monad (#+ do)]] [control @@ -26,7 +26,7 @@ ["." //]) (template [<name>] - [(exception: #export (<name> {type Type}) + [(exception: .public (<name> {type Type}) (exception.report ["Type" (%.type type)]))] @@ -43,7 +43,7 @@ ) (template [<name>] - [(exception: #export (<name> {expected Type} {actual Type}) + [(exception: .public (<name> {expected Type} {actual Type}) (exception.report ["Expected" (%.type expected)] ["Actual" (%.type actual)]))] @@ -52,23 +52,23 @@ [wrong_parameter] ) -(exception: #export empty_input) +(exception: .public empty_input) -(exception: #export (unconsumed_input {remaining (List Type)}) +(exception: .public (unconsumed_input {remaining (List Type)}) (exception.report ["Types" (|> remaining (list\map (|>> %.type (format text.new_line "* "))) (text.join_with ""))])) -(type: #export Env +(type: .public Env {#.doc (doc "An environment for type parsing.")} (Dictionary Nat [Type Code])) -(type: #export (Parser a) +(type: .public (Parser a) {#.doc (doc "A parser of Lux types.")} (//.Parser [Env (List Type)] a)) -(def: #export fresh +(def: .public fresh {#.doc (doc "An empty parsing environment.")} Env (dictionary.empty n.hash)) @@ -87,13 +87,13 @@ _ (exception.except ..unconsumed_input remaining)))) -(def: #export (run poly type) +(def: .public (run poly type) {#.doc (doc "Applies a parser against a type." "Verifies that the parser fully consumes the type's information.")} (All [a] (-> (Parser a) Type (Try a))) (run' ..fresh poly (list type))) -(def: #export env +(def: .public env {#.doc (doc "Yields the current parsing environment.")} (Parser Env) (.function (_ [env inputs]) @@ -109,7 +109,7 @@ (#try.Success [[_ remaining] output]) (#try.Success [[env remaining] output])))) -(def: #export peek +(def: .public peek {#.doc (doc "Inspect a type in the input stream without consuming it.")} (Parser Type) (.function (_ [env inputs]) @@ -120,7 +120,7 @@ (#.Item headT tail) (#try.Success [[env inputs] headT])))) -(def: #export any +(def: .public any {#.doc (doc "Yields a type, without examination.")} (Parser Type) (.function (_ [env inputs]) @@ -131,7 +131,7 @@ (#.Item headT tail) (#try.Success [[env tail] headT])))) -(def: #export (local types poly) +(def: .public (local types poly) {#.doc (doc "Apply a parser to the given inputs.")} (All [a] (-> (List Type) (Parser a) (Parser a))) (.function (_ [env pass_through]) @@ -146,7 +146,7 @@ (-> Nat Code) (code.local_identifier ($_ text\compose "label" text.tab (n\encode idx)))) -(def: #export (with_extension type poly) +(def: .public (with_extension type poly) (All [a] (-> Type (Parser a) (Parser [Code a]))) (.function (_ [env inputs]) (let [current_id (dictionary.size env) @@ -161,7 +161,7 @@ (#try.Success [[env inputs'] [g!var output]]))))) (template [<name> <flattener> <tag> <exception>] - [(`` (def: #export (<name> poly) + [(`` (def: .public (<name> poly) {#.doc (doc (~~ (template.text ["Parses the contents of a " <name> " type."])))} (All [a] (-> (Parser a) (Parser a))) (do //.monad @@ -184,7 +184,7 @@ (//.failure (exception.error ..not_polymorphic headT)) (in [num_arg bodyT])))) -(def: #export (polymorphic poly) +(def: .public (polymorphic poly) (All [a] (-> (Parser a) (Parser [Code (List Code) a]))) (do {! //.monad} [headT any @@ -221,7 +221,7 @@ [output poly] (in [funcL all_varsL output]))))) -(def: #export (function in_poly out_poly) +(def: .public (function in_poly out_poly) {#.doc (doc "Parses a function's inputs and output.")} (All [i o] (-> (Parser i) (Parser o) (Parser [i o]))) (do //.monad @@ -232,7 +232,7 @@ (local (list outputT) out_poly)) (//.failure (exception.error ..not_function headT))))) -(def: #export (applied poly) +(def: .public (applied poly) {#.doc (doc "Parses a type application.")} (All [a] (-> (Parser a) (Parser a))) (do //.monad @@ -243,7 +243,7 @@ (..local (#.Item funcT paramsT) poly)))) (template [<name> <test> <doc>] - [(def: #export (<name> expected) + [(def: .public (<name> expected) {#.doc (doc <doc>)} (-> Type (Parser Any)) (do //.monad @@ -260,14 +260,14 @@ "Parses a super type."] ) -(def: #export (adjusted_idx env idx) +(def: .public (adjusted_idx env idx) (-> Env Nat Nat) (let [env_level (n./ 2 (dictionary.size env)) parameter_level (n./ 2 idx) parameter_idx (n.% 2 idx)] (|> env_level dec (n.- parameter_level) (n.* 2) (n.+ parameter_idx)))) -(def: #export parameter +(def: .public parameter (Parser Code) (do //.monad [env ..env @@ -284,7 +284,7 @@ _ (//.failure (exception.error ..not_parameter headT))))) -(def: #export (parameter! id) +(def: .public (parameter! id) (-> Nat (Parser Any)) (do //.monad [env ..env @@ -298,7 +298,7 @@ _ (//.failure (exception.error ..not_parameter headT))))) -(def: #export existential +(def: .public existential {#.doc (doc "Yields an existential type.")} (Parser Nat) (do //.monad @@ -310,7 +310,7 @@ _ (//.failure (exception.error ..not_existential headT))))) -(def: #export named +(def: .public named {#.doc (doc "Yields a named type.")} (Parser [Name Type]) (do //.monad @@ -323,11 +323,11 @@ (//.failure (exception.error ..not_named inputT))))) (`` (template: (|nothing|) - (#.Named [(~~ (static .prelude_module)) "Nothing"] - (#.UnivQ #.End - (#.Parameter 1))))) + [(#.Named [(~~ (static .prelude_module)) "Nothing"] + (#.UnivQ #.End + (#.Parameter 1)))])) -(def: #export (recursive poly) +(def: .public (recursive poly) (All [a] (-> (Parser a) (Parser [Code a]))) (do {! //.monad} [headT any] @@ -343,7 +343,7 @@ _ (//.failure (exception.error ..not_recursive headT))))) -(def: #export recursive_self +(def: .public recursive_self (Parser Code) (do //.monad [env ..env @@ -357,7 +357,7 @@ _ (//.failure (exception.error ..not_recursive headT))))) -(def: #export recursive_call +(def: .public recursive_call (Parser Code) (do {! //.monad} [env ..env diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index 91fd7e67c..14072c73c 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -17,24 +17,24 @@ ["/" xml (#+ Attribute Attrs Tag XML)]]]]] ["." //]) -(type: #export (Parser a) +(type: .public (Parser a) {#.doc (doc "A parser of XML-encoded data.")} (//.Parser [Attrs (List XML)] a)) -(exception: #export empty_input) -(exception: #export unexpected_input) +(exception: .public empty_input) +(exception: .public unexpected_input) -(exception: #export (wrong_tag {expected Tag} {actual Tag}) +(exception: .public (wrong_tag {expected Tag} {actual Tag}) (exception.report ["Expected" (%.text (/.tag expected))] ["Actual" (%.text (/.tag actual))])) -(exception: #export (unknown_attribute {expected Attribute} {available (List Attribute)}) +(exception: .public (unknown_attribute {expected Attribute} {available (List Attribute)}) (exception.report ["Expected" (%.text (/.attribute expected))] ["Available" (exception.listing (|>> /.attribute %.text) available)])) -(exception: #export (unconsumed_inputs {inputs (List XML)}) +(exception: .public (unconsumed_inputs {inputs (List XML)}) (exception.report ["Inputs" (exception.listing (\ /.codec encode) inputs)])) @@ -49,13 +49,13 @@ (#try.Failure error) (#try.Failure error))) -(def: #export (run parser documents) +(def: .public (run parser documents) {#.doc (doc "Applies a parser against a stream of XML documents." "Verifies that all of the inputs are consumed by the parser.")} (All [a] (-> (Parser a) (List XML) (Try a))) (..run' parser /.attributes documents)) -(def: #export text +(def: .public text {#.doc (doc "Yields text from a text node.")} (Parser Text) (function (_ [attrs documents]) @@ -71,7 +71,7 @@ (#/.Node _) (exception.except ..unexpected_input []))))) -(def: #export tag +(def: .public tag {#.doc (doc "Yields the tag from the next node.")} (Parser Tag) (function (_ [attrs documents]) @@ -87,7 +87,7 @@ (#/.Node tag _ _) (#try.Success [[attrs documents] tag]))))) -(def: #export (attribute name) +(def: .public (attribute name) {#.doc (doc "Yields the value of an attribute in the current node.")} (-> Attribute (Parser Text)) (function (_ [attrs documents]) @@ -98,7 +98,7 @@ (#.Some value) (#try.Success [[attrs documents] value])))) -(def: #export (node expected parser) +(def: .public (node expected parser) {#.doc (doc "Parses the contents of the next node if the tag matches.")} (All [a] (-> Tag (Parser a) (Parser a))) (function (_ [attrs documents]) @@ -118,7 +118,7 @@ (try\map (|>> [[attrs tail]]))) (exception.except ..wrong_tag [expected actual])))))) -(def: #export ignore +(def: .public ignore {#.doc (doc "Skips the next node.")} (Parser Any) (function (_ [attrs documents]) @@ -129,9 +129,9 @@ (#.Item head tail) (#try.Success [[attrs tail] []])))) -(exception: #export nowhere) +(exception: .public nowhere) -(def: #export (somewhere parser) +(def: .public (somewhere parser) {#.doc (doc "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs.")} (All [a] (-> (Parser a) (Parser a))) (function (recur [attrs input]) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index 8f36f8a41..7e551f43c 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -24,7 +24,7 @@ (Parser (List Code)) (s.tuple (p.some s.any))) -(syntax: #export (new> start +(syntax: .public (new> start {body body^} prev) {#.doc (doc "Ignores the piped argument, and begins a new pipe." @@ -35,7 +35,7 @@ (new> 0 [inc]))))} (in (list (` (|> (~ start) (~+ body)))))) -(syntax: #export (let> binding body prev) +(syntax: .public (let> binding body prev) {#.doc (doc "Gives a name to the piped-argument, within the given expression." (n.= 10 (|> 5 @@ -48,7 +48,7 @@ (function (_ tokens) (#e.Success [(list.reversed tokens) []]))) -(syntax: #export (cond> {_ _reversed_} +(syntax: .public (cond> {_ _reversed_} prev {else body^} {_ _reversed_} @@ -67,7 +67,7 @@ (` (|> (~ g!temp) (~+ then)))))) (|> (~ g!temp) (~+ else))))))))) -(syntax: #export (if> {test body^} {then body^} {else body^} prev) +(syntax: .public (if> {test body^} {then body^} {else body^} prev) {#.doc (doc "If-branching." (is? (if (n.even? sample) "even" @@ -80,7 +80,7 @@ [(~+ else)] (~ prev)))))) -(syntax: #export (when> {test body^} {then body^} prev) +(syntax: .public (when> {test body^} {then body^} prev) {#.doc (doc "Only execute the body when the test passes." (is? (if (n.even? sample) (n.* 2 sample) @@ -92,7 +92,7 @@ [] (~ prev)))))) -(syntax: #export (loop> {test body^} +(syntax: .public (loop> {test body^} {then body^} prev) {#.doc (doc "Loops for pipes." @@ -106,7 +106,7 @@ ((~' recur) (|> (~ g!temp) (~+ then))) (~ g!temp)))))))) -(syntax: #export (do> monad +(syntax: .public (do> monad {steps (p.some body^)} prev) {#.doc (doc "Monadic pipes." @@ -130,7 +130,7 @@ _ (in (list prev))))) -(syntax: #export (exec> {body body^} +(syntax: .public (exec> {body body^} prev) {#.doc (doc "Non-updating pipes." "Will generate piped computations, but their results will not be used in the larger scope." @@ -142,7 +142,7 @@ (exec (|> (~ g!temp) (~+ body)) (~ g!temp)))))))) -(syntax: #export (tuple> {paths (p.many body^)} +(syntax: .public (tuple> {paths (p.many body^)} prev) {#.doc (doc "Parallel branching for pipes." "Allows to run multiple pipelines for a value and gives you a tuple of the outputs." @@ -156,7 +156,7 @@ [(~+ (list\map (function (_ body) (` (|> (~ g!temp) (~+ body)))) paths))])))))) -(syntax: #export (case> {branches (p.many (p.and s.any s.any))} +(syntax: .public (case> {branches (p.many (p.and s.any s.any))} prev) {#.doc (doc "Pattern-matching for pipes." "The bodies of each branch are NOT pipes; just regular values." diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux index 8c46ef9a8..947c18b21 100644 --- a/stdlib/source/library/lux/control/reader.lux +++ b/stdlib/source/library/lux/control/reader.lux @@ -1,38 +1,38 @@ (.module: [library - [lux #* + [lux (#- local) [abstract [apply (#+ Apply)] ["." functor (#+ Functor)] ["." monad (#+ Monad do)]]]]) -(type: #export (Reader r a) +(type: .public (Reader r a) {#.doc "Computations that have access to some environmental value."} (-> r a)) -(def: #export ask +(def: .public ask {#.doc "Get the environment."} (All [r] (Reader r r)) (function (_ env) env)) -(def: #export (local change proc) +(def: .public (local change proc) {#.doc "Run computation with a locally-modified environment."} (All [r a] (-> (-> r r) (Reader r a) (Reader r a))) (|>> change proc)) -(def: #export (run env proc) +(def: .public (run env proc) {#.doc (doc "Executes the reader against the given environment.")} (All [r a] (-> r (Reader r a) a)) (proc env)) -(implementation: #export functor +(implementation: .public functor (All [r] (Functor (Reader r))) (def: (map f fa) (function (_ env) (f (fa env))))) -(implementation: #export apply +(implementation: .public apply (All [r] (Apply (Reader r))) (def: &functor ..functor) @@ -41,7 +41,7 @@ (function (_ env) ((ff env) (fa env))))) -(implementation: #export monad +(implementation: .public monad (All [r] (Monad (Reader r))) (def: &functor ..functor) @@ -53,7 +53,7 @@ (function (_ env) (mma env env)))) -(implementation: #export (with monad) +(implementation: .public (with monad) {#.doc "Monad transformer for Reader."} (All [M] (-> (Monad M) (All [e] (Monad (All [a] (Reader e (M a))))))) @@ -67,7 +67,7 @@ [eMa (run env eMeMa)] (run env eMa))))) -(def: #export lift +(def: .public lift {#.doc "Lift monadic values to the Reader wrapper."} (All [M e a] (-> (M a) (Reader e (M a)))) (\ ..monad in)) diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux index 6911ef015..daf4b33d3 100644 --- a/stdlib/source/library/lux/control/region.lux +++ b/stdlib/source/library/lux/control/region.lux @@ -18,7 +18,7 @@ (type: (Cleaner r !) (-> r (! (Try Any)))) -(type: #export (Region r ! a) +(type: .public (Region r ! a) {#.doc (doc "A region where resources may be be claimed and where a side-effecting computation may be performed." "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks.")} (-> [r (List (Cleaner r !))] @@ -33,7 +33,7 @@ "-----------------------------------------" text.new_line text.new_line)) -(exception: #export [a] (clean_up_error {error Text} +(exception: .public [a] (clean_up_error {error Text} {output (Try a)}) (format error (case output @@ -53,7 +53,7 @@ (#try.Failure error) (exception.except ..clean_up_error [error output]))) -(def: #export (run monad computation) +(def: .public (run monad computation) {#.doc (doc "Executes a region-based computation, with a side-effect determined by the monad.")} (All [! a] (-> (Monad !) (All [r] (Region r ! a)) @@ -64,7 +64,7 @@ (monad.map ! (function (_ cleaner) (cleaner []))) (\ ! map (list\fold clean output))))) -(def: #export (acquire monad cleaner value) +(def: .public (acquire monad cleaner value) {#.doc (doc "Acquire a resource while pairing it a function that knows how to reclaim it.")} (All [! a] (-> (Monad !) (-> a (! (Try Any))) a (All [r] (Region r ! a)))) @@ -73,7 +73,7 @@ cleaners) (#try.Success value)]))) -(implementation: #export (functor super) +(implementation: .public (functor super) (All [!] (-> (Functor !) (All [r] (Functor (Region r !))))) @@ -91,7 +91,7 @@ (#try.Failure error))]) (fa region+cleaners)))))) -(implementation: #export (apply super) +(implementation: .public (apply super) (All [!] (-> (Monad !) (All [r] (Apply (Region r !))))) @@ -116,7 +116,7 @@ (#try.Failure error) (in [cleaners (#try.Failure error)])))))) -(implementation: #export (monad super) +(implementation: .public (monad super) (All [!] (-> (Monad !) (All [r] (Monad (Region r !))))) @@ -139,7 +139,7 @@ (#try.Failure error) (in [cleaners (#try.Failure error)])))))) -(def: #export (failure monad error) +(def: .public (failure monad error) {#.doc (doc "Immediately fail with this 'message'.")} (All [! a] (-> (Monad !) Text @@ -147,14 +147,14 @@ (function (_ [region cleaners]) (\ monad in [cleaners (#try.Failure error)]))) -(def: #export (except monad exception message) +(def: .public (except monad exception message) {#.doc (doc "Fail by throwing/raising an exception.")} (All [! e a] (-> (Monad !) (Exception e) e (All [r] (Region r ! a)))) (failure monad (exception.error exception message))) -(def: #export (lift monad operation) +(def: .public (lift monad operation) {#.doc (doc "Lift an effectful computation into a region-based computation.")} (All [! a] (-> (Monad !) (! a) diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index 48a7e8abf..44289b3cb 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -21,7 +21,7 @@ ["." template] [syntax (#+ syntax:)]]]]) -(exception: #export (must_remember {deadline Date} {today Date} {message Text} {focus (Maybe Code)}) +(exception: .public (must_remember {deadline Date} {today Date} {message Text} {focus (Maybe Code)}) (exception.report ["Deadline" (%.date deadline)] ["Today" (%.date today)] @@ -47,7 +47,7 @@ (#try.Failure message) (<>.failure message))))) -(syntax: #export (remember {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)}) +(syntax: .public (remember {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)}) {#.doc (doc "A message with an expiration date." "Can have an optional piece of code to focus on." (remember "2022-04-01" @@ -67,7 +67,7 @@ (meta.failure (exception.error ..must_remember [deadline today message focus]))))) (template [<name> <message>] - [(`` (syntax: #export (<name> {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)}) + [(`` (syntax: .public (<name> {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)}) {#.doc (doc (~~ (template.text ["A " <message> " message with an expiration date."])) "Can have an optional piece of code to focus on." (<name> "2022-04-01" diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index b58468911..4834e172c 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -24,19 +24,19 @@ ["|.|" declaration] ["|.|" annotations]]]]]) -(abstract: #export (Capability brand input output) - (-> input output) - +(abstract: .public (Capability brand input output) {#.doc (doc "Represents the capability to perform an operation." "This operation is assumed to have security implications.")} + (-> input output) + (def: forge (All [brand input output] (-> (-> input output) (Capability brand input output))) (|>> :abstraction)) - (def: #export (use capability input) + (def: .public (use capability input) {#.doc (doc "Applies a capability against its required input.")} (All [brand input output] (-> (Capability brand input output) @@ -44,7 +44,7 @@ output)) ((:representation capability) input)) - (syntax: #export (capability: {export |export|.parser} + (syntax: .public (capability: {export |export|.parser} {declaration |declaration|.parser} {annotations (<>.maybe |annotations|.parser)} {[forge input output] (<c>.form ($_ <>.and <c>.local_identifier <c>.any <c>.any))}) @@ -74,7 +74,7 @@ (~! ..forge))) )))) - (def: #export (async capability) + (def: .public (async capability) {#.doc (doc "Converts a synchronous I/O-based capability into an asynchronous capability.")} (All [brand input output] (-> (Capability brand input (IO output)) diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index dc5a07e0d..32bf06c38 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -8,38 +8,38 @@ [type abstract]]]) -(abstract: #export (Policy brand value label) - value - +(abstract: .public (Policy brand value label) {#.doc (doc "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.")} - (type: #export (Can_Upgrade brand label value) + value + + (type: .public (Can_Upgrade brand label value) {#.doc (doc "Represents the capacity to 'upgrade' a value.")} (-> value (Policy brand value label))) - (type: #export (Can_Downgrade brand label value) + (type: .public (Can_Downgrade brand label value) {#.doc (doc "Represents the capacity to 'downgrade' a value.")} (-> (Policy brand value label) value)) - (type: #export (Privilege brand label) + (type: .public (Privilege brand label) {#.doc (doc "Represents the privilege to both 'upgrade' and 'downgrade' a value.")} {#can_upgrade (Can_Upgrade brand label) #can_downgrade (Can_Downgrade brand label)}) - (type: #export (Delegation brand from to) + (type: .public (Delegation brand from to) {#.doc (doc "Represents the act of delegating policy capacities.")} (All [value] (-> (Policy brand value from) (Policy brand value to)))) - (def: #export (delegation downgrade upgrade) + (def: .public (delegation downgrade upgrade) {#.doc (doc "Delegating policy capacities.")} (All [brand from to] (-> (Can_Downgrade brand from) (Can_Upgrade brand to) (Delegation brand from to))) (|>> downgrade upgrade)) - (type: #export (Context brand scope label) + (type: .public (Context brand scope label) {#.doc (doc "A computational context with an associated policy privilege.")} (-> (Privilege brand label) (scope label))) @@ -49,7 +49,7 @@ {#can_upgrade (|>> :abstraction) #can_downgrade (|>> :representation)}) - (def: #export (with_policy context) + (def: .public (with_policy context) {#.doc (doc "Activates a security context with the priviledge to enforce it's policy." (type: Password @@ -82,13 +82,13 @@ (type (All [brand label] (constructor (All [value] (Policy brand value label)))))) - (implementation: #export functor + (implementation: .public functor (:~ (..of_policy Functor)) (def: (map f fa) (|> fa :representation f :abstraction))) - (implementation: #export apply + (implementation: .public apply (:~ (..of_policy Apply)) (def: &functor ..functor) @@ -96,7 +96,7 @@ (def: (apply ff fa) (:abstraction ((:representation ff) (:representation fa))))) - (implementation: #export monad + (implementation: .public monad (:~ (..of_policy Monad)) (def: &functor ..functor) @@ -105,18 +105,18 @@ ) (template [<brand> <value> <upgrade> <downgrade> <doc>] - [(abstract: #export <brand> - Any - + [(abstract: .public <brand> {#.doc <doc>} - (type: #export <value> + Any + + (type: .public <value> (Policy <brand>)) - (type: #export <upgrade> + (type: .public <upgrade> (Can_Upgrade <brand>)) - (type: #export <downgrade> + (type: .public <downgrade> (Can_Downgrade <brand>)) )] diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux index ec576f9cd..5021d293d 100644 --- a/stdlib/source/library/lux/control/state.lux +++ b/stdlib/source/library/lux/control/state.lux @@ -1,52 +1,52 @@ (.module: [library - [lux #* + [lux (#- local) [abstract [functor (#+ Functor)] [apply (#+ Apply)] [monad (#+ Monad do)]]]]) -(type: #export (State s a) +(type: .public (State s a) {#.doc "Stateful computations."} (-> s [s a])) -(def: #export get +(def: .public get {#.doc "Read the current state."} (All [s] (State s s)) (function (_ state) [state state])) -(def: #export (put new_state) +(def: .public (put new_state) {#.doc "Set the new state."} (All [s] (-> s (State s Any))) (function (_ state) [new_state []])) -(def: #export (update change) +(def: .public (update change) {#.doc "Compute the new state."} (All [s] (-> (-> s s) (State s Any))) (function (_ state) [(change state) []])) -(def: #export (use user) +(def: .public (use user) {#.doc "Run a function on the current state."} (All [s a] (-> (-> s a) (State s a))) (function (_ state) [state (user state)])) -(def: #export (local change action) +(def: .public (local change action) {#.doc "Run the computation with a locally-modified state."} (All [s a] (-> (-> s s) (State s a) (State s a))) (function (_ state) (let [[state' output] (action (change state))] [state output]))) -(def: #export (run state action) +(def: .public (run state action) {#.doc "Run a stateful computation."} (All [s a] (-> s (State s a) [s a])) (action state)) -(implementation: #export functor +(implementation: .public functor (All [s] (Functor (State s))) (def: (map f ma) @@ -54,7 +54,7 @@ (let [[state' a] (ma state)] [state' (f a)])))) -(implementation: #export apply +(implementation: .public apply (All [s] (Apply (State s))) (def: &functor ..functor) @@ -65,7 +65,7 @@ [state'' a] (fa state')] [state'' (f a)])))) -(implementation: #export monad +(implementation: .public monad (All [s] (Monad (State s))) (def: &functor ..functor) @@ -79,7 +79,7 @@ (let [[state' ma] (mma state)] (ma state'))))) -(def: #export (while condition body) +(def: .public (while condition body) {#.doc (doc "A stateful while loop.")} (All [s] (-> (State s Bit) (State s Any) (State s Any))) (do {! ..monad} @@ -90,7 +90,7 @@ (while condition body)) (in [])))) -(def: #export (do_while condition body) +(def: .public (do_while condition body) {#.doc (doc "A stateful do-while loop.")} (All [s] (-> (State s Bit) (State s Any) (State s Any))) (do ..monad @@ -117,16 +117,16 @@ [state a] (sFa state)] (in [state (f a)]))))) -(type: #export (+State M s a) +(type: .public (+State M s a) {#.doc "Stateful computations decorated by a monad."} (-> s (M [s a]))) -(def: #export (run' state action) +(def: .public (run' state action) {#.doc "Execute a stateful computation decorated by a monad."} (All [M s a] (-> s (+State M s a) (M [s a]))) (action state)) -(implementation: #export (with monad) +(implementation: .public (with monad) {#.doc "A monad transformer to create composite stateful computations."} (All [M s] (-> (Monad M) (Monad (+State M s)))) @@ -142,7 +142,7 @@ [[state' sMa] (sMsMa state)] (sMa state'))))) -(def: #export (lift monad ma) +(def: .public (lift monad ma) {#.doc "Lift monadic values to the +State wrapper."} (All [M s a] (-> (Monad M) (M a) (+State M s a))) (function (_ state) diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index b528d22aa..8b6323863 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -14,16 +14,16 @@ [type abstract]]]) -(type: #export (Thread ! a) +(type: .public (Thread ! a) {#.doc (doc "An imperative process with access to mutable values.")} (-> ! a)) -(abstract: #export (Box t v) - (Array v) - +(abstract: .public (Box t v) {#.doc "A mutable box holding a value."} - (def: #export (box init) + (Array v) + + (def: .public (box init) {#.doc (doc "A brand-new box initialized to the given value.")} (All [a] (-> a (All [!] (Thread ! (Box ! a))))) (function (_ !) @@ -31,7 +31,7 @@ (array.write! 0 init) :abstraction))) - (def: #export (read box) + (def: .public (read box) {#.doc (doc "Reads the current value in the box.")} (All [! a] (-> (Box ! a) (Thread ! a))) (function (_ !) @@ -53,28 +53,28 @@ @.php ("php array read" 0 (:representation box)) @.scheme ("scheme array read" 0 (:representation box))}))) - (def: #export (write value box) + (def: .public (write value box) {#.doc (doc "Mutates the value in the box.")} (All [a] (-> a (All [!] (-> (Box ! a) (Thread ! Any))))) (function (_ !) (|> box :representation (array.write! 0 value) :abstraction))) ) -(def: #export (run thread) +(def: .public (run thread) {#.doc (doc "Executes the imperative thread in a self-contained way.")} (All [a] (-> (All [!] (Thread ! a)) a)) (thread [])) -(def: #export io +(def: .public io {#.doc (doc "Transforms the imperative thread into an I/O computation.")} (All [a] (-> (All [!] (Thread ! a)) (IO a))) (|>> ..run io.io)) -(implementation: #export functor +(implementation: .public functor (All [!] (Functor (Thread !))) (def: (map f) @@ -82,7 +82,7 @@ (function (_ !) (f (fa !)))))) -(implementation: #export apply +(implementation: .public apply (All [!] (Apply (Thread !))) (def: &functor ..functor) @@ -91,7 +91,7 @@ (function (_ !) ((ff !) (fa !))))) -(implementation: #export monad +(implementation: .public monad (All [!] (Monad (Thread !))) (def: &functor ..functor) @@ -104,7 +104,7 @@ (function (_ !) ((ffa !) !)))) -(def: #export (update f box) +(def: .public (update f box) {#.doc (doc "Update a box's value by applying a function to it.")} (All [a !] (-> (-> a a) (Box ! a) (Thread ! a))) (do ..monad diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 0226bab08..fa02b452a 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -9,12 +9,12 @@ [meta ["." location]]]]) -(type: #export (Try a) +(type: .public (Try a) {#.doc (doc "A computation that can fail with an error message.")} (#Failure Text) (#Success a)) -(implementation: #export functor +(implementation: .public functor (Functor Try) (def: (map f ma) @@ -25,7 +25,7 @@ (#Success datum) (#Success (f datum))))) -(implementation: #export apply +(implementation: .public apply (Apply Try) (def: &functor ..functor) @@ -43,7 +43,7 @@ (#Failure msg) (#Failure msg)))) -(implementation: #export monad +(implementation: .public monad (Monad Try) (def: &functor ..functor) @@ -59,7 +59,7 @@ (#Success ma) ma))) -(implementation: #export (with monad) +(implementation: .public (with monad) {#.doc (doc "Enhances a monad with error-handling functionality.")} ## TODO: Replace (All [a] (! (Try a))) with (functor.Then ! Try) (All [!] (-> (Monad !) (Monad (All [a] (! (Try a)))))) @@ -81,12 +81,12 @@ (#Success Mea) Mea)))) -(def: #export (lifted monad) +(def: .public (lifted monad) {#.doc (doc "Wraps a monadic value with error-handling machinery.")} (All [! a] (-> (Monad !) (-> (! a) (! (Try a))))) (\ monad map (\ ..monad in))) -(implementation: #export (equivalence (^open "_\.")) +(implementation: .public (equivalence (^open "_\.")) (All [a] (-> (Equivalence a) (Equivalence (Try a)))) (def: (= reference sample) @@ -101,7 +101,7 @@ false ))) -(def: #export (assumed try) +(def: .public (assumed try) {#.doc (doc "Assumes a Try value succeeded, and yields its value." "If it didn't, raises the error as a runtime error." "WARNING: Use with caution.")} @@ -113,7 +113,7 @@ (#Failure message) (error! message))) -(def: #export (maybe try) +(def: .public (maybe try) (All [a] (-> (Try a) (Maybe a))) (case try (#Success value) @@ -122,7 +122,7 @@ (#Failure message) #.None)) -(def: #export (of_maybe maybe) +(def: .public (of_maybe maybe) (All [a] (-> (Maybe a) (Try a))) (case maybe (#.Some value) @@ -132,7 +132,7 @@ (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encode) (name_of ..of_maybe)))))) -(macro: #export (else tokens compiler) +(macro: .public (else tokens compiler) {#.doc (doc "Allows you to provide a default value that will be used" "if a (Try x) value turns out to be #Failure." "Note: the expression for the default value will not be computed if the base computation succeeds." diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index ee5c15ee8..b4ea701cb 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -8,17 +8,17 @@ ["." functor (#+ Functor)] ["." monad (#+ Monad do)]]]]) -(type: #export (Writer l a) +(type: .public (Writer l a) {#.doc "Represents a value with an associated 'log' value to record arbitrary information."} {#log l #value a}) -(def: #export (write l) +(def: .public (write l) {#.doc "Set the log to a particular value."} (All [l] (-> l (Writer l Any))) [l []]) -(implementation: #export functor +(implementation: .public functor (All [l] (Functor (Writer l))) @@ -26,7 +26,7 @@ (let [[log datum] fa] [log (f datum)]))) -(implementation: #export (apply monoid) +(implementation: .public (apply monoid) (All [l] (-> (Monoid l) (Apply (Writer l)))) @@ -37,7 +37,7 @@ [log2 a] fa] [(\ monoid compose log1 log2) (f a)]))) -(implementation: #export (monad monoid) +(implementation: .public (monad monoid) (All [l] (-> (Monoid l) (Monad (Writer l)))) @@ -50,7 +50,7 @@ (let [[log1 [log2 a]] mma] [(\ monoid compose log1 log2) a]))) -(implementation: #export (with monoid monad) +(implementation: .public (with monoid monad) {#.doc (doc "Enhances a monad with Writer functionality.")} (All [l M] (-> (Monoid l) (Monad M) (Monad (All [a] (M (Writer l a)))))) @@ -72,7 +72,7 @@ [l2 a] Mla] (in [(\ monoid compose l1 l2) a])))) -(def: #export (lift monoid monad) +(def: .public (lift monoid monad) {#.doc (doc "Wraps a monadic value with Writer machinery.")} (All [l M a] (-> (Monoid l) (Monad M) diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index 1b320f241..59c5c026a 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -22,19 +22,19 @@ ["f" frac] ["." i64]]]]]) -(exception: #export (index_out_of_bounds {size Nat} {index Nat}) +(exception: .public (index_out_of_bounds {size Nat} {index Nat}) (exception.report ["Size" (%.nat size)] ["Index" (%.nat index)])) -(exception: #export (slice_out_of_bounds {size Nat} {offset Nat} {length Nat}) +(exception: .public (slice_out_of_bounds {size Nat} {offset Nat} {length Nat}) (exception.report ["Size" (%.nat size)] ["Offset" (%.nat offset)] ["Length" (%.nat length)])) (with_expansions [<documentation> (as_is {#.doc (doc "A binary BLOB of data.")}) - <jvm> (as_is (type: #export Binary + <jvm> (as_is (type: .public Binary <documentation> (ffi.type [byte])) @@ -77,17 +77,17 @@ (new [ArrayBuffer]) (length ffi.Number)]) - (type: #export Binary + (type: .public Binary <documentation> Uint8Array)) @.python - (type: #export Binary + (type: .public Binary <documentation> (primitive "bytearray")) @.scheme - (as_is (type: #export Binary + (as_is (type: .public Binary <documentation> (primitive "bytevector")) @@ -97,80 +97,80 @@ (ffi.import: (bytevector-length [Binary] Nat)))} ## Default - (type: #export Binary + (type: .public Binary <documentation> (array.Array (I64 Any))))) (template: (!size binary) - (for {@.old (ffi.array_length binary) - @.jvm (ffi.array_length binary) + [(for {@.old (ffi.array_length binary) + @.jvm (ffi.array_length binary) - @.js - (|> binary - Uint8Array::length - f.nat) + @.js + (|> binary + Uint8Array::length + f.nat) - @.python - (|> binary - (:as (array.Array (I64 Any))) - "python array length") + @.python + (|> binary + (:as (array.Array (I64 Any))) + "python array length") - @.scheme - (..bytevector-length [binary])} + @.scheme + (..bytevector-length [binary])} - ## Default - (array.size binary))) + ## Default + (array.size binary))]) (template: (!read index binary) - (for {@.old (..i64 (ffi.array_read index binary)) - @.jvm (..i64 (ffi.array_read index binary)) - - @.js + [(for {@.old (..i64 (ffi.array_read index binary)) + @.jvm (..i64 (ffi.array_read index binary)) + + @.js + (|> binary + (: ..Binary) + (:as (array.Array .Frac)) + ("js array read" index) + f.nat + .i64) + + @.python + (|> binary + (:as (array.Array .I64)) + ("python array read" index)) + + @.scheme + (..bytevector-u8-ref [binary index])} + + ## Default (|> binary - (: ..Binary) - (:as (array.Array .Frac)) - ("js array read" index) - f.nat - .i64) - - @.python - (|> binary - (:as (array.Array .I64)) - ("python array read" index)) - - @.scheme - (..bytevector-u8-ref [binary index])} - - ## Default - (|> binary - (array.read index) - (maybe.else (: (I64 Any) 0)) - (:as I64)))) + (array.read index) + (maybe.else (: (I64 Any) 0)) + (:as I64)))]) (template: (!!write <byte_type> <post> <write> index value binary) - (|> binary - (: ..Binary) - (:as (array.Array <byte_type>)) - (<write> index (|> value .nat (n.% (hex "100")) <post>)) - (:as ..Binary))) + [(|> binary + (: ..Binary) + (:as (array.Array <byte_type>)) + (<write> index (|> value .nat (n.% (hex "100")) <post>)) + (:as ..Binary))]) (template: (!write index value binary) - (for {@.old (ffi.array_write index (..byte value) binary) - @.jvm (ffi.array_write index (..byte value) binary) + [(for {@.old (ffi.array_write index (..byte value) binary) + @.jvm (ffi.array_write index (..byte value) binary) - @.js (!!write .Frac n.frac "js array write" index value binary) - @.python (!!write (I64 Any) (:as (I64 Any)) "python array write" index value binary) - @.scheme (exec (..bytevector-u8-set! [binary index value]) - binary)} + @.js (!!write .Frac n.frac "js array write" index value binary) + @.python (!!write (I64 Any) (:as (I64 Any)) "python array write" index value binary) + @.scheme (exec (..bytevector-u8-set! [binary index value]) + binary)} - ## Default - (array.write! index (|> value .nat (n.% (hex "100"))) binary))) + ## Default + (array.write! index (|> value .nat (n.% (hex "100"))) binary))]) -(def: #export size +(def: .public size (-> Binary Nat) (|>> !size)) -(def: #export (create size) +(def: .public (create size) {#.doc (doc "A fresh/empty binary BLOB of the specified size.")} (-> Nat Binary) (for {@.old (ffi.array byte size) @@ -190,7 +190,7 @@ ## Default (array.empty size))) -(def: #export (fold f init binary) +(def: .public (fold f init binary) (All [a] (-> (-> I64 a a) a Binary a)) (let [size (..!size binary)] (loop [index 0 @@ -199,14 +199,14 @@ (recur (inc index) (f (!read index binary) output)) output)))) -(def: #export (read/8 index binary) +(def: .public (read/8 index binary) {#.doc (doc "Read 1 byte (8 bits) at the given index.")} (-> Nat Binary (Try I64)) (if (n.< (..!size binary) index) (#try.Success (!read index binary)) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(def: #export (read/16 index binary) +(def: .public (read/16 index binary) {#.doc (doc "Read 2 bytes (16 bits) at the given index.")} (-> Nat Binary (Try I64)) (if (n.< (..!size binary) (n.+ 1 index)) @@ -215,7 +215,7 @@ (!read (n.+ 1 index) binary))) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(def: #export (read/32 index binary) +(def: .public (read/32 index binary) {#.doc (doc "Read 4 bytes (32 bits) at the given index.")} (-> Nat Binary (Try I64)) (if (n.< (..!size binary) (n.+ 3 index)) @@ -226,7 +226,7 @@ (!read (n.+ 3 index) binary))) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(def: #export (read/64 index binary) +(def: .public (read/64 index binary) {#.doc (doc "Read 8 bytes (64 bits) at the given index.")} (-> Nat Binary (Try I64)) (if (n.< (..!size binary) (n.+ 7 index)) @@ -241,7 +241,7 @@ (!read (n.+ 7 index) binary))) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(def: #export (write/8 index value binary) +(def: .public (write/8 index value binary) {#.doc (doc "Write 1 byte (8 bits) at the given index.")} (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) index) @@ -249,7 +249,7 @@ (!write index value))) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(def: #export (write/16 index value binary) +(def: .public (write/16 index value binary) {#.doc (doc "Write 2 bytes (16 bits) at the given index.")} (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) (n.+ 1 index)) @@ -258,7 +258,7 @@ (!write (n.+ 1 index) value))) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(def: #export (write/32 index value binary) +(def: .public (write/32 index value binary) {#.doc (doc "Write 4 bytes (32 bits) at the given index.")} (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) (n.+ 3 index)) @@ -269,7 +269,7 @@ (!write (n.+ 3 index) value))) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(def: #export (write/64 index value binary) +(def: .public (write/64 index value binary) {#.doc (doc "Write 8 bytes (64 bits) at the given index.")} (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) (n.+ 7 index)) @@ -293,7 +293,7 @@ (!write (n.+ 7 index) value)))) (exception.except ..index_out_of_bounds [(..!size binary) index]))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Binary) (def: (= reference sample) @@ -314,7 +314,7 @@ @.jvm (as_is)} ## Default - (exception: #export (cannot_copy_bytes {bytes Nat} + (exception: .public (cannot_copy_bytes {bytes Nat} {source_input Nat} {target_output Nat}) (exception.report @@ -322,7 +322,7 @@ ["Source input space" (%.nat source_input)] ["Target output space" (%.nat target_output)]))) -(def: #export (copy bytes source_offset source target_offset target) +(def: .public (copy bytes source_offset source target_offset target) {#.doc (doc "Mutates the target binary BLOB by copying bytes from the source BLOB to it.")} (-> Nat Nat Binary Nat Binary (Try Binary)) (with_expansions [<jvm> (as_is (do try.monad @@ -344,7 +344,7 @@ (recur (inc index))) (#try.Success target)))))))) -(def: #export (slice offset length binary) +(def: .public (slice offset length binary) {#.doc (doc "Yields a subset of the binary BLOB, so long as the specified range is valid.")} (-> Nat Nat Binary (Try Binary)) (let [size (..!size binary) @@ -358,7 +358,7 @@ ## Default (..copy length offset binary 0 (..create length))))))) -(def: #export (drop bytes binary) +(def: .public (drop bytes binary) {#.doc (doc "Yields a binary BLOB with at most the specified number of bytes removed.")} (-> Nat Binary Binary) (case bytes @@ -371,7 +371,7 @@ (#try.Failure _) (..create 0))))) -(implementation: #export monoid +(implementation: .public monoid (Monoid Binary) (def: identity diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux index 5de3cf526..69111ccb4 100644 --- a/stdlib/source/library/lux/data/bit.lux +++ b/stdlib/source/library/lux/data/bit.lux @@ -10,14 +10,14 @@ ["." function]]]]) (template [<zero> <one>] - [(def: #export <zero> Bit #0) - (def: #export <one> Bit #1)] + [(def: .public <zero> Bit #0) + (def: .public <one> Bit #1)] [no yes] [off on] ) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Bit) (def: (= x y) @@ -25,7 +25,7 @@ y (not y)))) -(implementation: #export hash +(implementation: .public hash (Hash Bit) (def: &equivalence ..equivalence) @@ -36,7 +36,7 @@ #1 3))) (template [<name> <identity> <op>] - [(implementation: #export <name> + [(implementation: .public <name> (Monoid Bit) (def: identity <identity>) @@ -46,7 +46,7 @@ [conjunction #1 and] ) -(implementation: #export codec +(implementation: .public codec (Codec Text Bit) (def: (encode x) @@ -60,7 +60,7 @@ "#0" (#.Right #0) _ (#.Left "Wrong syntax for Bit.")))) -(def: #export complement +(def: .public complement {#.doc (doc "Generates the complement of a predicate." "That is a predicate that returns the oposite of the original predicate.")} (All [a] (-> (-> a Bit) (-> a Bit))) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 6811c2234..8a3d0db92 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -17,10 +17,10 @@ [number ["n" nat]]]]]) -(def: #export type_name +(def: .public type_name "#Array") -(type: #export (Array a) +(type: .public (Array a) {#.doc "Mutable arrays."} (#.Primitive ..type_name (#.Item a #.End))) @@ -29,13 +29,13 @@ <array_type> (type (Array <elem_type>))] (for {@.jvm (template: (!int value) - (|> value - (:as <index_type>) - "jvm object cast" - "jvm conversion long-to-int"))} + [(|> value + (:as <index_type>) + "jvm object cast" + "jvm conversion long-to-int")])} (as_is)) - (def: #export (empty size) + (def: .public (empty size) {#.doc (doc "An empty array of the specified size.")} (All [a] (-> Nat (Array a))) (for {@.old @@ -55,7 +55,7 @@ @.php ("php array new" size) @.scheme ("scheme array new" size)})) - (def: #export (size array) + (def: .public (size array) (All [a] (-> (Array a) Nat)) (for {@.old ("jvm arraylength" array) @@ -77,12 +77,12 @@ @.scheme ("scheme array length" array)})) (template: (!read <read> <null?>) - (let [output (<read> index array)] - (if (<null?> output) - #.None - (#.Some output)))) + [(let [output (<read> index array)] + (if (<null?> output) + #.None + (#.Some output)))]) - (def: #export (read index array) + (def: .public (read index array) (All [a] (-> Nat (Array a) (Maybe a))) (if (n.< (size array) index) @@ -108,7 +108,7 @@ @.scheme (!read "scheme array read" "scheme object nil?")}) #.None)) - (def: #export (write! index value array) + (def: .public (write! index value array) {#.doc (doc "Mutate the array by writing a value to the specified index.")} (All [a] (-> Nat a (Array a) (Array a))) @@ -128,7 +128,7 @@ @.php ("php array write" index value array) @.scheme ("scheme array write" index value array)})) - (def: #export (delete! index array) + (def: .public (delete! index array) {#.doc (doc "Mutate the array by deleting the value at the specified index.")} (All [a] (-> Nat (Array a) (Array a))) @@ -148,7 +148,7 @@ array)) ) -(def: #export (contains? index array) +(def: .public (contains? index array) (All [a] (-> Nat (Array a) Bit)) (case (..read index array) @@ -158,7 +158,7 @@ _ false)) -(def: #export (update! index transform array) +(def: .public (update! index transform array) {#.doc (doc "Mutate the array by updating the value at the specified index.")} (All [a] (-> Nat (-> a a) (Array a) (Array a))) @@ -169,7 +169,7 @@ (#.Some value) (write! index (transform value) array))) -(def: #export (upsert! index default transform array) +(def: .public (upsert! index default transform array) {#.doc (doc "Mutate the array by updating the value at the specified index." "If there is no value, update and write the default value given.")} (All [a] @@ -178,7 +178,7 @@ (|> array (read index) (maybe.else default) transform) array)) -(def: #export (copy! length src_start src_array dest_start dest_array) +(def: .public (copy! length src_start src_array dest_start dest_array) {#.doc (doc "Writes the contents of one array into the other.")} (All [a] (-> Nat Nat (Array a) Nat (Array a) @@ -195,7 +195,7 @@ dest_array (list.indices length)))) -(def: #export (occupancy array) +(def: .public (occupancy array) {#.doc "Finds out how many cells in an array are occupied."} (All [a] (-> (Array a) Nat)) (list\fold (function (_ idx count) @@ -208,12 +208,12 @@ 0 (list.indices (size array)))) -(def: #export (vacancy array) +(def: .public (vacancy array) {#.doc "Finds out how many cells in an array are vacant."} (All [a] (-> (Array a) Nat)) (n.- (..occupancy array) (..size array))) -(def: #export (filter! p xs) +(def: .public (filter! p xs) {#.doc (doc "Delete every item of the array that fails to satisfy the predicate.")} (All [a] (-> (Predicate a) (Array a) (Array a))) @@ -229,7 +229,7 @@ xs (list.indices (size xs)))) -(def: #export (find p xs) +(def: .public (find p xs) {#.doc (doc "Yields the first item in the array that satisfies the predicate.")} (All [a] (-> (Predicate a) (Array a) (Maybe a))) @@ -246,7 +246,7 @@ (recur (inc idx)))) #.None)))) -(def: #export (find+ p xs) +(def: .public (find+ p xs) {#.doc "Just like 'find', but with access to the index of each value."} (All [a] (-> (-> Nat a Bit) (Array a) (Maybe [Nat a]))) @@ -263,7 +263,7 @@ (recur (inc idx)))) #.None)))) -(def: #export (clone xs) +(def: .public (clone xs) {#.doc (doc "Yields a shallow clone of the array.")} (All [a] (-> (Array a) (Array a))) (let [arr_size (size xs)] @@ -277,7 +277,7 @@ (empty arr_size) (list.indices arr_size)))) -(def: #export (of_list xs) +(def: .public (of_list xs) (All [a] (-> (List a) (Array a))) (product.right (list\fold (function (_ x [idx arr]) [(inc idx) (write! idx x arr)]) @@ -288,7 +288,7 @@ Nat (dec 0)) -(def: #export (list array) +(def: .public (list array) {#.doc (doc "Yields a list with every non-empty item in the array.")} (All [a] (-> (Array a) (List a))) (loop [idx (dec (size array)) @@ -306,7 +306,7 @@ #.None output))))) -(def: #export (list' default array) +(def: .public (list' default array) {#.doc (doc "Like 'list', but uses the 'default' value when encountering an empty cell in the array.")} (All [a] (-> a (Array a) (List a))) (loop [idx (dec (size array)) @@ -320,7 +320,7 @@ (#.Item (maybe.else default (read idx array)) output))))) -(implementation: #export (equivalence (^open ",\.")) +(implementation: .public (equivalence (^open ",\.")) (All [a] (-> (Equivalence a) (Equivalence (Array a)))) (def: (= xs ys) @@ -341,7 +341,7 @@ true (list.indices sxs)))))) -(implementation: #export monoid +(implementation: .public monoid (All [a] (Monoid (Array a))) (def: identity (empty 0)) @@ -353,7 +353,7 @@ (copy! sxs 0 xs 0) (copy! sxy 0 ys sxs))))) -(implementation: #export functor +(implementation: .public functor (Functor Array) (def: (map f ma) @@ -371,7 +371,7 @@ (list.indices arr_size)) )))) -(implementation: #export fold +(implementation: .public fold (Fold Array) (def: (fold f init xs) @@ -388,7 +388,7 @@ so_far))))) (template [<name> <init> <op>] - [(def: #export (<name> predicate) + [(def: .public (<name> predicate) (All [a] (-> (Predicate a) (Predicate (Array a)))) (function (_ array) diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux index 7820cfe4c..01296c8a2 100644 --- a/stdlib/source/library/lux/data/collection/bits.lux +++ b/stdlib/source/library/lux/data/collection/bits.lux @@ -14,13 +14,13 @@ ["n" nat] ["." i64]]]]]) -(type: #export Chunk +(type: .public Chunk I64) -(def: #export chunk_size +(def: .public chunk_size i64.width) -(type: #export Bits +(type: .public Bits {#.doc (doc "A bit-map.")} (Array Chunk)) @@ -28,11 +28,11 @@ Chunk (.i64 0)) -(def: #export empty +(def: .public empty Bits (array.empty 0)) -(def: #export (size bits) +(def: .public (size bits) {#.doc (doc "Measures the size of a bit-map by counting all the 1s in the bit-map.")} (-> Bits Nat) (array\fold (function (_ chunk total) @@ -40,15 +40,15 @@ 0 bits)) -(def: #export (capacity bits) +(def: .public (capacity bits) (-> Bits Nat) (|> bits array.size (n.* chunk_size))) -(def: #export empty? +(def: .public empty? (-> Bits Bit) (|>> ..size (n.= 0))) -(def: #export (get index bits) +(def: .public (get index bits) (-> Nat Bits Bit) (let [[chunk_index bit_index] (n./% chunk_size index)] (.and (n.< (array.size bits) chunk_index) @@ -63,7 +63,7 @@ empty_chunk)) (template [<name> <op>] - [(def: #export (<name> index input) + [(def: .public (<name> index input) (-> Nat Bits Bits) (let [[chunk_index bit_index] (n./% chunk_size index)] (loop [size|output (n.max (inc chunk_index) @@ -96,7 +96,7 @@ [flip i64.flip] ) -(def: #export (intersects? reference sample) +(def: .public (intersects? reference sample) (-> Bits Bits Bit) (let [chunks (n.min (array.size reference) (array.size sample))] @@ -109,7 +109,7 @@ (recur (inc idx))) #0)))) -(def: #export (not input) +(def: .public (not input) (-> Bits Bits) (case (array.size input) 0 @@ -133,7 +133,7 @@ output)))))) (template [<name> <op>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (-> Bits Bits Bits) (case (n.max (array.size param) (array.size subject)) @@ -164,7 +164,7 @@ [xor i64.xor] ) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Bits) (def: (= reference sample) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 771bdc551..6ed3c4f4f 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -555,52 +555,52 @@ #.End colls))) -(type: #export (Dictionary k v) +(type: .public (Dictionary k v) {#.doc "A dictionary implemented as a Hash-Array Mapped Trie (HAMT)."} {#hash (Hash k) #root (Node k v)}) -(def: #export key_hash +(def: .public key_hash (All [k v] (-> (Dictionary k v) (Hash k))) (get@ #..hash)) -(def: #export (empty key_hash) +(def: .public (empty key_hash) {#.doc (doc "An empty dictionary.")} (All [k v] (-> (Hash k) (Dictionary k v))) {#hash key_hash #root empty_node}) -(def: #export (put key val dict) +(def: .public (put key val dict) (All [k v] (-> k v (Dictionary k v) (Dictionary k v))) (let [[key_hash node] dict] [key_hash (put' root_level (\ key_hash hash key) key val key_hash node)])) -(def: #export (remove key dict) +(def: .public (remove key dict) (All [k v] (-> k (Dictionary k v) (Dictionary k v))) (let [[key_hash node] dict] [key_hash (remove' root_level (\ key_hash hash key) key key_hash node)])) -(def: #export (get key dict) +(def: .public (get key dict) (All [k v] (-> k (Dictionary k v) (Maybe v))) (let [[key_hash node] dict] (get' root_level (\ key_hash hash key) key key_hash node))) -(def: #export (key? dict key) +(def: .public (key? dict key) (All [k v] (-> (Dictionary k v) k Bit)) (case (get key dict) #.None #0 (#.Some _) #1)) -(exception: #export key_already_exists) +(exception: .public key_already_exists) -(def: #export (try_put key val dict) +(def: .public (try_put key val dict) {#.doc "Only puts the KV-pair if the key is not already present."} (All [k v] (-> k v (Dictionary k v) (Try (Dictionary k v)))) (case (get key dict) #.None (#try.Success (put key val dict)) (#.Some _) (exception.except ..key_already_exists []))) -(def: #export (update key f dict) +(def: .public (update key f dict) {#.doc "Transforms the value located at key (if available), using the given function."} (All [k v] (-> k (-> v v) (Dictionary k v) (Dictionary k v))) (case (get key dict) @@ -610,7 +610,7 @@ (#.Some val) (put key (f val) dict))) -(def: #export (upsert key default f dict) +(def: .public (upsert key default f dict) {#.doc (doc "Updates the value at the key; if it exists." "Otherwise, puts a value by applying the function to a default.")} (All [k v] (-> k v (-> v v) (Dictionary k v) (Dictionary k v))) @@ -619,19 +619,19 @@ (..get key dict))) dict)) -(def: #export size +(def: .public size (All [k v] (-> (Dictionary k v) Nat)) (|>> product.right ..size')) -(def: #export empty? +(def: .public empty? (All [k v] (-> (Dictionary k v) Bit)) (|>> size (n.= 0))) -(def: #export entries +(def: .public entries (All [k v] (-> (Dictionary k v) (List [k v]))) (|>> product.right ..entries')) -(def: #export (of_list key_hash kvs) +(def: .public (of_list key_hash kvs) (All [k v] (-> (Hash k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [k v] dict) (..put k v dict)) @@ -639,7 +639,7 @@ kvs)) (template [<side> <name>] - [(def: #export <name> + [(def: .public <name> (All [k v] (-> (Dictionary k v) (List <side>))) (|>> ..entries (list\fold (function (_ [k v] bundle) @@ -650,7 +650,7 @@ [v values] ) -(def: #export (merged dict2 dict1) +(def: .public (merged dict2 dict1) {#.doc (doc "Merges 2 dictionaries." "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.")} (All [k v] (-> (Dictionary k v) (Dictionary k v) (Dictionary k v))) @@ -658,7 +658,7 @@ dict1 (entries dict2))) -(def: #export (merged_with f dict2 dict1) +(def: .public (merged_with f dict2 dict1) {#.doc (doc "Merges 2 dictionaries." "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.")} (All [k v] (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v))) @@ -672,7 +672,7 @@ dict1 (entries dict2))) -(def: #export (re_bind from_key to_key dict) +(def: .public (re_bind from_key to_key dict) {#.doc (doc "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'.")} (All [k v] (-> k k (Dictionary k v) (Dictionary k v))) (case (get from_key dict) @@ -684,7 +684,7 @@ (remove from_key) (put to_key val)))) -(def: #export (sub keys dict) +(def: .public (sub keys dict) {#.doc "A sub-dictionary, with only the specified keys."} (All [k v] (-> (List k) (Dictionary k v) (Dictionary k v))) (let [[key_hash _] dict] @@ -695,7 +695,7 @@ (empty key_hash) keys))) -(implementation: #export (equivalence (^open ",\.")) +(implementation: .public (equivalence (^open ",\.")) (All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v)))) (def: (= reference subject) @@ -733,7 +733,7 @@ [k (f v)]) collisions))))) -(implementation: #export functor +(implementation: .public functor (All [k] (Functor (Dictionary k))) (def: (map f fa) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 3b4e7a17c..8d91b5cfb 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -44,12 +44,12 @@ [black #Black] ) -(type: #export (Dictionary k v) +(type: .public (Dictionary k v) {#.doc (doc "A dictionary data-structure with ordered entries.")} {#&order (Order k) #root (Maybe (Node k v))}) -(def: #export (empty order) +(def: .public (empty order) {#.doc (doc "An empty dictionary, employing the given order.")} (All [k v] (-> (Order k) (Dictionary k v))) {#&order order @@ -57,7 +57,7 @@ ## TODO: Doing inneficient access of Order functions due to compiler bug. ## TODO: Must improve it as soon as bug is fixed. -(def: #export (get key dict) +(def: .public (get key dict) (All [k v] (-> k (Dictionary k v) (Maybe v))) (let [## (^open "_\.") (get@ #&order dict) ] @@ -82,7 +82,7 @@ ## TODO: Doing inneficient access of Order functions due to compiler bug. ## TODO: Must improve it as soon as bug is fixed. -(def: #export (key? dict key) +(def: .public (key? dict key) (All [k v] (-> (Dictionary k v) k Bit)) (let [## (^open "_\.") (get@ #&order dict) ] @@ -101,7 +101,7 @@ (recur (get@ #right node))))))))) (template [<name> <side>] - [(def: #export (<name> dict) + [(def: .public (<name> dict) {#.doc (doc (~~ (template.text ["Yields value under the " <name> "imum key."])))} (All [k v] (-> (Dictionary k v) (Maybe v))) (case (get@ #root dict) @@ -121,7 +121,7 @@ [max #right] ) -(def: #export (size dict) +(def: .public (size dict) (All [k v] (-> (Dictionary k v) Nat)) (loop [node (get@ #root dict)] (case node @@ -132,7 +132,7 @@ (inc (n.+ (recur (get@ #left node)) (recur (get@ #right node))))))) -(def: #export empty? +(def: .public empty? (All [k v] (-> (Dictionary k v) Bit)) (|>> ..size (n.= 0))) @@ -249,7 +249,7 @@ #Black <default_behavior>)))) -(def: #export (put key value dict) +(def: .public (put key value dict) (All [k v] (-> k v (Dictionary k v) (Dictionary k v))) (let [(^open "_\.") (get@ #&order dict) root' (loop [?root (get@ #root dict)] @@ -472,7 +472,7 @@ _ (undefined))) -(def: #export (remove key dict) +(def: .public (remove key dict) (All [k v] (-> k (Dictionary k v) (Dictionary k v))) (let [(^open "_\.") (get@ #&order dict) [?root found?] (loop [?root (get@ #root dict)] @@ -527,7 +527,7 @@ (set@ #root (#.Some (blackened root)) dict) ))) -(def: #export (update key transform dict) +(def: .public (update key transform dict) (All [k v] (-> k (-> v v) (Dictionary k v) (Dictionary k v))) (case (..get key dict) (#.Some old) @@ -536,7 +536,7 @@ #.None dict)) -(def: #export (of_list order list) +(def: .public (of_list order list) (All [k v] (-> (Order k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [key value] dict) (put key value dict)) @@ -544,7 +544,7 @@ list)) (template [<name> <type> <output>] - [(def: #export (<name> dict) + [(def: .public (<name> dict) (All [k v] (-> (Dictionary k v) (List <type>))) (loop [node (get@ #root dict)] (case node @@ -562,7 +562,7 @@ [values v (get@ #value node')] ) -(implementation: #export (equivalence (^open ",\.")) +(implementation: .public (equivalence (^open ",\.")) (All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v)))) (def: (= reference sample) diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux index 03025db7e..10c831700 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux @@ -13,24 +13,24 @@ ["n" nat]]]]]) ## https://en.wikipedia.org/wiki/Property_list -(type: #export (PList a) +(type: .public (PList a) {#.doc (doc "A property list." "It's a simple dictionary-like structure with Text keys.")} (List [Text a])) -(def: #export empty +(def: .public empty PList #.End) -(def: #export size +(def: .public size (All [a] (-> (PList a) Nat)) list.size) -(def: #export empty? +(def: .public empty? (All [a] (-> (PList a) Bit)) (|>> ..size (n.= 0))) -(def: #export (get key properties) +(def: .public (get key properties) (All [a] (-> Text (PList a) (Maybe a))) (case properties #.End @@ -42,7 +42,7 @@ (get key properties')))) (template [<name> <type> <access>] - [(def: #export <name> + [(def: .public <name> (All [a] (-> (PList a) (List <type>))) (list\map <access>))] @@ -50,7 +50,7 @@ [values a product.right] ) -(def: #export (contains? key properties) +(def: .public (contains? key properties) (All [a] (-> Text (PList a) Bit)) (case (..get key properties) (#.Some _) @@ -59,7 +59,7 @@ #.None false)) -(def: #export (put key val properties) +(def: .public (put key val properties) (All [a] (-> Text a (PList a) (PList a))) (case properties #.End @@ -72,7 +72,7 @@ (#.Item [k' v'] (put key val properties'))))) -(def: #export (update key f properties) +(def: .public (update key f properties) (All [a] (-> Text (-> a a) (PList a) (PList a))) (case properties #.End @@ -83,7 +83,7 @@ (#.Item [k' (f v')] properties') (#.Item [k' v'] (update key f properties'))))) -(def: #export (remove key properties) +(def: .public (remove key properties) (All [a] (-> Text (PList a) (PList a))) (case properties #.End @@ -95,7 +95,7 @@ (#.Item [k' v'] (remove key properties'))))) -(def: #export equivalence +(def: .public equivalence (All [a] (-> (Equivalence a) (Equivalence (PList a)))) (|>> (product.equivalence text.equivalence) list.equivalence)) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 35aeaafe4..1c8294dc0 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -23,7 +23,7 @@ ## #End ## (#Item a (List a))) -(implementation: #export fold +(implementation: .public fold (Fold List) (def: (fold f init xs) @@ -34,7 +34,7 @@ (#.Item x xs') (fold f (f x init) xs')))) -(def: #export (folds f init inputs) +(def: .public (folds f init inputs) (All [a b] (-> (-> a b b) b (List a) (List b))) (case inputs #.End @@ -43,14 +43,14 @@ (#.Item [head tail]) (#.Item [init (folds f (f head init) tail)]))) -(def: #export (reversed xs) +(def: .public (reversed xs) (All [a] (-> (List a) (List a))) (fold (function (_ head tail) (#.Item head tail)) #.End xs)) -(def: #export (only keep? xs) +(def: .public (only keep? xs) {#.doc (doc "A list with only values that satisfy the predicate.")} (All [a] (-> (Predicate a) (List a) (List a))) @@ -63,7 +63,7 @@ (#.Item x (only keep? xs')) (only keep? xs')))) -(def: #export (partition satisfies? list) +(def: .public (partition satisfies? list) {#.doc "Divide the list into all elements that satisfy a predicate, and all elements that do not."} (All [a] (-> (Predicate a) (List a) [(List a) (List a)])) (case list @@ -76,7 +76,7 @@ [(#.Item head in) out] [in (#.Item head out)])))) -(def: #export (pairs xs) +(def: .public (pairs xs) {#.doc (doc "Cut the list into pairs of 2." "Caveat emptor: If the list has an un-even number of elements, the last one will be skipped.")} (All [a] (-> (List a) (List [a a]))) @@ -88,7 +88,7 @@ #.End)) (template [<name> <then> <else>] - [(def: #export (<name> n xs) + [(def: .public (<name> n xs) (All [a] (-> Nat (List a) (List a))) (if (n.> 0 n) @@ -105,7 +105,7 @@ ) (template [<name> <then> <else>] - [(def: #export (<name> predicate xs) + [(def: .public (<name> predicate xs) (All [a] (-> (Predicate a) (List a) (List a))) (case xs @@ -121,7 +121,7 @@ [drop_while (drop_while predicate xs') xs] ) -(def: #export (split n xs) +(def: .public (split n xs) (All [a] (-> Nat (List a) [(List a) (List a)])) (if (n.> 0 n) @@ -146,14 +146,14 @@ (split_with' predicate (#.Item x ys) xs') [ys xs]))) -(def: #export (split_with predicate xs) +(def: .public (split_with predicate xs) {#.doc "Segment the list by using a predicate to tell when to cut."} (All [a] (-> (Predicate a) (List a) [(List a) (List a)])) (let [[ys' xs'] (split_with' predicate #.End xs)] [(reversed ys') xs'])) -(def: #export (chunk size list) +(def: .public (chunk size list) {#.doc "Segment the list in chunks of the given size."} (All [a] (-> Nat (List a) (List (List a)))) (case list @@ -164,7 +164,7 @@ (let [[pre post] (split size list)] (#.Item pre (chunk size post))))) -(def: #export (repeat n x) +(def: .public (repeat n x) {#.doc "A list of the value x, repeated n times."} (All [a] (-> Nat a (List a))) @@ -182,7 +182,7 @@ #.None (list))) -(def: #export (iterations f x) +(def: .public (iterations f x) {#.doc "Generates a list element by element until the function returns #.None."} (All [a] (-> (-> a (Maybe a)) a (List a))) @@ -193,7 +193,7 @@ #.None (list x))) -(def: #export (one check xs) +(def: .public (one check xs) (All [a b] (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs @@ -208,7 +208,7 @@ #.None (one check xs')))) -(def: #export (all check xs) +(def: .public (all check xs) (All [a b] (-> (-> a (Maybe b)) (List a) (List b))) (for {## TODO: Stop relying on this ASAP. @@ -234,7 +234,7 @@ #.None (all check xs'))))) -(def: #export (find predicate xs) +(def: .public (find predicate xs) {#.doc "Yields the first value in the list that satisfies the predicate."} (All [a] (-> (Predicate a) (List a) (Maybe a))) @@ -244,7 +244,7 @@ #.None)) xs)) -(def: #export (interpose sep xs) +(def: .public (interpose sep xs) {#.doc "Puts a value between every two elements in the list."} (All [a] (-> a (List a) (List a))) @@ -258,12 +258,12 @@ (#.Item x xs') (list& x sep (interpose sep xs')))) -(def: #export (size list) +(def: .public (size list) (All [a] (-> (List a) Nat)) (fold (function (_ _ acc) (n.+ 1 acc)) 0 list)) (template [<name> <init> <op>] - [(def: #export (<name> predicate xs) + [(def: .public (<name> predicate xs) (All [a] (-> (Predicate a) (List a) Bit)) (loop [xs xs] @@ -283,7 +283,7 @@ [any? #0 or] ) -(def: #export (item i xs) +(def: .public (item i xs) {#.doc "Fetches the element at the specified index."} (All [a] (-> Nat (List a) (Maybe a))) @@ -296,7 +296,7 @@ (#.Some x) (item (dec i) xs')))) -(implementation: #export (equivalence Equivalence<a>) +(implementation: .public (equivalence Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (List a)))) (def: (= xs ys) @@ -312,7 +312,7 @@ #0 ))) -(implementation: #export (hash super) +(implementation: .public (hash super) (All [a] (-> (Hash a) (Hash (List a)))) (def: &equivalence @@ -324,7 +324,7 @@ (n.+ (\ super hash member) hash)) 0))) -(implementation: #export monoid +(implementation: .public monoid (All [a] (Monoid (List a))) (def: identity #.End) @@ -338,7 +338,7 @@ (open: "." ..monoid) -(implementation: #export functor +(implementation: .public functor (Functor List) (def: (map f ma) @@ -351,7 +351,7 @@ (open: "." ..functor) -(implementation: #export apply +(implementation: .public apply (Apply List) (def: &functor ..functor) @@ -364,7 +364,7 @@ (#.Item f ff') (compose (map f fa) (apply ff' fa))))) -(implementation: #export monad +(implementation: .public monad (Monad List) (def: &functor ..functor) @@ -375,7 +375,7 @@ (def: join (|>> reversed (fold compose identity)))) -(def: #export (sort < xs) +(def: .public (sort < xs) {#.doc (doc "A list ordered by a comparison function.")} (All [a] (-> (-> a a Bit) (List a) (List a))) (case xs @@ -391,7 +391,7 @@ xs')] ($_ compose (sort < pre) (list x) (sort < post))))) -(def: #export (empty? xs) +(def: .public (empty? xs) (All [a] (Predicate (List a))) (case xs #.End @@ -400,7 +400,7 @@ _ false)) -(def: #export (member? eq xs x) +(def: .public (member? eq xs x) (All [a] (-> (Equivalence a) (List a) a Bit)) (case xs #.End @@ -411,7 +411,7 @@ (member? eq xs' x)))) (template [<name> <output> <side> <doc>] - [(def: #export (<name> xs) + [(def: .public (<name> xs) {#.doc <doc>} (All [a] (-> (List a) (Maybe <output>))) (case xs @@ -425,7 +425,7 @@ [tail (List a) xs' "For a list of size N, yields the N-1 elements after the first one."] ) -(def: #export (indices size) +(def: .public (indices size) {#.doc "Produces all the valid indices for a given size."} (All [a] (-> Nat (List Nat))) (if (n.= 0 size) @@ -458,10 +458,10 @@ output' (recur input' output'))))) -(macro: #export (zipped tokens state) +(macro: .public (zipped tokens state) {#.doc (doc "Create list zippers with the specified number of input lists." - (def: #export zipped/2 (zipped 2)) - (def: #export zipped/3 (zipped 3)) + (def: .public zipped/2 (zipped 2)) + (def: .public zipped/3 (zipped 3)) (zipped/3 xs ys zs) ((zipped 3) xs ys zs))} (case tokens @@ -500,13 +500,13 @@ _ (#.Left "Wrong syntax for zipped"))) -(def: #export zipped/2 (zipped 2)) -(def: #export zipped/3 (zipped 3)) +(def: .public zipped/2 (zipped 2)) +(def: .public zipped/3 (zipped 3)) -(macro: #export (zipped_with tokens state) +(macro: .public (zipped_with tokens state) {#.doc (doc "Create list zippers with the specified number of input lists." - (def: #export zipped_with/2 (zipped_with 2)) - (def: #export zipped_with/3 (zipped_with 3)) + (def: .public zipped_with/2 (zipped_with 2)) + (def: .public zipped_with/3 (zipped_with 3)) (zipped_with/2 + xs ys) ((zipped_with 2) + xs ys))} (case tokens @@ -548,10 +548,10 @@ _ (#.Left "Wrong syntax for zipped_with"))) -(def: #export zipped_with/2 (zipped_with 2)) -(def: #export zipped_with/3 (zipped_with 3)) +(def: .public zipped_with/2 (zipped_with 2)) +(def: .public zipped_with/3 (zipped_with 3)) -(def: #export (last xs) +(def: .public (last xs) (All [a] (-> (List a) (Maybe a))) (case xs #.End @@ -563,7 +563,7 @@ (#.Item x xs') (last xs'))) -(def: #export (inits xs) +(def: .public (inits xs) {#.doc (doc "For a list of size N, yields the first N-1 elements." "Will yield a #.None for empty lists.")} (All [a] (-> (List a) (Maybe (List a)))) @@ -583,12 +583,12 @@ (#.Some (#.Item x tail))) )) -(def: #export concat +(def: .public concat {#.doc (doc "The sequential combination of all the lists.")} (All [a] (-> (List (List a)) (List a))) (\ ..monad join)) -(implementation: #export (with monad) +(implementation: .public (with monad) {#.doc (doc "Enhances a monad with List functionality.")} (All [M] (-> (Monad M) (Monad (All [a] (M (List a)))))) @@ -606,12 +606,12 @@ (monad.seq ! lMla))] (in (concat lla))))) -(def: #export (lift monad) +(def: .public (lift monad) {#.doc (doc "Wraps a monadic value with List machinery.")} (All [M a] (-> (Monad M) (-> (M a) (M (List a))))) (\ monad map (\ ..monad in))) -(def: #export (enumeration xs) +(def: .public (enumeration xs) {#.doc "Pairs every element in the list with its index, starting at 0."} (All [a] (-> (List a) (List [Nat a]))) (loop [idx 0 @@ -623,7 +623,7 @@ (#.Item x xs') (#.Item [idx x] (recur (inc idx) xs'))))) -(macro: #export (when tokens state) +(macro: .public (when tokens state) {#.doc (doc "Can be used as a guard in (co)monadic be/do expressions." (do monad [value (do_something 1 2 3) diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index 0c6a24f88..31c8222a2 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -11,48 +11,48 @@ [number ["n" nat]]]]]) -(type: #export (Queue a) +(type: .public (Queue a) {#.doc (doc "A first-in, first-out sequential data-structure.")} {#front (List a) #rear (List a)}) -(def: #export empty +(def: .public empty Queue {#front (.list) #rear (.list)}) -(def: #export (of_list entries) +(def: .public (of_list entries) (All [a] (-> (List a) (Queue a))) {#front entries #rear (.list)}) -(def: #export (list queue) +(def: .public (list queue) (All [a] (-> (Queue a) (List a))) (let [(^slots [#front #rear]) queue] (list\compose front (list.reversed rear)))) -(def: #export peek +(def: .public peek {#.doc (doc "Yields the first value in the queue, if any.")} (All [a] (-> (Queue a) (Maybe a))) (|>> (get@ #front) list.head)) -(def: #export (size queue) +(def: .public (size queue) (All [a] (-> (Queue a) Nat)) (let [(^slots [#front #rear]) queue] (n.+ (list.size front) (list.size rear)))) -(def: #export empty? +(def: .public empty? (All [a] (-> (Queue a) Bit)) (|>> (get@ #front) list.empty?)) -(def: #export (member? equivalence queue member) +(def: .public (member? equivalence queue member) (All [a] (-> (Equivalence a) (Queue a) a Bit)) (let [(^slots [#front #rear]) queue] (or (list.member? equivalence front member) (list.member? equivalence rear member)))) -(def: #export (pop queue) +(def: .public (pop queue) (All [a] (-> (Queue a) (Queue a))) (case (get@ #front queue) ## Empty... @@ -70,7 +70,7 @@ (|> queue (set@ #front front')))) -(def: #export (push val queue) +(def: .public (push val queue) (All [a] (-> a (Queue a) (Queue a))) (case (get@ #front queue) #.End @@ -79,7 +79,7 @@ _ (update@ #rear (|>> (#.Item val)) queue))) -(implementation: #export (equivalence super) +(implementation: .public (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Queue a)))) (def: (= reference subject) @@ -87,7 +87,7 @@ (..list reference) (..list subject)))) -(implementation: #export functor +(implementation: .public functor (Functor Queue) (def: (map f fa) diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index 698bb57ac..763f1836d 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -15,14 +15,14 @@ [type (#+ :by_example) [abstract (#+ abstract: :abstraction :representation)]]]]) -(type: #export Priority +(type: .public Priority Nat) -(def: #export max +(def: .public max Priority n\top) -(def: #export min +(def: .public min Priority n\bottom) @@ -36,21 +36,23 @@ @)) -(abstract: #export (Queue a) +(abstract: .public (Queue a) + {} + (Maybe (Tree :@: Priority a)) - (def: #export empty + (def: .public empty Queue (:abstraction #.None)) - (def: #export (peek queue) + (def: .public (peek queue) (All [a] (-> (Queue a) (Maybe a))) (do maybe.monad [tree (:representation queue)] (tree.one (n.= (tree.tag tree)) tree))) - (def: #export (size queue) + (def: .public (size queue) (All [a] (-> (Queue a) Nat)) (case (:representation queue) #.None @@ -65,7 +67,7 @@ (0 #1 [left right]) (n.+ (recur left) (recur right)))))) - (def: #export (member? equivalence queue member) + (def: .public (member? equivalence queue member) (All [a] (-> (Equivalence a) (Queue a) a Bit)) (case (:representation queue) #.None @@ -81,7 +83,7 @@ (or (recur left) (recur right)))))) - (def: #export (pop queue) + (def: .public (pop queue) (All [a] (-> (Queue a) (Queue a))) (:abstraction (do maybe.monad @@ -109,7 +111,7 @@ (#.Some =right) (#.Some (\ ..builder branch left =right))))))))) - (def: #export (push priority value queue) + (def: .public (push priority value queue) (All [a] (-> Priority a (Queue a) (Queue a))) (let [addition (\ ..builder leaf priority value)] (:abstraction @@ -121,6 +123,6 @@ (#.Some (\ ..builder branch tree addition)))))) ) -(def: #export empty? +(def: .public empty? (All [a] (-> (Queue a) Bit)) (|>> ..size (n.= 0))) diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 20c6c2cea..43d41cc2c 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -182,25 +182,25 @@ (list\fold (function (_ sub acc) (list\compose (list' sub) acc)) #.End)))) -(type: #export (Row a) +(type: .public (Row a) {#.doc (doc "A sequential data-structure with fast random access.")} {#level Level #size Nat #root (Hierarchy a) #tail (Base a)}) -(def: #export empty +(def: .public empty Row {#level (level_up root_level) #size 0 #root (empty_hierarchy []) #tail (array.empty 0)}) -(def: #export (size row) +(def: .public (size row) (All [a] (-> (Row a) Nat)) (get@ #size row)) -(def: #export (add val row) +(def: .public (add val row) (All [a] (-> a (Row a) (Row a))) ## Check if there is room in the tail. (let [row_size (get@ #size row)] @@ -235,13 +235,13 @@ (exception: incorrect_row_structure) -(exception: #export [a] (index_out_of_bounds {row (Row a)} {index Nat}) +(exception: .public [a] (index_out_of_bounds {row (Row a)} {index Nat}) (exception.report ["Size" (\ n.decimal encode (get@ #size row))] ["Index" (\ n.decimal encode index)])) (exception: base_was_not_found) -(def: #export (within_bounds? row idx) +(def: .public (within_bounds? row idx) {#.doc (doc "Determines whether the index is within the bounds of the row.")} (All [a] (-> (Row a) Nat Bit)) (n.< (get@ #size row) idx)) @@ -268,7 +268,7 @@ (exception.except ..incorrect_row_structure [])))) (exception.except ..index_out_of_bounds [row idx]))) -(def: #export (item idx row) +(def: .public (item idx row) (All [a] (-> Nat (Row a) (Try a))) (do try.monad [base (base_for idx row)] @@ -279,7 +279,7 @@ #.None (exception.except ..incorrect_row_structure [])))) -(def: #export (put idx val row) +(def: .public (put idx val row) (All [a] (-> Nat a (Row a) (Try (Row a)))) (let [row_size (get@ #size row)] (if (within_bounds? row idx) @@ -293,13 +293,13 @@ row))) (exception.except ..index_out_of_bounds [row idx])))) -(def: #export (update idx f row) +(def: .public (update idx f row) (All [a] (-> Nat (-> a a) (Row a) (Try (Row a)))) (do try.monad [val (..item idx row)] (..put idx (f val) row))) -(def: #export (pop row) +(def: .public (pop row) (All [a] (-> (Row a) (Row a))) (case (get@ #size row) 0 @@ -341,24 +341,24 @@ (set@ #tail new_tail)))))) )) -(def: #export (list row) +(def: .public (list row) (All [a] (-> (Row a) (List a))) (list\compose (list' (#Hierarchy (get@ #root row))) (list' (#Base (get@ #tail row))))) -(def: #export of_list +(def: .public of_list (All [a] (-> (List a) (Row a))) (list\fold ..add ..empty)) -(def: #export (member? a/Equivalence row val) +(def: .public (member? a/Equivalence row val) (All [a] (-> (Equivalence a) (Row a) a Bit)) (list.member? a/Equivalence (list row) val)) -(def: #export empty? +(def: .public empty? (All [a] (-> (Row a) Bit)) (|>> (get@ #size) (n.= 0))) -(syntax: #export (row {elems (p.some s.any)}) +(syntax: .public (row {elems (p.some s.any)}) {#.doc (doc "Row literals." (row 12 34 56 78 90))} (in (.list (` (..of_list (.list (~+ elems))))))) @@ -377,7 +377,7 @@ _ #0))) -(implementation: #export (equivalence Equivalence<a>) +(implementation: .public (equivalence Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Row a)))) (def: (= v1 v2) @@ -401,7 +401,7 @@ init hierarchy)))) -(implementation: #export fold +(implementation: .public fold (Fold Row) (def: (fold f init xs) @@ -412,7 +412,7 @@ (#Hierarchy (get@ #root xs))) (#Base (get@ #tail xs)))))) -(implementation: #export monoid +(implementation: .public monoid (All [a] (Monoid (Row a))) (def: identity ..empty) @@ -431,7 +431,7 @@ (#Hierarchy hierarchy) (#Hierarchy (array\map (map f) hierarchy))))) -(implementation: #export functor +(implementation: .public functor (Functor Row) (def: (map f xs) @@ -440,7 +440,7 @@ #root (|> xs (get@ #root) (array\map (\ node_functor map f))) #tail (|> xs (get@ #tail) (array\map f))})) -(implementation: #export apply +(implementation: .public apply (Apply Row) (def: &functor ..functor) @@ -453,7 +453,7 @@ ff)] (fold compose identity results)))) -(implementation: #export monad +(implementation: .public monad (Monad Row) (def: &functor ..functor) @@ -465,14 +465,14 @@ (^open ".") ..monoid] (fold (function (_ post pre) (compose pre post)) identity)))) -(def: #export reversed +(def: .public reversed (All [a] (-> (Row a) (Row a))) (|>> ..list list.reversed (list\fold add ..empty))) (template [<name> <array> <init> <op>] - [(def: #export <name> + [(def: .public <name> (All [a] (-> (Predicate a) (Row a) Bit)) (let [help (: (All [a] diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 44755f0db..98869531f 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -19,23 +19,23 @@ [number ["n" nat]]]]]) -(type: #export (Sequence a) +(type: .public (Sequence a) {#.doc "An infinite sequence of values."} (Cont [a (Sequence a)])) -(def: #export (iterations f x) +(def: .public (iterations f x) {#.doc "Create a sequence by applying a function to a value, and to its result, on and on..."} (All [a] (-> (-> a a) a (Sequence a))) (//.pending [x (iterations f (f x))])) -(def: #export (repeat x) +(def: .public (repeat x) {#.doc "Repeat a value forever."} (All [a] (-> a (Sequence a))) (//.pending [x (repeat x)])) -(def: #export (cycle [start next]) +(def: .public (cycle [start next]) {#.doc (doc "Go over the elements of a list forever." "The list should not be empty.")} (All [a] @@ -50,7 +50,7 @@ (recur head' tail'))]))) (template [<name> <return>] - [(def: #export (<name> sequence) + [(def: .public (<name> sequence) (All [a] (-> (Sequence a) <return>)) (let [[head tail] (//.run sequence)] <name>))] @@ -59,7 +59,7 @@ [tail (Sequence a)] ) -(def: #export (item idx sequence) +(def: .public (item idx sequence) (All [a] (-> Nat (Sequence a) a)) (let [[head tail] (//.run sequence)] (case idx @@ -67,7 +67,7 @@ _ (item (dec idx) tail)))) (template [<taker> <dropper> <splitter> <pred_type> <pred_test> <pred_step>] - [(def: #export (<taker> pred xs) + [(def: .public (<taker> pred xs) (All [a] (-> <pred_type> (Sequence a) (List a))) (let [[x xs'] (//.run xs)] @@ -75,7 +75,7 @@ (list& x (<taker> <pred_step> xs')) (list)))) - (def: #export (<dropper> pred xs) + (def: .public (<dropper> pred xs) (All [a] (-> <pred_type> (Sequence a) (Sequence a))) (let [[x xs'] (//.run xs)] @@ -83,7 +83,7 @@ (<dropper> <pred_step> xs') xs))) - (def: #export (<splitter> pred xs) + (def: .public (<splitter> pred xs) (All [a] (-> <pred_type> (Sequence a) [(List a) (Sequence a)])) (let [[x xs'] (//.run xs)] @@ -96,14 +96,14 @@ [take drop split Nat (n.> 0 pred) (dec pred)] ) -(def: #export (unfold step init) +(def: .public (unfold step init) {#.doc "A stateful way of infinitely calculating the values of a sequence."} (All [a b] (-> (-> a [a b]) a (Sequence b))) (let [[next x] (step init)] (//.pending [x (unfold step next)]))) -(def: #export (only predicate sequence) +(def: .public (only predicate sequence) {#.doc (doc "A new sequence only with items that satisfy the predicate.")} (All [a] (-> (-> a Bit) (Sequence a) (Sequence a))) (let [[head tail] (//.run sequence)] @@ -111,7 +111,7 @@ (//.pending [head (only predicate tail)]) (only predicate tail)))) -(def: #export (partition left? xs) +(def: .public (partition left? xs) {#.doc (doc "Split a sequence in two based on a predicate." "The left side contains all entries for which the predicate is #1." "The right side contains all entries for which the predicate is #0.")} @@ -119,14 +119,14 @@ [(..only left? xs) (..only (bit.complement left?) xs)]) -(implementation: #export functor +(implementation: .public functor (Functor Sequence) (def: (map f fa) (let [[head tail] (//.run fa)] (//.pending [(f head) (map f tail)])))) -(implementation: #export comonad +(implementation: .public comonad (CoMonad Sequence) (def: &functor ..functor) @@ -137,7 +137,7 @@ (let [[head tail] (//.run wa)] (//.pending [wa (split tail)])))) -(syntax: #export (^sequence& {patterns (<code>.form (<>.many <code>.any))} +(syntax: .public (^sequence& {patterns (<code>.form (<>.many <code>.any))} body {branches (<>.some <code>.any)}) {#.doc (doc "Allows destructuring of sequences in pattern-matching expressions." diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux index 64438517f..2269117ca 100644 --- a/stdlib/source/library/lux/data/collection/set.lux +++ b/stdlib/source/library/lux/data/collection/set.lux @@ -15,53 +15,53 @@ ["." // #_ ["#" dictionary (#+ Dictionary)]]) -(type: #export (Set a) +(type: .public (Set a) {#.doc (doc "An un-ordered data-structure with unique items." "This means there is no repetition/duplication among the items.")} (Dictionary a Any)) -(def: #export member_hash +(def: .public member_hash (All [a] (-> (Set a) (Hash a))) //.key_hash) -(def: #export empty +(def: .public empty (All [a] (-> (Hash a) (Set a))) //.empty) -(def: #export size +(def: .public size (All [a] (-> (Set a) Nat)) //.size) -(def: #export (add elem set) +(def: .public (add elem set) (All [a] (-> a (Set a) (Set a))) (|> set (//.put elem []))) -(def: #export remove +(def: .public remove (All [a] (-> a (Set a) (Set a))) //.remove) -(def: #export member? +(def: .public member? (All [a] (-> (Set a) a Bit)) //.key?) -(def: #export list +(def: .public list (All [a] (-> (Set a) (List a))) //.keys) -(def: #export union +(def: .public union (All [a] (-> (Set a) (Set a) (Set a))) //.merged) -(def: #export (difference sub base) +(def: .public (difference sub base) (All [a] (-> (Set a) (Set a) (Set a))) (list\fold ..remove base (..list sub))) -(def: #export (intersection filter base) +(def: .public (intersection filter base) (All [a] (-> (Set a) (Set a) (Set a))) (//.sub (//.keys filter) base)) -(implementation: #export equivalence +(implementation: .public equivalence (All [a] (Equivalence (Set a))) (def: (= (^@ reference [hash _]) sample) @@ -70,7 +70,7 @@ (list.every? (..member? reference) (..list sample))))) -(implementation: #export hash +(implementation: .public hash (All [a] (Hash (Set a))) (def: &equivalence ..equivalence) @@ -80,28 +80,28 @@ ..list (\ (list.hash (..member_hash set)) hash)))) -(implementation: #export (monoid hash) +(implementation: .public (monoid hash) (All [a] (-> (Hash a) (Monoid (Set a)))) (def: identity (..empty hash)) (def: compose ..union)) -(def: #export empty? +(def: .public empty? (All [a] (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: #export (of_list hash elements) +(def: .public (of_list hash elements) (All [a] (-> (Hash a) (List a) (Set a))) (list\fold ..add (..empty hash) elements)) -(def: #export (sub? super sub) +(def: .public (sub? super sub) (All [a] (-> (Set a) (Set a) Bit)) (list.every? (..member? super) (..list sub))) -(def: #export (super? sub super) +(def: .public (super? sub super) (All [a] (-> (Set a) (Set a) Bit)) (..sub? super sub)) -(def: #export predicate +(def: .public predicate (All [a] (-> (Set a) (Predicate a))) ..member?) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index 9d746ae52..05c02d4cf 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -19,20 +19,20 @@ [// ["." maybe]]]]) -(abstract: #export (Set a) - (Dictionary a Nat) - +(abstract: .public (Set a) {#.doc (doc "A set that keeps track of repetition in its entries.")} - (def: #export empty + (Dictionary a Nat) + + (def: .public empty (All [a] (-> (Hash a) (Set a))) (|>> dictionary.empty :abstraction)) - (def: #export size + (def: .public size (All [a] (-> (Set a) Nat)) (|>> :representation dictionary.values (list\fold n.+ 0))) - (def: #export (add multiplicity elem set) + (def: .public (add multiplicity elem set) (All [a] (-> Nat a (Set a) (Set a))) (case multiplicity 0 set @@ -41,7 +41,7 @@ (dictionary.upsert elem 0 (n.+ multiplicity)) :abstraction))) - (def: #export (remove multiplicity elem set) + (def: .public (remove multiplicity elem set) (All [a] (-> Nat a (Set a) (Set a))) (case multiplicity 0 set @@ -55,11 +55,11 @@ #.None set))) - (def: #export (multiplicity set elem) + (def: .public (multiplicity set elem) (All [a] (-> (Set a) a Nat)) (|> set :representation (dictionary.get elem) (maybe.else 0))) - (def: #export list + (def: .public list (All [a] (-> (Set a) (List a))) (|>> :representation dictionary.entries @@ -68,7 +68,7 @@ #.End))) (template [<name> <compose>] - [(def: #export (<name> parameter subject) + [(def: .public (<name> parameter subject) (All [a] (-> (Set a) (Set a) (Set a))) (:abstraction (dictionary.merged_with <compose> (:representation parameter) (:representation subject))))] @@ -76,7 +76,7 @@ [sum n.+] ) - (def: #export (intersection parameter (^:representation subject)) + (def: .public (intersection parameter (^:representation subject)) (All [a] (-> (Set a) (Set a) (Set a))) (list\fold (function (_ [elem multiplicity] output) (..add (n.min (..multiplicity parameter elem) @@ -86,7 +86,7 @@ (..empty (dictionary.key_hash subject)) (dictionary.entries subject))) - (def: #export (difference parameter subject) + (def: .public (difference parameter subject) (All [a] (-> (Set a) (Set a) (Set a))) (|> parameter :representation @@ -95,7 +95,7 @@ (..remove multiplicity elem output)) subject))) - (def: #export (sub? reference subject) + (def: .public (sub? reference subject) {#.doc (doc "Is 'subject' a sub-set of 'reference'?")} (All [a] (-> (Set a) (Set a) Bit)) (|> subject @@ -106,7 +106,7 @@ (..multiplicity reference) (n.>= multiplicity)))))) - (def: #export (support set) + (def: .public (support set) {#.doc (doc "A set of the unique (non repeated) members.")} (All [a] (-> (Set a) (//.Set a))) (let [(^@ set [hash _]) (:representation set)] @@ -114,7 +114,7 @@ dictionary.keys (//.of_list hash)))) - (implementation: #export equivalence + (implementation: .public equivalence (All [a] (Equivalence (Set a))) (def: (= (^:representation reference) sample) @@ -127,7 +127,7 @@ (..multiplicity sample) (n.= multiplicity)))))))) - (implementation: #export hash + (implementation: .public hash (All [a] (Hash (Set a))) (def: &equivalence ..equivalence) @@ -140,24 +140,24 @@ (dictionary.entries set))))) ) -(def: #export (member? set elem) +(def: .public (member? set elem) (All [a] (-> (Set a) a Bit)) (|> elem (..multiplicity set) (n.> 0))) -(def: #export empty? +(def: .public empty? (All [a] (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: #export (of_list hash subject) +(def: .public (of_list hash subject) (All [a] (-> (Hash a) (List a) (Set a))) (list\fold (..add 1) (..empty hash) subject)) -(def: #export (of_set subject) +(def: .public (of_set subject) (All [a] (-> (//.Set a) (Set a))) (..of_list (//.member_hash subject) (//.list subject))) -(def: #export super? +(def: .public super? {#.doc (doc "Is 'subject' a super-set of 'reference'?")} (All [a] (-> (Set a) (Set a) Bit)) (function.flip sub?)) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index 97e32646c..8f2992ebc 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -12,21 +12,21 @@ [type abstract]]]) -(abstract: #export (Set a) - (/.Dictionary a a) - +(abstract: .public (Set a) {#.doc (doc "A set with ordered entries.")} - (def: #export empty + (/.Dictionary a a) + + (def: .public empty (All [a] (-> (Order a) (Set a))) (|>> /.empty :abstraction)) - (def: #export (member? set elem) + (def: .public (member? set elem) (All [a] (-> (Set a) a Bit)) (/.key? (:representation set) elem)) (template [<type> <name> <alias>] - [(def: #export <name> + [(def: .public <name> (All [a] (-> (Set a) <type>)) (|>> :representation <alias>))] @@ -36,39 +36,39 @@ [Bit empty? /.empty?] ) - (def: #export (add elem set) + (def: .public (add elem set) (All [a] (-> a (Set a) (Set a))) (|> set :representation (/.put elem elem) :abstraction)) - (def: #export (remove elem set) + (def: .public (remove elem set) (All [a] (-> a (Set a) (Set a))) (|> set :representation (/.remove elem) :abstraction)) - (def: #export list + (def: .public list (All [a] (-> (Set a) (List a))) (|>> :representation /.keys)) - (def: #export (of_list &order list) + (def: .public (of_list &order list) (All [a] (-> (Order a) (List a) (Set a))) (list\fold add (..empty &order) list)) - (def: #export (union left right) + (def: .public (union left right) (All [a] (-> (Set a) (Set a) (Set a))) (list\fold ..add right (..list left))) - (def: #export (intersection left right) + (def: .public (intersection left right) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..list right) (list.only (..member? left)) (..of_list (get@ #/.&order (:representation right))))) - (def: #export (difference param subject) + (def: .public (difference param subject) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..list subject) (list.only (|>> (..member? param) not)) (..of_list (get@ #/.&order (:representation subject))))) - (implementation: #export equivalence + (implementation: .public equivalence (All [a] (Equivalence (Set a))) (def: (= reference sample) @@ -76,14 +76,14 @@ = (..list reference) (..list sample)))) ) -(def: #export (sub? super sub) +(def: .public (sub? super sub) {#.doc (doc "Is 'sub' a sub-set of 'super'?")} (All [a] (-> (Set a) (Set a) Bit)) (|> sub ..list (list.every? (..member? super)))) -(def: #export (super? sub super) +(def: .public (super? sub super) {#.doc (doc "Is 'super' a super-set of 'sub'?")} (All [a] (-> (Set a) (Set a) Bit)) (sub? super sub)) diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index 3f720d9ac..d34fe97ac 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -10,24 +10,24 @@ [type abstract]]]) -(abstract: #export (Stack a) - (List a) - +(abstract: .public (Stack a) {#.doc (doc "A first-in, last-out sequential data-structure.")} - (def: #export empty + (List a) + + (def: .public empty Stack (:abstraction (list))) - (def: #export size + (def: .public size (All [a] (-> (Stack a) Nat)) (|>> :representation //.size)) - (def: #export empty? + (def: .public empty? (All [a] (-> (Stack a) Bit)) (|>> :representation //.empty?)) - (def: #export (peek stack) + (def: .public (peek stack) {#.doc (doc "Yields the top value in the stack, if any.")} (All [a] (-> (Stack a) (Maybe a))) (case (:representation stack) @@ -37,7 +37,7 @@ (#.Item value _) (#.Some value))) - (def: #export (pop stack) + (def: .public (pop stack) (All [a] (-> (Stack a) (Maybe [a (Stack a)]))) (case (:representation stack) #.End @@ -46,11 +46,11 @@ (#.Item top stack') (#.Some [top (:abstraction stack')]))) - (def: #export (push value stack) + (def: .public (push value stack) (All [a] (-> a (Stack a) (Stack a))) (:abstraction (#.Item value (:representation stack)))) - (implementation: #export (equivalence super) + (implementation: .public (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Stack a)))) @@ -58,7 +58,7 @@ (def: (= reference subject) (\ (//.equivalence super) = (:representation reference) (:representation subject)))) - (implementation: #export functor + (implementation: .public functor (Functor Stack) (def: (map f value) diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index 23a957fb7..7d12bad74 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -16,12 +16,12 @@ [syntax (#+ syntax:)] ["." code]]]]) -(type: #export (Tree a) +(type: .public (Tree a) {#.doc (doc "A generic tree data-structure.")} {#value a #children (List (Tree a))}) -(def: #export (flat tree) +(def: .public (flat tree) {#.doc (doc "All the leaf values of the tree, in order.")} (All [a] (-> (Tree a) (List a))) (|> tree @@ -30,12 +30,12 @@ list\join (#.Item (get@ #value tree)))) -(def: #export (leaf value) +(def: .public (leaf value) (All [a] (-> a (Tree a))) {#value value #children (list)}) -(def: #export (branch value children) +(def: .public (branch value children) (All [a] (-> a (List (Tree a)) (Tree a))) {#value value #children children}) @@ -54,7 +54,7 @@ (<>.else (list)) (<>.and <code>.any))) -(syntax: #export (tree {root tree^}) +(syntax: .public (tree {root tree^}) {#.doc (doc "Tree literals." (: (Tree Nat) (tree 12 @@ -65,14 +65,14 @@ (` {#value (~ value) #children (list (~+ (list\map recur children)))}))))))) -(implementation: #export (equivalence super) +(implementation: .public (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Tree a)))) (def: (= tx ty) (and (\ super = (get@ #value tx) (get@ #value ty)) (\ (list.equivalence (equivalence super)) = (get@ #children tx) (get@ #children ty))))) -(implementation: #export functor +(implementation: .public functor (Functor Tree) (def: (map f fa) @@ -80,7 +80,7 @@ #children (list\map (map f) (get@ #children fa))})) -(implementation: #export fold +(implementation: .public fold (Fold Tree) (def: (fold f init tree) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index ae6c21990..157b6657e 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -11,15 +11,15 @@ [abstract (#+ abstract: :abstraction :representation)]]]]) ## https://en.wikipedia.org/wiki/Finger_tree -(abstract: #export (Tree @ t v) +(abstract: .public (Tree @ t v) + {#.doc (doc "A finger tree.")} + {#monoid (Monoid t) #tag t #root (Or v [(Tree @ t v) (Tree @ t v)])} - {#.doc (doc "A finger tree.")} - - (interface: #export (Builder @ t) + (interface: .public (Builder @ t) {#.doc (doc "A builder for finter tree structures.")} (: (All [v] (-> t v (Tree @ t v))) @@ -31,7 +31,7 @@ branch)) (template [<name> <tag> <output>] - [(def: #export <name> + [(def: .public <name> (All [@ t v] (-> (Tree @ t v) <output>)) (|>> :representation (get@ <tag>)))] @@ -39,7 +39,7 @@ [root #root (Either v [(Tree @ t v) (Tree @ t v)])] ) - (implementation: #export (builder monoid) + (implementation: .public (builder monoid) {#.doc (doc "A new builder using the given monoid.")} (All [t] (Ex [@] (-> (Monoid t) (Builder @ t)))) @@ -55,7 +55,7 @@ #tag (\ monoid compose (..tag left) (..tag right)) #root (0 #1 [left right])}))) - (def: #export (value tree) + (def: .public (value tree) (All [@ t v] (-> (Tree @ t v) v)) (case (get@ #root (:representation tree)) (0 #0 value) @@ -64,7 +64,7 @@ (0 #1 [left right]) (value left))) - (def: #export (tags tree) + (def: .public (tags tree) (All [@ t v] (-> (Tree @ t v) (List t))) (case (get@ #root (:representation tree)) (0 #0 value) @@ -74,7 +74,7 @@ (list\compose (tags left) (tags right)))) - (def: #export (values tree) + (def: .public (values tree) (All [@ t v] (-> (Tree @ t v) (List v))) (case (get@ #root (:representation tree)) (0 #0 value) @@ -84,7 +84,7 @@ (list\compose (values left) (values right)))) - (def: #export (one predicate tree) + (def: .public (one predicate tree) {#.doc (doc "Finds one value that meets the predicate.")} (All [@ t v] (-> (Predicate t) (Tree @ t v) (Maybe v))) (let [[monoid tag root] (:representation tree)] @@ -104,7 +104,7 @@ #.None))) ) -(def: #export (exists? predicate tree) +(def: .public (exists? predicate tree) {#.doc (doc "Verifies that a value exists which meets the predicate.")} (All [@ t v] (-> (Predicate t) (Tree @ t v) Bit)) (case (..one predicate tree) diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index e47036a56..6d7e0f9e4 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -22,12 +22,12 @@ #rights (List (Tree a))}) ## https://en.wikipedia.org/wiki/Zipper_(data_structure) -(type: #export (Zipper a) +(type: .public (Zipper a) {#.doc "Tree zippers, for easy navigation and editing of trees."} {#family (Maybe (Family Zipper a)) #node (Tree a)}) -(implementation: #export (equivalence super) +(implementation: .public (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Zipper a)))) @@ -42,24 +42,24 @@ (//.equivalence super))] (== reference sample)))) -(def: #export (zipper tree) +(def: .public (zipper tree) (All [a] (-> (Tree a) (Zipper a))) {#family #.None #node tree}) -(def: #export tree +(def: .public tree (All [a] (-> (Zipper a) (Tree a))) (get@ #node)) -(def: #export value +(def: .public value (All [a] (-> (Zipper a) a)) (get@ [#node #//.value])) -(def: #export (set value zipper) +(def: .public (set value zipper) (All [a] (-> a (Zipper a) (Zipper a))) (set@ [#node #//.value] value zipper)) -(def: #export (update transform zipper) +(def: .public (update transform zipper) (All [a] (-> (-> a a) (Zipper a) (Zipper a))) (update@ [#node #//.value] transform zipper)) @@ -67,15 +67,15 @@ (All [a] (-> (Zipper a) (List (Tree a)))) (get@ [#node #//.children])) -(def: #export leaf? +(def: .public leaf? (All [a] (-> (Zipper a) Bit)) (|>> ..children list.empty?)) -(def: #export branch? +(def: .public branch? (All [a] (-> (Zipper a) Bit)) (|>> ..leaf? not)) -(def: #export (start? zipper) +(def: .public (start? zipper) (All [a] (-> (Zipper a) Bit)) (case (get@ #family zipper) #.None @@ -84,7 +84,7 @@ _ false)) -(def: #export (down zipper) +(def: .public (down zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (case (..children zipper) #.End @@ -96,7 +96,7 @@ #rights tail}) #node head}))) -(def: #export (up zipper) +(def: .public (up zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (do maybe.monad [family (get@ #family zipper)] @@ -115,7 +115,7 @@ parent)))))) (template [<one> <all> <side> <op_side>] - [(def: #export (<one> zipper) + [(def: .public (<one> zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (case (get@ #family zipper) (#.Some family) @@ -139,7 +139,7 @@ #.None #.None)) - (def: #export (<all> zipper) + (def: .public (<all> zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (case (get@ #family zipper) #.None @@ -168,7 +168,7 @@ [left leftmost #lefts #rights] ) -(def: #export (next zipper) +(def: .public (next zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (case (..down zipper) (#.Some forward) @@ -199,7 +199,7 @@ #.None zipper))) -(def: #export (previous zipper) +(def: .public (previous zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (case (..left zipper) #.None @@ -214,7 +214,7 @@ backward)))) (template [<name> <move>] - [(def: #export (<name> zipper) + [(def: .public (<name> zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (case (<move> zipper) #.None @@ -233,7 +233,7 @@ [start ..previous] ) -(def: #export (end? zipper) +(def: .public (end? zipper) (All [a] (-> (Zipper a) Bit)) (case (..end zipper) #.None @@ -242,19 +242,19 @@ (#.Some _) false)) -(def: #export (interpose value zipper) +(def: .public (interpose value zipper) (All [a] (-> a (Zipper a) (Zipper a))) (update@ [#node #//.children] (|>> (//.branch value) list) zipper)) -(def: #export (adopt value zipper) +(def: .public (adopt value zipper) (All [a] (-> a (Zipper a) (Zipper a))) (update@ [#node #//.children] (|>> (#.Item (//.leaf value))) zipper)) -(def: #export (remove zipper) +(def: .public (remove zipper) (All [a] (-> (Zipper a) (Maybe (Zipper a)))) (do maybe.monad [family (get@ #family zipper)] @@ -272,7 +272,7 @@ (set@ #node next)))))) (template [<name> <side>] - [(def: #export (<name> value zipper) + [(def: .public (<name> value zipper) (All [a] (-> a (Zipper a) (Maybe (Zipper a)))) (case (get@ #family zipper) #.None @@ -287,7 +287,7 @@ [insert_right #rights] ) -(implementation: #export functor +(implementation: .public functor (Functor Zipper) (def: (map f (^slots [#family #node])) @@ -298,7 +298,7 @@ family) #node (//\map f node)})) -(implementation: #export comonad +(implementation: .public comonad (CoMonad Zipper) (def: &functor ..functor) diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index 433dd9bc3..f99dbfbd9 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -41,43 +41,43 @@ (-> Frac Nat) (|>> (f.* rgb_factor) f.int .nat)) -(type: #export RGB +(type: .public RGB {#.doc (doc "Red-Green-Blue color format.")} {#red Nat #green Nat #blue Nat}) -(type: #export HSL +(type: .public HSL {#.doc (doc "Hue-Saturation-Lightness color format.")} [Frac Frac Frac]) -(type: #export CMYK +(type: .public CMYK {#.doc (doc "Cyan-Magenta-Yellow-Key color format.")} {#cyan Frac #magenta Frac #yellow Frac #key Frac}) -(type: #export HSB +(type: .public HSB {#.doc (doc "Hue-Saturation-Brightness color format.")} [Frac Frac Frac]) -(abstract: #export Color - RGB - +(abstract: .public Color {#.doc (doc "A color value, independent of color format.")} - (def: #export (of_rgb [red green blue]) + RGB + + (def: .public (of_rgb [red green blue]) (-> RGB Color) (:abstraction {#red (n.% ..rgb_limit red) #green (n.% ..rgb_limit green) #blue (n.% ..rgb_limit blue)})) - (def: #export rgb + (def: .public rgb (-> Color RGB) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Color) (def: (= reference sample) @@ -87,7 +87,7 @@ (n.= gR gS) (n.= bR bS))))) - (implementation: #export hash + (implementation: .public hash (Hash Color) (def: &equivalence ..equivalence) @@ -99,19 +99,19 @@ (i64.left_shifted 8 g) b)))) - (def: #export black + (def: .public black Color (..of_rgb {#red 0 #green 0 #blue 0})) - (def: #export white + (def: .public white Color (..of_rgb {#red ..top #green ..top #blue ..top})) - (implementation: #export addition + (implementation: .public addition (Monoid Color) (def: identity ..black) @@ -127,7 +127,7 @@ (-> Nat Nat) (|> ..top (n.- value))) - (def: #export (complement color) + (def: .public (complement color) {#.doc (doc "The opposite color.")} (-> Color Color) (let [[red green blue] (:representation color)] @@ -135,7 +135,7 @@ #green (complement' green) #blue (complement' blue)}))) - (implementation: #export subtraction + (implementation: .public subtraction (Monoid Color) (def: identity ..white) @@ -148,7 +148,7 @@ #blue (n.min lB rB)})))) ) -(def: #export (hsl color) +(def: .public (hsl color) (-> Color HSL) (let [[red green blue] (rgb color) red (..down red) @@ -202,7 +202,7 @@ ## else p)))) -(def: #export (of_hsl [hue saturation luminance]) +(def: .public (of_hsl [hue saturation luminance]) (-> HSL Color) (if (f.= +0.0 saturation) ## Achromatic @@ -220,7 +220,7 @@ #green (|> hue (hue_rgb p q)) #blue (|> hue (f.- third) (hue_rgb p q))})))) -(def: #export (hsb color) +(def: .public (hsb color) (-> Color HSB) (let [[red green blue] (rgb color) red (..down red) @@ -252,7 +252,7 @@ saturation brightness])))) -(def: #export (of_hsb [hue saturation brightness]) +(def: .public (of_hsb [hue saturation brightness]) (-> HSB Color) (let [hue (|> hue (f.* +6.0)) i (math.floor hue) @@ -269,7 +269,7 @@ #green (..up green) #blue (..up blue)}))) -(def: #export (cmyk color) +(def: .public (cmyk color) (-> Color CMYK) (let [[red green blue] (rgb color) red (..down red) @@ -287,7 +287,7 @@ #yellow yellow #key key})) -(def: #export (of_cmyk [cyan magenta yellow key]) +(def: .public (of_cmyk [cyan magenta yellow key]) (-> CMYK Color) (if (f.= +1.0 key) (of_rgb {#red 0 @@ -314,7 +314,7 @@ ## else ratio)) -(def: #export (interpolated ratio end start) +(def: .public (interpolated ratio end start) (-> Frac Color Color Color) (let [dS (..normal ratio) dE (|> +1.0 (f.- dS)) @@ -331,7 +331,7 @@ #blue (interpolated' blueE blueS)}))) (template [<name> <target>] - [(def: #export (<name> ratio color) + [(def: .public (<name> ratio color) (-> Frac Color Color) (..interpolated ratio <target> color))] @@ -340,7 +340,7 @@ ) (template [<op> <name>] - [(def: #export (<name> ratio color) + [(def: .public (<name> ratio color) (-> Frac Color Color) (let [[hue saturation luminance] (hsl color)] (of_hsl [hue @@ -353,7 +353,7 @@ [f.- un_saturated] ) -(def: #export (gray_scale color) +(def: .public (gray_scale color) (-> Color Color) (let [[_ _ luminance] (hsl color)] (of_hsl [+0.0 @@ -366,7 +366,7 @@ (in (list (` {#.doc (.doc (~ g!documentation))}))))) (template [<name> <1> <2>] - [(`` (def: #export (<name> color) + [(`` (def: .public (<name> color) (~~ (..color_scheme_documentation <name>)) (-> Color [Color Color Color]) (let [[hue saturation luminance] (hsl color)] @@ -384,7 +384,7 @@ ) (template [<name> <1> <2> <3>] - [(`` (def: #export (<name> color) + [(`` (def: .public (<name> color) (~~ (..color_scheme_documentation <name>)) (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (hsb color)] @@ -403,10 +403,10 @@ [tetradic (|> +2.0 (f./ +12.0)) (|> +6.0 (f./ +12.0)) (|> +8.0 (f./ +12.0))] ) -(type: #export Spread +(type: .public Spread Frac) -(type: #export Palette +(type: .public Palette (-> Spread Nat Color (List Color))) (syntax: (palette_documentation {name <code>.local_identifier}) @@ -414,7 +414,7 @@ g!documentation (code.text (format "A " name " palette."))] (in (list (` {#.doc (.doc (~ g!documentation))}))))) -(`` (def: #export (analogous spread variations color) +(`` (def: .public (analogous spread variations color) (~~ (..palette_documentation analogous)) Palette (let [[hue saturation brightness] (hsb color) @@ -425,7 +425,7 @@ brightness])) (list.indices variations))))) -(`` (def: #export (monochromatic spread variations color) +(`` (def: .public (monochromatic spread variations color) (~~ (..palette_documentation monochromatic)) Palette (let [[hue saturation brightness] (hsb color) @@ -438,26 +438,26 @@ [hue saturation] of_hsb)))))) -(type: #export Alpha +(type: .public Alpha {#.doc (doc "The degree of transparency of a pigment.")} Rev) -(def: #export transparent +(def: .public transparent {#.doc (doc "The maximum degree of transparency.")} Alpha rev\bottom) -(def: #export translucent +(def: .public translucent {#.doc (doc "The average degree of transparency.")} Alpha .5) -(def: #export opaque +(def: .public opaque {#.doc (doc "The minimum degree of transparency.")} Alpha rev\top) -(type: #export Pigment +(type: .public Pigment {#.doc (doc "A color with some degree of transparency.")} {#color Color #alpha Alpha}) diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux index 459ab6db8..b64c9cbcc 100644 --- a/stdlib/source/library/lux/data/color/named.lux +++ b/stdlib/source/library/lux/data/color/named.lux @@ -26,7 +26,7 @@ in)) (template [<red> <green> <blue> <name>] - [(`` (def: #export <name> + [(`` (def: .public <name> {#.doc (doc (~~ (..documentation <red> <green> <blue> <name>)))} Color (//.of_rgb {#//.red (hex <red>) diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 918119cb2..8d8c388c5 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -32,25 +32,25 @@ (-> Size (I64 Any)) (|>> (n.* i64.bits_per_byte) i64.mask)) -(type: #export Mutation +(type: .public Mutation {#.doc (doc "A mutation of binary data, tracking where in the data to transform.")} (-> [Offset Binary] [Offset Binary])) -(type: #export Specification +(type: .public Specification {#.doc (doc "A description of how to transform binary data.")} [Size Mutation]) -(def: #export no_op +(def: .public no_op {#.doc (doc "A specification for empty binary data.")} Specification [0 function.identity]) -(def: #export (instance [size mutation]) +(def: .public (instance [size mutation]) {#.doc (doc "Given a specification of how to construct binary data, yields a binary blob that matches it.")} (-> Specification Binary) (|> size binary.create [0] mutation product.right)) -(implementation: #export monoid +(implementation: .public monoid (Monoid Specification) (def: identity @@ -60,17 +60,17 @@ [(n.+ sizeL sizeR) (|>> mutL mutR)])) -(type: #export (Writer a) +(type: .public (Writer a) {#.doc (doc "An operation that knows how to write information into a binary blob.")} (-> a Specification)) -(def: #export (run writer value) +(def: .public (run writer value) {#.doc (doc "Yields a binary blob with all the information written to it.")} (All [a] (-> (Writer a) a Binary)) (..instance (writer value))) (template [<name> <size> <write>] - [(def: #export <name> + [(def: .public <name> (Writer (I64 Any)) (function (_ value) [<size> @@ -86,7 +86,7 @@ [bits/64 /.size/64 binary.write/64] ) -(def: #export (or left right) +(def: .public (or left right) (All [l r] (-> (Writer l) (Writer r) (Writer (Or l r)))) (function (_ altV) (case altV @@ -104,38 +104,38 @@ [1 #.Right right]) ))) -(def: #export (and pre post) +(def: .public (and pre post) (All [a b] (-> (Writer a) (Writer b) (Writer [a b]))) (function (_ [preV postV]) (\ ..monoid compose (pre preV) (post postV)))) -(def: #export (rec body) +(def: .public (rec body) {#.doc (doc "A combinator for recursive writers.")} (All [a] (-> (-> (Writer a) (Writer a)) (Writer a))) (function (recur value) (body recur value))) -(def: #export any +(def: .public any (Writer Any) (function.constant ..no_op)) -(def: #export bit +(def: .public bit (Writer Bit) (|>> (case> #0 0 #1 1) ..bits/8)) (template [<name> <type>] - [(def: #export <name> (Writer <type>) ..bits/64)] + [(def: .public <name> (Writer <type>) ..bits/64)] [nat Nat] [int Int] [rev Rev] ) -(def: #export frac +(def: .public frac (Writer Frac) (|>> frac.bits ..bits/64)) -(def: #export (segment size) +(def: .public (segment size) {#.doc (doc "Writes at most 'size' bytes of an input binary blob.")} (-> Nat (Writer Binary)) (function (_ value) @@ -150,7 +150,7 @@ binary))])])) (template [<name> <bits> <size> <write>] - [(def: #export <name> + [(def: .public <name> (Writer Binary) (let [mask (..mask <size>)] (function (_ value) @@ -171,7 +171,7 @@ ) (template [<name> <binary>] - [(def: #export <name> + [(def: .public <name> (Writer Text) (|>> (\ utf8.codec encode) <binary>))] @@ -181,10 +181,10 @@ [utf8/64 ..binary/64] ) -(def: #export text ..utf8/64) +(def: .public text ..utf8/64) (template [<name> <size> <write>] - [(def: #export (<name> valueW) + [(def: .public (<name> valueW) (All [v] (-> (Writer v) (Writer (Row v)))) (function (_ value) (let [original_count (row.size value) @@ -213,25 +213,25 @@ [row/64 /.size/64 binary.write/64] ) -(def: #export maybe +(def: .public maybe (All [a] (-> (Writer a) (Writer (Maybe a)))) (..or ..any)) -(def: #export (list value) +(def: .public (list value) (All [a] (-> (Writer a) (Writer (List a)))) (..rec (|>> (..and value) (..or ..any)))) -(def: #export (set value) +(def: .public (set value) (All [a] (-> (Writer a) (Writer (Set a)))) (|>> set.list (..list value))) -(def: #export name +(def: .public name (Writer Name) (..and ..text ..text)) -(def: #export type +(def: .public type (Writer Type) (..rec (function (_ recur) @@ -263,11 +263,11 @@ [10 #.Named (..and ..name recur)]) )))))) -(def: #export location +(def: .public location (Writer Location) ($_ ..and ..text ..nat ..nat)) -(def: #export code +(def: .public code (Writer Code) (..rec (function (_ recur) diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index a3ff932e7..52a44d226 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -21,32 +21,34 @@ ["#." style (#+ Style)] ["#." query (#+ Query)]]) -(abstract: #export Common Any) -(abstract: #export Special Any) +(abstract: .public Common {} Any) +(abstract: .public Special {} Any) -(abstract: #export (CSS brand) +(abstract: .public (CSS brand) + {} + Text - (def: #export css + (def: .public css (-> (CSS Any) Text) (|>> :representation)) - (def: #export empty + (def: .public empty (CSS Common) (:abstraction "")) - (def: #export (rule selector style) + (def: .public (rule selector style) (-> (Selector Any) Style (CSS Common)) (:abstraction (format (/selector.selector selector) "{" (/style.inline style) "}"))) - (def: #export char_set + (def: .public char_set (-> Encoding (CSS Special)) (|>> encoding.name %.text (text.enclosed ["@charset " ";"]) :abstraction)) - (def: #export (font font) + (def: .public (font font) (-> Font (CSS Special)) (let [with_unicode (case (get@ #/font.unicode_range font) (#.Some unicode_range) @@ -69,7 +71,7 @@ (format "@font-face") :abstraction))) - (def: #export (import url query) + (def: .public (import url query) (-> URL (Maybe Query) (CSS Special)) (:abstraction (format (format "@import url(" (%.text url) ")") (case query @@ -83,11 +85,11 @@ (def: css_separator text.new_line) - (type: #export Frame + (type: .public Frame {#when Percentage #what Style}) - (def: #export (key_frames animation frames) + (def: .public (key_frames animation frames) (-> (Value Animation) (List Frame) (CSS Special)) (:abstraction (format "@keyframes " (/value.value animation) " {" (|> frames @@ -102,11 +104,11 @@ (:abstraction (format (:representation <pre>) ..css_separator (:representation <post>)))) - (def: #export (and pre post) + (def: .public (and pre post) (-> (CSS Any) (CSS Any) (CSS Any)) (!compose pre post)) - (def: #export (alter combinator selector css) + (def: .public (alter combinator selector css) (-> Combinator (Selector Any) (CSS Common) (CSS Common)) (|> css :representation @@ -115,13 +117,13 @@ (text.join_with ..css_separator) :abstraction)) - (def: #export (dependent combinator selector style inner) + (def: .public (dependent combinator selector style inner) (-> Combinator (Selector Any) Style (CSS Common) (CSS Common)) (!compose (..rule selector style) (..alter combinator selector inner))) (template [<name> <combinator>] - [(def: #export <name> + [(def: .public <name> (-> (Selector Any) Style (CSS Common) (CSS Common)) (..dependent <combinator>))] diff --git a/stdlib/source/library/lux/data/format/css/font.lux b/stdlib/source/library/lux/data/format/css/font.lux index 9856d19e4..9149bf899 100644 --- a/stdlib/source/library/lux/data/format/css/font.lux +++ b/stdlib/source/library/lux/data/format/css/font.lux @@ -13,11 +13,11 @@ ["." // #_ ["#." value (#+ Value Font_Stretch Font_Style Font_Weight)]]) -(type: #export Unicode_Range +(type: .public Unicode_Range {#start Nat #end Nat}) -(type: #export Font +(type: .public Font {#family Text #source URL #stretch (Maybe (Value Font_Stretch)) diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux index 29f3681f9..de5197de3 100644 --- a/stdlib/source/library/lux/data/format/css/property.lux +++ b/stdlib/source/library/lux/data/format/css/property.lux @@ -55,16 +55,18 @@ (syntax: (text_identifier {identifier s.text}) (in (list (code.local_identifier (text.replace_all "-" "_" identifier))))) -(abstract: #export (Property brand) +(abstract: .public (Property brand) + {} + Text - (def: #export name + (def: .public name (-> (Property Any) Text) (|>> :representation)) (template [<brand> <alias>+ <property>+] [(`` (template [<alias> <property>] - [(def: #export <alias> + [(def: .public <alias> (Property <brand>) (:abstraction <property>))] @@ -72,7 +74,7 @@ (with_expansions [<rows> (template.spliced <property>+)] (template [<property>] - [(`` (def: #export (~~ (text_identifier <property>)) + [(`` (def: .public (~~ (text_identifier <property>)) (Property <brand>) (:abstraction <property>)))] diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux index 115aeaf97..5366e1013 100644 --- a/stdlib/source/library/lux/data/format/css/query.lux +++ b/stdlib/source/library/lux/data/format/css/query.lux @@ -24,15 +24,17 @@ (syntax: (text_identifier {identifier s.text}) (in (list (code.local_identifier (text.replace_all "-" "_" identifier))))) -(abstract: #export Media +(abstract: .public Media + {} + Text - (def: #export media + (def: .public media (-> Media Text) (|>> :representation)) (template [<media>] - [(`` (def: #export (~~ (text_identifier <media>)) + [(`` (def: .public (~~ (text_identifier <media>)) Media (:abstraction <media>)))] @@ -42,15 +44,17 @@ ["speech"] )) -(abstract: #export Feature +(abstract: .public Feature + {} + Text - (def: #export feature + (def: .public feature (-> Feature Text) (|>> :representation)) (template [<feature> <brand>] - [(`` (def: #export ((~~ (text_identifier <feature>)) input) + [(`` (def: .public ((~~ (text_identifier <feature>)) input) (-> (Value <brand>) Feature) (:abstraction (format "(" <feature> ": " (//value.value input) ")"))))] @@ -102,15 +106,17 @@ ) ) -(abstract: #export Query +(abstract: .public Query + {} + Text - (def: #export query + (def: .public query (-> Query Text) (|>> :representation)) (template [<name> <operator>] - [(def: #export <name> + [(def: .public <name> (-> Media Query) (|>> ..media (format <operator>) :abstraction))] @@ -118,12 +124,12 @@ [only "only "] ) - (def: #export not + (def: .public not (-> Feature Query) (|>> ..feature (format "not ") :abstraction)) (template [<name> <operator>] - [(def: #export (<name> left right) + [(def: .public (<name> left right) (-> Query Query Query) (:abstraction (format (:representation left) <operator> diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux index 08f2165da..50bbb160d 100644 --- a/stdlib/source/library/lux/data/format/css/selector.lux +++ b/stdlib/source/library/lux/data/format/css/selector.lux @@ -12,44 +12,46 @@ ["." template]] ["." locale (#+ Locale)]]]) -(type: #export Label Text) +(type: .public Label Text) -(type: #export Tag Label) -(type: #export ID Label) -(type: #export Class Label) -(type: #export Attribute Label) +(type: .public Tag Label) +(type: .public ID Label) +(type: .public Class Label) +(type: .public Attribute Label) -(abstract: #export (Generic brand) Any) +(abstract: .public (Generic brand) {} Any) (template [<generic> <brand>] - [(abstract: <brand> Any) - (type: #export <generic> (Generic <brand>))] + [(abstract: <brand> {} Any) + (type: .public <generic> (Generic <brand>))] [Can_Chain Can_Chain'] [Cannot_Chain Cannot_Chain'] ) -(abstract: #export Unique Any) -(abstract: #export Specific Any) -(abstract: #export Composite Any) +(abstract: .public Unique {} Any) +(abstract: .public Specific {} Any) +(abstract: .public Composite {} Any) -(abstract: #export (Selector kind) +(abstract: .public (Selector kind) + {} + Text - (def: #export selector + (def: .public selector (-> (Selector Any) Text) (|>> :representation)) - (def: #export any + (def: .public any (Selector Cannot_Chain) (:abstraction "*")) - (def: #export tag + (def: .public tag (-> Tag (Selector Cannot_Chain)) (|>> :abstraction)) (template [<name> <type> <prefix> <kind>] - [(def: #export <name> + [(def: .public <name> (-> <type> (Selector <kind>)) (|>> (format <prefix>) :abstraction))] @@ -59,7 +61,7 @@ (template [<right> <left> <combo> <combinator>+] [(`` (template [<combinator> <name>] - [(def: #export (<name> right left) + [(def: .public (<name> right left) (-> (Selector <right>) (Selector <left>) (Selector <combo>)) (:abstraction (format (:representation left) <combinator> @@ -81,15 +83,15 @@ ["~" later]]] ) - (type: #export Combinator + (type: .public Combinator (-> (Selector Any) (Selector Any) (Selector Composite))) - (def: #export (with? attribute) + (def: .public (with? attribute) (-> Attribute (Selector Can_Chain)) (:abstraction (format "[" attribute "]"))) (template [<check> <name>] - [(def: #export (<name> attribute value) + [(def: .public (<name> attribute value) (-> Attribute Text (Selector Can_Chain)) (:abstraction (format "[" attribute <check> value "]")))] @@ -103,7 +105,7 @@ (template [<kind> <pseudo>+] [(`` (template [<name> <pseudo>] - [(def: #export <name> + [(def: .public <name> (Selector Can_Chain) (:abstraction <pseudo>))] @@ -147,7 +149,7 @@ [selection "::selection"]]] ) - (def: #export (language locale) + (def: .public (language locale) (-> Locale (Selector Can_Chain)) (|> locale locale.code @@ -155,32 +157,34 @@ (format ":lang") :abstraction)) - (def: #export not + (def: .public not (-> (Selector Any) (Selector Can_Chain)) (|>> :representation (text.enclosed ["(" ")"]) (format ":not") :abstraction)) - (abstract: #export Index + (abstract: .public Index + {} + Text - (def: #export index + (def: .public index (-> Nat Index) (|>> %.nat :abstraction)) (template [<name> <index>] - [(def: #export <name> Index (:abstraction <index>))] + [(def: .public <name> Index (:abstraction <index>))] [odd "odd"] [even "even"] ) - (type: #export Formula + (type: .public Formula {#constant Int #variable Int}) - (def: #export (formula input) + (def: .public (formula input) (-> Formula Index) (let [(^slots [#constant #variable]) input] (:abstraction (format (if (i.< +0 variable) @@ -189,7 +193,7 @@ (%.int constant))))) (template [<name> <pseudo>] - [(def: #export (<name> index) + [(def: .public (<name> index) (-> Index (Selector Can_Chain)) (|> (:representation index) (text.enclosed ["(" ")"]) diff --git a/stdlib/source/library/lux/data/format/css/style.lux b/stdlib/source/library/lux/data/format/css/style.lux index 5f2c68888..a8ad45203 100644 --- a/stdlib/source/library/lux/data/format/css/style.lux +++ b/stdlib/source/library/lux/data/format/css/style.lux @@ -10,19 +10,19 @@ ["#." value (#+ Value)] ["#." property (#+ Property)]]) -(abstract: #export Style - Text - +(abstract: .public Style {#.doc "The style associated with a CSS selector."} - (def: #export empty + Text + + (def: .public empty Style (:abstraction "")) - (def: #export separator + (def: .public separator " ") - (def: #export (with [property value]) + (def: .public (with [property value]) (All [brand] (-> [(Property brand) (Value brand)] (-> Style Style))) @@ -30,7 +30,7 @@ (format (//property.name property) ": " (//value.value value) ";" ..separator) :abstraction)) - (def: #export inline + (def: .public inline (-> Style Text) (|>> :representation)) ) diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index 6dbf1c3f4..ed2d75319 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -32,15 +32,17 @@ (in (list (code.local_identifier (text.replace_all "-" "_" identifier))))) (template: (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+) - (abstract: #export <abstraction> + (abstract: .public <abstraction> + {} + <representation> - (def: #export <out> + (def: .public <out> (-> <abstraction> <representation>) (|>> :representation)) (`` (template [<name> <value>] - [(def: #export <name> <abstraction> (:abstraction <value>))] + [(def: .public <name> <abstraction> (:abstraction <value>))] (~~ (template.spliced <sample>+)) )) @@ -48,7 +50,7 @@ (template.spliced <definition>+))) (template: (multi: <multi> <type> <separator>) - (def: #export (<multi> pre post) + (def: .public (<multi> pre post) (-> (Value <type>) (Value <type>) (Value <type>)) (:abstraction (format (:representation pre) <separator> @@ -61,15 +63,17 @@ raw (|> raw (text.split 1) maybe.assume product.right)))) -(abstract: #export (Value brand) +(abstract: .public (Value brand) + {} + Text - (def: #export value + (def: .public value (-> (Value Any) Text) (|>> :representation)) (template [<name> <value>] - [(def: #export <name> Value (:abstraction <value>))] + [(def: .public <name> Value (:abstraction <value>))] [initial "initial"] [inherit "inherit"] @@ -77,10 +81,10 @@ ) (template [<brand> <alias>+ <value>+] - [(abstract: #export <brand> Any) + [(abstract: .public <brand> {} Any) (`` (template [<name> <value>] - [(def: #export <name> + [(def: .public <name> (Value <brand>) (:abstraction <value>))] @@ -88,7 +92,7 @@ (with_expansions [<rows> (template.spliced <value>+)] (template [<value>] - [(`` (def: #export (~~ (..text_identifier <value>)) + [(`` (def: .public (~~ (..text_identifier <value>)) (Value <brand>) (:abstraction <value>)))] @@ -793,18 +797,18 @@ [end "end"]] []) - (def: #export (steps intervals step) + (def: .public (steps intervals step) (-> Nat Step (Value Timing)) (..apply "steps" (list (%.nat intervals) (..step step)))) - (def: #export (cubic_bezier p0 p1 p2 p3) + (def: .public (cubic_bezier p0 p1 p2 p3) (-> Frac Frac Frac Frac (Value Timing)) (|> (list p0 p1 p2 p3) (list\map %number) (..apply "cubic-bezier"))) (template [<name> <brand>] - [(def: #export <name> + [(def: .public <name> (-> Nat (Value <brand>)) (|>> %.nat :abstraction))] @@ -814,18 +818,18 @@ [span_line Grid_Span] ) - (def: #export animation + (def: .public animation (-> Label (Value Animation)) (|>> :abstraction)) - (def: #export (rgb color) + (def: .public (rgb color) (-> color.Color (Value Color)) (let [[red green blue] (color.rgb color)] (..apply "rgb" (list (%.nat red) (%.nat green) (%.nat blue))))) - (def: #export (rgba pigment) + (def: .public (rgba pigment) (-> color.Pigment (Value Color)) (let [(^slots [#color.color #color.alpha]) pigment [red green blue] (color.rgb color)] @@ -837,7 +841,7 @@ (format "0" (%.rev alpha))))))) (template [<name> <suffix>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> Frac (Value Length)) (:abstraction (format (%number value) <suffix>)))] @@ -866,7 +870,7 @@ (%.nat (.nat value)))) (template [<name> <suffix>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> Int (Value Time)) (:abstraction (format (if (i.< +0 value) (%.int value) @@ -878,41 +882,45 @@ [milli_seconds "ms"] ) - (def: #export thickness + (def: .public thickness (-> (Value Length) (Value Thickness)) (|>> :transmutation)) (def: slice_separator " ") - (def: #export (slice_number/2 horizontal vertical) + (def: .public (slice_number/2 horizontal vertical) (-> Nat Nat (Value Slice)) (:abstraction (format (%.nat horizontal) ..slice_separator (%.nat vertical)))) - (abstract: #export Stop + (abstract: .public Stop + {} + Text - (def: #export stop + (def: .public stop (-> (Value Color) Stop) (|>> (:representation Value) (:abstraction Stop))) (def: stop_separator " ") - (def: #export (single_stop length color) + (def: .public (single_stop length color) (-> (Value Length) (Value Color) Stop) (:abstraction (format (:representation Value color) ..stop_separator (:representation Value length)))) - (def: #export (double_stop start end color) + (def: .public (double_stop start end color) (-> (Value Length) (Value Length) (Value Color) Stop) (:abstraction (format (:representation Value color) ..stop_separator (:representation Value start) ..stop_separator (:representation Value end)))) - (abstract: #export Hint + (abstract: .public Hint + {} + Text - (def: #export hint + (def: .public hint (-> (Value Length) Hint) (|>> (:representation Value) (:abstraction Hint))) @@ -925,28 +933,30 @@ (#.Some hint) (format (:representation Hint hint) ..value_separator (:representation Stop stop)))))) - (type: #export (List/1 a) + (type: .public (List/1 a) [a (List a)]) - (abstract: #export Angle + (abstract: .public Angle + {} + Text - (def: #export angle + (def: .public angle (-> Angle Text) (|>> :representation)) - (def: #export (turn value) + (def: .public (turn value) (-> Rev Angle) (:abstraction (format (%.rev value) "turn"))) (def: degree_limit Nat 360) - (def: #export (degree value) + (def: .public (degree value) (-> Nat Angle) (:abstraction (format (%.nat (n.% ..degree_limit value)) "deg"))) (template [<degree> <name>] - [(def: #export <name> + [(def: .public <name> Angle (..degree <degree>))] @@ -957,7 +967,7 @@ ) (template [<name> <function>] - [(def: #export (<name> angle start next) + [(def: .public (<name> angle start next) (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) (let [[now after] next] (..apply <function> (list& (:representation Angle angle) @@ -969,31 +979,33 @@ ) ) - (abstract: #export Percentage + (abstract: .public Percentage + {} + Text - (def: #export percentage + (def: .public percentage (-> Percentage Text) (|>> :representation)) (def: percentage_limit Nat (.inc 100)) - (def: #export (%% value) + (def: .public (%% value) (-> Nat Percentage) (:abstraction (format (%.nat (n.% percentage_limit value)) "%"))) - (def: #export slice_percent/1 + (def: .public slice_percent/1 (-> Percentage (Value Slice)) (|>> :representation (:abstraction Value))) - (def: #export (slice_percent/2 horizontal vertical) + (def: .public (slice_percent/2 horizontal vertical) (-> Percentage Percentage (Value Slice)) (:abstraction Value (format (:representation horizontal) ..slice_separator (:representation vertical)))) (template [<input> <pre> <function>+] [(`` (template [<name> <function>] - [(def: #export <name> + [(def: .public <name> (-> <input> (Value Filter)) (|>> <pre> (list) (..apply <function>)))] @@ -1014,13 +1026,13 @@ ) ) - (def: #export svg_filter + (def: .public svg_filter (-> URL (Value Filter)) (|>> (list) (..apply "url"))) (def: default_shadow_length (px +0.0)) - (def: #export (drop_shadow horizontal vertical blur spread color) + (def: .public (drop_shadow horizontal vertical blur spread color) (-> (Value Length) (Value Length) (Maybe (Value Length)) (Maybe (Value Length)) (Value Color) @@ -1037,7 +1049,7 @@ (def: length_separator " ") (template [<name> <type>] - [(def: #export (<name> horizontal vertical) + [(def: .public (<name> horizontal vertical) (-> (Value Length) (Value Length) (Value <type>)) (:abstraction (format (:representation horizontal) ..length_separator @@ -1047,11 +1059,11 @@ [fit Fit] ) - (def: #export (fit/1 length) + (def: .public (fit/1 length) (-> (Value Length) (Value Fit)) (..fit length length)) - (def: #export image + (def: .public image (-> URL (Value Image)) (|>> %.text (list) @@ -1072,7 +1084,7 @@ []) (template [<name> <function>] - [(def: #export (<name> shape extent location start next) + [(def: .public (<name> shape extent location start next) (-> Shape (Maybe Extent) (Value Location) Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) @@ -1093,7 +1105,7 @@ [repeating_radial_gradient "repeating-radial-gradient"] ) - (def: #export (shadow horizontal vertical blur spread color inset?) + (def: .public (shadow horizontal vertical blur spread color inset?) (-> (Value Length) (Value Length) (Maybe (Value Length)) (Maybe (Value Length)) (Value Color) Bit @@ -1110,36 +1122,36 @@ (text.join_with " ") :abstraction))) - (type: #export Rectangle + (type: .public Rectangle {#top (Value Length) #right (Value Length) #bottom (Value Length) #left (Value Length)}) - (def: #export (clip rectangle) + (def: .public (clip rectangle) (-> Rectangle (Value Clip)) (`` (..apply "rect" (list (~~ (template [<side>] [(:representation (get@ <side> rectangle))] [#top] [#right] [#bottom] [#left])))))) - (def: #export counter + (def: .public counter (-> Label (Value Counter)) (|>> :abstraction)) - (def: #export current_count + (def: .public current_count (-> (Value Counter) (Value Content)) (|>> :representation (list) (..apply "counter"))) - (def: #export text + (def: .public text (-> Text (Value Content)) (|>> %.text :abstraction)) - (def: #export attribute + (def: .public attribute (-> Label (Value Content)) (|>> (list) (..apply "attr"))) - (def: #export media + (def: .public media (-> URL (Value Content)) (|>> (list) (..apply "url"))) @@ -1150,11 +1162,11 @@ [cursive "cursive"] [fantasy "fantasy"] [monospace "monospace"]] - [(def: #export font + [(def: .public font (-> Text Font) (|>> %.text :abstraction)) - (def: #export (font_family options) + (def: .public (font_family options) (-> (List Font) (Value Font)) (case options (#.Item _) @@ -1166,35 +1178,35 @@ #.End ..initial))]) - (def: #export font_size + (def: .public font_size (-> (Value Length) (Value Font_Size)) (|>> :transmutation)) - (def: #export number + (def: .public number (-> Frac (Value Number)) (|>> %number :abstraction)) - (def: #export grid + (def: .public grid (-> Label (Value Grid)) (|>> :abstraction)) - (def: #export fit_content + (def: .public fit_content (-> (Value Length) (Value Grid_Content)) (|>> :representation (list) (..apply "fit-content"))) - (def: #export (min_max min max) + (def: .public (min_max min max) (-> (Value Grid_Content) (Value Grid_Content) (Value Grid_Content)) (..apply "minmax" (list (:representation min) (:representation max)))) - (def: #export grid_span + (def: .public grid_span (-> Nat (Value Grid_Span)) (|>> %.nat (format "span ") :abstraction)) (def: grid_column_separator " ") (def: grid_row_separator " ") - (def: #export grid_template + (def: .public grid_template (-> (List (List (Maybe (Value Grid)))) (Value Grid_Template)) (let [empty (: (Value Grid) (:abstraction "."))] @@ -1205,11 +1217,11 @@ (text.join_with ..grid_row_separator) :abstraction))) - (def: #export (resolution dpi) + (def: .public (resolution dpi) (-> Nat (Value Resolution)) (:abstraction (format (%.nat dpi) "dpi"))) - (def: #export (ratio numerator denominator) + (def: .public (ratio numerator denominator) (-> Nat Nat (Value Ratio)) (:abstraction (format (%.nat numerator) "/" (%.nat denominator)))) @@ -1226,20 +1238,20 @@ [double_left_quote "\201C"] [double_right_quote "\201D"] [low_double_quote "\201E"]] - [(def: #export quote + [(def: .public quote (-> Text Quote) (|>> :abstraction))]) (def: quote_separator " ") - (def: #export (quotes [left0 right0] [left1 right1]) + (def: .public (quotes [left0 right0] [left1 right1]) (-> [Quote Quote] [Quote Quote] (Value Quotes)) (|> (list left0 right0 left1 right1) (list\map (|>> ..quote_text %.text)) (text.join_with ..quote_separator) :abstraction)) - (def: #export (matrix_2d [a b] [c d] [tx ty]) + (def: .public (matrix_2d [a b] [c d] [tx ty]) (-> [Frac Frac] [Frac Frac] [Frac Frac] @@ -1248,7 +1260,7 @@ (list\map %number) (..apply "matrix"))) - (def: #export (matrix_3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3]) + (def: .public (matrix_3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3]) (-> [Frac Frac Frac Frac] [Frac Frac Frac Frac] [Frac Frac Frac Frac] @@ -1259,7 +1271,7 @@ (..apply "matrix3d"))) (template [<name> <function> <input_types> <input_values>] - [(`` (def: #export (<name> [(~~ (template.spliced <input_values>))]) + [(`` (def: .public (<name> [(~~ (template.spliced <input_values>))]) (-> [(~~ (template.spliced <input_types>))] (Value Transform)) (|> (list (~~ (template.spliced <input_values>))) (list\map %number) @@ -1281,7 +1293,7 @@ ) (template [<name> <function> <input_types> <input_values>] - [(`` (def: #export (<name> [(~~ (template.spliced <input_values>))]) + [(`` (def: .public (<name> [(~~ (template.spliced <input_values>))]) (-> [(~~ (template.spliced <input_types>))] (Value Transform)) (|> (list (~~ (template.spliced <input_values>))) (list\map ..angle) @@ -1297,29 +1309,29 @@ [skew_y "skewY" [Angle] [angle]] ) - (def: #export (rotate_3d [x y z angle]) + (def: .public (rotate_3d [x y z angle]) (-> [Frac Frac Frac Angle] (Value Transform)) (..apply "rotate3d" (list (%number x) (%number y) (%number z) (..angle angle)))) (def: origin_separator " ") - (def: #export (origin_2d x y) + (def: .public (origin_2d x y) (-> (Value Length) (Value Length) (Value Transform_Origin)) (:abstraction (format (:representation x) ..origin_separator (:representation y)))) - (def: #export (origin_3d x y z) + (def: .public (origin_3d x y z) (-> (Value Length) (Value Length) (Value Length) (Value Transform_Origin)) (:abstraction (format (:representation x) ..origin_separator (:representation y) ..origin_separator (:representation z)))) - (def: #export vertical_align + (def: .public vertical_align (-> (Value Length) (Value Vertical_Align)) (|>> :transmutation)) - (def: #export (z_index index) + (def: .public (z_index index) (-> Int (Value Z_Index)) (:abstraction (if (i.< +0 index) (%.int index) diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 6bbef9f5b..33500a7ac 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -23,17 +23,17 @@ ["." style (#+ Style)]] ["." xml (#+ XML)]]) -(type: #export Tag selector.Tag) -(type: #export ID selector.ID) -(type: #export Class selector.Class) +(type: .public Tag selector.Tag) +(type: .public ID selector.ID) +(type: .public Class selector.Class) -(type: #export Attributes +(type: .public Attributes {#.doc "Attributes for an HTML tag."} (List [Text Text])) -(type: #export Script js.Statement) +(type: .public Script js.Statement) -(type: #export Target +(type: .public Target #Blank #Parent #Self @@ -76,12 +76,14 @@ (-> Tag Text) (text.enclosed ["</" ">"])) -(abstract: #export (HTML brand) +(abstract: .public (HTML brand) + {} + Text (template [<name> <brand>] - [(abstract: #export <brand> Any) - (type: #export <name> (HTML <brand>))] + [(abstract: .public <brand> {} Any) + (type: .public <name> (HTML <brand>))] [Meta Meta'] [Head Head'] @@ -98,12 +100,12 @@ ) (template [<super> <super_raw> <sub>+] - [(abstract: #export (<super_raw> brand) Any) - (type: #export <super> (HTML (<super_raw> Any))) + [(abstract: .public (<super_raw> brand) {} Any) + (type: .public <super> (HTML (<super_raw> Any))) (`` (template [<sub> <sub_raw>] - [(abstract: #export <sub_raw> Any) - (type: #export <sub> (HTML (<super_raw> <sub_raw>)))] + [(abstract: .public <sub_raw> {} Any) + (type: .public <sub> (HTML (<super_raw> <sub_raw>)))] (~~ (template.spliced <sub>+))))] @@ -116,15 +118,15 @@ [Track Track']]] ) - (def: #export html + (def: .public html (-> Document Text) (|>> :representation)) - (def: #export (and pre post) + (def: .public (and pre post) (All [brand] (-> (HTML brand) (HTML brand) (HTML brand))) (:abstraction (format (:representation pre) (:representation post)))) - (def: #export (comment content node) + (def: .public (comment content node) (All [brand] (-> Text (HTML brand) (HTML brand))) (:abstraction (format (text.enclosed ["<!--" "-->"] content) @@ -157,7 +159,7 @@ (..close tag)))) (template [<name> <tag> <brand>] - [(def: #export <name> + [(def: .public <name> (-> Attributes <brand>) (..simple <tag>))] @@ -169,7 +171,7 @@ [parameter "param" Parameter] ) - (def: #export (base href target) + (def: .public (base href target) (-> URL (Maybe Target) Meta) (let [partial (list ["href" href]) full (case target @@ -180,46 +182,46 @@ partial)] (..simple "base" full))) - (def: #export style + (def: .public style (-> Style Meta) (|>> style.inline (..raw "style" (list)))) - (def: #export (script attributes inline) + (def: .public (script attributes inline) (-> Attributes (Maybe Script) Meta) (|> inline (maybe\map js.code) (maybe.else "") (..raw "script" attributes))) - (def: #export text + (def: .public text (-> Text Content) (|>> ..safe :abstraction)) (template [<tag> <alias> <name>] - [(def: #export <name> + [(def: .public <name> Element (..simple <tag> (list))) - (def: #export <alias> <name>)] + (def: .public <alias> <name>)] ["br" br line_break] ["wbr" wbr word_break] ["hr" hr separator] ) - (def: #export (image source attributes) + (def: .public (image source attributes) (-> URL Attributes Image) (|> attributes (#.Item ["src" source]) (..simple "img"))) - (def: #export (svg attributes content) + (def: .public (svg attributes content) (-> Attributes XML Element) (|> content (\ xml.codec encode) (..raw "svg" attributes))) - (type: #export Coord + (type: .public Coord {#horizontal Nat #vertical Nat}) @@ -230,15 +232,15 @@ (Format Coord) (format (%.nat horizontal) ..metric_separator (%.nat vertical))) - (type: #export Rectangle + (type: .public Rectangle {#start Coord #end Coord}) - (type: #export Circle + (type: .public Circle {#center Coord #radius Nat}) - (type: #export Polygon + (type: .public Polygon {#first Coord #second Coord #third Coord @@ -258,7 +260,7 @@ (list\map %coord) (text.join_with ..coord_separator))) - (type: #export Shape + (type: .public Shape (#Rectangle Rectangle) (#Circle Circle) (#Polygon Polygon)) @@ -287,7 +289,7 @@ (#Polygon polygon) (..polygon attributes polygon))) - (def: #export (map attributes areas for) + (def: .public (map attributes areas for) (-> Attributes (List [Attributes Shape]) Image Image) ($_ ..and for @@ -300,7 +302,7 @@ (list\fold (function.flip ..and) head tail))))) (template [<name> <tag> <type>] - [(def: #export <name> + [(def: .public <name> (-> Attributes <type>) (..empty <tag>))] @@ -312,7 +314,7 @@ ) (template [<name> <tag>] - [(def: #export (<name> attributes media on_unsupported) + [(def: .public (<name> attributes media on_unsupported) (-> Attributes Media (Maybe Content) Element) (..tag <tag> attributes (|> on_unsupported @@ -323,20 +325,20 @@ [video "video"] ) - (def: #export (picture attributes sources image) + (def: .public (picture attributes sources image) (-> Attributes Source Image Element) (..tag "picture" attributes (..and sources image))) - (def: #export (anchor href attributes content) + (def: .public (anchor href attributes content) (-> URL Attributes Element Element) (..tag "a" (list& ["href" href] attributes) content)) - (def: #export label + (def: .public label (-> ID Input) (|>> ["for"] list (..empty "label"))) (template [<name> <container_tag> <description_tag> <type>] - [(def: #export (<name> description attributes content) + [(def: .public (<name> description attributes content) (-> (Maybe Content) Attributes <type> <type>) (..tag <container_tag> attributes (case description @@ -354,7 +356,7 @@ ) (template [<name> <tag> <type>] - [(def: #export (<name> attributes content) + [(def: .public (<name> attributes content) (-> Attributes (Maybe Content) <type>) (|> content (maybe.else (..text "")) @@ -364,10 +366,10 @@ [iframe "iframe" Element] ) - (type: #export Phrase (-> Attributes Content Element)) + (type: .public Phrase (-> Attributes Content Element)) (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> Phrase (..tag <tag>))] @@ -403,7 +405,7 @@ [variable "var"] ) - (def: #export incorrect ..struck) + (def: .public incorrect ..struck) (def: (ruby_pronunciation pronunciation) (-> Content (HTML Any)) @@ -413,18 +415,18 @@ pronunciation (..tag "rp" (list) (..text ")"))))) - (def: #export (ruby attributes content pronunciation) + (def: .public (ruby attributes content pronunciation) (-> Attributes Content Content Element) (..tag "ruby" attributes ($_ ..and content (ruby_pronunciation pronunciation)))) - (type: #export Composite + (type: .public Composite (-> Attributes Element Element)) (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> Composite (..tag <tag>))] @@ -450,7 +452,7 @@ ["dd" description Element] ) - (def: #export (description_list attributes descriptions) + (def: .public (description_list attributes descriptions) (-> Attributes (List [Content Element]) Element) (case (list\map (function (_ [term description]) ($_ ..and @@ -464,10 +466,10 @@ (..tag "dl" attributes (list\fold (function.flip ..and) head tail)))) - (def: #export p ..paragraph) + (def: .public p ..paragraph) (template [<name> <tag> <input> <output>] - [(def: #export <name> + [(def: .public <name> (-> Attributes <input> <output>) (..tag <tag>))] @@ -486,7 +488,7 @@ ) (template [<name> <tag> <input> <output>] - [(def: #export <name> + [(def: .public <name> (-> <input> <output>) (..tag <tag> (list)))] @@ -511,7 +513,7 @@ [columns_group "colgroup" Column HTML] ) - (def: #export (table attributes caption columns headers rows footer) + (def: .public (table attributes caption columns headers rows footer) (-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element) (let [head (..table_head (..table_row headers)) content (case (list\map table_row rows) @@ -547,7 +549,7 @@ content))) (template [<name> <doc_type>] - [(def: #export <name> + [(def: .public <name> (-> Head Body Document) (let [doc_type <doc_type>] (function (_ head body) diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 60bcfd107..3f7789e70 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -32,7 +32,7 @@ ["f" frac ("#\." decimal)]]]]]) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Null Any] @@ -41,7 +41,7 @@ [String Text] ) -(type: #export #rec JSON +(type: .public #rec JSON (#Null Null) (#Boolean Boolean) (#Number Number) @@ -50,23 +50,23 @@ (#Object (Dictionary String JSON))) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Array (Row JSON)] [Object (Dictionary String JSON)] ) -(def: #export null? +(def: .public null? (Predicate JSON) (|>> (case> #Null true _ false))) -(def: #export object +(def: .public object (-> (List [String JSON]) JSON) (|>> (dictionary.of_list text.hash) #..Object)) -(syntax: #export (json token) +(syntax: .public (json token) {#.doc (doc "A simple way to produce JSON literals." (json #null) (json #1) @@ -109,7 +109,7 @@ _ (in (list token))))) -(def: #export (fields json) +(def: .public (fields json) {#.doc "Get all the fields in a JSON object."} (-> JSON (Try (List String))) (case json @@ -119,7 +119,7 @@ _ (#try.Failure ($_ text\compose "Cannot get the fields of a non-object.")))) -(def: #export (get key json) +(def: .public (get key json) {#.doc "A JSON object field getter."} (-> String JSON (Try JSON)) (case json @@ -134,7 +134,7 @@ _ (#try.Failure ($_ text\compose "Cannot get field '" key "' on a non-object.")))) -(def: #export (set key value json) +(def: .public (set key value json) {#.doc "A JSON object field setter."} (-> String JSON JSON (Try JSON)) (case json @@ -145,7 +145,7 @@ (#try.Failure ($_ text\compose "Cannot set field '" key "' on a non-object.")))) (template [<name> <tag> <type> <desc>] - [(def: #export (<name> key json) + [(def: .public (<name> key json) {#.doc (code.text ($_ text\compose "A JSON object field getter for " <desc> "."))} (-> Text JSON (Try <type>)) (case (get key json) @@ -165,7 +165,7 @@ [get_object #Object Object "objects"] ) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence JSON) (def: (= x y) @@ -273,7 +273,7 @@ (text.join_with ..value_separator) (text.enclosed [..object_start ..object_end]))) -(def: #export (format json) +(def: .public (format json) (-> JSON Text) (case json (^template [<tag> <format>] @@ -416,7 +416,7 @@ (array_parser json_parser) (object_parser json_parser))))) -(implementation: #export codec +(implementation: .public codec (Codec Text JSON) (def: encode ..format) diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux index 2fbef2fa0..5fe9a9a9d 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -31,17 +31,19 @@ (text.replace_all "." "\.") (text.replace_all "!" "\!"))) -(abstract: #export Span Any) -(abstract: #export Block Any) +(abstract: .public Span {} Any) +(abstract: .public Block {} Any) -(abstract: #export (Markdown brand) +(abstract: .public (Markdown brand) + {} + Text - (def: #export empty + (def: .public empty Markdown (:abstraction "")) - (def: #export text + (def: .public text (-> Text (Markdown Span)) (|>> ..safe :abstraction)) @@ -49,7 +51,7 @@ (format text.new_line text.new_line)) (template [<name> <prefix>] - [(def: #export (<name> content) + [(def: .public (<name> content) (-> Text Markdown) (:abstraction (format <prefix> " " (..safe content) ..blank_line)))] @@ -65,16 +67,16 @@ (-> Text (Markdown Block)) (:abstraction (format content ..blank_line))) - (def: #export paragraph + (def: .public paragraph (-> (Markdown Span) (Markdown Block)) (|>> :representation ..block)) - (def: #export break + (def: .public break (Markdown Span) (:abstraction (format " " text.new_line))) (template [<name> <wrapper>] - [(def: #export <name> + [(def: .public <name> (-> (Markdown Span) (Markdown Span)) (|>> :representation (text.enclosed [<wrapper> <wrapper>]) @@ -97,13 +99,13 @@ (-> Text Text) (..prefix text.tab)) - (def: #export quote + (def: .public quote (-> (Markdown Block) (Markdown Block)) (|>> :representation (..prefix "> ") :abstraction)) - (def: #export numbered_list + (def: .public numbered_list (-> (List [(Markdown Span) (Maybe (Markdown Block))]) (Markdown Block)) (|>> list.enumeration @@ -118,7 +120,7 @@ (text.join_with text.new_line) ..block)) - (def: #export bullet_list + (def: .public bullet_list (-> (List [(Markdown Span) (Maybe (Markdown Block))]) (Markdown Block)) (|>> (list\map (function (_ [summary detail]) @@ -132,35 +134,35 @@ (text.join_with text.new_line) ..block)) - (def: #export snippet + (def: .public snippet {#.doc "A snippet of code."} (-> Text (Markdown Span)) (|>> ..safe (text.enclosed ["`" "`"]) :abstraction)) - (def: #export code + (def: .public code {#.doc "A block of code."} (-> Text (Markdown Block)) (let [open (format "```" text.new_line) close (format text.new_line "```")] (|>> (text.enclosed [open close]) ..block))) - (def: #export (image description url) + (def: .public (image description url) (-> Text URL (Markdown Span)) (:abstraction (format "![" (..safe description) "](" url ")"))) - (def: #export horizontal_rule + (def: .public horizontal_rule (Markdown Block) (..block "___")) - (def: #export (link description url) + (def: .public (link description url) (-> (Markdown Span) URL (Markdown Span)) (:abstraction (format "[" (:representation description) "](" url ")"))) - (type: #export Email + (type: .public Email Text) (template [<name> <type>] - [(def: #export <name> + [(def: .public <name> (-> <type> (Markdown Span)) (|>> (text.enclosed ["<" ">"]) :abstraction))] @@ -169,7 +171,7 @@ ) (template [<name> <brand> <infix>] - [(def: #export (<name> pre post) + [(def: .public (<name> pre post) (-> (Markdown <brand>) (Markdown <brand>) (Markdown <brand>)) (:abstraction (format (:representation pre) <infix> (:representation post))))] @@ -177,7 +179,7 @@ [then Block ""] ) - (def: #export markdown + (def: .public markdown (-> (Markdown Any) Text) (|>> :representation)) ) diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 1f1451790..e60c13e05 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -56,28 +56,30 @@ (template [<exception> <limit> <size> <type> <in> <out> <writer> <suffix> <coercion>] - [(def: #export <limit> + [(def: .public <limit> Nat (|> ..octal_size (list.repeat <size>) (list\fold n.* 1) inc)) - (exception: #export (<exception> {value Nat}) + (exception: .public (<exception> {value Nat}) (exception.report ["Value" (%.nat value)] ["Maximum" (%.nat (dec <limit>))])) - (abstract: #export <type> + (abstract: .public <type> + {} + Nat - (def: #export (<in> value) + (def: .public (<in> value) (-> Nat (Try <type>)) (if (n.< <limit> value) (#try.Success (:abstraction value)) (exception.except <exception> [value]))) - (def: #export <out> + (def: .public <out> (-> <type> Nat) (|>> :representation)) @@ -108,7 +110,7 @@ as_big] ) -(exception: #export (wrong_character {expected Char} {actual Char}) +(exception: .public (wrong_character {expected Char} {actual Char}) (exception.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) @@ -152,6 +154,8 @@ (..big value))))) (abstract: Checksum + {} + Text (def: from_checksum @@ -217,12 +221,12 @@ (n.<= ..last_ascii char))) true))) -(exception: #export (not_ascii {text Text}) +(exception: .public (not_ascii {text Text}) (exception.report ["Text" (%.text text)])) -(def: #export name_size Size 31) -(def: #export path_size Size 99) +(def: .public name_size Size 31) +(def: .public path_size Size 99) (def: (un_padded string) (-> Binary (Try Binary)) @@ -241,16 +245,18 @@ (binary.slice 0 (inc end) string)))))))) (template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>] - [(abstract: #export <type> + [(abstract: .public <type> + {} + <representation> - (exception: #export (<exception> {value Text}) + (exception: .public (<exception> {value Text}) (exception.report ["Value" (%.text value)] ["Size" (%.nat (text.size value))] ["Maximum" (%.nat <size>)])) - (def: #export (<in> value) + (def: .public (<in> value) (-> <representation> (Try <type>)) (if (..ascii? value) (if (|> value (\ utf8.codec encode) binary.size (n.<= <size>)) @@ -258,7 +264,7 @@ (exception.except <exception> [value])) (exception.except ..not_ascii [value]))) - (def: #export <out> + (def: .public <out> (-> <type> <representation>) (|>> :representation)) @@ -285,7 +291,7 @@ text (\ utf8.codec decode ascii)] (<in> text))))) - (def: #export <none> + (def: .public <none> <type> (try.assumed (<in> ""))) )] @@ -297,6 +303,8 @@ (def: magic_size Size 7) (abstract: Magic + {} + Text (def: ustar (:abstraction "ustar ")) @@ -383,6 +391,8 @@ (..small_number ..device_size))) (abstract: Link_Flag + {} + Char (def: link_flag @@ -411,7 +421,7 @@ <options> ) - (exception: #export (invalid_link_flag {value Nat}) + (exception: .public (invalid_link_flag {value Nat}) (exception.report ["Value" (%.nat value)])) @@ -430,14 +440,16 @@ (exception.except ..invalid_link_flag [(.nat linkflag)])))))) ) -(abstract: #export Mode +(abstract: .public Mode + {} + Nat - (def: #export mode + (def: .public mode (-> Mode Nat) (|>> :representation)) - (def: #export (and left right) + (def: .public (and left right) (-> Mode Mode Mode) (:abstraction (i64.or (:representation left) @@ -450,7 +462,7 @@ try.assumed ..small_writer)) - (exception: #export (invalid_mode {value Nat}) + (exception: .public (invalid_mode {value Nat}) (exception.report ["Value" (%.nat value)])) @@ -472,7 +484,7 @@ ["2000" set_group_id_on_execution] ["4000" set_user_id_on_execution])] (template [<code> <name>] - [(def: #export <name> + [(def: .public <name> Mode (:abstraction (number.oct <code>)))] @@ -518,10 +530,12 @@ (list.repeat ..content_size) (list\fold n.* 1))) -(abstract: #export Content +(abstract: .public Content + {} + [Big Binary] - (def: #export (content content) + (def: .public (content content) (-> Binary (Try Content)) (do try.monad [size (..big (binary.size content))] @@ -531,35 +545,35 @@ (-> Content [Big Binary]) (|>> :representation)) - (def: #export data + (def: .public data (-> Content Binary) (|>> :representation product.right)) ) -(type: #export ID +(type: .public ID Small) -(def: #export no_id +(def: .public no_id ID (..as_small 0)) -(type: #export Owner +(type: .public Owner {#name Name #id ID}) -(type: #export Ownership +(type: .public Ownership {#user Owner #group Owner}) -(type: #export File +(type: .public File [Path Instant Mode Ownership Content]) -(type: #export Normal File) -(type: #export Symbolic_Link Path) -(type: #export Directory Path) -(type: #export Contiguous File) +(type: .public Normal File) +(type: .public Symbolic_Link Path) +(type: .public Directory Path) +(type: .public Contiguous File) -(type: #export Entry +(type: .public Entry (#Normal ..Normal) (#Symbolic_Link ..Symbolic_Link) (#Directory ..Directory) @@ -572,7 +586,7 @@ Device (try.assumed (..small 0))) -(type: #export Tar +(type: .public Tar (Row Entry)) (def: (blocks size) @@ -717,7 +731,7 @@ (def: end_of_archive_size Size (n.* 2 ..block_size)) -(def: #export writer +(def: .public writer (Writer Tar) (let [end_of_archive (binary.create ..end_of_archive_size)] (function (_ tar) @@ -727,7 +741,7 @@ tar) (format.segment ..end_of_archive_size end_of_archive))))) -(exception: #export (wrong_checksum {expected Nat} {actual Nat}) +(exception: .public (wrong_checksum {expected Nat} {actual Nat}) (exception.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) @@ -789,7 +803,7 @@ #major_device major_device #minor_device minor_device}))) -(exception: #export (wrong_link_flag {expected Link_Flag} {actual Link_Flag}) +(exception: .public (wrong_link_flag {expected Link_Flag} {actual Link_Flag}) (exception.report ["Expected" (%.nat (..link_flag expected))] ["Actual" (%.nat (..link_flag actual))])) @@ -854,7 +868,7 @@ (exception.assertion ..wrong_checksum [0 actual] (n.= 0 actual)))))) -(exception: #export invalid_end_of_archive) +(exception: .public invalid_end_of_archive) (def: end_of_archive_parser (Parser Any) @@ -865,7 +879,7 @@ (exception.assertion ..invalid_end_of_archive [] done?)))) -(def: #export parser +(def: .public parser (Parser Tar) (|> (<>.some entry_parser) (\ <>.monad map row.of_list) diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index 843a35c91..54e544583 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -21,21 +21,21 @@ ["n" nat] ["." int]]]]]) -(type: #export Tag +(type: .public Tag Name) -(type: #export Attribute +(type: .public Attribute Name) -(type: #export Attrs +(type: .public Attrs (Dictionary Attribute Text)) -(def: #export attributes +(def: .public attributes {#.doc (doc "An empty set of XML attributes.")} Attrs (dictionary.empty name.hash)) -(type: #export #rec XML +(type: .public #rec XML (#Text Text) (#Node Tag Attrs (List XML))) @@ -206,14 +206,14 @@ (text.replace_all "'" "'") (text.replace_all text.double_quote """))) -(def: #export (tag [namespace name]) +(def: .public (tag [namespace name]) {#.doc (doc "The text format of a XML tag.")} (-> Tag Text) (case namespace "" name _ ($_ text\compose namespace ..namespace_separator name))) -(def: #export attribute +(def: .public attribute {#.doc (doc "The text format of a XML attribute.")} (-> Attribute Text) ..tag) @@ -229,7 +229,7 @@ " encoding=" (quote "UTF-8") "?>"))) -(implementation: #export codec +(implementation: .public codec (Codec Text XML) (def: encode @@ -275,7 +275,7 @@ (def: decode (<text>.run ..xml^))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence XML) (def: (= reference sample) diff --git a/stdlib/source/library/lux/data/identity.lux b/stdlib/source/library/lux/data/identity.lux index 851504816..be7560d60 100644 --- a/stdlib/source/library/lux/data/identity.lux +++ b/stdlib/source/library/lux/data/identity.lux @@ -9,29 +9,29 @@ [control ["." function]]]]) -(type: #export (Identity a) +(type: .public (Identity a) {#.doc (doc "A value, as is, without any extra structure super-imposed on it.")} a) -(implementation: #export functor +(implementation: .public functor (Functor Identity) (def: map function.identity)) -(implementation: #export apply +(implementation: .public apply (Apply Identity) (def: &functor ..functor) (def: (apply ff fa) (ff fa))) -(implementation: #export monad +(implementation: .public monad (Monad Identity) (def: &functor ..functor) (def: in function.identity) (def: join function.identity)) -(implementation: #export comonad +(implementation: .public comonad (CoMonad Identity) (def: &functor ..functor) diff --git a/stdlib/source/library/lux/data/lazy.lux b/stdlib/source/library/lux/data/lazy.lux index d4b345f87..1fa45e583 100644 --- a/stdlib/source/library/lux/data/lazy.lux +++ b/stdlib/source/library/lux/data/lazy.lux @@ -17,12 +17,12 @@ [type abstract]]]) -(abstract: #export (Lazy a) - (-> [] a) - +(abstract: .public (Lazy a) {#.doc (doc "A value specified by an expression that is calculated only at the last moment possible." "Afterwards, the value is cached for future reference.")} + (-> [] a) + (def: (lazy' generator) (All [a] (-> (-> [] a) (Lazy a))) (let [cache (atom.atom #.None)] @@ -36,36 +36,36 @@ (exec (io.run (atom.compare_and_swap _ (#.Some value) cache)) value))))))) - (def: #export (value lazy) + (def: .public (value lazy) (All [a] (-> (Lazy a) a)) ((:representation lazy) []))) -(syntax: #export (lazy expression) +(syntax: .public (lazy expression) {#.doc (doc "Specifies a lazy value by providing the expression that computes it.")} (with_gensyms [g!_] (in (list (` ((~! lazy') (function ((~ g!_) (~ g!_)) (~ expression)))))))) -(implementation: #export (equivalence (^open "\.")) +(implementation: .public (equivalence (^open "\.")) (All [a] (-> (Equivalence a) (Equivalence (Lazy a)))) (def: (= left right) (\= (..value left) (..value right)))) -(implementation: #export functor +(implementation: .public functor (Functor Lazy) (def: (map f fa) (lazy (f (value fa))))) -(implementation: #export apply +(implementation: .public apply (Apply Lazy) (def: &functor ..functor) (def: (apply ff fa) (lazy ((value ff) (value fa))))) -(implementation: #export monad +(implementation: .public monad (Monad Lazy) (def: &functor ..functor) diff --git a/stdlib/source/library/lux/data/maybe.lux b/stdlib/source/library/lux/data/maybe.lux index bab93295d..a34bf2948 100644 --- a/stdlib/source/library/lux/data/maybe.lux +++ b/stdlib/source/library/lux/data/maybe.lux @@ -15,7 +15,7 @@ ## #.None ## (#.Some a)) -(implementation: #export monoid +(implementation: .public monoid (All [a] (Monoid (Maybe a))) (def: identity #.None) @@ -28,7 +28,7 @@ (#.Some x) (#.Some x)))) -(implementation: #export functor +(implementation: .public functor (Functor Maybe) (def: (map f ma) @@ -36,7 +36,7 @@ #.None #.None (#.Some a) (#.Some (f a))))) -(implementation: #export apply +(implementation: .public apply (Apply Maybe) (def: &functor ..functor) @@ -49,7 +49,7 @@ _ #.None))) -(implementation: #export monad +(implementation: .public monad (Monad Maybe) (def: &functor ..functor) @@ -65,7 +65,7 @@ (#.Some mx) mx))) -(implementation: #export (equivalence super) +(implementation: .public (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Maybe a)))) (def: (= mx my) @@ -79,7 +79,7 @@ _ #0))) -(implementation: #export (hash super) +(implementation: .public (hash super) (All [a] (-> (Hash a) (Hash (Maybe a)))) (def: &equivalence @@ -93,7 +93,7 @@ (#.Some value) (\ super hash value)))) -(implementation: #export (with monad) +(implementation: .public (with monad) (All [M] (-> (Monad M) (Monad (All [a] (M (Maybe a)))))) (def: &functor (functor.compose (get@ #monad.&functor monad) ..functor)) @@ -110,12 +110,12 @@ (#.Some Mma) Mma)))) -(def: #export (lift monad) +(def: .public (lift monad) {#.doc (doc "Wraps a monadic value with Maybe machinery.")} (All [M a] (-> (Monad M) (-> (M a) (M (Maybe a))))) (\ monad map (\ ..monad in))) -(macro: #export (else tokens state) +(macro: .public (else tokens state) {#.doc (doc "Allows you to provide a default value that will be used" "if a (Maybe x) value turns out to be #.None." "Note: the expression for the default value will not be computed if the base computation succeeds." @@ -139,14 +139,14 @@ _ (#.Left "Wrong syntax for else"))) -(def: #export assume +(def: .public assume {#.doc (doc "Assumes that a Maybe value is a #.Some and yields its value." "Raises/throws a runtime error otherwise." "WARNING: Use with caution.")} (All [a] (-> (Maybe a) a)) (|>> (..else (undefined)))) -(def: #export (list value) +(def: .public (list value) (All [a] (-> (Maybe a) (List a))) (case value #.None @@ -155,7 +155,7 @@ (#.Some value) (#.Item value #.End))) -(macro: #export (when tokens state) +(macro: .public (when tokens state) {#.doc (doc "Can be used as a guard in (co)monadic be/do expressions." (do monad [value (do_something 1 2 3) diff --git a/stdlib/source/library/lux/data/name.lux b/stdlib/source/library/lux/data/name.lux index cd4b3b67d..1cc1d321c 100644 --- a/stdlib/source/library/lux/data/name.lux +++ b/stdlib/source/library/lux/data/name.lux @@ -14,7 +14,7 @@ ## [Text Text]) (template [<name> <doc>] - [(def: #export (<name> name) + [(def: .public (<name> name) {#.doc (doc <doc>)} (-> Name Text) (let [[module short] name] @@ -24,15 +24,15 @@ [short "The short part of a name."] ) -(def: #export hash +(def: .public hash (Hash Name) (product.hash text.hash text.hash)) -(def: #export equivalence +(def: .public equivalence (Equivalence Name) (\ ..hash &equivalence)) -(implementation: #export order +(implementation: .public order (Order Name) (def: &equivalence ..equivalence) @@ -44,7 +44,7 @@ (def: separator ".") -(implementation: #export codec +(implementation: .public codec (Codec Text Name) (def: (encode [module short]) diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux index 25e6b02d0..9a8d5da7d 100644 --- a/stdlib/source/library/lux/data/product.lux +++ b/stdlib/source/library/lux/data/product.lux @@ -7,7 +7,7 @@ [hash (#+ Hash)]]]]) (template [<name> <doc>] - [(def: #export (<name> pair) + [(def: .public (<name> pair) {#.doc (doc <doc>)} (All [left right] (-> [left right] <name>)) @@ -19,7 +19,7 @@ ) ## https://en.wikipedia.org/wiki/Currying -(def: #export (curry f) +(def: .public (curry f) {#.doc (doc "Converts a 2-argument function into nested single-argument functions.")} (All [a b c] (-> (-> [a b] c) @@ -27,7 +27,7 @@ (function (_ x y) (f [x y]))) -(def: #export (uncurry f) +(def: .public (uncurry f) {#.doc (doc "Converts nested single-argument functions into a 2-argument function.")} (All [a b c] (-> (-> a b c) @@ -36,12 +36,12 @@ (let [[x y] xy] (f x y)))) -(def: #export (swap xy) +(def: .public (swap xy) (All [a b] (-> [a b] [b a])) (let [[x y] xy] [y x])) -(def: #export (apply f g) +(def: .public (apply f g) {#.doc (doc "Apply functions to both sides of a pair.")} (All [a b c d] (-> (-> a c) (-> b d) @@ -49,7 +49,7 @@ (function (_ [x y]) [(f x) (g y)])) -(def: #export (fork f g) +(def: .public (fork f g) {#.doc (doc "Yields a pair by applying both functions to a single value.")} (All [a l r] (-> (-> a l) (-> a r) @@ -57,14 +57,14 @@ (function (_ x) [(f x) (g x)])) -(implementation: #export (equivalence left right) +(implementation: .public (equivalence left right) (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence [l r]))) (def: (= [rl rr] [sl sr]) (and (\ left = rl sl) (\ right = rr sr)))) -(def: #export (hash left right) +(def: .public (hash left right) (All [l r] (-> (Hash l) (Hash r) (Hash [l r]))) (implementation (def: &equivalence diff --git a/stdlib/source/library/lux/data/store.lux b/stdlib/source/library/lux/data/store.lux index ecc34fde5..ba795f4d1 100644 --- a/stdlib/source/library/lux/data/store.lux +++ b/stdlib/source/library/lux/data/store.lux @@ -7,7 +7,7 @@ [type implicit]]]) -(type: #export (Store s a) +(type: .public (Store s a) {#cursor s #peek (-> s a)}) @@ -16,7 +16,7 @@ {#cursor (get@ #cursor wa) #peek (function (_ s) (f (set@ #cursor s wa)))}) -(implementation: #export functor +(implementation: .public functor (All [s] (Functor (Store s))) (def: (map f fa) @@ -24,7 +24,7 @@ (f (\ store peek (\ store cursor)))) fa))) -(implementation: #export comonad +(implementation: .public comonad (All [s] (CoMonad (Store s))) (def: &functor ..functor) @@ -33,18 +33,18 @@ (def: split (extend id))) -(def: #export (peeks trans store) +(def: .public (peeks trans store) (All [s a] (-> (-> s s) (Store s a) a)) (|> (\\ cursor) trans (\\ peek))) -(def: #export (seek cursor store) +(def: .public (seek cursor store) (All [s a] (-> s (Store s a) (Store s a))) (\ (\\ split store) peek cursor)) -(def: #export (seeks change store) +(def: .public (seeks change store) (All [s a] (-> (-> s s) (Store s a) (Store s a))) (|> store (\\ split) (peeks change))) -(def: #export (experiment Functor<f> change store) +(def: .public (experiment Functor<f> change store) (All [f s a] (-> (Functor f) (-> s (f s)) (Store s a) (f a))) (\ Functor<f> map (\\ peek) (change (\\ cursor)))) diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux index 224ba3878..bde3fc86f 100644 --- a/stdlib/source/library/lux/data/sum.lux +++ b/stdlib/source/library/lux/data/sum.lux @@ -7,7 +7,7 @@ [hash (#+ Hash)]]]]) (template [<right?> <name> <doc>] - [(def: #export (<name> value) + [(def: .public (<name> value) {#.doc (doc <doc>)} (All [left right] (-> <name> (Or left right))) @@ -18,7 +18,7 @@ [#1 right "Lifts value to the right side of a 2-variant."]) -(def: #export (either fl fr) +(def: .public (either fl fr) {#.doc (doc "Applies a function to either side of a 2-variant.")} (All [a b c] (-> (-> a c) (-> b c) @@ -28,7 +28,7 @@ (0 #0 l) (fl l) (0 #1 r) (fr r)))) -(def: #export (apply fl fr) +(def: .public (apply fl fr) {#.doc (doc "Applies functions to both sides of a 2-variant.")} (All [l l' r r'] (-> (-> l l') (-> r r') @@ -39,7 +39,7 @@ (0 #1 r) (0 #1 (fr r))))) (template [<name> <side> <right?>] - [(def: #export (<name> es) + [(def: .public (<name> es) (All [a b] (-> (List (Or a b)) (List <side>))) (case es #.End @@ -55,7 +55,7 @@ [rights b #1] ) -(def: #export (partition xs) +(def: .public (partition xs) (All [a b] (-> (List (Or a b)) [(List a) (List b)])) (case xs #.End @@ -67,7 +67,7 @@ (0 #0 x') [(#.Item x' lefts) rights] (0 #1 x') [lefts (#.Item x' rights)])))) -(def: #export (equivalence left right) +(def: .public (equivalence left right) (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (Or l r)))) (implementation (def: (= reference sample) @@ -81,7 +81,7 @@ _ false)))) -(def: #export (hash left right) +(def: .public (hash left right) (All [l r] (-> (Hash l) (Hash r) (Hash (Or l r)))) (implementation (def: &equivalence diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index f4870ecf5..f58365d66 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -18,19 +18,19 @@ ["n" nat] ["." i64]]]]]) -(type: #export Char +(type: .public Char {#.doc (doc "A character code number.")} Nat) ## TODO: Instead of ints, chars should be produced fron nats. ## (The JVM specifies chars as 16-bit unsigned integers) -(def: #export of_char +(def: .public of_char (-> Char Text) (|>> .int "lux i64 char")) (template [<code> <short> <long>] - [(def: #export <long> (..of_char <code>)) - (def: #export <short> <long>)] + [(def: .public <long> (..of_char <code>)) + (def: .public <short> <long>)] [00 \0 null] [07 \a alarm] @@ -43,26 +43,26 @@ [34 \'' double_quote] ) -(def: #export line_feed +(def: .public line_feed {#.doc (doc "Same as 'new_line'.")} ..new_line) -(def: #export size +(def: .public size (-> Text Nat) (|>> "lux text size")) -(def: #export (char index input) +(def: .public (char index input) {#.doc (doc "Yields the character at the specified index.")} (-> Nat Text (Maybe Char)) (if (n.< ("lux text size" input) index) (#.Some ("lux text char" index input)) #.None)) -(def: #export (index_of' from pattern input) +(def: .public (index_of' from pattern input) (-> Nat Text Text (Maybe Nat)) ("lux text index" from pattern input)) -(def: #export (index_of pattern input) +(def: .public (index_of pattern input) (-> Text Text (Maybe Nat)) (index_of' 0 pattern input)) @@ -79,11 +79,11 @@ (#.Some from') (recur (inc from') output'))))) -(def: #export (last_index_of part text) +(def: .public (last_index_of part text) (-> Text Text (Maybe Nat)) (last_index_of' 0 part text)) -(def: #export (starts_with? prefix x) +(def: .public (starts_with? prefix x) (-> Text Text Bit) (case (index_of prefix x) (#.Some 0) @@ -92,7 +92,7 @@ _ false)) -(def: #export (ends_with? postfix x) +(def: .public (ends_with? postfix x) (-> Text Text Bit) (case (last_index_of postfix x) (#.Some n) @@ -102,12 +102,12 @@ _ false)) -(def: #export (enclosed_by? boundary value) +(def: .public (enclosed_by? boundary value) (-> Text Text Bit) (and (starts_with? boundary value) (ends_with? boundary value))) -(def: #export (contains? sub text) +(def: .public (contains? sub text) (-> Text Text Bit) (case ("lux text index" 0 sub text) (#.Some _) @@ -116,36 +116,36 @@ _ false)) -(def: #export (prefix param subject) +(def: .public (prefix param subject) (-> Text Text Text) ("lux text concat" param subject)) -(def: #export (suffix param subject) +(def: .public (suffix param subject) (-> Text Text Text) ("lux text concat" subject param)) -(def: #export (enclosed [left right] content) +(def: .public (enclosed [left right] content) {#.doc "Surrounds the given content text with left and right side additions."} (-> [Text Text] Text Text) ($_ "lux text concat" left content right)) -(def: #export (enclosed' boundary content) +(def: .public (enclosed' boundary content) {#.doc "Surrounds the given content text with the same boundary text."} (-> Text Text Text) (enclosed [boundary boundary] content)) -(def: #export format +(def: .public format (-> Text Text) (..enclosed' ..double_quote)) -(def: #export (clip offset size input) +(def: .public (clip offset size input) {#.doc (doc "Clips a chunk of text from the input at the specified offset and of the specified size.")} (-> Nat Nat Text (Maybe Text)) (if (|> size (n.+ offset) (n.<= ("lux text size" input))) (#.Some ("lux text clip" offset size input)) #.None)) -(def: #export (clip' offset input) +(def: .public (clip' offset input) {#.doc (doc "Clips the remaining text from the input at the specified offset.")} (-> Nat Text (Maybe Text)) (let [size ("lux text size" input)] @@ -153,7 +153,7 @@ (#.Some ("lux text clip" offset (n.- offset size) input)) #.None))) -(def: #export (split at x) +(def: .public (split at x) (-> Nat Text (Maybe [Text Text])) (case [(..clip 0 at x) (..clip' at x)] [(#.Some pre) (#.Some post)] @@ -162,7 +162,7 @@ _ #.None)) -(def: #export (split_with token sample) +(def: .public (split_with token sample) (-> Text Text (Maybe [Text Text])) (do maybe.monad [index (index_of token sample) @@ -170,7 +170,7 @@ [_ post] (split (size token) post')] (in [pre post]))) -(def: #export (split_all_with token sample) +(def: .public (split_all_with token sample) (-> Text Text (List Text)) (loop [input sample output (: (List Text) (list))] @@ -185,14 +185,14 @@ (#.Item input) list.reversed)))) -(def: #export (replace_once pattern replacement template) +(def: .public (replace_once pattern replacement template) (-> Text Text Text Text) (<| (maybe.else template) (do maybe.monad [[pre post] (..split_with pattern template)] (in ($_ "lux text concat" pre replacement post))))) -(def: #export (replace_all pattern replacement template) +(def: .public (replace_all pattern replacement template) (-> Text Text Text Text) (for {@.old (:as Text @@ -235,13 +235,13 @@ #.None ("lux text concat" left right))))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Text) (def: (= reference sample) ("lux text =" reference sample))) -(implementation: #export order +(implementation: .public order (Order Text) (def: &equivalence ..equivalence) @@ -249,7 +249,7 @@ (def: (< reference sample) ("lux text <" reference sample))) -(implementation: #export monoid +(implementation: .public monoid (Monoid Text) (def: identity "") @@ -257,7 +257,7 @@ (def: (compose left right) ("lux text concat" left right))) -(implementation: #export hash +(implementation: .public hash (Hash Text) (def: &equivalence ..equivalence) @@ -290,27 +290,27 @@ (n.+ ("lux text char" index input)))) hash)))))) -(def: #export concat +(def: .public concat (-> (List Text) Text) (let [(^open ".") ..monoid] (|>> list.reversed (list\fold compose identity)))) -(def: #export (join_with separator texts) +(def: .public (join_with separator texts) (-> Text (List Text) Text) (|> texts (list.interpose separator) concat)) -(def: #export (empty? text) +(def: .public (empty? text) (-> Text Bit) (case text "" true _ false)) -(def: #export space +(def: .public space Text " ") -(def: #export (space? char) +(def: .public (space? char) {#.doc "Checks whether the character is white-space."} (-> Char Bit) (with_expansions [<options> (template [<char>] @@ -330,7 +330,7 @@ _ false)))) -(def: #export (lower_cased value) +(def: .public (lower_cased value) (-> Text Text) (for {@.old (:as Text @@ -353,7 +353,7 @@ (:as Text ("ruby object do" "downcase" value))})) -(def: #export (upper_cased value) +(def: .public (upper_cased value) (-> Text Text) (for {@.old (:as Text diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux index d20dc21b9..332504d08 100644 --- a/stdlib/source/library/lux/data/text/buffer.lux +++ b/stdlib/source/library/lux/data/text/buffer.lux @@ -47,7 +47,9 @@ )} (as_is)))) -(`` (abstract: #export Buffer +(`` (abstract: .public Buffer + {#.doc "Immutable text buffer for efficient text concatenation."} + (for {@.old [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.jvm [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.js [Nat (-> (JS_Array Text) (JS_Array Text))] @@ -55,9 +57,7 @@ ## default (Row Text)) - {#.doc "Immutable text buffer for efficient text concatenation."} - - (def: #export empty + (def: .public empty Buffer (:abstraction (with_expansions [<jvm> [0 function.identity]] (for {@.old <jvm> @@ -67,7 +67,7 @@ ## default row.empty)))) - (def: #export (append chunk buffer) + (def: .public (append chunk buffer) (-> Text Buffer Buffer) (with_expansions [<jvm> (let [[capacity transform] (:representation buffer) append! (: (-> Text java/lang/StringBuilder java/lang/StringBuilder) @@ -99,7 +99,7 @@ ## default (|> buffer :representation (row.add chunk) :abstraction)))) - (def: #export size + (def: .public size (-> Buffer Nat) (with_expansions [<jvm> (|>> :representation product.left)] (for {@.old <jvm> @@ -112,7 +112,7 @@ (n.+ (//.size chunk) total)) 0))))) - (def: #export (text buffer) + (def: .public (text buffer) (-> Buffer Text) (with_expansions [<jvm> (let [[capacity transform] (:representation buffer)] (|> (java/lang/StringBuilder::new (.int capacity)) diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux index 8829d7d92..7f94a8c08 100644 --- a/stdlib/source/library/lux/data/text/encoding.lux +++ b/stdlib/source/library/lux/data/text/encoding.lux @@ -6,11 +6,13 @@ ## https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html -(abstract: #export Encoding +(abstract: .public Encoding + {} + Text (template [<name> <encoding>] - [(def: #export <name> + [(def: .public <name> Encoding (:abstraction <encoding>))] @@ -159,7 +161,7 @@ [koi8_u "KOI8-U"] ) - (def: #export name + (def: .public name (-> Encoding Text) (|>> :representation)) ) diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux index 7e5c8a4e2..5892d403d 100644 --- a/stdlib/source/library/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux @@ -157,7 +157,7 @@ ..utf8->string #try.Success)}))) -(implementation: #export codec +(implementation: .public codec {#.doc (doc "A codec for binary encoding of text as UTF-8.")} (Codec Binary Text) diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index d34c91d70..7e02459e1 100644 --- a/stdlib/source/library/lux/data/text/escape.lux +++ b/stdlib/source/library/lux/data/text/escape.lux @@ -68,7 +68,7 @@ (def: ascii_bottom (hex "20")) (def: ascii_top (hex "7E")) -(def: #export (escapable? char) +(def: .public (escapable? char) (-> Char Bit) (case char (^template [<char>] @@ -109,7 +109,7 @@ ("lux text clip" post_offset post_limit current) post_limit])) -(def: #export (escape text) +(def: .public (escape text) {#.doc (doc "Yields a escaped version of the text.")} (-> Text Text) (loop [offset 0 @@ -141,18 +141,18 @@ (recur (inc offset) previous current limit))) (format previous current)))) -(exception: #export (dangling_escape {text Text}) +(exception: .public (dangling_escape {text Text}) (exception.report ["In" (%.text text)] ["At" (%.nat (dec (//.size text)))])) -(exception: #export (invalid_escape {text Text} {offset Nat} {sigil Char}) +(exception: .public (invalid_escape {text Text} {offset Nat} {sigil Char}) (exception.report ["In" (%.text text)] ["At" (%.nat offset)] ["Name" (%.text (//.of_char sigil))])) -(exception: #export (invalid_unicode_escape {text Text} {offset Nat}) +(exception: .public (invalid_unicode_escape {text Text} {offset Nat}) (exception.report ["In" (%.text text)] ["At" (%.nat offset)])) @@ -191,7 +191,7 @@ (#try.Failure error) (exception.except ..invalid_unicode_escape [current offset]))) -(def: #export (un_escape text) +(def: .public (un_escape text) {#.doc (doc "Yields an un-escaped text." "Fails if it was improperly escaped.")} (-> Text (Try Text)) @@ -238,7 +238,7 @@ "" current _ (format previous current)))))) -(syntax: #export (escaped {literal <code>.text}) +(syntax: .public (escaped {literal <code>.text}) {#.doc (doc "If given a escaped text literal, expands to an un-escaped version.")} (case (..un_escape literal) (#try.Success un_escaped) diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux index cf4b3e2d4..4cfd5cb34 100644 --- a/stdlib/source/library/lux/data/text/format.lux +++ b/stdlib/source/library/lux/data/text/format.lux @@ -39,23 +39,23 @@ ["." location]] ["." type]]]) -(type: #export (Format a) +(type: .public (Format a) {#.doc "A way to produce readable text from values."} (-> a Text)) -(implementation: #export functor +(implementation: .public functor (contravariant.Functor Format) (def: (map f fb) (|>> f fb))) -(syntax: #export (format {fragments (<>.many <c>.any)}) +(syntax: .public (format {fragments (<>.many <c>.any)}) {#.doc (doc "Text interpolation." (format "Static part " (text static) " does not match URI: " uri))} (in (.list (` ($_ "lux text concat" (~+ fragments)))))) (template [<name> <type> <formatter>] - [(def: #export <name> + [(def: .public <name> (Format <type>) <formatter>)] @@ -85,7 +85,7 @@ (template [<type> <format>,<codec>] [(`` (template [<format> <codec>] - [(def: #export <format> + [(def: .public <format> (Format <type>) (\ <codec> encode))] @@ -113,18 +113,18 @@ [frac/16 frac.hex]]] ) -(def: #export (mod modular) +(def: .public (mod modular) (All [m] (Format (modular.Mod m))) (let [codec (modular.codec (modular.modulus modular))] (\ codec encode modular))) -(def: #export (list formatter) +(def: .public (list formatter) (All [a] (-> (Format a) (Format (List a)))) (|>> (list\map (|>> formatter (format " "))) (text.join_with "") (text.enclosed ["(list" ")"]))) -(def: #export (maybe format) +(def: .public (maybe format) (All [a] (-> (Format a) (Format (Maybe a)))) (function (_ value) (case value diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 8c353db1c..defbaf3e1 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -230,7 +230,7 @@ (in (` ((~! join_text^) ((~! <>.many) (~ base))))) ))) -(exception: #export (incorrect_quantification {from Nat} {to Nat}) +(exception: .public (incorrect_quantification {from Nat} {to Nat}) (exception.report ["Input" (format (%.nat from) "," (%.nat to))] ["Should be" (format (%.nat to) "," (%.nat from))])) @@ -411,7 +411,7 @@ (-> Text (Parser Code)) (\ <>.monad map product.right (re_alternative^ #1 re_scoped^ current_module))) -(syntax: #export (regex {pattern <code>.text}) +(syntax: .public (regex {pattern <code>.text}) {#.doc (doc "Create lexers using regular-expression syntax." "For example:" @@ -482,7 +482,7 @@ (in (list regex)) ))) -(syntax: #export (^regex {[pattern bindings] (<code>.form (<>.and <code>.text (<>.maybe <code>.any)))} +(syntax: .public (^regex {[pattern bindings] (<code>.form (<>.and <code>.text (<>.maybe <code>.any)))} body {branches (<>.many <code>.any)}) {#.doc (doc "Allows you to test text against regular expressions." diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index 955b851d2..e1a4a4de6 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -21,12 +21,12 @@ abstract]]] ["." /// (#+ Char)]) -(abstract: #export Block - (Interval Char) - +(abstract: .public Block {#.doc (doc "A block of valid unicode characters.")} - (implementation: #export monoid + (Interval Char) + + (implementation: .public monoid (Monoid Block) (def: identity @@ -41,12 +41,12 @@ (n.max (\ left top) (\ right top))))))) - (def: #export (block start additional) + (def: .public (block start additional) (-> Char Nat Block) (:abstraction (interval.between n.enum start (n.+ additional start)))) (template [<name> <slot>] - [(def: #export <name> + [(def: .public <name> (-> Block Char) (|>> :representation (get@ <slot>)))] @@ -54,25 +54,25 @@ [end #interval.top] ) - (def: #export (size block) + (def: .public (size block) (-> Block Nat) (let [start (get@ #interval.bottom (:representation block)) end (get@ #interval.top (:representation block))] (|> end (n.- start) inc))) - (def: #export (within? block char) + (def: .public (within? block char) (All [a] (-> Block Char Bit)) (interval.within? (:representation block) char)) ) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Block) (def: (= reference subject) (and (n.= (..start reference) (..start subject)) (n.= (..end reference) (..end subject))))) -(implementation: #export hash +(implementation: .public hash (Hash Block) (def: &equivalence ..equivalence) @@ -86,7 +86,7 @@ (template [<name> <start> <end>] [(with_expansions [<block_name> (..block_name <name>) <documentation> (template.text [<start> "-" <end> " | " <block_name>])] - (def: #export <name> + (def: .public <name> {#.doc (doc <documentation>)} Block (let [start (hex <start>) diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index 0a5aa6ce8..ab5d978b6 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -26,10 +26,12 @@ @)) -(abstract: #export Set +(abstract: .public Set + {} + (Tree :@: Block []) - (def: #export (compose left right) + (def: .public (compose left right) (-> Set Set Set) (:abstraction (\ builder branch @@ -41,7 +43,7 @@ (:abstraction (\ builder leaf block []))) - (def: #export (set [head tail]) + (def: .public (set [head tail]) (-> [Block (List Block)] Set) (list\fold (: (-> Block Set Set) (function (_ block set) @@ -150,7 +152,7 @@ //block.hangul_syllables )])) - (def: #export character + (def: .public character Set ($_ ..compose ..character/0 @@ -158,7 +160,7 @@ ..character/2 )) - (def: #export non_character + (def: .public non_character Set (..set [//block.high_surrogates (list //block.high_private_use_surrogates @@ -193,26 +195,26 @@ ## //block.tags )])) - (def: #export full + (def: .public full Set ($_ ..compose ..character ..non_character )) - (def: #export start + (def: .public start (-> Set Char) (|>> :representation tree.tag //block.start)) - (def: #export end + (def: .public end (-> Set Char) (|>> :representation tree.tag //block.end)) - (def: #export (member? set character) + (def: .public (member? set character) (-> Set Char Bit) (loop [tree (:representation set)] (if (//block.within? (tree.tag tree) character) @@ -225,7 +227,7 @@ (recur right))) false))) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Set) (def: (= reference subject) @@ -234,7 +236,7 @@ ) (template [<name> <blocks>] - [(def: #export <name> + [(def: .public <name> Set (..set <blocks>))] diff --git a/stdlib/source/library/lux/data/trace.lux b/stdlib/source/library/lux/data/trace.lux index 9646fa0f3..5767084eb 100644 --- a/stdlib/source/library/lux/data/trace.lux +++ b/stdlib/source/library/lux/data/trace.lux @@ -7,15 +7,15 @@ comonad] function]]) -(type: #export (Trace t a) +(type: .public (Trace t a) {#monoid (Monoid t) #trace (-> t a)}) -(implementation: #export functor (All [t] (Functor (Trace t))) +(implementation: .public functor (All [t] (Functor (Trace t))) (def: (map f fa) (update@ #trace (compose f) fa))) -(implementation: #export comonad (All [t] (CoMonad (Trace t))) +(implementation: .public comonad (All [t] (CoMonad (Trace t))) (def: &functor ..functor) (def: (out wa) @@ -31,6 +31,6 @@ ((get@ #trace wa) (\ monoid compose t1 t2)))})}))) -(def: #export (run context tracer) +(def: .public (run context tracer) (All [t a] (-> t (Trace t a) a)) (\ tracer trace context)) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 0fbd4657a..cc09e996e 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- type) + [lux (#- type private) ["@" target] ["." type] ["." ffi (#+ import:)] @@ -140,7 +140,7 @@ (text.join_with " ") (text.enclosed ["[" "]"]))))) -(def: #export (inspection value) +(def: .public (inspection value) Inspector (with_expansions [<jvm> (let [object (:as java/lang/Object value)] (`` (<| (~~ (template [<class> <processing>] @@ -378,7 +378,7 @@ )) }))) -(exception: #export (cannot_represent_value {type Type}) +(exception: .public (cannot_represent_value {type Type}) (exception.report ["Type" (%.type type)])) @@ -511,7 +511,7 @@ (<>.failure "") )))) -(def: #export (representation type value) +(def: .public (representation type value) (-> Type Any (Try Text)) (case (<type>.run ..representation_parser type) (#try.Success representation) @@ -520,23 +520,23 @@ (#try.Failure _) (exception.except ..cannot_represent_value type))) -(syntax: #export (private {definition <code>.identifier}) +(syntax: .public (private {definition <code>.identifier}) (let [[module _] definition] (in (list (` ("lux in-module" (~ (code.text module)) (~ (code.identifier definition)))))))) -(def: #export (log! message) +(def: .public (log! message) {#.doc "Logs message to standard output."} (-> Text Any) ("lux io log" message)) -(exception: #export (type_hole {location Location} {type Type}) +(exception: .public (type_hole {location Location} {type Type}) (exception.report ["Location" (%.location location)] ["Type" (%.type type)])) -(syntax: #export (:hole) +(syntax: .public (:hole) (do meta.monad [location meta.location expectedT meta.expected_type] @@ -552,11 +552,11 @@ (<code>.record (<>.and <code>.local_identifier (\ <>.monad map (|>> #.Some) <code>.any))))) -(exception: #export (unknown_local_binding {name Text}) +(exception: .public (unknown_local_binding {name Text}) (exception.report ["Name" (%.text name)])) -(syntax: #export (here {targets (: (<code>.Parser (List Target)) +(syntax: .public (here {targets (: (<code>.Parser (List Target)) (|> ..target <>.some (<>.else (list))))}) diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index 4347cec39..ae9745baa 100644 --- a/stdlib/source/library/lux/extension.lux +++ b/stdlib/source/library/lux/extension.lux @@ -57,7 +57,7 @@ (<>.some (..input default))))) (template [<any> <end> <and> <run> <extension> <name>] - [(syntax: #export (<name> + [(syntax: .public (<name> {[name extension phase archive inputs] (..declaration (` <any>))} body) (let [g!parser (case (list\map product.right inputs) diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux index 0b641a3a6..069e38123 100644 --- a/stdlib/source/library/lux/ffi.js.lux +++ b/stdlib/source/library/lux/ffi.js.lux @@ -22,7 +22,7 @@ ["." code] ["." template]]]]) -(abstract: #export (Object brand) +(abstract: .public (Object brand) Any) (template [<name>] @@ -30,7 +30,7 @@ (abstract: <brand> Any - (type: #export <name> + (type: .public <name> (Object <brand>))))] [Function] @@ -40,7 +40,7 @@ ) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Boolean Bit] @@ -149,11 +149,11 @@ ("js object null"))) input)) -(def: #export (null _) +(def: .public (null _) (-> Any Nothing) (:assume ("js object null"))) -(def: #export null? +(def: .public null? (-> Any Bit) (|>> "js object null?")) @@ -232,7 +232,7 @@ ("js constant" (~ (code.text source))) (~+ (list\map (with_null g!temp) g!inputs))))))))))) -(syntax: #export (import: {import ..import}) +(syntax: .public (import: {import ..import}) (with_gensyms [g!temp] (case import (#Class [[class_name class_parameters] format members]) @@ -319,10 +319,10 @@ outputT))) ))) -(template: #export (type_of object) +(template: .public (type_of object) ("js type-of" object)) -(syntax: #export (constant type +(syntax: .public (constant type {[head tail] (<code>.tuple (<>.and <code>.local_identifier (<>.some <code>.local_identifier)))}) (with_gensyms [g!_] (let [constant (` ("js constant" (~ (code.text head))))] @@ -356,7 +356,7 @@ .true)) (template [<name> <constant>] - [(def: #export <name> + [(def: .public <name> Bit (!defined? <constant>))] @@ -364,7 +364,7 @@ [on_nashorn? [java lang Object]] ) -(def: #export on_node_js? +(def: .public on_node_js? Bit (case (..constant (Object Any) [process]) (#.Some process) @@ -379,7 +379,7 @@ #.None false)) -(template: #export (closure <inputs> <output>) +(template: .public (closure <inputs> <output>) (.:as ..Function (`` ("js function" (~~ (template.amount <inputs>)) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 536960c9a..bda7e8484 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -55,7 +55,7 @@ (|>> type.reflection reflection.reflection)) (template [<name> <class>] - [(def: #export <name> + [(def: .public <name> .Type (#.Primitive <class> #.End))] @@ -70,7 +70,7 @@ ) (template [<name> <class>] - [(def: #export <name> + [(def: .public <name> .Type (#.Primitive (reflection.reflection <class>) #.End))] @@ -124,16 +124,16 @@ ) (template [<name> <op> <from> <to>] - [(template: #export (<name> value) + [(template: .public (<name> value) {#.doc (doc "Type converter." (: <to> (<name> (: <from> foo))))} - (|> value - (: <from>) - "jvm object cast" - <op> - "jvm object cast" - (: <to>)))] + [(|> value + (: <from>) + "jvm object cast" + <op> + "jvm object cast" + (: <to>))])] [byte_to_long "jvm conversion byte-to-long" ..Byte ..Long] @@ -167,11 +167,11 @@ ) (template [<name> <from> <to> <0> <1>] - [(template: #export (<name> value) + [(template: .public (<name> value) {#.doc (doc "Type converter." (: <to> (<name> (: <from> foo))))} - (|> value <0> <1>))] + [(|> value <0> <1>)])] [long_to_char ..Long ..Character ..long_to_int ..int_to_char] [byte_to_int ..Byte ..Integer ..byte_to_long ..long_to_int] @@ -187,18 +187,18 @@ #ManualPrM #AutoPrM) -(type: #export Privacy +(type: .public Privacy #PublicP #PrivateP #ProtectedP #DefaultP) -(type: #export State +(type: .public State #VolatileS #FinalS #DefaultS) -(type: #export Inheritance +(type: .public Inheritance #FinalI #AbstractI #DefaultI) @@ -537,11 +537,11 @@ (<code>.this! (' #abstract)) (in [])))) -(exception: #export (class_names_cannot_contain_periods {name Text}) +(exception: .public (class_names_cannot_contain_periods {name Text}) (exception.report ["Name" (%.text name)])) -(exception: #export (class_name_cannot_be_a_type_variable {name Text} +(exception: .public (class_name_cannot_be_a_type_variable {name Text} {type_vars (List (Type Var))}) (exception.report ["Name" (%.text name)] @@ -575,7 +575,7 @@ (<code>.form (<>.and class_name^ (<>.some (parameter^ type_vars))))))] (in (type.class (name.safe name) parameters)))) -(exception: #export (unexpected_type_variable {name Text} +(exception: .public (unexpected_type_variable {name Text} {type_vars (List (Type Var))}) (exception.report ["Unexpected Type Variable" (%.text name)] @@ -1199,7 +1199,7 @@ (Type Class) (type.class "java.lang.Object" (list))) -(syntax: #export (class: +(syntax: .public (class: {.let [! <>.monad]} {im inheritance_modifier^} {[full_class_name class_vars] (\ ! map parser.declaration ..declaration^)} @@ -1256,7 +1256,7 @@ [(~+ (list\map field_decl$ fields))] [(~+ (list\map (method_def$ fully_qualified_class_name method_parser super fields) methods))])))))) -(syntax: #export (interface: +(syntax: .public (interface: {.let [! <>.monad]} {[full_class_name class_vars] (\ ! map parser.declaration ..declaration^)} {supers (<>.else (list) @@ -1272,7 +1272,7 @@ [(~+ (list\map annotation$ annotations))] (~+ (list\map method_decl$ members))))))) -(syntax: #export (object +(syntax: .public (object {class_vars ..vars^} {super (<>.else $Object (class^ class_vars))} @@ -1298,12 +1298,12 @@ [(~+ (list\map constructor_arg$ constructor_args))] [(~+ (list\map (method_def$ "" (<>.failure "") super (list)) methods))]))))) -(syntax: #export (null) +(syntax: .public (null) {#.doc (doc "Null object reference." (null))} (in (list (` ("jvm object null"))))) -(def: #export (null? obj) +(def: .public (null? obj) {#.doc (doc "Test for null object reference." (= (null? (null)) true) @@ -1312,7 +1312,7 @@ (-> (primitive "java.lang.Object") Bit) ("jvm object null?" obj)) -(syntax: #export (??? expr) +(syntax: .public (??? expr) {#.doc (doc "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." (= (??? (: java/lang/String (null))) #.None) @@ -1324,7 +1324,7 @@ #.None (#.Some (~ g!temp))))))))) -(syntax: #export (!!! expr) +(syntax: .public (!!! expr) {#.doc (doc "Takes a (Maybe ObjectType) and returns a ObjectType." "A #.None would get translated into a (null)." (= (null) @@ -1339,7 +1339,7 @@ ("jvm object null")} (~ expr))))))) -(syntax: #export (check {class (..type^ (list))} +(syntax: .public (check {class (..type^ (list))} {unchecked (<>.maybe <code>.any)}) {#.doc (doc "Checks whether an object is an instance of a particular class." "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes." @@ -1366,7 +1366,7 @@ (~ check_code)))))) )))) -(syntax: #export (synchronized lock body) +(syntax: .public (synchronized lock body) {#.doc (doc "Evaluates body, while holding a lock on a given object." (synchronized object_to_be_locked (exec (do_something ___) @@ -1374,7 +1374,7 @@ (finish_the_computation ___))))} (in (list (` ("jvm object synchronized" (~ lock) (~ body)))))) -(syntax: #export (do_to obj {methods (<>.some partial_call^)}) +(syntax: .public (do_to obj {methods (<>.some partial_call^)}) {#.doc (doc "Call a variety of methods on an object. Then, return the object." (do_to object (ClassName::method1 arg0 arg1 arg2) @@ -1739,7 +1739,7 @@ (#.Left _) (meta.failure (format "Unknown class: " class_name))))) -(syntax: #export (import: +(syntax: .public (import: {declaration ..declaration^} {.let [[class_name class_type_vars] (parser.declaration declaration)]} {bundles (<>.some (..bundle class_type_vars))}) @@ -1803,7 +1803,7 @@ (monad.map ! (member_import$ class_type_vars kind declaration)))] (in (list& (class_import$ declaration) (list\join =members))))) -(syntax: #export (array {type (..type^ (list))} +(syntax: .public (array {type (..type^ (list))} size) {#.doc (doc "Create an array of the given type, with the given size." (array java/lang/Object 10))} @@ -1828,7 +1828,7 @@ (in (list (` (: (~ (value_type #ManualPrM (type.array type))) ("jvm array new object" (~ g!size)))))))))) -(exception: #export (cannot_convert_to_jvm_type {type .Type}) +(exception: .public (cannot_convert_to_jvm_type {type .Type}) (exception.report ["Lux Type" (%.type type)])) @@ -1923,7 +1923,7 @@ _ <failure>)))) -(syntax: #export (array_length array) +(syntax: .public (array_length array) {#.doc (doc "Gives the length of an array." (array_length my_array))} (case array @@ -1959,7 +1959,7 @@ (in (list (` (let [(~ g!array) (~ array)] (..array_length (~ g!array))))))))) -(syntax: #export (array_read idx array) +(syntax: .public (array_read idx array) {#.doc (doc "Loads an element from an array." (array_read 10 my_array))} (case array @@ -1997,7 +1997,7 @@ (in (list (` (let [(~ g!array) (~ array)] (..array_read (~ idx) (~ g!array))))))))) -(syntax: #export (array_write idx value array) +(syntax: .public (array_write idx value array) {#.doc (doc "Stores an element into an array." (array_write 10 my_object my_array))} (case array @@ -2036,20 +2036,20 @@ (in (list (` (let [(~ g!array) (~ array)] (..array_write (~ idx) (~ value) (~ g!array))))))))) -(syntax: #export (class_for {type (..type^ (list))}) +(syntax: .public (class_for {type (..type^ (list))}) {#.doc (doc "Loads the class as a java.lang.Class object." (class_for java/lang/String))} (in (list (` ("jvm object class" (~ (code.text (..reflection type)))))))) -(syntax: #export (type {type (..type^ (list))}) +(syntax: .public (type {type (..type^ (list))}) (in (list (..value_type #ManualPrM type)))) -(exception: #export (cannot_cast_to_non_object {type (Type Value)}) +(exception: .public (cannot_cast_to_non_object {type (Type Value)}) (exception.report ["Signature" (..signature type)] ["Reflection" (..reflection type)])) -(syntax: #export (:cast {type (..type^ (list))} +(syntax: .public (:cast {type (..type^ (list))} object) (case [(parser.array? type) (parser.class? type)] diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux index c004b3145..fc6266d78 100644 --- a/stdlib/source/library/lux/ffi.lua.lux +++ b/stdlib/source/library/lux/ffi.lua.lux @@ -23,12 +23,12 @@ ["." code] ["." template]]]]) -(abstract: #export (Object brand) Any) +(abstract: .public (Object brand) Any) (template [<name>] [(with_expansions [<brand> (template.identifier [<name> "'"])] (abstract: <brand> Any) - (type: #export <name> + (type: .public <name> (..Object <brand>)))] [Nil] @@ -37,7 +37,7 @@ ) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Boolean Bit] @@ -212,7 +212,7 @@ (:as ..Function (~ source)) (~+ (list\map (with_nil g!temp) g!inputs))))))))))) -(syntax: #export (import: {import ..import}) +(syntax: .public (import: {import ..import}) (with_gensyms [g!temp] (case import (#Class [class format members]) @@ -302,7 +302,7 @@ ("lua constant" (~ (code.text (text.replace_all "/" "." name)))))))))))) ))) -(template: #export (closure <inputs> <output>) +(template: .public (closure <inputs> <output>) (.:as ..Function (`` ("lua function" (~~ (template.amount <inputs>)) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 6b8ff867d..d81d48c39 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -27,7 +27,7 @@ ["." annotation]]]]) (template [<name> <op> <from> <to>] - [(def: #export (<name> value) + [(def: .public (<name> value) {#.doc (doc "Type converter." (: <to> (<name> (: <from> foo))))} @@ -89,18 +89,18 @@ #ManualPrM #AutoPrM) -(type: #export Privacy +(type: .public Privacy #PublicP #PrivateP #ProtectedP #DefaultP) -(type: #export State +(type: .public State #VolatileS #FinalS #DefaultS) -(type: #export Inheritance +(type: .public Inheritance #FinalI #AbstractI #DefaultI) @@ -1165,7 +1165,7 @@ {#super_class_name "java/lang/Object" #super_class_params (list)}) -(syntax: #export (class: +(syntax: .public (class: {im inheritance_modifier^} {class_decl ..class_decl^} {.let [full_class_name (product.left class_decl)]} @@ -1225,7 +1225,7 @@ (with_brackets (spaced (list\map (method_def$ replacer super) methods))))))]] (in (list (` ((~ (code.text def_code)))))))) -(syntax: #export (interface: +(syntax: .public (interface: {class_decl ..class_decl^} {.let [class_vars (product.right class_decl)]} {supers (<>.else (list) @@ -1243,7 +1243,7 @@ (in (list (` ((~ (code.text def_code)))))) )) -(syntax: #export (object +(syntax: .public (object {class_vars (<code>.tuple (<>.some ..type_param^))} {super (<>.else object_super_class (..super_class_decl^ class_vars))} @@ -1269,12 +1269,12 @@ (with_brackets (spaced (list\map (method_def$ function.identity super) methods))))))] (in (list (` ((~ (code.text def_code)))))))) -(syntax: #export (null) +(syntax: .public (null) {#.doc (doc "Null object reference." (null))} (in (list (` ("jvm object null"))))) -(def: #export (null? obj) +(def: .public (null? obj) {#.doc (doc "Test for null object reference." (= (null? (null)) true) @@ -1283,7 +1283,7 @@ (-> (primitive "java.lang.Object") Bit) ("jvm object null?" obj)) -(syntax: #export (??? expr) +(syntax: .public (??? expr) {#.doc (doc "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." (= (??? (: java/lang/String (null))) #.None) @@ -1295,7 +1295,7 @@ #.None (#.Some (~ g!temp))))))))) -(syntax: #export (!!! expr) +(syntax: .public (!!! expr) {#.doc (doc "Takes a (Maybe ObjectType) and returns a ObjectType." "A #.None would get translated into a (null)." (= (null) @@ -1310,7 +1310,7 @@ ("jvm object null")} (~ expr))))))) -(syntax: #export (check {class (..generic_type^ (list))} +(syntax: .public (check {class (..generic_type^ (list))} {unchecked (<>.maybe <code>.any)}) {#.doc (doc "Checks whether an object is an instance of a particular class." "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes." @@ -1337,7 +1337,7 @@ (~ check_code)))))) )))) -(syntax: #export (synchronized lock body) +(syntax: .public (synchronized lock body) {#.doc (doc "Evaluates body, while holding a lock on a given object." (synchronized object_to_be_locked (exec (do_something ___) @@ -1345,7 +1345,7 @@ (finish_the_computation ___))))} (in (list (` ("jvm object synchronized" (~ lock) (~ body)))))) -(syntax: #export (do_to obj {methods (<>.some partial_call^)}) +(syntax: .public (do_to obj {methods (<>.some partial_call^)}) {#.doc (doc "Call a variety of methods on an object. Then, return the object." (do_to object (ClassName::method1 arg0 arg1 arg2) @@ -1652,7 +1652,7 @@ (meta.failure (format "Cannot load class: " class_name text.new_line error))))) -(syntax: #export (import: +(syntax: .public (import: {class_decl ..class_decl^} {bundles (<>.some (..bundle (product.right class_decl)))}) {#.doc (doc "Allows importing JVM classes, and using them as types." @@ -1715,7 +1715,7 @@ (monad.map ! (member_import$ (product.right class_decl) kind class_decl)))] (in (list& (class_import$ class_decl) (list\join =members))))) -(syntax: #export (array {type (..generic_type^ (list))} +(syntax: .public (array {type (..generic_type^ (list))} size) {#.doc (doc "Create an array of the given type, with the given size." (array java/lang/Object 10))} @@ -1735,7 +1735,7 @@ _ (in (list (` ("jvm anewarray" (~ (code.text (generic_type$ type))) (~ size))))))) -(syntax: #export (array_length array) +(syntax: .public (array_length array) {#.doc (doc "Gives the length of an array." (array_length my_array))} (in (list (` ("jvm arraylength" (~ array)))))) @@ -1762,7 +1762,7 @@ _ (meta.failure (format "Cannot convert to JvmType: " (type.format type)))))) -(syntax: #export (array_read idx array) +(syntax: .public (array_read idx array) {#.doc (doc "Loads an element from an array." (array_read 10 my_array))} (case array @@ -1791,7 +1791,7 @@ (in (list (` (let [(~ g!array) (~ array)] (..array_read (~ idx) (~ g!array))))))))) -(syntax: #export (array_write idx value array) +(syntax: .public (array_write idx value array) {#.doc (doc "Stores an element into an array." (array_write 10 my_object my_array))} (case array @@ -1820,10 +1820,10 @@ (in (list (` (let [(~ g!array) (~ array)] (..array_write (~ idx) (~ value) (~ g!array))))))))) -(syntax: #export (class_for {type (..generic_type^ (list))}) +(syntax: .public (class_for {type (..generic_type^ (list))}) {#.doc (doc "Loads the class as a java.lang.Class object." (class_for java/lang/String))} (in (list (` ("jvm object class" (~ (code.text (simple_class$ (list) type)))))))) -(syntax: #export (type {type (..generic_type^ (list))}) +(syntax: .public (type {type (..generic_type^ (list))}) (in (list (..class_type #ManualPrM (list) type)))) diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index a8f0a7f06..114dfce7b 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -23,12 +23,12 @@ ["." code] ["." template]]]]) -(abstract: #export (Object brand) Any) +(abstract: .public (Object brand) Any) (template [<name>] [(with_expansions [<brand> (template.identifier [<name> "'"])] - (abstract: #export <brand> Any) - (type: #export <name> + (abstract: .public <brand> Any) + (type: .public <name> (..Object <brand>)))] [Null] @@ -36,7 +36,7 @@ ) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Boolean Bit] @@ -182,7 +182,7 @@ ..constant )) -(syntax: #export (try expression) +(syntax: .public (try expression) {#.doc (doc (case (try (risky_computation input)) (#.Right success) (do_something success) @@ -232,7 +232,7 @@ (:as ..Function (~ source)) (~+ (list\map (with_null g!temp) g!inputs))))))))))) -(syntax: #export (import: {import ..import}) +(syntax: .public (import: {import ..import}) (with_gensyms [g!temp] (case import (#Class [class alias format members]) diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux index 5c05710a7..d1a81dc6a 100644 --- a/stdlib/source/library/lux/ffi.py.lux +++ b/stdlib/source/library/lux/ffi.py.lux @@ -23,12 +23,12 @@ ["." code] ["." template]]]]) -(abstract: #export (Object brand) Any) +(abstract: .public (Object brand) Any) (template [<name>] [(with_expansions [<brand> (template.identifier [<name> "'"])] (abstract: <brand> Any) - (type: #export <name> + (type: .public <name> (..Object <brand>)))] [None] @@ -37,7 +37,7 @@ ) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Boolean Bit] @@ -212,7 +212,7 @@ (:as ..Function (~ source)) (~+ (list\map (with_none g!temp) g!inputs))))))))))) -(syntax: #export (import: {import ..import}) +(syntax: .public (import: {import ..import}) (with_gensyms [g!temp] (case import (#Class [class format members]) @@ -307,7 +307,7 @@ outputT))) ))) -(template: #export (lambda <inputs> <output>) +(template: .public (lambda <inputs> <output>) (.:as ..Function (`` ("python function" (~~ (template.amount <inputs>)) diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux index 70c2f21be..dfb8aabc4 100644 --- a/stdlib/source/library/lux/ffi.rb.lux +++ b/stdlib/source/library/lux/ffi.rb.lux @@ -23,12 +23,12 @@ ["." code] ["." template]]]]) -(abstract: #export (Object brand) Any) +(abstract: .public (Object brand) Any) (template [<name>] [(with_expansions [<brand> (template.identifier [<name> "'"])] (abstract: <brand> Any) - (type: #export <name> + (type: .public <name> (..Object <brand>)))] [Nil] @@ -36,7 +36,7 @@ ) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Boolean Bit] @@ -225,7 +225,7 @@ (:as ..Function (~ source)) (~+ (list\map (with_nil g!temp) g!inputs))))))))))) -(syntax: #export (import: {[?module import] ..import}) +(syntax: .public (import: {[?module import] ..import}) (with_gensyms [g!temp] (case import (#Class [class alias format members]) diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 886f045d1..85f3f560a 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -23,12 +23,12 @@ ["." code] ["." template]]]]) -(abstract: #export (Object brand) Any) +(abstract: .public (Object brand) Any) (template [<name>] [(with_expansions [<brand> (template.identifier [<name> "'"])] - (abstract: #export <brand> Any) - (type: #export <name> + (abstract: .public <brand> Any) + (type: .public <name> (..Object <brand>)))] [Nil] @@ -36,7 +36,7 @@ ) (template [<name> <type>] - [(type: #export <name> + [(type: .public <name> <type>)] [Boolean Bit] @@ -149,7 +149,7 @@ ..constant )) -(syntax: #export (try expression) +(syntax: .public (try expression) {#.doc (doc (case (try (risky_computation input)) (#.Right success) (do_something success) @@ -199,7 +199,7 @@ (:as ..Function (~ source)) (~+ (list\map (with_nil g!temp) g!inputs))))))))))) -(syntax: #export (import: {import ..import}) +(syntax: .public (import: {import ..import}) (with_gensyms [g!temp] (case import (#Function [name alias inputsT io? try? outputT]) diff --git a/stdlib/source/library/lux/locale.lux b/stdlib/source/library/lux/locale.lux index e77e88c89..512d214c6 100644 --- a/stdlib/source/library/lux/locale.lux +++ b/stdlib/source/library/lux/locale.lux @@ -15,13 +15,15 @@ ["." language (#+ Language)] ["." territory (#+ Territory)]]) -(abstract: #export Locale +(abstract: .public Locale + {} + Text (def: territory_separator "_") (def: encoding_separator ".") - (def: #export (locale language territory encoding) + (def: .public (locale language territory encoding) (-> Language (Maybe Territory) (Maybe Encoding) Locale) (:abstraction (format (language.code language) (|> territory @@ -31,15 +33,15 @@ (maybe\map (|>> encoding.name (format ..encoding_separator))) (maybe.else ""))))) - (def: #export code + (def: .public code (-> Locale Text) (|>> :representation)) - (def: #export hash + (def: .public hash (Hash Locale) (\ hash.functor map ..code text.hash)) - (def: #export equivalence + (def: .public equivalence (Equivalence Locale) (\ ..hash &equivalence)) ) diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux index 4933a97a6..cf6b38e99 100644 --- a/stdlib/source/library/lux/locale/language.lux +++ b/stdlib/source/library/lux/locale/language.lux @@ -12,14 +12,14 @@ ["." template]]]]) ## https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes -(abstract: #export Language +(abstract: .public Language + {#.doc (doc "An ISO 639 language.")} + {#name Text #code Text} - {#.doc (doc "An ISO 639 language.")} - (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> (-> Language Text) (|>> :representation (get@ <tag>)))] @@ -30,12 +30,12 @@ (template [<bundle>] [(with_expansions [<bundle>' (template.spliced <bundle>)] (template [<code> <name> <definition> <alias>+] - [(def: #export <definition> + [(def: .public <definition> Language (:abstraction {#name <name> #code <code>})) (`` (template [<alias>] - [(def: #export <alias> + [(def: .public <alias> Language <definition>)] @@ -557,13 +557,13 @@ ["zun" "Zuni" zuni []] ["zza" "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki" zaza [[dimili] [dimli] [kirdki] [kirmanjki] [zazaki]]]]]) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Language) (def: (= reference sample) (is? reference sample))) - (implementation: #export hash + (implementation: .public hash (Hash Language) (def: &equivalence diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux index 15ac79698..862c10bb6 100644 --- a/stdlib/source/library/lux/locale/territory.lux +++ b/stdlib/source/library/lux/locale/territory.lux @@ -12,16 +12,16 @@ ["." template]]]]) ## https://en.wikipedia.org/wiki/ISO_3166-1 -(abstract: #export Territory +(abstract: .public Territory + {#.doc (doc "An ISO 3166 territory.")} + {#name Text #short Text #long Text #code Nat} - {#.doc (doc "An ISO 3166 territory.")} - (template [<name> <field> <type>] - [(def: #export <name> + [(def: .public <name> (-> Territory <type>) (|>> :representation (get@ <field>)))] @@ -33,7 +33,7 @@ ) (template [<short> <long> <number> <name> <main> <neighbor>+] - [(def: #export <main> + [(def: .public <main> Territory (:abstraction {#name <name> #short <short> @@ -41,7 +41,7 @@ #code <number>})) (`` (template [<neighbor>] - [(def: #export <neighbor> Territory <main>)] + [(def: .public <neighbor> Territory <main>)] (~~ (template.spliced <neighbor>+))))] @@ -296,13 +296,13 @@ ["ZW" "ZWE" 716 "Zimbabwe" zimbabwe []] ) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Territory) (def: (= reference sample) (is? reference sample))) - (implementation: #export hash + (implementation: .public hash (Hash Territory) (def: &equivalence ..equivalence) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index 91025dcaf..193b5a25e 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -18,7 +18,7 @@ ["#" meta ["." location]]]) -(def: #export (single_expansion syntax) +(def: .public (single_expansion syntax) {#.doc (doc "Given code that requires applying a macro, does it once and returns the result." "Otherwise, returns the code as-is.")} (-> Code (Meta (List Code))) @@ -36,7 +36,7 @@ _ (\ //.monad in (list syntax)))) -(def: #export (expansion syntax) +(def: .public (expansion syntax) {#.doc (doc "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left." "Otherwise, returns the code as-is.")} (-> Code (Meta (List Code))) @@ -58,7 +58,7 @@ _ (\ //.monad in (list syntax)))) -(def: #export (full_expansion syntax) +(def: .public (full_expansion syntax) {#.doc "Expands all macro-calls everywhere recursively, until only primitive/base code remains."} (-> Code (Meta (List Code))) (case syntax @@ -106,7 +106,7 @@ _ (\ //.monad in (list syntax)))) -(def: #export (gensym prefix) +(def: .public (gensym prefix) {#.doc (doc "Generates a unique name as an Code node (ready to be used in code templates)." "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.")} (-> Text (Meta Code)) @@ -126,14 +126,14 @@ _ (//.failure (text\compose "Code is not a local identifier: " (code.format ast))))) -(def: #export wrong_syntax_error +(def: .public wrong_syntax_error (-> Name Text) (|>> name\encode (text\compose "Wrong syntax for "))) -(macro: #export (with_gensyms tokens) +(macro: .public (with_gensyms tokens) {#.doc (doc "Creates new identifiers and offers them to the body expression." - (syntax: #export (synchronized lock body) + (syntax: .public (synchronized lock body) (with_gensyms [g!lock g!body g!_] (in (list (` (let [(~ g!lock) (~ lock) (~ g!_) ("jvm monitorenter" (~ g!lock)) @@ -155,7 +155,7 @@ _ (//.failure (..wrong_syntax_error (name_of ..with_gensyms))))) -(def: #export (one_expansion token) +(def: .public (one_expansion token) {#.doc "Works just like expand, except that it ensures that the output is a single Code token."} (-> Code (Meta Code)) (do //.monad @@ -168,7 +168,7 @@ (//.failure "Macro expanded to more than 1 element.")))) (template [<macro> <func>] - [(macro: #export (<macro> tokens) + [(macro: .public (<macro> tokens) {#.doc (doc "Performs a macro-expansion and logs the resulting code." "You can either use the resulting code, or omit them." "By omitting them, this macro produces nothing (just like the lux.comment macro)." diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux index ec99f68a4..916e82dee 100644 --- a/stdlib/source/library/lux/macro/code.lux +++ b/stdlib/source/library/lux/macro/code.lux @@ -36,7 +36,7 @@ ## (Ann Location (Code' (Ann Location)))) (template [<name> <type> <tag>] - [(def: #export (<name> x) + [(def: .public (<name> x) (-> <type> Code) [location.dummy (<tag> x)])] @@ -54,7 +54,7 @@ ) (template [<name> <tag> <doc>] - [(def: #export (<name> name) + [(def: .public (<name> name) {#.doc <doc>} (-> Text Code) [location.dummy (<tag> ["" name])])] @@ -62,7 +62,7 @@ [local_identifier #.Identifier "Produces a local identifier (an identifier with no module prefix)."] [local_tag #.Tag "Produces a local tag (a tag with no module prefix)."]) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Code) (def: (= x y) @@ -92,7 +92,7 @@ _ false))) -(def: #export (format ast) +(def: .public (format ast) (-> Code Text) (case ast (^template [<tag> <struct>] @@ -139,7 +139,7 @@ "}") )) -(def: #export (replace original substitute ast) +(def: .public (replace original substitute ast) {#.doc "Replaces all code that looks like the 'original' with the 'substitute'."} (-> Code Code Code Code) (if (\ ..equivalence = original ast) diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index f6dcb0590..8a4360ac7 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -17,12 +17,12 @@ ["." // ["#." code]]) -(exception: #export (unknown_module {module Text}) +(exception: .public (unknown_module {module Text}) (exception.report ["Module" (text.format module)])) (template [<name>] - [(exception: #export (<name> {module Text} {definition Text}) + [(exception: .public (<name> {module Text} {definition Text}) (exception.report ["Module" (text.format module)] ["Definition" (text.format definition)]))] @@ -95,7 +95,7 @@ #.None (list))))))) -(def: #export (push macros) +(def: .public (push macros) (-> (List [Name Macro]) (Meta Code)) (do meta.monad [_ (monad.map meta.monad ..push_one macros) diff --git a/stdlib/source/library/lux/macro/poly.lux b/stdlib/source/library/lux/macro/poly.lux index f89f7568c..535c8236f 100644 --- a/stdlib/source/library/lux/macro/poly.lux +++ b/stdlib/source/library/lux/macro/poly.lux @@ -6,9 +6,9 @@ [abstract ["." monad (#+ do)]] [control - ["<>" parser + ["<>" parser ("#\." monad) ["<.>" type (#+ Env)] - ["<.>" code]]] + ["<.>" code (#+ Parser)]]] [data ["." product] ["." maybe] @@ -18,18 +18,23 @@ ["." dictionary]]] [macro (#+ with_gensyms) ["." code] - [syntax (#+ syntax:) - ["|.|" export]]] + [syntax (#+ syntax:)]] [math [number ["n" nat]]]]]) -(syntax: #export (poly: {export |export|.parser} - {name <code>.local_identifier} - body) +(def: polyP + (Parser [Code Text Code]) + (let [private ($_ <>.and + <code>.local_identifier + <code>.any)] + (<>.either (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private)))) + +(syntax: .public (poly: {[export_policy name body] ..polyP}) (with_gensyms [g!_ g!type g!output] (let [g!name (code.identifier ["" name])] - (in (.list (` ((~! syntax:) (~+ (|export|.format export)) ((~ g!name) {(~ g!type) (~! <code>.identifier)}) + (in (.list (` ((~! syntax:) (~ export_policy) ((~ g!name) {(~ g!type) (~! <code>.identifier)}) ((~! do) (~! meta.monad) [(~ g!type) ((~! meta.type_definition) (~ g!type))] (case (: (.Either .Text .Code) @@ -43,45 +48,30 @@ (#.Right (~ g!output)) ((~' in) (.list (~ g!output)))))))))))) -(def: (common_poly_name? poly_func) - (-> Text Bit) - (text.contains? "?" poly_func)) - -(def: (derivation_name poly args) - (-> Text (List Text) (Maybe Text)) - (if (common_poly_name? poly) - (#.Some (list\fold (text.replace_once "?") poly args)) - #.None)) +(def: derivedP + (Parser [Code Text [Name (List Name)] (Maybe Code)]) + (let [private ($_ <>.and + <code>.local_identifier + (<code>.form (<>.and <code>.identifier (<>.many <code>.identifier))) + (<>.maybe <code>.any))] + (<>.either (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private)))) -(syntax: #export (derived: {export |export|.parser} - {?name (<>.maybe <code>.local_identifier)} - {[poly_func poly_args] (<code>.form (<>.and <code>.identifier (<>.many <code>.identifier)))} - {?custom_impl (<>.maybe <code>.any)}) +(syntax: .public (derived: {[export_policy name [poly_func poly_args] ?custom_impl] + ..derivedP}) (do {! meta.monad} [poly_args (monad.map ! meta.normal poly_args) - name (case ?name - (#.Some name) - (in name) - - (^multi #.None - {(derivation_name (product.right poly_func) (list\map product.right poly_args)) - (#.Some derived_name)}) - (in derived_name) - - _ - (<>.failure "derived: was given no explicit name, and cannot generate one from given information.")) .let [impl (case ?custom_impl (#.Some custom_impl) custom_impl #.None (` ((~ (code.identifier poly_func)) (~+ (list\map code.identifier poly_args)))))]] - (in (.list (` (def: (~+ (|export|.format export)) - (~ (code.identifier ["" name])) + (in (.list (` (def: (~ export_policy) (~ (code.identifier ["" name])) {#.implementation? #1} (~ impl))))))) -(def: #export (code env type) +(def: .public (code env type) (-> Env Type Code) (`` (case type (#.Primitive name params) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 99bb28c0e..2689d68f3 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -41,12 +41,12 @@ #.End #.End (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) -(macro: #export (syntax: tokens) +(macro: .public (syntax: tokens) {#.doc (doc "A more advanced way to define macros than 'macro:'." "The inputs to the macro can be parsed in complex ways through the use of syntax parsers." "The macro body is also (implicitly) run in the Meta monad, to save some typing." "Also, the compiler state can be accessed through the *compiler* binding." - (syntax: #export (object {.let [imports (class_imports *compiler*)]} + (syntax: .public (object {.let [imports (class_imports *compiler*)]} {.let [class_vars (list)]} {super (opt (super_class_decl^ imports class_vars))} {interfaces (tuple (some (super_class_decl^ imports class_vars)))} @@ -58,28 +58,32 @@ (with_brackets (spaced (list\map constructor_arg$ constructor_args))) (with_brackets (spaced (list\map (method_def$ id) methods))))))] (in (list (` ((~ (code.text def_code)))))))))} - (let [[exported? tokens] (: [Bit (List Code)] - (case tokens - (^ (list& [_ (#.Tag ["" "export"])] tokens')) - [#1 tokens'] - - _ - [#0 tokens])) - ?parts (: (Maybe [Text (List Code) Code Code]) + (let [?parts (: (Maybe [Code Text (List Code) Code Code]) (case tokens + (^ (list export_policy + [_ (#.Form (list& [_ (#.Identifier ["" name])] args))] + body)) + (#.Some [export_policy name args (` {}) body]) + + (^ (list export_policy + [_ (#.Form (list& [_ (#.Identifier ["" name])] args))] + meta_data + body)) + (#.Some [export_policy name args meta_data body]) + (^ (list [_ (#.Form (list& [_ (#.Identifier ["" name])] args))] body)) - (#.Some name args (` {}) body) + (#.Some [(` .private) name args (` {}) body]) (^ (list [_ (#.Form (list& [_ (#.Identifier ["" name])] args))] meta_data body)) - (#.Some name args meta_data body) + (#.Some [(` .private) name args meta_data body]) _ #.None))] (case ?parts - (#.Some [name args meta body]) + (#.Some [export_policy name args meta body]) (with_gensyms [g!tokens g!body g!error] (do {! meta.monad} [vars+parsers (monad.map ! @@ -110,12 +114,8 @@ args) this_module meta.current_module_name .let [g!state (code.identifier ["" "*compiler*"]) - error_msg (code.text (macro.wrong_syntax_error [this_module name])) - export_ast (: (List Code) - (if exported? - (list (' #export)) - (list)))]] - (in (list (` (macro: (~+ export_ast) ((~ (code.identifier ["" name])) (~ g!tokens) (~ g!state)) + error_msg (code.text (macro.wrong_syntax_error [this_module name]))]] + (in (list (` (macro: (~ export_policy) ((~ (code.identifier ["" name])) (~ g!tokens) (~ g!state)) (~ meta) ({(#.Right (~ g!body)) ((~ g!body) (~ g!state)) diff --git a/stdlib/source/library/lux/macro/syntax/annotations.lux b/stdlib/source/library/lux/macro/syntax/annotations.lux index 73738ebc5..88d43f03d 100644 --- a/stdlib/source/library/lux/macro/syntax/annotations.lux +++ b/stdlib/source/library/lux/macro/syntax/annotations.lux @@ -15,27 +15,27 @@ [macro ["." code]]]]) -(type: #export Annotations +(type: .public Annotations {#.doc (doc "Definition/module annotations.")} (List [Name Code])) -(def: #export equivalence +(def: .public equivalence (Equivalence Annotations) (list.equivalence (product.equivalence name.equivalence code.equivalence))) -(def: #export empty +(def: .public empty Annotations (list)) -(def: #export format +(def: .public format (-> Annotations Code) (let [entry (product.apply code.tag function.identity)] (|>> (list\map entry) code.record))) -(def: #export parser +(def: .public parser (Parser Annotations) (<code>.record (<>.some diff --git a/stdlib/source/library/lux/macro/syntax/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux index 2e60ed0cc..c55f6f233 100644 --- a/stdlib/source/library/lux/macro/syntax/check.lux +++ b/stdlib/source/library/lux/macro/syntax/check.lux @@ -17,25 +17,25 @@ (def: extension "lux check") -(type: #export Check +(type: .public Check {#.doc (doc "A type annotation for an expression.")} {#type Code #value Code}) -(def: #export equivalence +(def: .public equivalence (Equivalence Check) ($_ product.equivalence code.equivalence code.equivalence )) -(def: #export (format (^slots [#type #value])) +(def: .public (format (^slots [#type #value])) (-> Check Code) (` ((~ (code.text ..extension)) (~ type) (~ value)))) -(def: #export parser +(def: .public parser (Parser Check) (<| <code>.form (<>.after (<code>.text! ..extension)) diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux index 429368764..158bb618f 100644 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ b/stdlib/source/library/lux/macro/syntax/declaration.lux @@ -14,19 +14,19 @@ [macro ["." code]]]]) -(type: #export Declaration +(type: .public Declaration {#.doc (doc "A declaration for either a constant or a function.")} {#name Text #arguments (List Text)}) -(def: #export equivalence +(def: .public equivalence (Equivalence Declaration) ($_ product.equivalence text.equivalence (list.equivalence text.equivalence) )) -(def: #export parser +(def: .public parser {#.doc (doc "A parser for declaration syntax." "Such as:" quux @@ -37,7 +37,7 @@ (<code>.form (<>.and <code>.local_identifier (<>.some <code>.local_identifier))))) -(def: #export (format value) +(def: .public (format value) (-> Declaration Code) (let [g!name (code.local_identifier (get@ #name value))] (case (get@ #arguments value) diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index 4ad19d041..eeefc3074 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -25,7 +25,7 @@ ["#." annotations (#+ Annotations)] ["#." check (#+ Check)]]) -(type: #export Definition +(type: .public Definition {#.doc (doc "Syntax for a constant definition.")} {#name Text #value (Either Check @@ -33,7 +33,7 @@ #anns Annotations #export? Bit}) -(def: #export equivalence +(def: .public equivalence (Equivalence Definition) ($_ product.equivalence text.equivalence @@ -70,7 +70,7 @@ #.line (~ (code.nat (get@ #.line location.dummy))) #.column (~ (code.nat (get@ #.column location.dummy)))})) -(def: #export (format (^slots [#name #value #anns #export?])) +(def: .public (format (^slots [#name #value #anns #export?])) (-> Definition Code) (` ((~ (code.text ..extension)) (~ (code.local_identifier name)) @@ -100,7 +100,7 @@ (in [head tail]))) )))) -(def: #export (parser compiler) +(def: .public (parser compiler) {#.doc "A reader that first macro-expands and then analyses the input Code, to ensure it is a definition."} (-> Lux (Parser Definition)) (do {! <>.monad} @@ -124,11 +124,11 @@ <code>.bit )))) -(exception: #export (lacks_type! {definition Definition}) +(exception: .public (lacks_type! {definition Definition}) (exception.report ["Definition" (%.code (..format definition))])) -(def: #export (typed compiler) +(def: .public (typed compiler) {#.doc "Only works for typed definitions."} (-> Lux (Parser Definition)) (do <>.monad diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux index f1e3c7a0f..03f96a2a0 100644 --- a/stdlib/source/library/lux/macro/syntax/export.lux +++ b/stdlib/source/library/lux/macro/syntax/export.lux @@ -9,13 +9,13 @@ (def: token (' #export)) -(def: #export (format exported?) +(def: .public (format exported?) (-> Bit (List Code)) (if exported? (list ..token) (list))) -(def: #export parser +(def: .public parser (Parser Bit) (<>.either (<>.after (<code>.this! ..token) (<>\in true)) diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux index c8630283e..d577d68e3 100644 --- a/stdlib/source/library/lux/macro/syntax/input.lux +++ b/stdlib/source/library/lux/macro/syntax/input.lux @@ -11,25 +11,25 @@ [macro ["." code]]]]) -(type: #export Input +(type: .public Input {#.doc (doc "The common typed-argument syntax used by many macros.")} {#binding Code #type Code}) -(def: #export equivalence +(def: .public equivalence (Equivalence Input) ($_ product.equivalence code.equivalence code.equivalence )) -(def: #export (format value) +(def: .public (format value) (-> Input Code) (code.record (list [(get@ #binding value) (get@ #type value)]))) -(def: #export parser +(def: .public parser {#.doc "Parser for the common typed-argument syntax used by many macros."} (Parser Input) (<code>.record diff --git a/stdlib/source/library/lux/macro/syntax/type/variable.lux b/stdlib/source/library/lux/macro/syntax/type/variable.lux index a2e710e4d..09dbdcd62 100644 --- a/stdlib/source/library/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/library/lux/macro/syntax/type/variable.lux @@ -11,19 +11,19 @@ [macro ["." code]]]]) -(type: #export Variable +(type: .public Variable {#.doc (doc "A variable'S name.")} Text) -(def: #export equivalence +(def: .public equivalence (Equivalence Variable) text.equivalence) -(def: #export format +(def: .public format (-> Variable Code) code.local_identifier) -(def: #export parser +(def: .public parser {#.doc "Parser for the common type variable/parameter used by many macros."} (Parser Variable) <code>.local_identifier) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index 09204ce76..c8a211113 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- let) + [lux (#- let local) ["." meta] [abstract ["." monad (#+ do)]] @@ -26,13 +26,13 @@ ["." code] ["." local]]) -(syntax: #export (spliced {parts (<code>.tuple (<>.some <code>.any))}) +(syntax: .public (spliced {parts (<code>.tuple (<>.some <code>.any))}) (in parts)) -(syntax: #export (amount {parts (<code>.tuple (<>.some <code>.any))}) +(syntax: .public (amount {parts (<code>.tuple (<>.some <code>.any))}) (in (list (code.nat (list.size parts))))) -(syntax: #export (with_locals {locals (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_locals {locals (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [g!locals (|> locals @@ -79,11 +79,11 @@ (-> Bit (Parser (List Text))) (<code>.tuple (<>.many (..snippet module_side?)))) -(syntax: #export (text {simple (..part false)}) +(syntax: .public (text {simple (..part false)}) (in (list (|> simple (text.join_with "") code.text)))) (template [<name> <simple> <complex>] - [(syntax: #export (<name> {name (<>.or (<>.and (..part true) (..part false)) + [(syntax: .public (<name> {name (<>.or (<>.and (..part true) (..part false)) (..part false))}) (case name (#.Left [simple complex]) @@ -132,7 +132,7 @@ #parameters (List Text) #template (List Code)}) -(exception: #export (irregular_arguments {expected Nat} {actual Nat}) +(exception: .public (irregular_arguments {expected Nat} {actual Nat}) (exception.report ["Expected" (\ nat.decimal encode expected)] ["Actual" (\ nat.decimal encode actual)])) @@ -160,7 +160,7 @@ #parameters parameters #template template}))) -(syntax: #export (let {locals (<code>.tuple (<>.some ..local))} +(syntax: .public (let {locals (<code>.tuple (<>.some ..local))} body) (do meta.monad [here_name meta.current_module_name diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 65c3c01d0..8a7c9feff 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -8,18 +8,20 @@ ["i" int]]]]]) (template [<name> <value> <doc>] - [(def: #export <name> + [(def: .public <name> {#.doc <doc>} <value>)] [e +2.7182818284590452354 "The base of the natural logarithm."] + ## ["Ï€ is wrong!" by Bob Palais](https://www.math.utah.edu/~palais/pi.html) [pi +3.14159265358979323846 "The ratio of a circle's circumference to its diameter."] + ## [The Tau Manifesto](https://tauday.com/tau-manifesto) [tau +6.28318530717958647692 "The ratio of a circle's circumference to its radius."] ) (for {@.old (as_is (template [<name> <method>] - [(def: #export (<name> input) + [(def: .public (<name> input) (-> Frac Frac) (<method> input))] @@ -40,24 +42,24 @@ [root/2 "jvm invokestatic:java.lang.Math:sqrt:double"] [root/3 "jvm invokestatic:java.lang.Math:cbrt:double"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) ("jvm invokestatic:java.lang.Math:pow:double,double" subject param))) @.jvm (as_is (template: (!double value) - (|> value - (:as (primitive "java.lang.Double")) - "jvm object cast")) + [(|> value + (:as (primitive "java.lang.Double")) + "jvm object cast")]) (template: (!frac value) - (|> value - "jvm object cast" - (: (primitive "java.lang.Double")) - (:as Frac))) + [(|> value + "jvm object cast" + (: (primitive "java.lang.Double")) + (:as Frac))]) (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> !double ["D"] @@ -82,7 +84,7 @@ [root/3 "cbrt"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) (|> ("jvm member invoke static" [] "java.lang.Math" "pow" [] ["D" (!double subject)] ["D" (!double param)]) @@ -90,7 +92,7 @@ @.js (as_is (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> ("js apply" ("js constant" <method>)) (:as Frac)))] @@ -113,13 +115,13 @@ [root/3 "Math.cbrt"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) (:as Frac ("js apply" ("js constant" "Math.pow") subject param)))) @.python (as_is (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> ("python object do" <method> ("python import" "math")) (:as Frac)))] @@ -141,17 +143,17 @@ [root/2 "sqrt"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) (:as Frac ("python object do" "pow" ("python import" "math") subject param))) - (def: #export root/3 + (def: .public root/3 (-> Frac Frac) (..pow ("lux f64 /" +3.0 +1.0)))) @.lua (as_is (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> ("lua apply" ("lua constant" <method>)) (:as Frac)))] @@ -173,17 +175,17 @@ [root/2 "math.sqrt"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) ("lua power" param subject)) - (def: #export root/3 + (def: .public root/3 (-> Frac Frac) (..pow ("lux f64 /" +3.0 +1.0)))) @.ruby (as_is (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> ("ruby apply" ("ruby constant" <method>)) (:as Frac)))] @@ -204,7 +206,7 @@ ) (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> ("ruby object do" <method>) (:as Int) @@ -214,13 +216,13 @@ [floor "floor"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) (:as Frac ("ruby object do" "**" subject param)))) @.php (as_is (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> ("php apply" ("php constant" <method>)) (:as Frac)))] @@ -242,17 +244,17 @@ [root/2 "sqrt"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) (:as Frac ("php apply" ("php constant" "pow") subject param))) - (def: #export root/3 + (def: .public root/3 (-> Frac Frac) (..pow ("lux f64 /" +3.0 +1.0)))) @.scheme (as_is (template [<name> <method>] - [(def: #export <name> + [(def: .public <name> (-> Frac Frac) (|>> ("scheme apply" ("scheme constant" <method>)) (:as Frac)))] @@ -274,16 +276,16 @@ [root/2 "sqrt"] ) - (def: #export (pow param subject) + (def: .public (pow param subject) (-> Frac Frac Frac) (:as Frac ("scheme apply" ("scheme constant" "expt") subject param))) - (def: #export root/3 + (def: .public root/3 (-> Frac Frac) (..pow ("lux f64 /" +3.0 +1.0)))) }) -(def: #export (round input) +(def: .public (round input) (-> Frac Frac) (let [floored (floor input) diff ("lux f64 -" floored input)] @@ -296,7 +298,7 @@ ## else floored))) -(def: #export (atan/2 x y) +(def: .public (atan/2 x y) (-> Frac Frac Frac) (cond ("lux f64 <" x +0.0) (..atan ("lux f64 /" x y)) @@ -317,13 +319,13 @@ ## ("lux f64 =" +0.0 y) ("lux f64 /" +0.0 +0.0)))) -(def: #export (log' base input) +(def: .public (log' base input) (-> Frac Frac Frac) ("lux f64 /" (..log base) (..log input))) -(def: #export (factorial n) +(def: .public (factorial n) (-> Nat Nat) (loop [acc 1 n n] @@ -331,7 +333,7 @@ acc (recur (n.* n acc) (dec n))))) -(def: #export (hypotenuse catA catB) +(def: .public (hypotenuse catA catB) (-> Frac Frac Frac) (..pow +0.5 ("lux f64 +" (..pow +2.0 catA) @@ -340,11 +342,11 @@ ## Hyperbolic functions ## https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions (template [<name> <comp> <inverse>] - [(def: #export (<name> x) + [(def: .public (<name> x) (-> Frac Frac) (|> (..exp x) (<comp> (..exp ("lux f64 *" -1.0 x))) ("lux f64 /" +2.0))) - (def: #export (<inverse> x) + (def: .public (<inverse> x) (-> Frac Frac) (|> +2.0 ("lux f64 /" (|> (..exp x) (<comp> (..exp ("lux f64 *" -1.0 x)))))))] @@ -353,7 +355,7 @@ ) (template [<name> <top> <bottom>] - [(def: #export (<name> x) + [(def: .public (<name> x) (-> Frac Frac) (let [e+ (exp x) e- (exp ("lux f64 *" -1.0 x)) @@ -367,7 +369,7 @@ ## https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms (template [<name> <comp>] - [(def: #export (<name> x) + [(def: .public (<name> x) (-> Frac Frac) (|> x (pow +2.0) (<comp> +1.0) (pow +0.5) ("lux f64 +" x) log))] @@ -376,7 +378,7 @@ ) (template [<name> <base> <diff>] - [(def: #export (<name> x) + [(def: .public (<name> x) (-> Frac Frac) (let [x+ (|> <base> ("lux f64 +" <diff>)) x- (|> <base> ("lux f64 -" <diff>))] @@ -387,7 +389,7 @@ ) (template [<name> <op>] - [(def: #export (<name> x) + [(def: .public (<name> x) (-> Frac Frac) (let [x^2 (|> x (pow +2.0))] (|> +1.0 (<op> x^2) (pow +0.5) ("lux f64 +" +1.0) ("lux f64 /" x) log)))] diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index 4b1a1ef8b..55653989a 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -80,7 +80,7 @@ (#Binary left op right) (` ((~ op) (~ (prefix right)) (~ (prefix left)))))) -(syntax: #export (infix {expr infix^}) +(syntax: .public (infix {expr infix^}) {#.doc (doc "Infix math syntax." (infix [x i.* +10]) (infix [[x i.+ y] i.* [x i.- y]]) diff --git a/stdlib/source/library/lux/math/logic/continuous.lux b/stdlib/source/library/lux/math/logic/continuous.lux index e68527938..691890917 100644 --- a/stdlib/source/library/lux/math/logic/continuous.lux +++ b/stdlib/source/library/lux/math/logic/continuous.lux @@ -11,15 +11,15 @@ [number ["/" rev ("#\." interval)]]]]]) -(def: #export false Rev /\bottom) -(def: #export true Rev /\top) +(def: .public false Rev /\bottom) +(def: .public true Rev /\top) (template [<name> <chooser> <monoid> <identity>] - [(def: #export <name> + [(def: .public <name> (-> Rev Rev Rev) <chooser>) - (implementation: #export <monoid> + (implementation: .public <monoid> (Monoid Rev) (def: identity <identity>) @@ -29,16 +29,16 @@ [and /.min conjunction ..true] ) -(def: #export (not input) +(def: .public (not input) (-> Rev Rev) (/.- input ..true)) -(def: #export (implies consequent antecedent) +(def: .public (implies consequent antecedent) (-> Rev Rev Rev) (or (not antecedent) consequent)) -(def: #export (= left right) +(def: .public (= left right) (-> Rev Rev Rev) (and (or (not left) right) (or left (not right)))) diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux index a449f1ca6..d36b7cfd2 100644 --- a/stdlib/source/library/lux/math/logic/fuzzy.lux +++ b/stdlib/source/library/lux/math/logic/fuzzy.lux @@ -17,18 +17,18 @@ ["." // #_ ["#" continuous]]) -(type: #export (Fuzzy a) +(type: .public (Fuzzy a) {#.doc (doc "A fuzzy set.")} (-> a Rev)) -(implementation: #export functor +(implementation: .public functor (contravariant.Functor Fuzzy) (def: (map f fb) (|>> f fb))) (template [<name> <verdict>] - [(def: #export <name> + [(def: .public <name> Fuzzy (function (_ _) <verdict>))] @@ -37,12 +37,12 @@ [full //.true] ) -(def: #export (membership set elem) +(def: .public (membership set elem) (All [a] (-> (Fuzzy a) a Rev)) (set elem)) (template [<set_composition> <membership_composition>] - [(def: #export (<set_composition> left right) + [(def: .public (<set_composition> left right) (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (function (_ elem) (<membership_composition> (left elem) @@ -52,27 +52,27 @@ [intersection //.and] ) -(def: #export (complement set) +(def: .public (complement set) (All [a] (-> (Fuzzy a) (Fuzzy a))) (|>> set //.not)) -(def: #export (difference sub base) +(def: .public (difference sub base) (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (..intersection (..complement sub) base)) -(def: #export (of_predicate predicate) +(def: .public (of_predicate predicate) (All [a] (-> (Predicate a) (Fuzzy a))) (function (_ elem) (if (predicate elem) //.true //.false))) -(def: #export (predicate treshold set) +(def: .public (predicate treshold set) (All [a] (-> Rev (Fuzzy a) (Predicate a))) (function (_ elem) (/.> treshold (set elem)))) -(def: #export of_set +(def: .public of_set (All [a] (-> (Set a) (Fuzzy a))) (|>> set.member? ..of_predicate)) @@ -97,18 +97,18 @@ (-> Rev Rev (Fuzzy Rev)) (..complement (..ascending from to))) -(def: #export (gradient from to) +(def: .public (gradient from to) (-> Rev Rev (Fuzzy Rev)) (if (/.< to from) (..ascending from to) (..descending from to))) (template: (!sort_2 <low> <high>) - (if (/.> <low> <high>) - [<low> <high>] - [<high> <low>])) + [(if (/.> <low> <high>) + [<low> <high>] + [<high> <low>])]) -(def: #export (triangle bottom middle top) +(def: .public (triangle bottom middle top) (-> Rev Rev Rev (Fuzzy Rev)) (let [[low_0 high_0] (!sort_2 bottom middle) [bottom' high_1] (!sort_2 low_0 top) @@ -116,7 +116,7 @@ (..intersection (..ascending bottom' middle') (..descending middle' top')))) -(def: #export (trapezoid bottom middle_bottom middle_top top) +(def: .public (trapezoid bottom middle_bottom middle_top top) (-> Rev Rev Rev Rev (Fuzzy Rev)) (let [[low_0 high_0] (!sort_2 bottom middle_bottom) [low_1 high_1] (!sort_2 middle_top top) @@ -126,7 +126,7 @@ (..intersection (..ascending bottom' middle_bottom') (..descending middle_top' top')))) -(def: #export (cut treshold set) +(def: .public (cut treshold set) (All [a] (-> Rev (Fuzzy a) (Fuzzy a))) (function (_ elem) (let [membership (set elem)] diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index bc92467b1..7bfbf34a0 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -27,19 +27,19 @@ ["." // #_ ["#" modulus (#+ Modulus)]]) -(abstract: #export (Mod m) +(abstract: .public (Mod m) + {#.doc "A number under a modulus."} + {#modulus (Modulus m) #value Int} - {#.doc "A number under a modulus."} - - (def: #export (modular modulus value) + (def: .public (modular modulus value) (All [%] (-> (Modulus %) Int (Mod %))) (:abstraction {#modulus modulus #value (i.mod (//.divisor modulus) value)})) (template [<name> <type> <side>] - [(def: #export <name> + [(def: .public <name> (All [%] (-> (Mod %) <type>)) (|>> :representation <side>))] @@ -47,7 +47,7 @@ [value Int product.right] ) - (exception: #export [%] (incorrect_modulus {modulus (Modulus %)} + (exception: .public [%] (incorrect_modulus {modulus (Modulus %)} {parsed Int}) (exception.report ["Expected" (i\encode (//.divisor modulus))] @@ -61,7 +61,7 @@ (<>.codec i.decimal (<text>.and (<text>.one_of "-+") (<text>.many <text>.decimal)))) - (implementation: #export (codec expected) + (implementation: .public (codec expected) (All [%] (-> (Modulus %) (Codec Text (Mod %)))) (def: (encode modular) @@ -80,7 +80,7 @@ (in (..modular expected value)))))) (template [<name> <op>] - [(def: #export (<name> reference subject) + [(def: .public (<name> reference subject) (All [%] (-> (Mod %) (Mod %) Bit)) (let [[_ reference] (:representation reference) [_ subject] (:representation subject)] @@ -93,19 +93,19 @@ [>= i.>=] ) - (implementation: #export equivalence + (implementation: .public equivalence (All [%] (Equivalence (Mod %))) (def: = ..=)) - (implementation: #export order + (implementation: .public order (All [%] (Order (Mod %))) (def: &equivalence ..equivalence) (def: < ..<)) (template [<name> <op>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (All [%] (-> (Mod %) (Mod %) (Mod %))) (let [[modulus param] (:representation param) [_ subject] (:representation subject)] @@ -120,7 +120,7 @@ ) (template [<composition> <identity> <monoid>] - [(implementation: #export (<monoid> modulus) + [(implementation: .public (<monoid> modulus) (All [%] (-> (Modulus %) (Monoid (Mod %)))) (def: identity @@ -132,7 +132,7 @@ [..* +1 multiplication] ) - (def: #export (inverse modular) + (def: .public (inverse modular) (All [%] (-> (Mod %) (Maybe (Mod %)))) (let [[modulus value] (:representation modular) [[vk mk] gcd] (i.extended_gcd value (//.divisor modulus))] @@ -141,13 +141,13 @@ _ #.None))) ) -(exception: #export [r% s%] (moduli_are_not_equal {reference (Modulus r%)} +(exception: .public [r% s%] (moduli_are_not_equal {reference (Modulus r%)} {subject (Modulus s%)}) (exception.report ["Reference" (i\encode (//.divisor reference))] ["Subject" (i\encode (//.divisor subject))])) -(def: #export (adapter reference subject) +(def: .public (adapter reference subject) (All [r% s%] (-> (Modulus r%) (Modulus s%) (Try (-> (Mod s%) (Mod r%))))) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index 05a0ef26d..72f5d583e 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -18,30 +18,30 @@ [type abstract]]]) -(exception: #export zero_cannot_be_a_modulus) - -(abstract: #export (Modulus %) - Int +(exception: .public zero_cannot_be_a_modulus) +(abstract: .public (Modulus %) {#.doc (doc "A number used as a modulus in modular arithmetic." "It cannot be 0.")} - (def: #export (modulus value) + Int + + (def: .public (modulus value) (Ex [%] (-> Int (Try (Modulus %)))) (if (i.= +0 value) (exception.except ..zero_cannot_be_a_modulus []) (#try.Success (:abstraction value)))) - (def: #export divisor + (def: .public divisor (All [%] (-> (Modulus %) Int)) (|>> :representation)) - (def: #export (= reference subject) + (def: .public (= reference subject) (All [%r %s] (-> (Modulus %r) (Modulus %s) Bit)) (i.= (:representation reference) (:representation subject))) - (def: #export (congruent? modulus reference subject) + (def: .public (congruent? modulus reference subject) (All [%] (-> (Modulus %) Int Int Bit)) (|> subject (i.- reference) @@ -49,7 +49,7 @@ (i.= +0))) ) -(syntax: #export (literal {divisor <code>.int}) +(syntax: .public (literal {divisor <code>.int}) {#.doc (doc "Success!" (literal 123) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index 288afd703..d1e8144ab 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -46,7 +46,7 @@ (text.replace_all ..separator "")) (template [<macro> <nat> <int> <rev> <frac> <error> <doc>] - [(macro: #export (<macro> tokens state) + [(macro: .public (<macro> tokens state) {#.doc <doc>} (case tokens (#.Item [meta (#.Text repr')] #.End) diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux index de73592f0..63df9b5ae 100644 --- a/stdlib/source/library/lux/math/number/complex.lux +++ b/stdlib/source/library/lux/math/number/complex.lux @@ -23,12 +23,12 @@ ["f" frac] ["." int]]]]]) -(type: #export Complex +(type: .public Complex {#.doc (doc "A complex number.")} {#real Frac #imaginary Frac}) -(syntax: #export (complex real {?imaginary (<>.maybe <code>.any)}) +(syntax: .public (complex real {?imaginary (<>.maybe <code>.any)}) {#.doc (doc "Complex literals." (complex real imaginary) "The imaginary part can be omitted if it's +0.0." @@ -36,23 +36,23 @@ (in (list (` {#..real (~ real) #..imaginary (~ (maybe.else (' +0.0) ?imaginary))})))) -(def: #export i +(def: .public i (..complex +0.0 +1.0)) -(def: #export +one +(def: .public +one (..complex +1.0 +0.0)) -(def: #export -one +(def: .public -one (..complex -1.0 +0.0)) -(def: #export zero +(def: .public zero (..complex +0.0 +0.0)) -(def: #export (not_a_number? complex) +(def: .public (not_a_number? complex) (or (f.not_a_number? (get@ #real complex)) (f.not_a_number? (get@ #imaginary complex)))) -(def: #export (= param input) +(def: .public (= param input) (-> Complex Complex Bit) (and (f.= (get@ #real param) (get@ #real input)) @@ -60,7 +60,7 @@ (get@ #imaginary input)))) (template [<name> <op>] - [(def: #export (<name> param input) + [(def: .public (<name> param input) (-> Complex Complex Complex) {#real (<op> (get@ #real param) (get@ #real input)) @@ -71,13 +71,13 @@ [- f.-] ) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Complex) (def: = ..=)) (template [<name> <transform>] - [(def: #export <name> + [(def: .public <name> (-> Complex Complex) (|>> (update@ #real <transform>) (update@ #imaginary <transform>)))] @@ -86,18 +86,18 @@ [signum f.signum] ) -(def: #export conjugate +(def: .public conjugate (-> Complex Complex) (update@ #imaginary f.opposite)) -(def: #export (*' param input) +(def: .public (*' param input) (-> Frac Complex Complex) {#real (f.* param (get@ #real input)) #imaginary (f.* param (get@ #imaginary input))}) -(def: #export (* param input) +(def: .public (* param input) (-> Complex Complex Complex) {#real (f.- (f.* (get@ #imaginary param) (get@ #imaginary input)) @@ -108,7 +108,7 @@ (f.* (get@ #imaginary param) (get@ #real input)))}) -(def: #export (/ param input) +(def: .public (/ param input) (-> Complex Complex Complex) (let [(^slots [#real #imaginary]) param] (if (f.< (f.abs imaginary) @@ -122,13 +122,13 @@ {#real (|> (get@ #imaginary input) (f.* quot) (f.+ (get@ #real input)) (f./ denom)) #imaginary (|> (get@ #imaginary input) (f.- (f.* quot (get@ #real input))) (f./ denom))})))) -(def: #export (/' param subject) +(def: .public (/' param subject) (-> Frac Complex Complex) (let [(^slots [#real #imaginary]) subject] {#real (f./ param real) #imaginary (f./ param imaginary)})) -(def: #export (% param input) +(def: .public (% param input) (-> Complex Complex Complex) (let [scaled (/ param input) quotient (|> scaled @@ -137,7 +137,7 @@ (- (* quotient param) input))) -(def: #export (cos subject) +(def: .public (cos subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] {#real (f.* (math.cosh imaginary) @@ -145,7 +145,7 @@ #imaginary (f.opposite (f.* (math.sinh imaginary) (math.sin real)))})) -(def: #export (cosh subject) +(def: .public (cosh subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] {#real (f.* (math.cos imaginary) @@ -153,7 +153,7 @@ #imaginary (f.* (math.sin imaginary) (math.sinh real))})) -(def: #export (sin subject) +(def: .public (sin subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] {#real (f.* (math.cosh imaginary) @@ -161,7 +161,7 @@ #imaginary (f.* (math.sinh imaginary) (math.cos real))})) -(def: #export (sinh subject) +(def: .public (sinh subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] {#real (f.* (math.cos imaginary) @@ -169,7 +169,7 @@ #imaginary (f.* (math.sin imaginary) (math.cosh real))})) -(def: #export (tan subject) +(def: .public (tan subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject r2 (f.* +2.0 real) @@ -178,7 +178,7 @@ {#real (f./ d (math.sin r2)) #imaginary (f./ d (math.sinh i2))})) -(def: #export (tanh subject) +(def: .public (tanh subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject r2 (f.* +2.0 real) @@ -187,7 +187,7 @@ {#real (f./ d (math.sinh r2)) #imaginary (f./ d (math.sin i2))})) -(def: #export (abs subject) +(def: .public (abs subject) (-> Complex Frac) (let [(^slots [#real #imaginary]) subject] (if (f.< (f.abs imaginary) @@ -203,21 +203,21 @@ (f.* (math.pow +0.5 (f.+ +1.0 (f.* q q))) (f.abs real))))))) -(def: #export (exp subject) +(def: .public (exp subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject r_exp (math.exp real)] {#real (f.* r_exp (math.cos imaginary)) #imaginary (f.* r_exp (math.sin imaginary))})) -(def: #export (log subject) +(def: .public (log subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] {#real (|> subject ..abs math.log) #imaginary (math.atan/2 real imaginary)})) (template [<name> <type> <op>] - [(def: #export (<name> param input) + [(def: .public (<name> param input) (-> <type> Complex Complex) (|> input log (<op> param) exp))] @@ -229,7 +229,7 @@ (-> Frac Frac Frac) (f.* (f.signum sign) magnitude)) -(def: #export (root/2 input) +(def: .public (root/2 input) (-> Complex Complex) (let [(^slots [#real #imaginary]) input t (|> input ..abs (f.+ (f.abs real)) (f./ +2.0) (math.pow +0.5))] @@ -245,7 +245,7 @@ (-> Complex Complex) (|> (complex +1.0) (- (* input input)) ..root/2)) -(def: #export (reciprocal (^slots [#real #imaginary])) +(def: .public (reciprocal (^slots [#real #imaginary])) (-> Complex Complex) (if (f.< (f.abs imaginary) (f.abs real)) @@ -260,14 +260,14 @@ {#real scale #imaginary (|> scale f.opposite (f.* q))}))) -(def: #export (acos input) +(def: .public (acos input) (-> Complex Complex) (|> input (..+ (|> input ..root/2-1z (..* ..i))) ..log (..* (..opposite ..i)))) -(def: #export (asin input) +(def: .public (asin input) (-> Complex Complex) (|> input ..root/2-1z @@ -275,7 +275,7 @@ ..log (..* (..opposite ..i)))) -(def: #export (atan input) +(def: .public (atan input) (-> Complex Complex) (|> input (..+ ..i) @@ -283,11 +283,11 @@ ..log (..* (../ (..complex +2.0) ..i)))) -(def: #export (argument (^slots [#real #imaginary])) +(def: .public (argument (^slots [#real #imaginary])) (-> Complex Frac) (math.atan/2 real imaginary)) -(def: #export (roots nth input) +(def: .public (roots nth input) (-> Nat Complex (List Complex)) (if (n.= 0 nth) (list) @@ -307,7 +307,7 @@ {#real real #imaginary imaginary}))))))) -(def: #export (approximately? margin_of_error standard value) +(def: .public (approximately? margin_of_error standard value) (-> Frac Complex Complex Bit) (and (f.approximately? margin_of_error (get@ #..real standard) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index c602db1c5..729d9b5b7 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -22,35 +22,35 @@ ["#." rev] ["/#" //]]) -(def: #export (= reference sample) +(def: .public (= reference sample) {#.doc "Frac(tion) equivalence."} (-> Frac Frac Bit) ("lux f64 =" reference sample)) -(def: #export (< reference sample) +(def: .public (< reference sample) {#.doc "Frac(tion) less-than."} (-> Frac Frac Bit) ("lux f64 <" reference sample)) -(def: #export (<= reference sample) +(def: .public (<= reference sample) {#.doc "Frac(tion) less-than or equal."} (-> Frac Frac Bit) (or ("lux f64 <" reference sample) ("lux f64 =" reference sample))) -(def: #export (> reference sample) +(def: .public (> reference sample) {#.doc "Frac(tion) greater-than."} (-> Frac Frac Bit) ("lux f64 <" sample reference)) -(def: #export (>= reference sample) +(def: .public (>= reference sample) {#.doc "Frac(tion) greater-than or equal."} (-> Frac Frac Bit) (or ("lux f64 <" sample reference) ("lux f64 =" sample reference))) (template [<comparison> <name>] - [(def: #export <name> + [(def: .public <name> (Predicate Frac) (<comparison> +0.0))] @@ -60,7 +60,7 @@ ) (template [<name> <op> <doc>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) {#.doc <doc>} (-> Frac Frac Frac) (<op> param subject))] @@ -72,22 +72,22 @@ [% "lux f64 %" "Frac(tion) remainder."] ) -(def: #export (/% param subject) +(def: .public (/% param subject) (-> Frac Frac [Frac Frac]) [(../ param subject) (..% param subject)]) -(def: #export opposite +(def: .public opposite (-> Frac Frac) (..* -1.0)) -(def: #export (abs x) +(def: .public (abs x) (-> Frac Frac) (if (..< +0.0 x) (..* -1.0 x) x)) -(def: #export (signum x) +(def: .public (signum x) (-> Frac Frac) (cond (..= +0.0 x) +0.0 (..< +0.0 x) -1.0 @@ -98,7 +98,7 @@ (def: max_exponent (//int.frac +1023)) (template [<name> <test> <doc>] - [(def: #export (<name> left right) + [(def: .public (<name> left right) {#.doc <doc>} (-> Frac Frac Frac) (if (<test> right left) @@ -109,11 +109,11 @@ [max ..> "Frac(tion) minimum."] ) -(def: #export nat +(def: .public nat (-> Frac Nat) (|>> "lux f64 i64" .nat)) -(def: #export int +(def: .public int (-> Frac Int) (|>> "lux f64 i64")) @@ -125,7 +125,7 @@ ("lux i64 right-shift" ..exponent_size) "lux i64 f64")) -(def: #export rev +(def: .public rev (-> Frac Rev) (|>> ..abs (..% +1.0) @@ -133,23 +133,23 @@ "lux f64 i64" ("lux i64 left-shift" ..exponent_size))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Frac) (def: = ..=)) -(implementation: #export order +(implementation: .public order (Order Frac) (def: &equivalence ..equivalence) (def: < ..<)) -(def: #export smallest +(def: .public smallest Frac (///.pow (//int.frac (//int.- (.int ..mantissa_size) ..min_exponent)) +2.0)) -(def: #export biggest +(def: .public biggest Frac (let [f2^-52 (///.pow (//nat.frac (//nat.- ..mantissa_size 0)) +2.0) f2^+1023 (///.pow ..max_exponent +2.0)] @@ -158,7 +158,7 @@ (..* f2^+1023)))) (template [<name> <compose> <identity>] - [(implementation: #export <name> + [(implementation: .public <name> (Monoid Frac) (def: identity <identity>) @@ -171,7 +171,7 @@ ) (template [<name> <numerator> <doc>] - [(def: #export <name> + [(def: .public <name> {#.doc <doc>} Frac (../ +0.0 <numerator>))] @@ -180,23 +180,23 @@ [positive_infinity +1.0 "Positive infinity."] ) -(def: #export negative_infinity +(def: .public negative_infinity {#.doc "Negative infinity."} Frac (..* -1.0 ..positive_infinity)) -(def: #export (not_a_number? number) +(def: .public (not_a_number? number) {#.doc "Tests whether a frac is actually not-a-number."} (-> Frac Bit) (not (..= number number))) -(def: #export (number? value) +(def: .public (number? value) (-> Frac Bit) (not (or (..not_a_number? value) (..= ..positive_infinity value) (..= ..negative_infinity value)))) -(implementation: #export decimal +(implementation: .public decimal (Codec Text Frac) (def: (encode x) @@ -247,7 +247,7 @@ (def: smallest_exponent (..log/2 ..smallest)) -(def: #export (bits input) +(def: .public (bits input) (-> Frac I64) (.i64 (cond (..not_a_number? input) ..not_a_number_bits @@ -310,7 +310,7 @@ [sign 1 ..sign_offset] ) -(def: #export (of_bits input) +(def: .public (of_bits input) (-> I64 Frac) (case [(: Nat (..exponent input)) (: Nat (..mantissa input)) @@ -374,7 +374,7 @@ (#try.Success [representation +0]))) (template [<struct> <nat> <int> <error>] - [(implementation: #export <struct> + [(implementation: .public <struct> (Codec Text Frac) (def: (encode value) @@ -427,20 +427,20 @@ [hex //nat.hex //int.hex "Invalid hexadecimal syntax: "] ) -(implementation: #export hash +(implementation: .public hash (Hash Frac) (def: &equivalence ..equivalence) (def: hash ..bits)) -(def: #export (approximately? margin_of_error standard value) +(def: .public (approximately? margin_of_error standard value) (-> Frac Frac Frac Bit) (|> value (..- standard) ..abs (..< margin_of_error))) -(def: #export (mod divisor dividend) +(def: .public (mod divisor dividend) (All [m] (-> Frac Frac Frac)) (let [remainder (..% divisor dividend)] (if (or (and (..< +0.0 divisor) diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux index 569e228fd..0f273497c 100644 --- a/stdlib/source/library/lux/math/number/i16.lux +++ b/stdlib/source/library/lux/math/number/i16.lux @@ -12,7 +12,7 @@ (def: sub (maybe.assume (i64.sub 16))) -(def: #export I16 +(def: .public I16 {#.doc (doc "A 16-bit integer.")} (:by_example [size] (Sub size) @@ -20,7 +20,7 @@ (I64 size))) -(def: #export equivalence (Equivalence I16) (\ ..sub &equivalence)) -(def: #export width Nat (\ ..sub width)) -(def: #export i16 (-> I64 I16) (\ ..sub narrow)) -(def: #export i64 (-> I16 I64) (\ ..sub widen)) +(def: .public equivalence (Equivalence I16) (\ ..sub &equivalence)) +(def: .public width Nat (\ ..sub width)) +(def: .public i16 (-> I64 I16) (\ ..sub narrow)) +(def: .public i64 (-> I16 I64) (\ ..sub widen)) diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux index 33374d19a..61fe87f40 100644 --- a/stdlib/source/library/lux/math/number/i32.lux +++ b/stdlib/source/library/lux/math/number/i32.lux @@ -12,7 +12,7 @@ (def: sub (maybe.assume (i64.sub 32))) -(def: #export I32 +(def: .public I32 {#.doc (doc "A 32-bit integer.")} (:by_example [size] (Sub size) @@ -20,7 +20,7 @@ (I64 size))) -(def: #export equivalence (Equivalence I32) (\ ..sub &equivalence)) -(def: #export width Nat (\ ..sub width)) -(def: #export i32 (-> I64 I32) (\ ..sub narrow)) -(def: #export i64 (-> I32 I64) (\ ..sub widen)) +(def: .public equivalence (Equivalence I32) (\ ..sub &equivalence)) +(def: .public width Nat (\ ..sub width)) +(def: .public i32 (-> I64 I32) (\ ..sub narrow)) +(def: .public i64 (-> I32 I64) (\ ..sub widen)) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 02dc98748..c6b8a69d8 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -10,19 +10,19 @@ [// ["n" nat]]) -(def: #export bits_per_byte +(def: .public bits_per_byte 8) -(def: #export bytes_per_i64 +(def: .public bytes_per_i64 8) -(def: #export width +(def: .public width Nat (n.* ..bits_per_byte ..bytes_per_i64)) (template [<parameter_type> <name> <op> <doc>] - [(def: #export (<name> parameter subject) + [(def: .public (<name> parameter subject) {#.doc <doc>} (All [s] (-> <parameter_type> (I64 s) (I64 s))) (<op> parameter subject))] @@ -36,34 +36,34 @@ ) ## https://en.wikipedia.org/wiki/Mask_(computing) -(type: #export Mask +(type: .public Mask {#.doc (doc "A pattern of bits that can be imposed on I64 values.")} I64) -(def: #export (bit position) +(def: .public (bit position) {#.doc (doc "A mask with only a specific bit set.")} (-> Nat Mask) (|> 1 .i64 (..left_shifted (n.% ..width position)))) -(def: #export sign +(def: .public sign {#.doc (doc "A mask for the sign bit of ints.")} Mask (..bit (dec ..width))) -(def: #export not +(def: .public not {#.doc "Bitwise negation."} (All [s] (-> (I64 s) (I64 s))) (..xor (.i64 (dec 0)))) -(def: #export false +(def: .public false Mask (.i64 0)) -(def: #export true +(def: .public true Mask (..not ..false)) -(def: #export (mask amount_of_bits) +(def: .public (mask amount_of_bits) {#.doc (doc "Mask a block of bits of the specified size.")} (-> Nat Mask) (case amount_of_bits @@ -76,7 +76,7 @@ (-> Nat Nat Nat) (|> value (right_shifted shift) (n.+ value))) -(def: #export (count subject) +(def: .public (count subject) {#.doc "Count the number of 1s in a bit-map."} (-> (I64 Any) Nat) (let [count' (n.- (|> subject (right_shifted 1) (..and 6148914691236517205) i64) @@ -89,13 +89,13 @@ (add_shift 32) (..and 127)))) -(def: #export (clear index input) +(def: .public (clear index input) {#.doc "Clear bit at the given index."} (All [s] (-> Nat (I64 s) (I64 s))) (|> index ..bit ..not (..and input))) (template [<name> <op> <doc>] - [(def: #export (<name> index input) + [(def: .public (<name> index input) {#.doc <doc>} (All [s] (-> Nat (I64 s) (I64 s))) (|> index ..bit (<op> input)))] @@ -104,16 +104,16 @@ [flip ..xor "Flip bit at given index."] ) -(def: #export (set? index input) +(def: .public (set? index input) (-> Nat (I64 Any) Bit) (|> input (:as I64) (..and (..bit index)) (n.= 0) .not)) -(def: #export (clear? index input) +(def: .public (clear? index input) (-> Nat (I64 Any) Bit) (.not (..set? index input))) (template [<name> <forward> <backward>] - [(def: #export (<name> distance input) + [(def: .public (<name> distance input) (All [s] (-> Nat (I64 s) (I64 s))) (..or (<forward> distance input) (<backward> (n.- (n.% ..width distance) ..width) input)))] @@ -122,18 +122,18 @@ [right_rotated ..right_shifted ..left_shifted] ) -(def: #export (region offset size) +(def: .public (region offset size) {#.doc (doc "A mask for a block of bits of the given size, starting at the given offset.")} (-> Nat Nat Mask) (..left_rotated offset (..mask size))) -(implementation: #export equivalence +(implementation: .public equivalence (All [a] (Equivalence (I64 a))) (def: (= reference sample) ("lux i64 =" reference sample))) -(implementation: #export hash +(implementation: .public hash (All [a] (Hash (I64 a))) (def: &equivalence ..equivalence) @@ -141,7 +141,7 @@ (def: hash .nat)) (template [<monoid> <identity> <compose>] - [(implementation: #export <monoid> + [(implementation: .public <monoid> (All [a] (Monoid (I64 a))) (def: identity <identity>) @@ -151,7 +151,7 @@ [conjunction ..true ..and] ) -(def: #export reversed +(def: .public reversed (All [a] (-> (I64 a) (I64 a))) (let [swapper (: (-> Nat (All [a] (-> (I64 a) (I64 a)))) (function (_ power) @@ -188,7 +188,7 @@ swap/02 swap/01))) -(interface: #export (Sub size) +(interface: .public (Sub size) {#.doc (doc "A sub-space of I64 with a reduce amount of bits.")} (: (Equivalence (I64 size)) @@ -200,7 +200,7 @@ (: (-> (I64 size) I64) widen)) -(def: #export (sub width) +(def: .public (sub width) {#.doc (doc "Given a width in the interval (0,64), yields an implementation for integers of that width.")} (Ex [size] (-> Nat (Maybe (Sub size)))) (if (.and (n.> 0 width) diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux index 1f02b508b..1c3bccea6 100644 --- a/stdlib/source/library/lux/math/number/i8.lux +++ b/stdlib/source/library/lux/math/number/i8.lux @@ -12,7 +12,7 @@ (def: sub (maybe.assume (i64.sub 8))) -(def: #export I8 +(def: .public I8 {#.doc (doc "An 8-bit integer.")} (:by_example [size] (Sub size) @@ -20,7 +20,7 @@ (I64 size))) -(def: #export equivalence (Equivalence I8) (\ ..sub &equivalence)) -(def: #export width Nat (\ ..sub width)) -(def: #export i8 (-> I64 I8) (\ ..sub narrow)) -(def: #export i64 (-> I8 I64) (\ ..sub widen)) +(def: .public equivalence (Equivalence I8) (\ ..sub &equivalence)) +(def: .public width Nat (\ ..sub width)) +(def: .public i8 (-> I64 I8) (\ ..sub narrow)) +(def: .public i64 (-> I8 I64) (\ ..sub widen)) diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index 610ad296e..dbef9c89c 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -19,29 +19,29 @@ ["#." nat] ["#." i64]]) -(def: #export (= reference sample) +(def: .public (= reference sample) {#.doc "Int(eger) equivalence."} (-> Int Int Bit) ("lux i64 =" reference sample)) -(def: #export (< reference sample) +(def: .public (< reference sample) {#.doc "Int(eger) less-than."} (-> Int Int Bit) ("lux i64 <" reference sample)) -(def: #export (<= reference sample) +(def: .public (<= reference sample) {#.doc "Int(eger) less-than or equal."} (-> Int Int Bit) (if ("lux i64 <" reference sample) #1 ("lux i64 =" reference sample))) -(def: #export (> reference sample) +(def: .public (> reference sample) {#.doc "Int(eger) greater-than."} (-> Int Int Bit) ("lux i64 <" sample reference)) -(def: #export (>= reference sample) +(def: .public (>= reference sample) {#.doc "Int(eger) greater-than or equal."} (-> Int Int Bit) (if ("lux i64 <" sample reference) @@ -49,7 +49,7 @@ ("lux i64 =" reference sample))) (template [<comparison> <name>] - [(def: #export <name> + [(def: .public <name> (Predicate Int) (<comparison> +0))] @@ -59,7 +59,7 @@ ) (template [<name> <test> <doc>] - [(def: #export (<name> left right) + [(def: .public (<name> left right) {#.doc <doc>} (-> Int Int Int) (if (<test> right left) @@ -71,7 +71,7 @@ ) (template [<name> <op> <doc>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) {#.doc <doc>} (-> Int Int Int) (<op> param subject))] @@ -83,25 +83,25 @@ [% "lux i64 %" "Int(eger) remainder."] ) -(def: #export (/% param subject) +(def: .public (/% param subject) {#.doc "Int(eger) [division remainder]."} (-> Int Int [Int Int]) [(../ param subject) (..% param subject)]) -(def: #export (opposite value) +(def: .public (opposite value) {#.doc (doc "A value of equal magnitude and opposite sign.")} (-> Int Int) (..- value +0)) -(def: #export (abs x) +(def: .public (abs x) {#.doc (doc "A value of equal magnitude and positive sign.")} (-> Int Int) (if (..< +0 x) (..* -1 x) x)) -(def: #export (signum x) +(def: .public (signum x) {#.doc (doc "A value (either -1, 0 or +0) which represents the sign.")} (-> Int Int) (cond (..= +0 x) +0 @@ -110,7 +110,7 @@ +1)) ## https://rob.conery.io/2018/08/21/mod-and-remainder-are-not-the-same/ -(def: #export (mod divisor dividend) +(def: .public (mod divisor dividend) {#.doc (doc "Integer modulo." "Note: The modulo and the remainder are not the same.")} (All [m] (-> Int Int Int)) @@ -122,28 +122,28 @@ (..+ divisor remainder) remainder))) -(def: #export even? +(def: .public even? (-> Int Bit) (|>> (..% +2) ("lux i64 =" +0))) -(def: #export odd? +(def: .public odd? (-> Int Bit) (|>> ..even? not)) ## https://en.wikipedia.org/wiki/Greatest_common_divisor -(def: #export (gcd a b) +(def: .public (gcd a b) {#.doc "Greatest Common Divisor."} (-> Int Int Int) (case b +0 a _ (gcd b (..% b a)))) -(def: #export (co_prime? a b) +(def: .public (co_prime? a b) (-> Int Int Bit) (..= +1 (..gcd a b))) ## https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm -(def: #export (extended_gcd a b) +(def: .public (extended_gcd a b) {#.doc "Extended euclidean algorithm."} (-> Int Int [[Int Int] Int]) (loop [x +1 x1 +0 @@ -157,7 +157,7 @@ b1 (- (* q b1) a1)))))) ## https://en.wikipedia.org/wiki/Least_common_multiple -(def: #export (lcm a b) +(def: .public (lcm a b) {#.doc "Least Common Multiple."} (-> Int Int Int) (case [a b] @@ -167,22 +167,22 @@ _ (|> a (/ (gcd a b)) (* b)))) -(def: #export frac +(def: .public frac (-> Int Frac) (|>> "lux i64 f64")) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Int) (def: = ..=)) -(implementation: #export order +(implementation: .public order (Order Int) (def: &equivalence ..equivalence) (def: < ..<)) -(implementation: #export enum +(implementation: .public enum (Enum Int) (def: &order ..order) @@ -190,7 +190,7 @@ (def: pred dec)) ## TODO: Find out why the numeric literals fail during JS compilation. -(implementation: #export interval +(implementation: .public interval (Interval Int) (def: &enum ..enum) @@ -204,7 +204,7 @@ (//i64.left_shifted 63 +1))) (template [<name> <compose> <identity>] - [(implementation: #export <name> + [(implementation: .public <name> (Monoid Int) (def: identity <identity>) @@ -220,7 +220,7 @@ (def: +sign "+") (template [<struct> <codec> <error>] - [(implementation: #export <struct> + [(implementation: .public <struct> (Codec Text Int) (def: (encode value) @@ -254,13 +254,13 @@ [hex //nat.hex "Invalid hexadecimal syntax for Int: "] ) -(implementation: #export hash +(implementation: .public hash (Hash Int) (def: &equivalence ..equivalence) (def: hash .nat)) -(def: #export (right_shifted parameter subject) +(def: .public (right_shifted parameter subject) {#.doc "Signed/arithmetic bitwise right-shift."} (-> Nat Int Int) (//i64.or (//i64.and //i64.sign subject) diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index 7599e221f..63c2302c4 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -16,7 +16,7 @@ ["." maybe]]]]) (template [<extension> <output> <name> <documentation>] - [(def: #export (<name> parameter subject) + [(def: .public (<name> parameter subject) {#.doc <documentation>} (-> Nat Nat <output>) (<extension> parameter subject))] @@ -35,7 +35,7 @@ (let [mask (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))] (|>> ("lux i64 and" mask)))) -(def: #export (< reference sample) +(def: .public (< reference sample) {#.doc "Nat(ural) less-than."} (-> Nat Nat Bit) (let [referenceH (..high reference) @@ -48,19 +48,19 @@ (..low sample)) #0)))) -(def: #export (<= reference sample) +(def: .public (<= reference sample) {#.doc "Nat(ural) less-than or equal."} (-> Nat Nat Bit) (if (..< reference sample) #1 ("lux i64 =" reference sample))) -(def: #export (> reference sample) +(def: .public (> reference sample) {#.doc "Nat(ural) greater-than."} (-> Nat Nat Bit) (..< sample reference)) -(def: #export (>= reference sample) +(def: .public (>= reference sample) {#.doc "Nat(ural) greater-than or equal."} (-> Nat Nat Bit) (if (..< sample reference) @@ -68,7 +68,7 @@ ("lux i64 =" reference sample))) (template [<name> <test> <doc>] - [(def: #export (<name> left right) + [(def: .public (<name> left right) {#.doc <doc>} (-> Nat Nat Nat) (if (<test> right left) @@ -79,7 +79,7 @@ [max ..> "Nat(ural) maximum."] ) -(def: #export (* parameter subject) +(def: .public (* parameter subject) {#.doc "Nat(ural) multiplication."} (-> Nat Nat Nat) (:as Nat @@ -87,7 +87,7 @@ (:as Int parameter) (:as Int subject)))) -(def: #export (/ parameter subject) +(def: .public (/ parameter subject) {#.doc "Nat(ural) division."} (-> Nat Nat Nat) (if ("lux i64 <" +0 (:as Int parameter)) @@ -106,7 +106,7 @@ quotient ("lux i64 +" 1 quotient))))) -(def: #export (/% parameter subject) +(def: .public (/% parameter subject) {#.doc "Nat(ural) [division remainder]."} (-> Nat Nat [Nat Nat]) (let [quotient (../ parameter subject) @@ -115,7 +115,7 @@ (:as Int quotient))] [quotient ("lux i64 -" flat subject)])) -(def: #export (% parameter subject) +(def: .public (% parameter subject) {#.doc "Nat(ural) remainder."} (-> Nat Nat Nat) (let [flat ("lux i64 *" @@ -123,18 +123,18 @@ (:as Int (../ parameter subject)))] ("lux i64 -" flat subject))) -(def: #export (gcd a b) +(def: .public (gcd a b) {#.doc "Greatest Common Divisor."} (-> Nat Nat Nat) (case b 0 a _ (gcd b (..% b a)))) -(def: #export (co_prime? a b) +(def: .public (co_prime? a b) (-> Nat Nat Bit) (..= 1 (..gcd a b))) -(def: #export (lcm a b) +(def: .public (lcm a b) {#.doc "Least Common Multiple."} (-> Nat Nat Nat) (case [a b] @@ -144,37 +144,37 @@ _ (|> a (../ (..gcd a b)) (..* b)))) -(def: #export even? +(def: .public even? (-> Nat Bit) (|>> (..% 2) ("lux i64 =" 0))) -(def: #export odd? +(def: .public odd? (-> Nat Bit) (|>> ..even? not)) -(def: #export frac +(def: .public frac (-> Nat Frac) (|>> .int "lux i64 f64")) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Nat) (def: = ..=)) -(implementation: #export order +(implementation: .public order (Order Nat) (def: &equivalence ..equivalence) (def: < ..<)) -(implementation: #export enum +(implementation: .public enum (Enum Nat) (def: &order ..order) (def: succ inc) (def: pred dec)) -(implementation: #export interval +(implementation: .public interval (Interval Nat) (def: &enum ..enum) @@ -182,7 +182,7 @@ (def: bottom 0)) (template [<name> <compose> <identity>] - [(implementation: #export <name> + [(implementation: .public <name> (Monoid Nat) (def: identity <identity>) @@ -300,7 +300,7 @@ _ #.None)) (template [<shift> <struct> <to_character> <to_value> <error>] - [(implementation: #export <struct> + [(implementation: .public <struct> (Codec Text Nat) (def: encode @@ -341,7 +341,7 @@ [4 hex hexadecimal_character hexadecimal_value "Invalid hexadecimal syntax for Nat: "] ) -(implementation: #export decimal +(implementation: .public decimal (Codec Text Nat) (def: (encode value) @@ -373,7 +373,7 @@ (#try.Success output))) <failure>))))) -(implementation: #export hash +(implementation: .public hash (Hash Nat) (def: &equivalence ..equivalence) diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index a53f87dd9..a9a494208 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -23,12 +23,12 @@ [// ["n" nat ("#\." decimal)]]) -(type: #export Ratio +(type: .public Ratio {#.doc (doc "An unsigned ratio of numbers.")} {#numerator Nat #denominator Nat}) -(def: #export (nat value) +(def: .public (nat value) (-> Ratio (Maybe Nat)) (case (get@ #denominator value) 1 (#.Some (get@ #numerator value)) @@ -40,7 +40,7 @@ {#numerator (n./ common numerator) #denominator (n./ common denominator)})) -(syntax: #export (ratio numerator {?denominator (<>.maybe <code>.any)}) +(syntax: .public (ratio numerator {?denominator (<>.maybe <code>.any)}) {#.doc (doc "Rational literals." (ratio numerator denominator) "The denominator can be omitted if it is 1." @@ -48,14 +48,14 @@ (in (list (` ((~! ..normal) {#..numerator (~ numerator) #..denominator (~ (maybe.else (' 1) ?denominator))}))))) -(def: #export (= parameter subject) +(def: .public (= parameter subject) (-> Ratio Ratio Bit) (and (n.= (get@ #numerator parameter) (get@ #numerator subject)) (n.= (get@ #denominator parameter) (get@ #denominator subject)))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Ratio) (def: = ..=)) @@ -67,72 +67,72 @@ (n.* (get@ #denominator parameter) (get@ #numerator subject))]) -(def: #export (< parameter subject) +(def: .public (< parameter subject) (-> Ratio Ratio Bit) (let [[parameter' subject'] (..equalized parameter subject)] (n.< parameter' subject'))) -(def: #export (<= parameter subject) +(def: .public (<= parameter subject) (-> Ratio Ratio Bit) (or (< parameter subject) (= parameter subject))) -(def: #export (> parameter subject) +(def: .public (> parameter subject) (-> Ratio Ratio Bit) (..< subject parameter)) -(def: #export (>= parameter subject) +(def: .public (>= parameter subject) (-> Ratio Ratio Bit) (or (> parameter subject) (= parameter subject))) -(implementation: #export order +(implementation: .public order (Order Ratio) (def: &equivalence ..equivalence) (def: < ..<)) -(def: #export (+ parameter subject) +(def: .public (+ parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject)] (normal [(n.+ parameter' subject') (n.* (get@ #denominator parameter) (get@ #denominator subject))]))) -(def: #export (- parameter subject) +(def: .public (- parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject)] (normal [(n.- parameter' subject') (n.* (get@ #denominator parameter) (get@ #denominator subject))]))) -(def: #export (* parameter subject) +(def: .public (* parameter subject) (-> Ratio Ratio Ratio) (normal [(n.* (get@ #numerator parameter) (get@ #numerator subject)) (n.* (get@ #denominator parameter) (get@ #denominator subject))])) -(def: #export (/ parameter subject) +(def: .public (/ parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject)] (normal [subject' parameter']))) -(def: #export (% parameter subject) +(def: .public (% parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject) quot (n./ parameter' subject')] (..- (update@ #numerator (n.* quot) parameter) subject))) -(def: #export (reciprocal (^slots [#numerator #denominator])) +(def: .public (reciprocal (^slots [#numerator #denominator])) (-> Ratio Ratio) {#numerator denominator #denominator numerator}) (def: separator ":") -(implementation: #export codec +(implementation: .public codec (Codec Text Ratio) (def: (encode (^slots [#numerator #denominator])) @@ -151,7 +151,7 @@ (#.Left (text\compose "Invalid syntax for ratio: " input))))) (template [<identity> <compose> <name>] - [(implementation: #export <name> + [(implementation: .public <name> (Monoid Ratio) (def: identity (..ratio <identity>)) diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index 66abd7e12..dadb71641 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -21,7 +21,7 @@ ["#." int]]) (template [<power> <name>] - [(def: #export <name> + [(def: .public <name> Rev (.rev (//i64.left_shifted (//nat.- <power> //i64.width) 1)))] @@ -39,29 +39,29 @@ [12 /4096] ) -(def: #export (= reference sample) +(def: .public (= reference sample) {#.doc "Rev(olution) equivalence."} (-> Rev Rev Bit) ("lux i64 =" reference sample)) -(def: #export (< reference sample) +(def: .public (< reference sample) {#.doc "Rev(olution) less-than."} (-> Rev Rev Bit) (//nat.< (.nat reference) (.nat sample))) -(def: #export (<= reference sample) +(def: .public (<= reference sample) {#.doc "Rev(olution) less-than or equal."} (-> Rev Rev Bit) (if (//nat.< (.nat reference) (.nat sample)) true ("lux i64 =" reference sample))) -(def: #export (> reference sample) +(def: .public (> reference sample) {#.doc "Rev(olution) greater-than."} (-> Rev Rev Bit) (..< sample reference)) -(def: #export (>= reference sample) +(def: .public (>= reference sample) {#.doc "Rev(olution) greater-than or equal."} (-> Rev Rev Bit) (if (..< sample reference) @@ -69,7 +69,7 @@ ("lux i64 =" reference sample))) (template [<name> <test> <doc>] - [(def: #export (<name> left right) + [(def: .public (<name> left right) {#.doc <doc>} (-> Rev Rev Rev) (if (<test> right left) @@ -81,7 +81,7 @@ ) (template [<name> <op> <doc>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) {#.doc <doc>} (-> Rev Rev Rev) (<op> param subject))] @@ -99,7 +99,7 @@ (let [mask (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))] (|>> ("lux i64 and" mask)))) -(def: #export (* param subject) +(def: .public (* param subject) {#.doc "Rev(olution) multiplication."} (-> Rev Rev Rev) (let [subjectH (..high subject) @@ -131,14 +131,14 @@ (//nat./ numerator ..odd_one)) (with_expansions [<least_significant_bit> 1] - (def: #export (reciprocal numerator) + (def: .public (reciprocal numerator) {#.doc "Rev(olution) reciprocal of a Nat(ural)."} (-> Nat Rev) (.rev (case (: Nat ("lux i64 and" <least_significant_bit> numerator)) 0 (..even_reciprocal numerator) _ (..odd_reciprocal numerator)))) - (def: #export (/ param subject) + (def: .public (/ param subject) {#.doc "Rev(olution) division."} (-> Rev Rev Rev) (if ("lux i64 =" +0 param) @@ -149,7 +149,7 @@ (.rev (//nat.* reciprocal (.nat subject))))))) (template [<operator> <name> <output> <output_type> <documentation>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) {#.doc <documentation>} (-> Rev Rev <output_type>) (<output> (<operator> (.nat param) (.nat subject))))] @@ -159,7 +159,7 @@ ) (template [<operator> <name>] - [(def: #export (<name> scale subject) + [(def: .public (<name> scale subject) (-> Nat Rev Rev) (.rev (<operator> (.nat scale) (.nat subject))))] @@ -167,7 +167,7 @@ [//nat./ down] ) -(def: #export (/% param subject) +(def: .public (/% param subject) (-> Rev Rev [Rev Rev]) [(../ param subject) (..% param subject)]) @@ -180,35 +180,35 @@ (def: frac_denominator (..mantissa -1)) -(def: #export frac +(def: .public frac (-> Rev Frac) (|>> ..mantissa ("lux f64 /" ..frac_denominator))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Rev) (def: = ..=)) -(implementation: #export hash +(implementation: .public hash (Hash Rev) (def: &equivalence ..equivalence) (def: hash .nat)) -(implementation: #export order +(implementation: .public order (Order Rev) (def: &equivalence ..equivalence) (def: < ..<)) -(implementation: #export enum +(implementation: .public enum (Enum Rev) (def: &order ..order) (def: succ inc) (def: pred dec)) -(implementation: #export interval +(implementation: .public interval (Interval Rev) (def: &enum ..enum) @@ -216,7 +216,7 @@ (def: bottom (.rev 0))) (template [<name> <compose> <identity>] - [(implementation: #export <name> + [(implementation: .public <name> (Monoid Rev) (def: identity (\ interval <identity>)) @@ -233,7 +233,7 @@ (template [<struct> <codec> <char_bit_size> <error>] [(with_expansions [<error_output> (as_is (#try.Failure ("lux text concat" <error> repr)))] - (implementation: #export <struct> + (implementation: .public <struct> (Codec Text Rev) (def: (encode value) @@ -408,7 +408,7 @@ (digits\-!' idx (..digit idx param) output)) output))) -(implementation: #export decimal +(implementation: .public decimal (Codec Text Rev) (def: (encode input) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 7d80d6f76..a0f8f66a1 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -38,15 +38,15 @@ [type [refinement (#+ Refiner Refined)]]]]) -(type: #export #rec PRNG +(type: .public #rec PRNG {#.doc "An abstract way to represent any PRNG."} (-> Any [PRNG I64])) -(type: #export (Random a) +(type: .public (Random a) {#.doc "A producer of random values based on a PRNG."} (-> PRNG [PRNG a])) -(implementation: #export functor +(implementation: .public functor (Functor Random) (def: (map f fa) @@ -54,7 +54,7 @@ (let [[state' a] (fa state)] [state' (f a)])))) -(implementation: #export apply +(implementation: .public apply (Apply Random) (def: &functor ..functor) @@ -65,7 +65,7 @@ [state'' a] (fa state')] [state'' (f a)])))) -(implementation: #export monad +(implementation: .public monad (Monad Random) (def: &functor ..functor) @@ -79,7 +79,7 @@ (let [[state' fa] (ffa state)] (fa state'))))) -(def: #export (only pred gen) +(def: .public (only pred gen) {#.doc "Retries the generator until the output satisfies a predicate."} (All [a] (-> (-> a Bit) (Random a) (Random a))) (do ..monad @@ -88,7 +88,7 @@ (in sample) (only pred gen)))) -(def: #export (one check random) +(def: .public (one check random) (All [a b] (-> (-> a (Maybe b)) (Random a) (Random b))) (do ..monad @@ -100,7 +100,7 @@ #.None (one check random)))) -(def: #export (refined refiner gen) +(def: .public (refined refiner gen) {#.doc "Retries the generator until the output can be refined."} (All [t r] (-> (Refiner t r) (Random t) (Random (Refined t r)))) (do ..monad @@ -112,13 +112,13 @@ #.None (refined refiner gen)))) -(def: #export bit +(def: .public bit (Random Bit) (function (_ prng) (let [[prng output] (prng [])] [prng (|> output (i64.and 1) (n.= 1))]))) -(def: #export i64 +(def: .public i64 (Random I64) (function (_ prng) (let [[prng left] (prng []) @@ -128,7 +128,7 @@ ("lux i64 +" right))]))) (template [<name> <type> <cast>] - [(def: #export <name> + [(def: .public <name> (Random <type>) (\ ..monad map <cast> ..i64))] @@ -137,11 +137,11 @@ [rev Rev .rev] ) -(def: #export frac +(def: .public frac (Random Frac) (\ ..monad map (|>> .i64 f.of_bits) ..nat)) -(def: #export safe_frac +(def: .public safe_frac {#.doc (doc "A number in the interval [0.0,1.0].")} (Random Frac) (let [mantissa_range (.int (i64.left_shifted 53 1)) @@ -152,7 +152,7 @@ (f./ mantissa_max)) ..int))) -(def: #export (char set) +(def: .public (char set) (-> unicode.Set (Random Char)) (let [start (unicode.start set) end (unicode.end set) @@ -163,7 +163,7 @@ (\ ..monad map in_range) (..only (unicode.member? set))))) -(def: #export (text char_gen size) +(def: .public (text char_gen size) (-> (Random Char) Nat (Random Text)) (if (n.= 0 size) (\ ..monad in "") @@ -173,7 +173,7 @@ (in (text\compose (text.of_char x) xs))))) (template [<name> <set>] - [(def: #export <name> + [(def: .public <name> (-> Nat (Random Text)) (..text (..char <set>)))] @@ -187,7 +187,7 @@ ) (template [<name> <type> <ctor> <gen>] - [(def: #export <name> + [(def: .public <name> (Random <type>) (do ..monad [left <gen> @@ -198,7 +198,7 @@ [complex c.Complex c.complex ..safe_frac] ) -(def: #export (and left right) +(def: .public (and left right) {#.doc "Sequencing combinator."} (All [a b] (-> (Random a) (Random b) (Random [a b]))) (do ..monad @@ -206,7 +206,7 @@ =right right] (in [=left =right]))) -(def: #export (or left right) +(def: .public (or left right) {#.doc "Heterogeneous alternative combinator."} (All [a b] (-> (Random a) (Random b) (Random (Or a b)))) (do {! ..monad} @@ -219,7 +219,7 @@ [=right right] (in (0 #1 =right)))))) -(def: #export (either left right) +(def: .public (either left right) {#.doc "Homogeneous alternative combinator."} (All [a] (-> (Random a) (Random a) (Random a))) (do ..monad @@ -228,14 +228,14 @@ left right))) -(def: #export (rec gen) +(def: .public (rec gen) {#.doc "A combinator for producing recursive random generators."} (All [a] (-> (-> (Random a) (Random a)) (Random a))) (function (_ state) (let [gen' (gen (rec gen))] (gen' state)))) -(def: #export (maybe value_gen) +(def: .public (maybe value_gen) (All [a] (-> (Random a) (Random (Maybe a)))) (do {! ..monad} [some? bit] @@ -246,7 +246,7 @@ (in #.None)))) (template [<name> <type> <zero> <plus>] - [(def: #export (<name> size value_gen) + [(def: .public (<name> size value_gen) (All [a] (-> Nat (Random a) (Random (<type> a)))) (if (n.> 0 size) (do ..monad @@ -260,7 +260,7 @@ ) (template [<name> <type> <ctor>] - [(def: #export (<name> size value_gen) + [(def: .public (<name> size value_gen) (All [a] (-> Nat (Random a) (Random (<type> a)))) (do ..monad [values (list size value_gen)] @@ -271,7 +271,7 @@ [stack Stack (list\fold stack.push stack.empty)] ) -(def: #export (set hash size value_gen) +(def: .public (set hash size value_gen) (All [a] (-> (Hash a) Nat (Random a) (Random (Set a)))) (if (n.> 0 size) (do {! ..monad} @@ -285,7 +285,7 @@ (recur []))))) (\ ..monad in (set.empty hash)))) -(def: #export (dictionary hash size key_gen value_gen) +(def: .public (dictionary hash size key_gen value_gen) (All [k v] (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v)))) (if (n.> 0 size) (do {! ..monad} @@ -300,23 +300,23 @@ (recur []))))) (\ ..monad in (dictionary.empty hash)))) -(def: #export instant +(def: .public instant (Random Instant) (\ ..monad map instant.of_millis ..int)) -(def: #export date +(def: .public date (Random Date) (\ ..monad map instant.date ..instant)) -(def: #export time +(def: .public time (Random Time) (\ ..monad map instant.time ..instant)) -(def: #export duration +(def: .public duration (Random Duration) (\ ..monad map duration.of_millis ..int)) -(def: #export month +(def: .public month (Random Month) (let [(^open "\.") ..monad] (..either (..either (..either (\in #month.January) @@ -332,7 +332,7 @@ (..either (\in #month.November) (\in #month.December))))))) -(def: #export day +(def: .public day (Random Day) (let [(^open "\.") ..monad] (..either (..either (\in #day.Sunday) @@ -343,18 +343,18 @@ (..either (\in #day.Friday) (\in #day.Saturday)))))) -(def: #export (run prng calc) +(def: .public (run prng calc) (All [a] (-> PRNG (Random a) [PRNG a])) (calc prng)) -(def: #export (prng update return) +(def: .public (prng update return) (All [a] (-> (-> a a) (-> a I64) (-> a PRNG))) (function (recur state) (function (_ _) [(recur (update state)) (return state)]))) -(def: #export (pcg_32 [increase seed]) +(def: .public (pcg_32 [increase seed]) {#.doc (doc "An implementation of the PCG32 algorithm." "For more information, please see: http://www.pcg-random.org/")} (-> [(I64 Any) (I64 Any)] PRNG) @@ -369,7 +369,7 @@ (i64.right_rotated rot) .i64))]))) -(def: #export (xoroshiro_128+ [s0 s1]) +(def: .public (xoroshiro_128+ [s0 s1]) {#.doc (doc "An implementation of the Xoroshiro128+ algorithm." "For more information, please see: http://xoroshiro.di.unimi.it/")} (-> [(I64 Any) (I64 Any)] PRNG) @@ -384,7 +384,7 @@ ## https://en.wikipedia.org/wiki/Xorshift#Initialization ## http://xorshift.di.unimi.it/splitmix64.c -(def: #export split_mix_64 +(def: .public split_mix_64 {#.doc (doc "An implementation of the SplitMix64 algorithm.")} (-> Nat PRNG) (let [twist (: (-> Nat Nat Nat) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index a3ae310b0..c3b66e3fc 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -29,7 +29,7 @@ ## (type: (Meta a) ## (-> Lux (Try [Lux a]))) -(implementation: #export functor +(implementation: .public functor (Functor Meta) (def: (map f fa) @@ -41,7 +41,7 @@ (#try.Success [compiler' a]) (#try.Success [compiler' (f a)]))))) -(implementation: #export apply +(implementation: .public apply (Apply Meta) (def: &functor ..functor) @@ -60,7 +60,7 @@ (#try.Failure msg) (#try.Failure msg))))) -(implementation: #export monad +(implementation: .public monad (Monad Meta) (def: &functor ..functor) @@ -78,11 +78,11 @@ (#try.Success [compiler' ma]) (ma compiler'))))) -(def: #export (run' compiler action) +(def: .public (run' compiler action) (All [a] (-> Lux (Meta a) (Try [Lux a]))) (action compiler)) -(def: #export (run compiler action) +(def: .public (run compiler action) (All [a] (-> Lux (Meta a) (Try a))) (case (action compiler) (#try.Failure error) @@ -91,7 +91,7 @@ (#try.Success [_ output]) (#try.Success output))) -(def: #export (either left right) +(def: .public (either left right) {#.doc "Pick whichever computation succeeds."} (All [a] (-> (Meta a) (Meta a) (Meta a))) (function (_ compiler) @@ -102,7 +102,7 @@ (#try.Success [compiler' output]) (#try.Success [compiler' output])))) -(def: #export (assertion message test) +(def: .public (assertion message test) {#.doc "Fails with the given message if the test is #0."} (-> Text Bit (Meta Any)) (function (_ compiler) @@ -110,14 +110,14 @@ (#try.Success [compiler []]) (#try.Failure message)))) -(def: #export (failure error) +(def: .public (failure error) {#.doc "Fails with the given error message."} (All [a] (-> Text (Meta a))) (function (_ state) (#try.Failure (location.with (get@ #.location state) error)))) -(def: #export (module name) +(def: .public (module name) (-> Text (Meta Module)) (function (_ compiler) (case (plist.get name (get@ #.modules compiler)) @@ -127,7 +127,7 @@ _ (#try.Failure ($_ text\compose "Unknown module: " name))))) -(def: #export current_module_name +(def: .public current_module_name (Meta Text) (function (_ compiler) (case (get@ #.current_module compiler) @@ -137,7 +137,7 @@ _ (#try.Failure "No current module.")))) -(def: #export current_module +(def: .public current_module (Meta Module) (let [(^open "\.") ..monad] (|> ..current_module_name @@ -153,7 +153,7 @@ _ false))) -(def: #export (normal name) +(def: .public (normal name) {#.doc (doc "If given a name without a module prefix, gives it the current module's name as prefix." "Otherwise, returns the name as-is.")} (-> Name (Meta Name)) @@ -184,7 +184,7 @@ (#.Some (:as Macro def_value)) #.None)))) -(def: #export (macro full_name) +(def: .public (macro full_name) (-> Name (Meta (Maybe Macro))) (do ..monad [[module name] (..normal full_name)] @@ -198,13 +198,13 @@ (macro' (get@ #.modules compiler) this_module module name))] (#try.Success [compiler macro])))))) -(def: #export seed +(def: .public seed (Meta Nat) (function (_ compiler) (#try.Success [(update@ #.seed inc compiler) (get@ #.seed compiler)]))) -(def: #export (module_exists? module) +(def: .public (module_exists? module) (-> Text (Meta Bit)) (function (_ compiler) (#try.Success [compiler (case (plist.get module (get@ #.modules compiler)) @@ -249,7 +249,7 @@ _ (\ ..monad in type))) -(def: #export (var_type name) +(def: .public (var_type name) {#.doc "Looks-up the type of a local variable somewhere in the environment."} (-> Text (Meta Type)) (function (_ compiler) @@ -274,7 +274,7 @@ #.None (#try.Failure ($_ text\compose "Unknown variable: " name)))))) -(def: #export (definition name) +(def: .public (definition name) {#.doc "Looks-up a definition's whole data in the available modules (including the current one)."} (-> Name (Meta Global)) (do ..monad @@ -331,7 +331,7 @@ "") " All known modules: " (|> compiler (get@ #.modules) (list\map product.left) (text.join_with separator)) text.new_line))))))) -(def: #export (export name) +(def: .public (export name) {#.doc "Looks-up a definition's type in the available modules (including the current one)."} (-> Name (Meta Definition)) (do ..monad @@ -348,7 +348,7 @@ (in definition) (failure ($_ text\compose "Definition is not an export: " (name\encode name)))))))) -(def: #export (definition_type name) +(def: .public (definition_type name) {#.doc "Looks-up a definition's type in the available modules (including the current one)."} (-> Name (Meta Type)) (do ..monad @@ -360,7 +360,7 @@ (#.Right [exported? def_type def_data def_value]) (clean_type def_type)))) -(def: #export (type name) +(def: .public (type name) {#.doc "Looks-up the type of either a local variable or a definition."} (-> Name (Meta Type)) (do ..monad @@ -373,7 +373,7 @@ _ (definition_type name)))) -(def: #export (type_definition name) +(def: .public (type_definition name) {#.doc "Finds the value of a type definition (such as Int, Any or Lux)."} (-> Name (Meta Type)) (do ..monad @@ -391,7 +391,7 @@ (in (:as Type def_value)) (..failure ($_ text\compose "Definition is not a type: " (name\encode name)))))))) -(def: #export (globals module) +(def: .public (globals module) {#.doc "The entire list of globals in a module (including the non-exported/private ones)."} (-> Text (Meta (List [Text Global]))) (function (_ compiler) @@ -402,7 +402,7 @@ (#.Some module) (#try.Success [compiler (get@ #.definitions module)])))) -(def: #export (definitions module) +(def: .public (definitions module) {#.doc "The entire list of definitions in a module (including the non-exported/private ones)."} (-> Text (Meta (List [Text Definition]))) (\ ..monad map @@ -415,7 +415,7 @@ (#.Some [name definition])))) (..globals module))) -(def: #export (exports module_name) +(def: .public (exports module_name) {#.doc "All the exported definitions in a module."} (-> Text (Meta (List [Text Definition]))) (do ..monad @@ -426,7 +426,7 @@ (in [name [exported? def_type def_data def_value]]) (list)))))) -(def: #export modules +(def: .public modules {#.doc "All the available modules (including the current one)."} (Meta (List [Text Module])) (function (_ compiler) @@ -435,7 +435,7 @@ [compiler] #try.Success))) -(def: #export (tags_of type_name) +(def: .public (tags_of type_name) {#.doc "All the tags associated with a type definition."} (-> Name (Meta (Maybe (List Name)))) (do ..monad @@ -448,13 +448,13 @@ _ (in #.None)))) -(def: #export location +(def: .public location {#.doc "The location of the current expression being analyzed."} (Meta Location) (function (_ compiler) (#try.Success [compiler (get@ #.location compiler)]))) -(def: #export expected_type +(def: .public expected_type {#.doc "The expected type of the current expression being analyzed."} (Meta Type) (function (_ compiler) @@ -465,26 +465,26 @@ #.None (#try.Failure "Not expecting any type.")))) -(def: #export (imported_modules module_name) +(def: .public (imported_modules module_name) {#.doc "All the modules imported by a specified module."} (-> Text (Meta (List Text))) (do ..monad [(^slots [#.imports]) (..module module_name)] (in imports))) -(def: #export (imported_by? import module) +(def: .public (imported_by? import module) (-> Text Text (Meta Bit)) (do ..monad [(^slots [#.imports]) (..module module)] (in (list.any? (text\= import) imports)))) -(def: #export (imported? import) +(def: .public (imported? import) (-> Text (Meta Bit)) (\ ..functor map (|>> (get@ #.imports) (list.any? (text\= import))) ..current_module)) -(def: #export (tag tag_name) +(def: .public (tag tag_name) {#.doc "Given a tag, finds out what is its index, its related tag-list and its associated type."} (-> Name (Meta [Nat (List Name) Type])) (do ..monad @@ -508,7 +508,7 @@ (text.join_with "")) ))))) -(def: #export (tag_lists module) +(def: .public (tag_lists module) {#.doc "All the tag-lists defined in a module, with their associated types."} (-> Text (Meta (List [(List Name) Type]))) (do ..monad @@ -521,7 +521,7 @@ (list\map (function (_ [type_name [tag_list exported? type]]) [tag_list type])))))) -(def: #export locals +(def: .public locals {#.doc "All the local variables currently in scope, separated in different scopes."} (Meta (List (List [Text Type]))) (function (_ compiler) @@ -536,7 +536,7 @@ [name type]))) scopes)])))) -(def: #export (de_aliased def_name) +(def: .public (de_aliased def_name) {#.doc "Given an aliased definition's name, returns the original definition being referenced."} (-> Name (Meta Name)) (do ..monad @@ -548,18 +548,18 @@ (#.Right _) def_name)))) -(def: #export get_compiler +(def: .public get_compiler {#.doc "Obtains the current state of the compiler."} (Meta Lux) (function (_ compiler) (#try.Success [compiler compiler]))) -(def: #export type_context +(def: .public type_context (Meta Type_Context) (function (_ compiler) (#try.Success [compiler (get@ #.type_context compiler)]))) -(def: #export (lift result) +(def: .public (lift result) (All [a] (-> (Try a) (Meta a))) (case result (#try.Success output) diff --git a/stdlib/source/library/lux/meta/annotation.lux b/stdlib/source/library/lux/meta/annotation.lux index b49dd5d8e..5180187e6 100644 --- a/stdlib/source/library/lux/meta/annotation.lux +++ b/stdlib/source/library/lux/meta/annotation.lux @@ -8,10 +8,10 @@ ["." maybe] ["." name ("#\." equivalence)]]]]) -(type: #export Annotation +(type: .public Annotation Code) -(def: #export (value tag ann) +(def: .public (value tag ann) (-> Name Annotation (Maybe Code)) (case ann [_ (#.Record ann)] @@ -34,7 +34,7 @@ #.None)) (template [<name> <tag> <type>] - [(def: #export (<name> tag ann) + [(def: .public (<name> tag ann) (-> Name Annotation (Maybe <type>)) (case (..value tag ann) (#.Some [_ (<tag> value)]) @@ -56,16 +56,16 @@ [record #.Record (List [Code Code])] ) -(def: #export documentation +(def: .public documentation (-> Annotation (Maybe Text)) (..text (name_of #.doc))) -(def: #export (flagged? flag) +(def: .public (flagged? flag) (-> Name Annotation Bit) (|>> (..bit flag) (maybe.else false))) (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> (-> Annotation Bit) (..flagged? (name_of <tag>)))] @@ -84,7 +84,7 @@ #.None)) (template [<name> <tag>] - [(def: #export (<name> ann) + [(def: .public (<name> ann) (-> Annotation (List Text)) (<| (maybe.else (list)) (do {! maybe.monad} diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux index 9216889f0..7e21951ce 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -4,7 +4,7 @@ [abstract [equivalence (#+ Equivalence)]]]]) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Location) (def: (= reference subject) @@ -12,13 +12,13 @@ ("lux i64 =" (get@ #.line reference) (get@ #.line subject)) ("lux i64 =" (get@ #.column reference) (get@ #.column subject))))) -(def: #export dummy +(def: .public dummy Location {#.module "" #.line 0 #.column 0}) -(macro: #export (here tokens compiler) +(macro: .public (here tokens compiler) {#.doc (doc "The Location of the current form." (here))} (case tokens @@ -33,7 +33,7 @@ _ (#.Left (`` (("lux in-module" (~~ (static .prelude_module)) wrong_syntax_error) (name_of ..here)))))) -(def: #export (format value) +(def: .public (format value) (-> Location Text) (let [separator "," [file line column] value] @@ -46,7 +46,7 @@ (def: \n ("lux i64 char" +10)) -(def: #export (with location error) +(def: .public (with location error) (-> Location Text Text) ($_ "lux text concat" (..format location) \n error)) diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index f17d42ec1..d2caa1a85 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -31,7 +31,7 @@ (in [(code.identifier ["" name]) (` (~! <cli>.any))])) (<code>.record (<>.and <code>.any <code>.any))))))) -(syntax: #export (program: +(syntax: .public (program: {args ..arguments^} body) {#.doc (doc "Defines the entry-point to a program (similar to the 'main' function/method in other programming languages)." diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux index 323cf812b..c2da2412f 100644 --- a/stdlib/source/library/lux/target.lux +++ b/stdlib/source/library/lux/target.lux @@ -2,11 +2,11 @@ [library lux]) -(type: #export Target +(type: .public Target Text) (template [<name> <value>] - [(def: #export <name> + [(def: .public <name> Target <value>)] diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index ed040a6b4..3bd089fa6 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -20,21 +20,23 @@ (-> Text Text) (text.enclosed ["(" ")"])) -(abstract: #export (Code brand) +(abstract: .public (Code brand) + {} + Text - (def: #export manual + (def: .public manual (-> Text Code) (|>> :abstraction)) - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) (template [<type> <super>] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (`` (abstract: #export (<brand> brand) Any)) - (`` (type: #export (<type> brand) + (`` (abstract: .public (<brand> brand) {} Any)) + (`` (type: .public (<type> brand) (<super> (<brand> brand)))))] [Expression Code] @@ -47,8 +49,8 @@ (template [<type> <super>] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (`` (abstract: #export <brand> Any)) - (`` (type: #export <type> (<super> <brand>))))] + (`` (abstract: .public <brand> {} Any)) + (`` (type: .public <type> (<super> <brand>))))] [Label Code] [Tag Expression] @@ -57,32 +59,32 @@ [Var/* Input] ) - (type: #export Lambda + (type: .public Lambda {#input Var/* #output (Expression Any)}) - (def: #export nil + (def: .public nil Literal (:abstraction "()")) (template [<prefix> <name>] - [(def: #export <name> + [(def: .public <name> (-> Text Literal) (|>> (format <prefix>) :abstraction))] ["'" symbol] [":" keyword]) - (def: #export bool + (def: .public bool (-> Bit Literal) (|>> (case> #0 ..nil #1 (..symbol "t")))) - (def: #export int + (def: .public int (-> Int Literal) (|>> %.int :abstraction)) - (def: #export float + (def: .public float (-> Frac Literal) (|>> (cond> [(f.= f.positive_infinity)] [(new> "(/ 1.0 0.0)" [])] @@ -97,7 +99,7 @@ [%.frac]) :abstraction)) - (def: #export (double value) + (def: .public (double value) (-> Frac Literal) (:abstraction (.cond (f.= f.positive_infinity value) @@ -132,24 +134,24 @@ )) ))) - (def: #export string + (def: .public string (-> Text Literal) (|>> ..safe (text.enclosed' text.double_quote) :abstraction)) - (def: #export var + (def: .public var (-> Text Var/1) (|>> :abstraction)) - (def: #export args + (def: .public args (-> (List Var/1) Var/*) (|>> (list\map ..code) (text.join_with " ") ..as_form :abstraction)) - (def: #export (args& singles rest) + (def: .public (args& singles rest) (-> (List Var/1) Var/1 Var/*) (|> (case singles #.End @@ -171,12 +173,12 @@ ..as_form :abstraction)) - (def: #export (call/* func) + (def: .public (call/* func) (-> (Expression Any) (-> (List (Expression Any)) (Computation Any))) (|>> (#.Item func) ..form)) (template [<name> <function>] - [(def: #export <name> + [(def: .public <name> (-> (List (Expression Any)) (Computation Any)) (..call/* (..var <function>)))] @@ -184,7 +186,7 @@ [list/* "list"] ) - (def: #export (labels definitions body) + (def: .public (labels definitions body) (-> (List [Var/1 Lambda]) (Expression Any) (Computation Any)) (..form (list (..var "labels") (..form (list\map (function (_ [def_name [def_args def_body]]) @@ -192,19 +194,19 @@ definitions)) body))) - (def: #export (destructuring_bind [bindings expression] body) + (def: .public (destructuring_bind [bindings expression] body) (-> [Var/* (Expression Any)] (List (Expression Any)) (Computation Any)) (..form (list& (..var "destructuring-bind") (:transmutation bindings) expression body))) (template [<call> <input_var>+ <input_type>+ <function>+] - [(`` (def: #export (<call> [(~~ (template.spliced <input_var>+))] function) + [(`` (def: .public (<call> [(~~ (template.spliced <input_var>+))] function) (-> [(~~ (template.spliced <input_type>+))] (Expression Any) (Computation Any)) (..call/* function (list (~~ (template.spliced <input_var>+)))))) (`` (template [<lux_name> <host_name>] - [(def: #export (<lux_name> args) + [(def: .public (<lux_name> args) (-> [(~~ (template.spliced <input_type>+))] (Computation Any)) (<call> args (..var <host_name>)))] @@ -262,7 +264,7 @@ (template [<call> <input_type>+ <function>+] [(`` (template [<lux_name> <host_name>] - [(def: #export (<lux_name> args) + [(def: .public (<lux_name> args) (-> [(~~ (template.spliced <input_type>+))] (Access Any)) (:transmutation (<call> args (..var <host_name>))))] @@ -279,29 +281,29 @@ [gethash/2 "gethash"]]] ) - (def: #export (make_hash_table/with_size size) + (def: .public (make_hash_table/with_size size) (-> (Expression Any) (Computation Any)) (..call/* (..var "make-hash-table") (list (..keyword "size") size))) - (def: #export (funcall/+ [func args]) + (def: .public (funcall/+ [func args]) (-> [(Expression Any) (List (Expression Any))] (Computation Any)) (..call/* (..var "funcall") (list& func args))) - (def: #export (search/3 [reference space start]) + (def: .public (search/3 [reference space start]) (-> [(Expression Any) (Expression Any) (Expression Any)] (Computation Any)) (..call/* (..var "search") (list reference space (..keyword "start2") start))) - (def: #export (concatenate/2|string [left right]) + (def: .public (concatenate/2|string [left right]) (-> [(Expression Any) (Expression Any)] (Computation Any)) (concatenate/3 [(..symbol "string") left right])) (template [<lux_name> <host_name>] - [(def: #export (<lux_name> left right) + [(def: .public (<lux_name> left right) (-> (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var <host_name>) left right)))] @@ -310,7 +312,7 @@ ) (template [<lux_name> <host_name>] - [(def: #export (<lux_name> [param subject]) + [(def: .public (<lux_name> [param subject]) (-> [(Expression Any) (Expression Any)] (Computation Any)) (..form (list (..var <host_name>) subject param)))] @@ -330,20 +332,20 @@ [logxor/2 "logxor"] ) - (def: #export (if test then else) + (def: .public (if test then else) (-> (Expression Any) (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var "if") test then else))) - (def: #export (when test then) + (def: .public (when test then) (-> (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var "when") test then))) - (def: #export (lambda input body) + (def: .public (lambda input body) (-> Var/* (Expression Any) Literal) (..form (list (..var "lambda") (:transmutation input) body))) (template [<lux_name> <host_name>] - [(def: #export (<lux_name> bindings body) + [(def: .public (<lux_name> bindings body) (-> (List [Var/1 (Expression Any)]) (List (Expression Any)) (Computation Any)) (..form (list& (..var <host_name>) (|> bindings @@ -356,16 +358,16 @@ [let* "let*"] ) - (def: #export (defparameter name body) + (def: .public (defparameter name body) (-> Var/1 (Expression Any) (Expression Any)) (..form (list (..var "defparameter") name body))) - (def: #export (defun name inputs body) + (def: .public (defun name inputs body) (-> Var/1 Var/* (Expression Any) (Expression Any)) (..form (list (..var "defun") name (:transmutation inputs) body))) (template [<name> <symbol>] - [(def: #export <name> + [(def: .public <name> (-> (List (Expression Any)) (Computation Any)) (|>> (list& (..var <symbol>)) ..form))] @@ -374,20 +376,20 @@ [values/* "values"] ) - (def: #export (setq name value) + (def: .public (setq name value) (-> Var/1 (Expression Any) (Expression Any)) (..form (list (..var "setq") name value))) - (def: #export (setf access value) + (def: .public (setf access value) (-> (Access Any) (Expression Any) (Expression Any)) (..form (list (..var "setf") access value))) - (type: #export Handler + (type: .public Handler {#condition_type (Expression Any) #condition Var/1 #body (Expression Any)}) - (def: #export (handler_case handlers body) + (def: .public (handler_case handlers body) (-> (List Handler) (Expression Any) (Computation Any)) (..form (list& (..var "handler-case") body @@ -398,7 +400,7 @@ handlers)))) (template [<name> <prefix>] - [(def: #export (<name> conditions expression) + [(def: .public (<name> conditions expression) (-> (List Text) (Expression Any) (Expression Any)) (case conditions #.End @@ -418,23 +420,23 @@ [conditional+ "#+"] [conditional- "#-"]) - (def: #export label + (def: .public label (-> Text Label) (|>> :abstraction)) - (def: #export (block name body) + (def: .public (block name body) (-> Label (List (Expression Any)) (Computation Any)) (..form (list& (..var "block") (:transmutation name) body))) - (def: #export (return_from target value) + (def: .public (return_from target value) (-> Label (Expression Any) (Computation Any)) (..form (list (..var "return-from") (:transmutation target) value))) - (def: #export (return value) + (def: .public (return value) (-> (Expression Any) (Computation Any)) (..form (list (..var "return") value))) - (def: #export (cond clauses else) + (def: .public (cond clauses else) (-> (List [(Expression Any) (Expression Any)]) (Expression Any) (Computation Any)) (..form (list& (..var "cond") (list\compose (list\map (function (_ [test then]) @@ -442,28 +444,28 @@ clauses) (list (..form (list (..bool true) else))))))) - (def: #export tag + (def: .public tag (-> Text Tag) (|>> :abstraction)) - (def: #export go + (def: .public go (-> Tag (Expression Any)) (|>> (list (..var "go")) ..form)) - (def: #export values_list/1 + (def: .public values_list/1 (-> (Expression Any) (Expression Any)) (|>> (list (..var "values-list")) ..form)) - (def: #export (multiple_value_setq bindings values) + (def: .public (multiple_value_setq bindings values) (-> Var/* (Expression Any) (Expression Any)) (..form (list (..var "multiple-value-setq") (:transmutation bindings) values))) ) -(def: #export (while condition body) +(def: .public (while condition body) (-> (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var "loop") (..var "while") condition (..var "do") body))) diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index 1ef296cdf..27e77e1fd 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -28,17 +28,19 @@ (|>> (format text.new_line) (text.replace_all text.new_line (format text.new_line text.tab)))) -(abstract: #export (Code brand) +(abstract: .public (Code brand) + {} + Text - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] + (abstract: (<brand> brand) {} Any) + (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -48,8 +50,8 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] + (abstract: .public <brand> {} Any) + (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Var [Location' Computation' Expression' Code]] [Access [Location' Computation' Expression' Code]] @@ -59,20 +61,20 @@ ) (template [<name> <literal>] - [(def: #export <name> Literal (:abstraction <literal>))] + [(def: .public <name> Literal (:abstraction <literal>))] [null "null"] [undefined "undefined"] ) - (def: #export boolean + (def: .public boolean (-> Bit Literal) (|>> (case> #0 "false" #1 "true") :abstraction)) - (def: #export (number value) + (def: .public (number value) (-> Frac Literal) (:abstraction (.cond (f.not_a_number? value) @@ -105,7 +107,7 @@ )) ))) - (def: #export string + (def: .public string (-> Text Literal) (|>> ..safe (text.enclosed [text.double_quote text.double_quote]) @@ -115,26 +117,26 @@ (def: field_separator ": ") (def: statement_suffix ";") - (def: #export array + (def: .public array (-> (List Expression) Computation) (|>> (list\map ..code) (text.join_with ..argument_separator) ..element :abstraction)) - (def: #export var + (def: .public var (-> Text Var) (|>> :abstraction)) - (def: #export (at index array_or_object) + (def: .public (at index array_or_object) (-> Expression Expression Access) (:abstraction (format (:representation array_or_object) (..element (:representation index))))) - (def: #export (the field object) + (def: .public (the field object) (-> Text Expression Access) (:abstraction (format (:representation object) "." field))) - (def: #export (apply/* function inputs) + (def: .public (apply/* function inputs) (-> Expression (List Expression) Computation) (|> inputs (list\map ..code) @@ -143,11 +145,11 @@ (format (:representation function)) :abstraction)) - (def: #export (do method inputs object) + (def: .public (do method inputs object) (-> Text (List Expression) Expression Computation) (apply/* (..the method object) inputs)) - (def: #export object + (def: .public object (-> (List [Text Expression]) Computation) (|>> (list\map (.function (_ [key val]) (format (:representation (..string key)) ..field_separator (:representation val)))) @@ -156,13 +158,13 @@ ..expression :abstraction)) - (def: #export (, pre post) + (def: .public (, pre post) (-> Expression Expression Computation) (|> (format (:representation pre) ..argument_separator (:representation post)) ..expression :abstraction)) - (def: #export (then pre post) + (def: .public (then pre post) (-> Statement Statement Statement) (:abstraction (format (:representation pre) text.new_line @@ -176,7 +178,7 @@ (text.enclosed ["{" close])))) - (def: #export (function! name inputs body) + (def: .public (function! name inputs body) (-> Var (List Var) Statement Statement) (|> body ..block @@ -188,14 +190,14 @@ " ") :abstraction)) - (def: #export (function name inputs body) + (def: .public (function name inputs body) (-> Var (List Var) Statement Computation) (|> (..function! name inputs body) :representation ..expression :abstraction)) - (def: #export (closure inputs body) + (def: .public (closure inputs body) (-> (List Var) Statement Computation) (|> body ..block @@ -209,7 +211,7 @@ :abstraction)) (template [<name> <op>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (-> Expression Expression Computation) (|> (format (:representation subject) " " <op> " " (:representation param)) ..expression @@ -239,7 +241,7 @@ ) (template [<name> <prefix>] - [(def: #export <name> + [(def: .public <name> (-> Expression Computation) (|>> :representation (text.prefix <prefix>) ..expression :abstraction))] @@ -249,7 +251,7 @@ ) (template [<name> <input> <format>] - [(def: #export (<name> value) + [(def: .public (<name> value) {#.doc "A 32-bit integer expression."} (-> <input> Computation) (:abstraction (..expression (format (<format> value) "|0"))))] @@ -258,13 +260,13 @@ [i32 Int %.int] ) - (def: #export (int value) + (def: .public (int value) (-> Int Literal) (:abstraction (.if (i.< +0 value) (%.int value) (%.nat (.nat value))))) - (def: #export (? test then else) + (def: .public (? test then else) (-> Expression Expression Expression Computation) (|> (format (:representation test) " ? " (:representation then) @@ -272,14 +274,14 @@ ..expression :abstraction)) - (def: #export type_of + (def: .public type_of (-> Expression Computation) (|>> :representation (format "typeof ") ..expression :abstraction)) - (def: #export (new constructor inputs) + (def: .public (new constructor inputs) (-> Expression (List Expression) Computation) (|> (format "new " (:representation constructor) (|> inputs @@ -289,76 +291,76 @@ ..expression :abstraction)) - (def: #export statement + (def: .public statement (-> Expression Statement) (|>> :representation (text.suffix ..statement_suffix) :abstraction)) - (def: #export use_strict + (def: .public use_strict Statement (:abstraction (format text.double_quote "use strict" text.double_quote ..statement_suffix))) - (def: #export (declare name) + (def: .public (declare name) (-> Var Statement) (:abstraction (format "var " (:representation name) ..statement_suffix))) - (def: #export (define name value) + (def: .public (define name value) (-> Var Expression Statement) (:abstraction (format "var " (:representation name) " = " (:representation value) ..statement_suffix))) - (def: #export (set' name value) + (def: .public (set' name value) (-> Location Expression Expression) (:abstraction (..expression (format (:representation name) " = " (:representation value))))) - (def: #export (set name value) + (def: .public (set name value) (-> Location Expression Statement) (:abstraction (format (:representation name) " = " (:representation value) ..statement_suffix))) - (def: #export (throw message) + (def: .public (throw message) (-> Expression Statement) (:abstraction (format "throw " (:representation message) ..statement_suffix))) - (def: #export (return value) + (def: .public (return value) (-> Expression Statement) (:abstraction (format "return " (:representation value) ..statement_suffix))) - (def: #export (delete' value) + (def: .public (delete' value) (-> Location Expression) (:abstraction (format "delete " (:representation value)))) - (def: #export (delete value) + (def: .public (delete value) (-> Location Statement) (:abstraction (format (:representation (delete' value)) ..statement_suffix))) - (def: #export (if test then! else!) + (def: .public (if test then! else!) (-> Expression Statement Statement Statement) (:abstraction (format "if(" (:representation test) ") " (..block then!) " else " (..block else!)))) - (def: #export (when test then!) + (def: .public (when test then!) (-> Expression Statement Statement) (:abstraction (format "if(" (:representation test) ") " (..block then!)))) - (def: #export (while test body) + (def: .public (while test body) (-> Expression Statement Loop) (:abstraction (format "while(" (:representation test) ") " (..block body)))) - (def: #export (do_while test body) + (def: .public (do_while test body) (-> Expression Statement Loop) (:abstraction (format "do " (..block body) " while(" (:representation test) ")" ..statement_suffix))) - (def: #export (try body [exception catch]) + (def: .public (try body [exception catch]) (-> Statement [Var Statement] Statement) (:abstraction (format "try " (..block body) " catch(" (:representation exception) ") " (..block catch)))) - (def: #export (for var init condition update iteration) + (def: .public (for var init condition update iteration) (-> Var Expression Expression Expression Statement Loop) (:abstraction (format "for(" (:representation (..define var init)) " " (:representation condition) @@ -366,20 +368,20 @@ ")" (..block iteration)))) - (def: #export label + (def: .public label (-> Text Label) (|>> :abstraction)) - (def: #export (with_label label loop) + (def: .public (with_label label loop) (-> Label Loop Statement) (:abstraction (format (:representation label) ": " (:representation loop)))) (template [<keyword> <0> <1>] - [(def: #export <0> + [(def: .public <0> Statement (:abstraction (format <keyword> ..statement_suffix))) - (def: #export (<1> label) + (def: .public (<1> label) (-> Label Statement) (:abstraction (format <keyword> " " (:representation label) ..statement_suffix)))] @@ -388,7 +390,7 @@ ) (template [<name> <js>] - [(def: #export <name> + [(def: .public <name> (-> Location Expression) (|>> :representation (text.suffix <js>) @@ -398,11 +400,11 @@ [-- "--"] ) - (def: #export (comment commentary on) + (def: .public (comment commentary on) (All [kind] (-> Text (Code kind) (Code kind))) (:abstraction (format "/* " commentary " */" " " (:representation on)))) - (def: #export (switch input cases default) + (def: .public (switch input cases default) (-> Expression (List [(List Literal) Statement]) (Maybe Statement) Statement) (:abstraction (format "switch (" (:representation input) ") " (|> (format (|> cases @@ -423,7 +425,7 @@ ..block)))) ) -(def: #export (cond clauses else!) +(def: .public (cond clauses else!) (-> (List [Expression Statement]) Statement Statement) (list\fold (.function (_ [test then!] next!) (..if test then! next!)) @@ -431,13 +433,13 @@ (list.reversed clauses))) (template [<apply> <arg>+ <type>+ <function>+] - [(`` (def: #export (<apply> function) + [(`` (def: .public (<apply> function) (-> Expression (~~ (template.spliced <type>+)) Computation) (.function (_ (~~ (template.spliced <arg>+))) (..apply/* function (list (~~ (template.spliced <arg>+))))))) (`` (template [<definition> <function>] - [(def: #export <definition> (<apply> (..var <function>)))] + [(def: .public <definition> (<apply> (..var <function>)))] (~~ (template.spliced <function>+))))] diff --git a/stdlib/source/library/lux/target/jvm.lux b/stdlib/source/library/lux/target/jvm.lux index b470abea9..1ada0da04 100644 --- a/stdlib/source/library/lux/target/jvm.lux +++ b/stdlib/source/library/lux/target/jvm.lux @@ -9,7 +9,7 @@ [type (#+ Type) ["." category (#+ Primitive Class Value Method)]]]]]]) -(type: #export Literal +(type: .public Literal (#Boolean Bit) (#Int Int) (#Long Int) @@ -17,7 +17,7 @@ (#Char Nat) (#String Text)) -(type: #export Constant +(type: .public Constant (#BIPUSH Int) (#SIPUSH Int) @@ -44,7 +44,7 @@ (#LDC Literal)) -(type: #export Int_Arithmetic +(type: .public Int_Arithmetic #IADD #ISUB #IMUL @@ -52,7 +52,7 @@ #IREM #INEG) -(type: #export Long_Arithmetic +(type: .public Long_Arithmetic #LADD #LSUB #LMUL @@ -60,7 +60,7 @@ #LREM #LNEG) -(type: #export Float_Arithmetic +(type: .public Float_Arithmetic #FADD #FSUB #FMUL @@ -68,7 +68,7 @@ #FREM #FNEG) -(type: #export Double_Arithmetic +(type: .public Double_Arithmetic #DADD #DSUB #DMUL @@ -76,13 +76,13 @@ #DREM #DNEG) -(type: #export Arithmetic +(type: .public Arithmetic (#Int_Arithmetic Int_Arithmetic) (#Long_Arithmetic Long_Arithmetic) (#Float_Arithmetic Float_Arithmetic) (#Double_Arithmetic Double_Arithmetic)) -(type: #export Int_Bitwise +(type: .public Int_Bitwise #IOR #IXOR #IAND @@ -90,7 +90,7 @@ #ISHR #IUSHR) -(type: #export Long_Bitwise +(type: .public Long_Bitwise #LOR #LXOR #LAND @@ -98,11 +98,11 @@ #LSHR #LUSHR) -(type: #export Bitwise +(type: .public Bitwise (#Int_Bitwise Int_Bitwise) (#Long_Bitwise Long_Bitwise)) -(type: #export Conversion +(type: .public Conversion #I2B #I2S #I2L @@ -122,7 +122,7 @@ #D2L #D2F) -(type: #export Array +(type: .public Array #ARRAYLENGTH (#NEWARRAY (Type Primitive)) @@ -152,7 +152,7 @@ #AALOAD #AASTORE) -(type: #export Object +(type: .public Object (#GETSTATIC (Type Class) Text (Type Value)) (#PUTSTATIC (Type Class) Text (Type Value)) @@ -169,29 +169,29 @@ (#INVOKESTATIC (Type Class) Text (Type Method)) (#INVOKEVIRTUAL (Type Class) Text (Type Method))) -(type: #export Register Nat) +(type: .public Register Nat) -(type: #export Local_Int +(type: .public Local_Int (#ILOAD Register) (#ISTORE Register)) -(type: #export Local_Long +(type: .public Local_Long (#LLOAD Register) (#LSTORE Register)) -(type: #export Local_Float +(type: .public Local_Float (#FLOAD Register) (#FSTORE Register)) -(type: #export Local_Double +(type: .public Local_Double (#DLOAD Register) (#DSTORE Register)) -(type: #export Local_Object +(type: .public Local_Object (#ALOAD Register) (#ASTORE Register)) -(type: #export Local +(type: .public Local (#Local_Int Local_Int) (#IINC Register) (#Local_Long Local_Long) @@ -199,7 +199,7 @@ (#Local_Double Local_Double) (#Local_Object Local_Object)) -(type: #export Stack +(type: .public Stack #DUP #DUP_X1 #DUP_X2 @@ -210,7 +210,7 @@ #POP #POP2) -(type: #export Comparison +(type: .public Comparison #LCMP #FCMPG @@ -219,9 +219,9 @@ #DCMPG #DCMPL) -(type: #export Label Nat) +(type: .public Label Nat) -(type: #export (Branching label) +(type: .public (Branching label) (#IF_ICMPEQ label) (#IF_ICMPGE label) (#IF_ICMPGT label) @@ -243,15 +243,15 @@ (#IFNONNULL label) (#IFNULL label)) -(type: #export (Exception label) +(type: .public (Exception label) (#Try label label label (Type Class)) #ATHROW) -(type: #export Concurrency +(type: .public Concurrency #MONITORENTER #MONITOREXIT) -(type: #export Return +(type: .public Return #RETURN #IRETURN #LRETURN @@ -259,14 +259,14 @@ #DRETURN #ARETURN) -(type: #export (Control label) +(type: .public (Control label) (#GOTO label) (#Branching (Branching label)) (#Exception (Exception label)) (#Concurrency Concurrency) (#Return Return)) -(type: #export (Instruction embedded label) +(type: .public (Instruction embedded label) #NOP (#Constant Constant) (#Arithmetic Arithmetic) @@ -280,5 +280,5 @@ (#Control (Control label)) (#Embedded embedded)) -(type: #export (Bytecode embedded label) +(type: .public (Bytecode embedded label) (Row (Instruction embedded label))) diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 6d94c1b5b..0aa919723 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -25,12 +25,12 @@ ["#." constant (#+ Constant)] ["#." code]]) -(type: #export (Info about) +(type: .public (Info about) {#name (Index UTF8) #length U4 #info about}) -(def: #export (info_equivalence Equivalence<about>) +(def: .public (info_equivalence Equivalence<about>) (All [about] (-> (Equivalence about) (Equivalence (Info about)))) @@ -51,15 +51,15 @@ (|>> nameT lengthT infoT)]))) (with_expansions [<Code> (as_is (/code.Code Attribute))] - (type: #export #rec Attribute + (type: .public #rec Attribute (#Constant (Info (Constant Any))) (#Code (Info <Code>))) - (type: #export Code + (type: .public Code <Code>) ) -(def: #export equivalence +(def: .public equivalence (Equivalence Attribute) (equivalence.rec (function (_ equivalence) @@ -90,7 +90,7 @@ #length (|> /constant.length //unsigned.u4 try.assumed) #info index})) -(def: #export (constant index) +(def: .public (constant index) (-> (Constant Any) (Resource Attribute)) (do //constant/pool.monad [@name (//constant/pool.utf8 "ConstantValue")] @@ -107,13 +107,13 @@ try.assumed) #info specification})) -(def: #export (code specification) +(def: .public (code specification) (-> Code (Resource Attribute)) (do //constant/pool.monad [@name (//constant/pool.utf8 "Code")] (in (code' @name specification)))) -(def: #export (writer value) +(def: .public (writer value) (Writer Attribute) (case value (#Constant attribute) diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index 2f80d96d2..733fd4d7c 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -22,13 +22,13 @@ ["." / #_ ["#." exception (#+ Exception)]]) -(type: #export (Code Attribute) +(type: .public (Code Attribute) {#limit Limit #code Binary #exception_table (Row Exception) #attributes (Row Attribute)}) -(def: #export (length length code) +(def: .public (length length code) (All [Attribute] (-> (-> Attribute Nat) (Code Attribute) Nat)) ($_ n.+ ## u2 max_stack; @@ -53,7 +53,7 @@ (row\map length) (row\fold n.+ 0)))) -(def: #export (equivalence attribute_equivalence) +(def: .public (equivalence attribute_equivalence) (All [attribute] (-> (Equivalence attribute) (Equivalence (Code attribute)))) ($_ product.equivalence @@ -64,7 +64,7 @@ )) ## https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: #export (writer writer code) +(def: .public (writer writer code) (All [Attribute] (-> (Writer Attribute) (Writer (Code Attribute)))) ($_ binaryF\compose ## u2 max_stack; diff --git a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux index e2aa089b0..42bb8ebb9 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux @@ -19,13 +19,13 @@ [encoding ["#." unsigned (#+ U2)]]]]) -(type: #export Exception +(type: .public Exception {#start Address #end Address #handler Address #catch (Index Class)}) -(def: #export equivalence +(def: .public equivalence (Equivalence Exception) ($_ product.equivalence ////address.equivalence @@ -35,7 +35,7 @@ )) ## https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: #export length +(def: .public length Nat ($_ n.+ ## u2 start_pc; @@ -48,7 +48,7 @@ ////unsigned.bytes/2 )) -(def: #export writer +(def: .public writer (Writer Exception) ($_ format.and ////address.writer diff --git a/stdlib/source/library/lux/target/jvm/attribute/constant.lux b/stdlib/source/library/lux/target/jvm/attribute/constant.lux index d9f26d418..8d7a0a26a 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/constant.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/constant.lux @@ -12,16 +12,16 @@ [encoding ["#." unsigned (#+ U2 U4)]]]) -(type: #export (Constant a) +(type: .public (Constant a) (Index (Value a))) -(def: #export equivalence +(def: .public equivalence (All [a] (Equivalence (Constant a))) ///index.equivalence) -(def: #export length +(def: .public length ///index.length) -(def: #export writer +(def: .public writer (All [a] (Writer (Constant a))) ///index.writer) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index a22ff102b..fa48223ae 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -51,11 +51,11 @@ ["." reflection] ["." parser]]]]) -(type: #export Label Nat) +(type: .public Label Nat) -(type: #export Resolver (Dictionary Label [Stack (Maybe Address)])) +(type: .public Resolver (Dictionary Label [Stack (Maybe Address)])) -(type: #export Tracker +(type: .public Tracker {#program_counter Address #next Label #known Resolver}) @@ -66,7 +66,7 @@ #next 0 #known (dictionary.empty n.hash)}) -(type: #export Relative +(type: .public Relative (-> Resolver (Try [(Row Exception) Instruction]))) (def: no_exceptions @@ -97,10 +97,10 @@ (in [(\ row.monoid compose left_exceptions right_exceptions) (_\compose left_instruction right_instruction)])))))) -(type: #export (Bytecode a) +(type: .public (Bytecode a) (+State Try [Pool Environment Tracker] (Writer Relative a))) -(def: #export new_label +(def: .public new_label (Bytecode Label) (function (_ [pool environment tracker]) (#try.Success [[pool @@ -109,11 +109,11 @@ [..relative_identity (get@ #next tracker)]]))) -(exception: #export (label_has_already_been_set {label Label}) +(exception: .public (label_has_already_been_set {label Label}) (exception.report ["Label" (%.nat label)])) -(exception: #export (mismatched_environments {instruction Name} +(exception: .public (mismatched_environments {instruction Name} {label Label} {address Address} {expected Stack} @@ -132,7 +132,7 @@ tracker)] [..relative_identity []]]))] - (def: #export (set_label label) + (def: .public (set_label label) (-> Label (Bytecode Any)) (function (_ [pool environment tracker]) (let [@here (get@ #program_counter tracker)] @@ -153,7 +153,7 @@ environment)] <success>)))))) -(def: #export monad +(def: .public monad (Monad Bytecode) (<| (:as (Monad Bytecode)) (writer.with ..relative_monoid) @@ -162,15 +162,15 @@ (: (Monad Try)) try.monad)) -(def: #export failure +(def: .public failure (-> Text Bytecode) (|>> #try.Failure function.constant)) -(def: #export (except exception value) +(def: .public (except exception value) (All [e] (-> (exception.Exception e) e Bytecode)) (..failure (exception.error exception value))) -(def: #export (resolve environment bytecode) +(def: .public (resolve environment bytecode) (All [a] (-> Environment (Bytecode a) (Resource [Environment (Row Exception) Instruction a]))) (function (_ pool) (do try.monad @@ -221,7 +221,7 @@ ) (template [<name> <consumption> <production> <registry> <instruction>] - [(def: #export <name> + [(def: .public <name> (Bytecode Any) (..bytecode <consumption> <production> @@ -416,7 +416,7 @@ []]])))) (template [<name> <consumption> <instruction>] - [(def: #export <name> + [(def: .public <name> (Bytecode Any) (do ..monad [_ (..bytecode <consumption> $0 @_ <instruction> [])] @@ -432,7 +432,7 @@ [athrow $1 _.athrow] ) -(def: #export (bipush byte) +(def: .public (bipush byte) (-> S1 (Bytecode Any)) (..bytecode $0 $1 @_ _.bipush [byte])) @@ -447,7 +447,7 @@ [..relative_identity output]])))) -(def: #export (string value) +(def: .public (string value) (-> //constant.UTF8 (Bytecode Any)) (do ..monad [index (..lift (//constant/pool.string value))] @@ -467,7 +467,7 @@ (#static doubleToRawLongBits #manual [double] long)]) (template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> <type> (Bytecode Any)) (case (|> value <to_lux>) (^template [<special> <instruction>] @@ -514,7 +514,7 @@ (def: negative_zero_float_bits (|> -0.0 (:as java/lang/Double) ffi.double_to_float ..float_bits)) -(def: #export (float value) +(def: .public (float value) (-> java/lang/Float (Bytecode Any)) (if (i.= ..negative_zero_float_bits (..float_bits value)) @@ -529,7 +529,7 @@ _ (..arbitrary_float value)))) (template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> <type> (Bytecode Any)) (case (|> value <to_lux>) (^template [<special> <instruction>] @@ -560,7 +560,7 @@ (def: negative_zero_double_bits (..double_bits (:as java/lang/Double -0.0))) -(def: #export (double value) +(def: .public (double value) (-> java/lang/Double (Bytecode Any)) (if (i.= ..negative_zero_double_bits (..double_bits value)) @@ -573,7 +573,7 @@ _ (..arbitrary_double value)))) -(exception: #export (invalid_register {id Nat}) +(exception: .public (invalid_register {id Nat}) (exception.report ["ID" (%.nat id)])) @@ -587,7 +587,7 @@ (..except ..invalid_register [id]))) (template [<for> <size> <name> <general> <specials>] - [(def: #export (<name> local) + [(def: .public (<name> local) (-> Nat (Bytecode Any)) (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local @@ -627,7 +627,7 @@ ) (template [<for> <size> <name> <general> <specials>] - [(def: #export (<name> local) + [(def: .public (<name> local) (-> Nat (Bytecode Any)) (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local @@ -667,7 +667,7 @@ ) (template [<consumption> <production> <name> <instruction> <input>] - [(def: #export <name> + [(def: .public <name> (-> <input> (Bytecode Any)) (..bytecode <consumption> <production> @_ <instruction>))] @@ -675,11 +675,11 @@ [$0 $1 sipush _.sipush S2] ) -(exception: #export (unknown_label {label Label}) +(exception: .public (unknown_label {label Label}) (exception.report ["Label" (%.nat label)])) -(exception: #export (cannot_do_a_big_jump {label Label} +(exception: .public (cannot_do_a_big_jump {label Label} {@from Address} {jump Big_Jump}) (exception.report @@ -703,7 +703,7 @@ (\ ! map (|>> #.Left) (//signed.s4 jump)) (\ ! map (|>> #.Right) (//signed.s2 jump)))))) -(exception: #export (unset_label {label Label}) +(exception: .public (unset_label {label Label}) (exception.report ["Label" (%.nat label)])) @@ -729,7 +729,7 @@ (update@ #known (dictionary.put label [stack #.None]) tracker))) (template [<consumption> <name> <instruction>] - [(def: #export (<name> label) + [(def: .public (<name> label) (-> Label (Bytecode Any)) (let [[estimator bytecode] <instruction>] (function (_ [pool environment tracker]) @@ -781,7 +781,7 @@ ) (template [<name> <instruction> <on_long_jump> <on_short_jump>] - [(def: #export (<name> label) + [(def: .public (<name> label) (-> Label (Bytecode Any)) (let [[estimator bytecode] <instruction>] (function (_ [pool environment tracker]) @@ -833,9 +833,9 @@ (#.Right small) (/jump.lift small))) -(exception: #export invalid_tableswitch) +(exception: .public invalid_tableswitch) -(def: #export (tableswitch minimum default [at_minimum afterwards]) +(def: .public (tableswitch minimum default [at_minimum afterwards]) (-> S4 Label [Label (List Label)] (Bytecode Any)) (let [[estimator bytecode] _.tableswitch] (function (_ [pool environment tracker]) @@ -872,9 +872,9 @@ (exception.except ..invalid_tableswitch [])))) []]])))))) -(exception: #export invalid_lookupswitch) +(exception: .public invalid_lookupswitch) -(def: #export (lookupswitch default cases) +(def: .public (lookupswitch default cases) (-> Label (List [S4 Label]) (Bytecode Any)) (let [cases (list.sort (function (_ [left _] [right _]) (i.< (//signed.value left) @@ -920,7 +920,7 @@ (|>> type.reflection reflection.reflection)) (template [<consumption> <production> <name> <category> <instruction>] - [(def: #export (<name> class) + [(def: .public (<name> class) (-> (Type <category>) (Bytecode Any)) (do ..monad [## TODO: Make sure it's impossible to have indexes greater than U2. @@ -933,16 +933,16 @@ [$1 $1 instanceof Object _.instanceof] ) -(def: #export (iinc register increase) +(def: .public (iinc register increase) (-> Nat U1 (Bytecode Any)) (do ..monad [register (..register register)] (..bytecode $0 $0 (/registry.for register) _.iinc [register increase]))) -(exception: #export (multiarray_cannot_be_zero_dimensional {class (Type Object)}) +(exception: .public (multiarray_cannot_be_zero_dimensional {class (Type Object)}) (exception.report ["Class" (..reflection class)])) -(def: #export (multianewarray class dimensions) +(def: .public (multianewarray class dimensions) (-> (Type Object) U1 (Bytecode Any)) (do ..monad [_ (: (Bytecode Any) @@ -965,7 +965,7 @@ 1)) (template [<static?> <name> <instruction> <method>] - [(def: #export (<name> class method type) + [(def: .public (<name> class method type) (-> (Type Class) Text (Type Method) (Bytecode Any)) (let [[type_variables inputs output exceptions] (parser.method type)] (do ..monad @@ -991,7 +991,7 @@ ) (template [<consumption> <name> <1> <2>] - [(def: #export (<name> class field type) + [(def: .public (<name> class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do ..monad [index (<| ..lift @@ -1009,12 +1009,12 @@ [$2 putfield _.putfield/1 _.putfield/2] ) -(exception: #export (invalid_range_for_try {start Address} {end Address}) +(exception: .public (invalid_range_for_try {start Address} {end Address}) (exception.report ["Start" (|> start /address.value //unsigned.value %.nat)] ["End" (|> end /address.value //unsigned.value %.nat)])) -(def: #export (try @start @end @handler catch) +(def: .public (try @start @end @handler catch) (-> Label Label Label (Type Class) (Bytecode Any)) (do ..monad [@catch (..lift (//constant/pool.class (//name.internal (..reflection catch))))] @@ -1038,7 +1038,7 @@ _.empty]))) []]])))) -(def: #export (compose pre post) +(def: .public (compose pre post) (All [pre post] (-> (Bytecode pre) (Bytecode post) (Bytecode post))) (do ..monad diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index 8a42afb41..d7f2f612f 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -23,18 +23,20 @@ ["#." unsigned (#+ U2)] ["#." signed (#+ S4)]]]]) -(abstract: #export Address +(abstract: .public Address + {} + U2 - (def: #export value + (def: .public value (-> Address U2) (|>> :representation)) - (def: #export start + (def: .public start Address (|> 0 ///unsigned.u2 try.assumed :abstraction)) - (def: #export (move distance) + (def: .public (move distance) (-> U2 (-> Address (Try Address))) (|>> :representation (///unsigned.+/2 distance) @@ -44,19 +46,19 @@ (-> Address (Try S4)) (|>> :representation ///unsigned.value .int ///signed.s4)) - (def: #export (jump from to) + (def: .public (jump from to) (-> Address Address (Try Big_Jump)) (do try.monad [from (with_sign from) to (with_sign to)] (///signed.-/4 from to))) - (def: #export (after? reference subject) + (def: .public (after? reference subject) (-> Address Address Bit) (n.> (|> reference :representation ///unsigned.value) (|> subject :representation ///unsigned.value))) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Address) (def: (= reference subject) @@ -64,11 +66,11 @@ (:representation reference) (:representation subject)))) - (def: #export writer + (def: .public writer (Writer Address) (|>> :representation ///unsigned.writer/2)) - (def: #export format + (def: .public format (Format Address) (|>> :representation ///unsigned.value %.nat)) ) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux index 6fbdadfa3..d426726e3 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux @@ -17,12 +17,12 @@ [type (#+ Type) [category (#+ Method)]]]]) -(type: #export Environment +(type: .public Environment {#limit Limit #stack (Maybe Stack)}) (template [<name> <limit>] - [(def: #export (<name> type) + [(def: .public (<name> type) (-> (Type Method) (Try Environment)) (do try.monad [limit (<limit> type)] @@ -33,10 +33,10 @@ [virtual /limit.virtual] ) -(type: #export Condition +(type: .public Condition (-> Environment (Try Environment))) -(implementation: #export monoid +(implementation: .public monoid (Monoid Condition) (def: identity (|>> #try.Success)) @@ -47,9 +47,9 @@ [environment (left environment)] (right environment))))) -(exception: #export discontinuity) +(exception: .public discontinuity) -(def: #export (stack environment) +(def: .public (stack environment) (-> Environment (Try Stack)) (case (get@ #..stack environment) (#.Some stack) @@ -58,17 +58,17 @@ #.None (exception.except ..discontinuity []))) -(def: #export discontinue +(def: .public discontinue (-> Environment Environment) (set@ #..stack #.None)) -(exception: #export (mismatched_stacks {expected Stack} +(exception: .public (mismatched_stacks {expected Stack} {actual Stack}) (exception.report ["Expected" (/stack.format expected)] ["Actual" (/stack.format actual)])) -(def: #export (continue expected environment) +(def: .public (continue expected environment) (-> Stack Environment (Try [Stack Environment])) (case (get@ #..stack environment) (#.Some actual) @@ -79,7 +79,7 @@ #.None (#try.Success [expected (set@ #..stack (#.Some expected) environment)]))) -(def: #export (consumes amount) +(def: .public (consumes amount) (-> U2 Condition) ## TODO: Revisit this definition once lenses/optics have been implemented, ## since it can probably be simplified with them. @@ -89,7 +89,7 @@ current (/stack.pop amount previous)] (in (set@ #..stack (#.Some current) environment))))) -(def: #export (produces amount) +(def: .public (produces amount) (-> U2 Condition) (function (_ environment) (do try.monad @@ -102,7 +102,7 @@ (set@ #..stack (#.Some current)) (set@ [#..limit #/limit.stack] limit)))))) -(def: #export (has registry) +(def: .public (has registry) (-> Registry Condition) (|>> (update@ [#..limit #/limit.registry] (/registry.has registry)) #try.Success)) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux index fad7c9dae..d8117947e 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux @@ -20,12 +20,12 @@ [type (#+ Type) [category (#+ Method)]]]]) -(type: #export Limit +(type: .public Limit {#stack Stack #registry Registry}) (template [<name> <registry>] - [(def: #export (<name> type) + [(def: .public (<name> type) (-> (Type Method) (Try Limit)) (do try.monad [registry (<registry> type)] @@ -36,21 +36,21 @@ [virtual /registry.virtual] ) -(def: #export length +(def: .public length ($_ n.+ ## u2 max_stack; /stack.length ## u2 max_locals; /registry.length)) -(def: #export equivalence +(def: .public equivalence (Equivalence Limit) ($_ product.equivalence /stack.equivalence /registry.equivalence )) -(def: #export (writer limit) +(def: .public (writer limit) (Writer Limit) ($_ format\compose (/stack.writer (get@ #stack limit)) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 3773b4333..7db606a0b 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -22,15 +22,17 @@ [category (#+ Method)] ["#/." parser]]]) -(type: #export Register U1) +(type: .public Register U1) (def: normal 1) (def: wide 2) -(abstract: #export Registry +(abstract: .public Registry + {} + U2 - (def: #export registry + (def: .public registry (-> U2 Registry) (|>> :abstraction)) @@ -46,7 +48,7 @@ (list\fold n.+ 0)))) (template [<start> <name>] - [(def: #export <name> + [(def: .public <name> (-> (Type Method) (Try Registry)) (|>> ..minimal (n.+ <start>) @@ -57,24 +59,24 @@ [1 virtual] ) - (def: #export equivalence + (def: .public equivalence (Equivalence Registry) (\ equivalence.functor map (|>> :representation) /////unsigned.equivalence)) - (def: #export writer + (def: .public writer (Writer Registry) (|>> :representation /////unsigned.writer/2)) - (def: #export (has needed) + (def: .public (has needed) (-> Registry Registry Registry) (|>> :representation (/////unsigned.max/2 (:representation needed)) :abstraction)) (template [<name> <extra>] - [(def: #export <name> + [(def: .public <name> (-> Register Registry) (let [extra (|> <extra> /////unsigned.u2 try.assumed)] (|>> /////unsigned.lift/2 @@ -87,5 +89,5 @@ ) ) -(def: #export length +(def: .public length /////unsigned.bytes/2) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux index 99a560347..a825e6699 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux @@ -17,11 +17,13 @@ [encoding ["#." unsigned (#+ U2)]]]) -(abstract: #export Stack +(abstract: .public Stack + {} + U2 (template [<frames> <name>] - [(def: #export <name> + [(def: .public <name> Stack (|> <frames> /////unsigned.u2 maybe.assume :abstraction))] @@ -29,13 +31,13 @@ [1 catch] ) - (def: #export equivalence + (def: .public equivalence (Equivalence Stack) (\ equivalence.functor map (|>> :representation) /////unsigned.equivalence)) - (def: #export writer + (def: .public writer (Writer Stack) (|>> :representation /////unsigned.writer/2)) @@ -44,7 +46,7 @@ (|>> :abstraction)) (template [<op> <name>] - [(def: #export (<name> amount) + [(def: .public (<name> amount) (-> U2 (-> Stack (Try Stack))) (|>> :representation (<op> amount) @@ -54,16 +56,16 @@ [/////unsigned.-/2 pop] ) - (def: #export (max left right) + (def: .public (max left right) (-> Stack Stack Stack) (:abstraction (/////unsigned.max/2 (:representation left) (:representation right)))) - (def: #export format + (def: .public format (Format Stack) (|>> :representation /////unsigned.value %.nat)) ) -(def: #export length +(def: .public length /////unsigned.bytes/2) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 3302b60dc..5aee5816a 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -36,23 +36,23 @@ [type [category (#+ Value Method)]]]]) -(type: #export Size U2) +(type: .public Size U2) -(type: #export Estimator +(type: .public Estimator (-> Address Size)) (def: fixed (-> Size Estimator) function.constant) -(type: #export Instruction +(type: .public Instruction (-> Specification Specification)) -(def: #export empty +(def: .public empty Instruction function.identity) -(def: #export run +(def: .public run (-> Instruction Specification) (function.apply format.no_op)) @@ -232,7 +232,9 @@ [(n.+ (///unsigned.value ..size/211) size) (|>> mutation ((trinary/211' opcode input0 input1 input2)))])]) -(abstract: #export Primitive_Array_Type +(abstract: .public Primitive_Array_Type + {} + U1 (def: code @@ -240,7 +242,7 @@ (|>> :representation)) (template [<code> <name>] - [(def: #export <name> (|> <code> ///unsigned.u1 try.assumed :abstraction))] + [(def: .public <name> (|> <code> ///unsigned.u1 try.assumed :abstraction))] [04 t_boolean] [05 t_char] @@ -491,7 +493,7 @@ [<input_name>] <inputs>')] - (def: #export <name> + (def: .public <name> [Estimator (-> [<input_types>] Instruction)] (let [[estimator <arity>'] <arity>] [estimator @@ -582,7 +584,7 @@ (n.- (n.% 4 parameter_start) 4)))) -(def: #export tableswitch +(def: .public tableswitch [(-> Nat Estimator) (-> S4 Big_Jump [Big_Jump (List Big_Jump)] Instruction)] (let [estimator (: (-> Nat Estimator) @@ -646,7 +648,7 @@ size) (|>> mutation tableswitch_mutation)]))))])) -(def: #export lookupswitch +(def: .public lookupswitch [(-> Nat Estimator) (-> Big_Jump (List [S4 Big_Jump]) Instruction)] (let [case_size (n.+ (///unsigned.value ..integer_size) @@ -706,7 +708,7 @@ size) (|>> mutation lookupswitch_mutation)]))))])) -(implementation: #export monoid +(implementation: .public monoid (Monoid Instruction) (def: identity ..empty) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux index 2873ef781..53fdd6081 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux @@ -10,18 +10,18 @@ [encoding ["#." signed (#+ S2 S4)]]]) -(type: #export Jump S2) +(type: .public Jump S2) -(def: #export equivalence +(def: .public equivalence (Equivalence Jump) ///signed.equivalence) -(def: #export writer +(def: .public writer (Writer Jump) ///signed.writer/2) -(type: #export Big_Jump S4) +(type: .public Big_Jump S4) -(def: #export lift +(def: .public lift (-> Jump Big_Jump) ///signed.lift/4) diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index 2e4b8eb15..17561fa0d 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- public private) [abstract [equivalence (#+ Equivalence)] ["." monad (#+ do)]] @@ -27,7 +27,7 @@ ["#." constant (#+ Constant) ["#/." pool (#+ Pool Resource)]]]) -(type: #export #rec Class +(type: .public #rec Class {#magic Magic #minor_version Minor #major_version Major @@ -51,7 +51,7 @@ ["4000" enum] ) -(def: #export equivalence +(def: .public equivalence (Equivalence Class) ($_ product.equivalence //unsigned.equivalence @@ -81,7 +81,7 @@ interfaces))] (in [@this @super @interfaces]))) -(def: #export (class version modifier +(def: .public (class version modifier this super interfaces fields methods attributes) (-> Major (Modifier Class) @@ -110,7 +110,7 @@ #methods (row.of_list =methods) #attributes attributes}))) -(def: #export (writer class) +(def: .public (writer class) (Writer Class) (`` ($_ binaryF\compose (~~ (template [<writer> <slot>] diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 7f2a7aa26..229dd247f 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -34,24 +34,26 @@ [encoding ["#." unsigned]]]]) -(type: #export UTF8 Text) +(type: .public UTF8 Text) (def: utf8_writer (Writer UTF8) binaryF.utf8/16) -(abstract: #export Class +(abstract: .public Class + {} + (Index UTF8) - (def: #export index + (def: .public index (-> Class (Index UTF8)) (|>> :representation)) - (def: #export class + (def: .public class (-> (Index UTF8) Class) (|>> :abstraction)) - (def: #export class_equivalence + (def: .public class_equivalence (Equivalence Class) (\ equivalence.functor map ..index @@ -66,7 +68,7 @@ ["#::." (#static floatToRawIntBits #manual [float] int)]) -(implementation: #export float_equivalence +(implementation: .public float_equivalence (Equivalence java/lang/Float) (def: (= parameter subject) @@ -82,14 +84,16 @@ ["#::." (#static doubleToRawLongBits [double] long)]) -(abstract: #export (Value kind) +(abstract: .public (Value kind) + {} + kind - (def: #export value + (def: .public value (All [kind] (-> (Value kind) kind)) (|>> :representation)) - (def: #export (value_equivalence Equivalence<kind>) + (def: .public (value_equivalence Equivalence<kind>) (All [kind] (-> (Equivalence kind) (Equivalence (Value kind)))) @@ -98,9 +102,9 @@ Equivalence<kind>)) (template [<constructor> <type> <marker>] - [(type: #export <type> (Value <marker>)) + [(type: .public <type> (Value <marker>)) - (def: #export <constructor> + (def: .public <constructor> (-> <marker> <type>) (|>> :abstraction))] @@ -126,16 +130,16 @@ ) ) -(type: #export (Name_And_Type of) +(type: .public (Name_And_Type of) {#name (Index UTF8) #descriptor (Index (Descriptor of))}) -(type: #export (Reference of) +(type: .public (Reference of) {#class (Index Class) #name_and_type (Index (Name_And_Type of))}) (template [<type> <equivalence> <writer>] - [(def: #export <equivalence> + [(def: .public <equivalence> (Equivalence (<type> Any)) ($_ product.equivalence //index.equivalence @@ -151,7 +155,7 @@ [Reference reference_equivalence reference_writer] ) -(type: #export Constant +(type: .public Constant (#UTF8 UTF8) (#Integer Integer) (#Float Float) @@ -164,7 +168,7 @@ (#Interface_Method (Reference //category.Method)) (#Name_And_Type (Name_And_Type Any))) -(def: #export (size constant) +(def: .public (size constant) (-> Constant Nat) (case constant (^or (#Long _) (#Double _)) @@ -173,7 +177,7 @@ _ 1)) -(def: #export equivalence +(def: .public equivalence (Equivalence Constant) ## TODO: Delete the explicit "implementation" and use the combinator ## version below as soon as the new format for variants is implemented. @@ -219,7 +223,7 @@ ## ) ) -(def: #export writer +(def: .public writer (Writer Constant) (with_expansions [<constants> (as_is [#UTF8 /tag.utf8 ..utf8_writer] [#Integer /tag.integer ..integer_writer] diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index d050b1e34..a82683e1b 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -35,59 +35,59 @@ [category (#+ Value Method)] ["#." descriptor (#+ Descriptor)]]]]) -(type: #export Pool [Index (Row [Index Constant])]) +(type: .public Pool [Index (Row [Index Constant])]) -(def: #export equivalence +(def: .public equivalence (Equivalence Pool) (product.equivalence //index.equivalence (row.equivalence (product.equivalence //index.equivalence //.equivalence)))) -(type: #export (Resource a) +(type: .public (Resource a) (+State Try Pool a)) -(def: #export monad +(def: .public monad (Monad Resource) (state.with try.monad)) (template: (!add <tag> <equivalence> <value>) - (function (_ [current pool]) - (let [<value>' <value>] - (with_expansions [<try_again> (as_is (recur (.inc idx)))] - (loop [idx 0] - (case (row.item idx pool) - (#try.Success entry) - (case entry - [index (<tag> reference)] - (if (\ <equivalence> = reference <value>') - (#try.Success [[current pool] - index]) - <try_again>) - - _ - <try_again>) - - (#try.Failure _) - (let [new (<tag> <value>')] - (do {! try.monad} - [@new (//unsigned.u2 (//.size new)) - next (: (Try Index) - (|> current - //index.value - (//unsigned.+/2 @new) - (\ ! map //index.index)))] - (in [[next - (row.add [current new] pool)] - current]))))))))) + [(function (_ [current pool]) + (let [<value>' <value>] + (with_expansions [<try_again> (as_is (recur (.inc idx)))] + (loop [idx 0] + (case (row.item idx pool) + (#try.Success entry) + (case entry + [index (<tag> reference)] + (if (\ <equivalence> = reference <value>') + (#try.Success [[current pool] + index]) + <try_again>) + + _ + <try_again>) + + (#try.Failure _) + (let [new (<tag> <value>')] + (do {! try.monad} + [@new (//unsigned.u2 (//.size new)) + next (: (Try Index) + (|> current + //index.value + (//unsigned.+/2 @new) + (\ ! map //index.index)))] + (in [[next + (row.add [current new] pool)] + current]))))))))]) (template: (!index <index>) - (|> <index> //index.value //unsigned.value)) + [(|> <index> //index.value //unsigned.value)]) (type: (Adder of) (-> of (Resource (Index of)))) (template [<name> <type> <tag> <equivalence>] - [(def: #export (<name> value) + [(def: .public (<name> value) (Adder <type>) (!add <tag> <equivalence> value))] @@ -98,32 +98,32 @@ [utf8 UTF8 #//.UTF8 text.equivalence] ) -(def: #export (string value) +(def: .public (string value) (-> Text (Resource (Index String))) (do ..monad [@value (utf8 value) .let [value (//.string @value)]] (!add #//.String (//.value_equivalence //index.equivalence) value))) -(def: #export (class name) +(def: .public (class name) (-> Internal (Resource (Index Class))) (do ..monad [@name (utf8 (//name.read name)) .let [value (//.class @name)]] (!add #//.Class //.class_equivalence value))) -(def: #export (descriptor value) +(def: .public (descriptor value) (All [kind] (-> (Descriptor kind) (Resource (Index (Descriptor kind))))) (let [value (//descriptor.descriptor value)] (!add #//.UTF8 text.equivalence value))) -(type: #export (Member of) +(type: .public (Member of) {#name UTF8 #descriptor (Descriptor of)}) -(def: #export (name_and_type [name descriptor]) +(def: .public (name_and_type [name descriptor]) (All [of] (-> (Member of) (Resource (Index (Name_And_Type of))))) (do ..monad @@ -132,7 +132,7 @@ (!add #//.Name_And_Type //.name_and_type_equivalence {#//.name @name #//.descriptor @descriptor}))) (template [<name> <tag> <of>] - [(def: #export (<name> class member) + [(def: .public (<name> class member) (-> External (Member <of>) (Resource (Index (Reference <of>)))) (do ..monad [@class (..class (//name.internal class)) @@ -144,7 +144,7 @@ [interface_method #//.Interface_Method Method] ) -(def: #export writer +(def: .public writer (Writer Pool) (function (_ [next pool]) (row\fold (function (_ [_index post] pre) @@ -152,7 +152,7 @@ (format.bits/16 (!index next)) pool))) -(def: #export empty +(def: .public empty Pool [(|> 1 //unsigned.u2 try.assumed //index.index) row.empty]) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 0eba9788e..7d53837f0 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -14,17 +14,19 @@ [encoding ["#." unsigned (#+ U1) ("u1//." equivalence)]]]) -(abstract: #export Tag +(abstract: .public Tag + {} + U1 - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Tag) (def: (= reference sample) (u1//= (:representation reference) (:representation sample)))) (template [<code> <name>] - [(def: #export <name> + [(def: .public <name> Tag (|> <code> ///unsigned.u1 try.assumed :abstraction))] @@ -44,7 +46,7 @@ [18 invoke_dynamic] ) - (def: #export writer + (def: .public writer (Writer Tag) (|>> :representation ///unsigned.writer/1)) ) diff --git a/stdlib/source/library/lux/target/jvm/encoding/name.lux b/stdlib/source/library/lux/target/jvm/encoding/name.lux index 02507ceb6..a0761950e 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/name.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/name.lux @@ -7,34 +7,36 @@ [type abstract]]]) -(def: #export internal_separator "/") -(def: #export external_separator ".") +(def: .public internal_separator "/") +(def: .public external_separator ".") -(type: #export External Text) +(type: .public External Text) -(abstract: #export Internal +(abstract: .public Internal + {} + Text - (def: #export internal + (def: .public internal (-> External Internal) (|>> (text.replace_all ..external_separator ..internal_separator) :abstraction)) - (def: #export read + (def: .public read (-> Internal Text) (|>> :representation)) - (def: #export external + (def: .public external (-> Internal External) (|>> :representation (text.replace_all ..internal_separator ..external_separator)))) -(def: #export safe +(def: .public safe (-> Text External) (|>> ..internal ..external)) -(def: #export (qualify package class) +(def: .public (qualify package class) (-> Text External External) (format (..safe package) ..external_separator class)) diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index dfdcedbb6..196f60380 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -22,26 +22,28 @@ [type abstract]]]) -(abstract: #export (Signed brand) +(abstract: .public (Signed brand) + {} + Int - (def: #export value + (def: .public value (-> (Signed Any) Int) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Signed brand))) (def: (= reference sample) (i.= (:representation reference) (:representation sample)))) - (implementation: #export order + (implementation: .public order (All [brand] (Order (Signed brand))) (def: &equivalence ..equivalence) (def: (< reference sample) (i.< (:representation reference) (:representation sample)))) - (exception: #export (value_exceeds_the_scope {value Int} + (exception: .public (value_exceeds_the_scope {value Int} {scope Nat}) (exception.report ["Value" (%.int value)] @@ -49,16 +51,16 @@ (template [<bytes> <name> <size> <constructor> <maximum> <+> <->] [(with_expansions [<raw> (template.identifier [<name> "'"])] - (abstract: #export <raw> Any) - (type: #export <name> (Signed <raw>))) + (abstract: .public <raw> {} Any) + (type: .public <name> (Signed <raw>))) - (def: #export <size> <bytes>) + (def: .public <size> <bytes>) - (def: #export <maximum> + (def: .public <maximum> <name> (|> <bytes> (n.* i64.bits_per_byte) dec i64.mask :abstraction)) - (def: #export <constructor> + (def: .public <constructor> (-> Int (Try <name>)) (let [positive (|> <bytes> (n.* i64.bits_per_byte) i64.mask) negative (|> positive .int (i.right_shifted 1) i64.not)] @@ -71,7 +73,7 @@ (exception.except ..value_exceeds_the_scope [value <size>]))))) (template [<abstract_operation> <concrete_operation>] - [(def: #export (<abstract_operation> parameter subject) + [(def: .public (<abstract_operation> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> (<concrete_operation> (:representation parameter) @@ -87,7 +89,7 @@ ) (template [<name> <from> <to>] - [(def: #export <name> + [(def: .public <name> (-> <from> <to>) (|>> :transmutation))] @@ -96,7 +98,7 @@ ) (template [<writer_name> <type> <writer>] - [(def: #export <writer_name> + [(def: .public <writer_name> (Writer <type>) (|>> :representation <writer>))] diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index 546d4f516..e9084bb9d 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -21,20 +21,22 @@ [type abstract]]]) -(abstract: #export (Unsigned brand) +(abstract: .public (Unsigned brand) + {} + Nat - (def: #export value + (def: .public value (-> (Unsigned Any) Nat) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Unsigned brand))) (def: (= reference sample) (n.= (:representation reference) (:representation sample)))) - (implementation: #export order + (implementation: .public order (All [brand] (Order (Unsigned brand))) (def: &equivalence ..equivalence) @@ -42,7 +44,7 @@ (n.< (:representation reference) (:representation sample)))) - (exception: #export (value_exceeds_the_maximum {type Name} + (exception: .public (value_exceeds_the_maximum {type Name} {value Nat} {maximum (Unsigned Any)}) (exception.report @@ -50,7 +52,7 @@ ["Value" (%.nat value)] ["Maximum" (%.nat (:representation maximum))])) - (exception: #export [brand] (subtraction_cannot_yield_negative_value + (exception: .public [brand] (subtraction_cannot_yield_negative_value {type Name} {parameter (Unsigned brand)} {subject (Unsigned brand)}) @@ -61,28 +63,28 @@ (template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>] [(with_expansions [<raw> (template.identifier [<name> "'"])] - (abstract: #export <raw> Any) - (type: #export <name> (Unsigned <raw>))) + (abstract: .public <raw> {} Any) + (type: .public <name> (Unsigned <raw>))) - (def: #export <size> <bytes>) + (def: .public <size> <bytes>) - (def: #export <maximum> + (def: .public <maximum> <name> (|> <bytes> (n.* i64.bits_per_byte) i64.mask :abstraction)) - (def: #export (<constructor> value) + (def: .public (<constructor> value) (-> Nat (Try <name>)) (if (n.<= (:representation <maximum>) value) (#try.Success (:abstraction value)) (exception.except ..value_exceeds_the_maximum [(name_of <name>) value <maximum>]))) - (def: #export (<+> parameter subject) + (def: .public (<+> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> (n.+ (:representation parameter) (:representation subject)))) - (def: #export (<-> parameter subject) + (def: .public (<-> parameter subject) (-> <name> <name> (Try <name>)) (let [parameter' (:representation parameter) subject' (:representation subject)] @@ -90,7 +92,7 @@ (#try.Success (:abstraction (n.- parameter' subject'))) (exception.except ..subtraction_cannot_yield_negative_value [(name_of <name>) parameter subject])))) - (def: #export (<max> left right) + (def: .public (<max> left right) (-> <name> <name> <name>) (:abstraction (n.max (:representation left) (:representation right))))] @@ -101,7 +103,7 @@ ) (template [<name> <from> <to>] - [(def: #export <name> + [(def: .public <name> (-> <from> <to>) (|>> :transmutation))] @@ -110,7 +112,7 @@ ) (template [<writer_name> <type> <writer>] - [(def: #export <writer_name> + [(def: .public <writer_name> (Writer <type>) (|>> :representation <writer>))] diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux index 93cda4c5e..a9d783621 100644 --- a/stdlib/source/library/lux/target/jvm/field.lux +++ b/stdlib/source/library/lux/target/jvm/field.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Type static) + [lux (#- Type static public private) [abstract [equivalence (#+ Equivalence)] ["." monad (#+ do)]] @@ -20,7 +20,7 @@ [category (#+ Value)] [descriptor (#+ Descriptor)]]]) -(type: #export #rec Field +(type: .public #rec Field {#modifier (Modifier Field) #name (Index UTF8) #descriptor (Index (Descriptor Value)) @@ -38,7 +38,7 @@ ["4000" enum] ) -(def: #export equivalence +(def: .public equivalence (Equivalence Field) ($_ product.equivalence modifier.equivalence @@ -46,7 +46,7 @@ //index.equivalence (row.equivalence //attribute.equivalence))) -(def: #export (writer field) +(def: .public (writer field) (Writer Field) (`` ($_ binaryF\compose (~~ (template [<writer> <slot>] @@ -58,7 +58,7 @@ [(binaryF.row/16 //attribute.writer) #attributes])) ))) -(def: #export (field modifier name type attributes) +(def: .public (field modifier name type attributes) (-> (Modifier Field) UTF8 (Type Value) (Row Attribute) (Resource Field)) (do //constant/pool.monad diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux index 851d6903f..66df65314 100644 --- a/stdlib/source/library/lux/target/jvm/index.lux +++ b/stdlib/source/library/lux/target/jvm/index.lux @@ -12,27 +12,29 @@ [encoding ["#." unsigned (#+ U2)]]]) -(def: #export length +(def: .public length //unsigned.bytes/2) -(abstract: #export (Index kind) +(abstract: .public (Index kind) + {} + U2 - (def: #export index + (def: .public index (All [kind] (-> U2 (Index kind))) (|>> :abstraction)) - (def: #export value + (def: .public value (-> (Index Any) U2) (|>> :representation)) - (def: #export equivalence + (def: .public equivalence (All [kind] (Equivalence (Index kind))) (\ equivalence.functor map ..value //unsigned.equivalence)) - (def: #export writer + (def: .public writer (All [kind] (Writer (Index kind))) (|>> :representation //unsigned.writer/2)) ) diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index ec7931743..3a38d9bb8 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -19,18 +19,18 @@ ["." array] ["." dictionary (#+ Dictionary)]]]]]) -(type: #export Library +(type: .public Library (Atom (Dictionary Text Binary))) -(exception: #export (already_stored {class Text}) +(exception: .public (already_stored {class Text}) (exception.report ["Class" class])) -(exception: #export (unknown {class Text}) +(exception: .public (unknown {class Text}) (exception.report ["Class" class])) -(exception: #export (cannot_define {class Text} {error Text}) +(exception: .public (cannot_define {class Text} {error Text}) (exception.report ["Class" class] ["Error" error])) @@ -78,7 +78,7 @@ (ffi.class_for java/lang/ClassLoader)) (java/lang/reflect/AccessibleObject::setAccessible true))))) -(def: #export (define class_name bytecode loader) +(def: .public (define class_name bytecode loader) (-> Text Binary java/lang/ClassLoader (Try java/lang/Object)) (let [signature (array.of_list (list (:as java/lang/Object class_name) @@ -95,11 +95,11 @@ ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) -(def: #export (new_library _) +(def: .public (new_library _) (-> Any Library) (atom.atom (dictionary.empty text.hash))) -(def: #export (memory library) +(def: .public (memory library) (-> Library java/lang/ClassLoader) (with_expansions [<cast> (for {@.old (<|) @@ -126,7 +126,7 @@ #.None (error! (exception.error ..unknown [class_name]))))))))) -(def: #export (store name bytecode library) +(def: .public (store name bytecode library) (-> Text Binary Library (IO (Try Any))) (do {! io.monad} [library' (atom.read library)] @@ -136,7 +136,7 @@ [_ (atom.update (dictionary.put name bytecode) library)] (in (#try.Success [])))))) -(def: #export (load name loader) +(def: .public (load name loader) (-> Text java/lang/ClassLoader (IO (Try (java/lang/Class java/lang/Object)))) (java/lang/ClassLoader::loadClass name loader)) diff --git a/stdlib/source/library/lux/target/jvm/magic.lux b/stdlib/source/library/lux/target/jvm/magic.lux index fee2c425a..c08360f9e 100644 --- a/stdlib/source/library/lux/target/jvm/magic.lux +++ b/stdlib/source/library/lux/target/jvm/magic.lux @@ -9,12 +9,12 @@ [encoding ["#." unsigned (#+ U4)]]]) -(type: #export Magic +(type: .public Magic U4) -(def: #export code +(def: .public code Magic (|> (hex "CAFEBABE") //unsigned.u4 try.assumed)) -(def: #export writer +(def: .public writer //unsigned.writer/4) diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index a2868b2ac..54aee2e60 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Type static) + [lux (#- Type static public private) [abstract [equivalence (#+ Equivalence)] ["." monad (#+ do)]] @@ -26,7 +26,7 @@ ["#/." category] ["#." descriptor (#+ Descriptor)]]]) -(type: #export #rec Method +(type: .public #rec Method {#modifier (Modifier Method) #name (Index UTF8) #descriptor (Index (Descriptor //type/category.Method)) @@ -47,7 +47,7 @@ ["1000" synthetic] ) -(def: #export (method modifier name type attributes code) +(def: .public (method modifier name type attributes code) (-> (Modifier Method) UTF8 (Type //type/category.Method) (List (Resource Attribute)) (Maybe (Bytecode Any)) (Resource Method)) (do {! //constant/pool.monad} @@ -82,7 +82,7 @@ #descriptor @descriptor #attributes attributes}))) -(def: #export equivalence +(def: .public equivalence (Equivalence Method) ($_ product.equivalence //modifier.equivalence @@ -91,7 +91,7 @@ (row.equivalence //attribute.equivalence) )) -(def: #export (writer field) +(def: .public (writer field) (Writer Method) (`` ($_ format\compose (~~ (template [<writer> <slot>] diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index d6fae89ed..92aeafec2 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -23,14 +23,16 @@ [encoding ["#." unsigned]]]) -(abstract: #export (Modifier of) +(abstract: .public (Modifier of) + {} + //unsigned.U2 - (def: #export code + (def: .public code (-> (Modifier Any) //unsigned.U2) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [of] (Equivalence (Modifier of))) (def: (= reference sample) @@ -39,24 +41,24 @@ (:representation sample)))) (template: (!wrap value) - (|> value - //unsigned.u2 - try.assumed - :abstraction)) + [(|> value + //unsigned.u2 + try.assumed + :abstraction)]) (template: (!unwrap value) - (|> value - :representation - //unsigned.value)) + [(|> value + :representation + //unsigned.value)]) - (def: #export (has? sub super) + (def: .public (has? sub super) (All [of] (-> (Modifier of) (Modifier of) Bit)) (let [sub (!unwrap sub)] (|> (!unwrap super) (i64.and sub) (\ i64.equivalence = sub)))) - (implementation: #export monoid + (implementation: .public monoid (All [of] (Monoid (Modifier of))) (def: identity @@ -65,11 +67,11 @@ (def: (compose left right) (!wrap (i64.or (!unwrap left) (!unwrap right))))) - (def: #export empty + (def: .public empty Modifier (\ ..monoid identity)) - (def: #export writer + (def: .public writer (All [of] (Writer (Modifier of))) (|>> :representation //unsigned.writer/2)) @@ -78,10 +80,10 @@ (|>> !wrap)) ) -(syntax: #export (modifiers: ofT {options (<>.many <c>.any)}) +(syntax: .public (modifiers: ofT {options (<>.many <c>.any)}) (with_gensyms [g!modifier g!code] (in (list (` (template [(~ g!code) (~ g!modifier)] - [(def: (~' #export) (~ g!modifier) + [(def: (~' .public) (~ g!modifier) (..Modifier (~ ofT)) ((~! ..modifier) ((~! number.hex) (~ g!code))))] diff --git a/stdlib/source/library/lux/target/jvm/modifier/inner.lux b/stdlib/source/library/lux/target/jvm/modifier/inner.lux index fc9bc982c..6a7e9ae7c 100644 --- a/stdlib/source/library/lux/target/jvm/modifier/inner.lux +++ b/stdlib/source/library/lux/target/jvm/modifier/inner.lux @@ -5,7 +5,7 @@ abstract]]] [// (#+ modifiers:)]) -(abstract: #export Inner Any) +(abstract: .public Inner {} Any) (modifiers: Inner ["0001" public] diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index 6827f2be9..bdb8249f2 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -111,12 +111,12 @@ (getConstructors [] [(java/lang/reflect/Constructor java/lang/Object)]) (getDeclaredMethods [] [java/lang/reflect/Method])]) -(exception: #export (unknown_class {class External}) +(exception: .public (unknown_class {class External}) (exception.report ["Class" (%.text class)])) (template [<name>] - [(exception: #export (<name> {jvm_type java/lang/reflect/Type}) + [(exception: .public (<name> {jvm_type java/lang/reflect/Type}) (exception.report ["Type" (java/lang/reflect/Type::getTypeName jvm_type)] ["Class" (|> jvm_type java/lang/Object::getClass java/lang/Object::toString)]))] @@ -125,7 +125,7 @@ [cannot_convert_to_a_lux_type] ) -(def: #export (load class_loader name) +(def: .public (load class_loader name) (-> java/lang/ClassLoader External (Try (java/lang/Class java/lang/Object))) (case (java/lang/Class::forName name false class_loader) (#try.Success class) @@ -134,7 +134,7 @@ (#try.Failure _) (exception.except ..unknown_class name))) -(def: #export (sub? class_loader super sub) +(def: .public (sub? class_loader super sub) (-> java/lang/ClassLoader External External (Try Bit)) (do try.monad [super (..load class_loader super) @@ -187,7 +187,7 @@ ## else (exception.except ..cannot_convert_to_a_lux_type reflection))) -(def: #export (parameter reflection) +(def: .public (parameter reflection) (-> java/lang/reflect/Type (Try (/.Type Parameter))) (<| (case (ffi.check java/lang/reflect/TypeVariable reflection) (#.Some reflection) @@ -217,12 +217,12 @@ _) (..class' parameter reflection))) -(def: #export class +(def: .public class (-> java/lang/reflect/Type (Try (/.Type Class))) (..class' ..parameter)) -(def: #export (type reflection) +(def: .public (type reflection) (-> java/lang/reflect/Type (Try (/.Type Value))) (<| (case (ffi.check java/lang/Class reflection) (#.Some reflection) @@ -256,7 +256,7 @@ ## else (..parameter reflection))) -(def: #export (return reflection) +(def: .public (return reflection) (-> java/lang/reflect/Type (Try (/.Type Return))) (with_expansions [<else> (as_is (..type reflection))] (case (ffi.check java/lang/Class reflection) @@ -272,13 +272,13 @@ #.None <else>))) -(exception: #export (cannot_correspond {class (java/lang/Class java/lang/Object)} +(exception: .public (cannot_correspond {class (java/lang/Class java/lang/Object)} {type Type}) (exception.report ["Class" (java/lang/Object::toString class)] ["Type" (%.type type)])) -(exception: #export (type_parameter_mismatch {expected Nat} +(exception: .public (type_parameter_mismatch {expected Nat} {actual Nat} {class (java/lang/Class java/lang/Object)} {type Type}) @@ -288,11 +288,11 @@ ["Class" (java/lang/Object::toString class)] ["Type" (%.type type)])) -(exception: #export (non_jvm_type {type Type}) +(exception: .public (non_jvm_type {type Type}) (exception.report ["Type" (%.type type)])) -(def: #export (correspond class type) +(def: .public (correspond class type) (-> (java/lang/Class java/lang/Object) Type (Try Mapping)) (case type (#.Primitive name params) @@ -326,7 +326,7 @@ _ (exception.except ..non_jvm_type [type]))) -(exception: #export (mistaken_field_owner {field java/lang/reflect/Field} +(exception: .public (mistaken_field_owner {field java/lang/reflect/Field} {owner (java/lang/Class java/lang/Object)} {target (java/lang/Class java/lang/Object)}) (exception.report @@ -335,7 +335,7 @@ ["Target" (java/lang/Object::toString target)])) (template [<name>] - [(exception: #export (<name> {field Text} + [(exception: .public (<name> {field Text} {class (java/lang/Class java/lang/Object)}) (exception.report ["Field" (%.text field)] @@ -346,7 +346,7 @@ [not_a_virtual_field] ) -(def: #export (field field target) +(def: .public (field field target) (-> Text (java/lang/Class java/lang/Object) (Try java/lang/reflect/Field)) (case (java/lang/Class::getDeclaredField field target) (#try.Success field) @@ -358,7 +358,7 @@ (#try.Failure _) (exception.except ..unknown_field [field target]))) -(def: #export deprecated? +(def: .public deprecated? (-> (array.Array java/lang/annotation/Annotation) Bit) (|>> array.list (list.all (|>> (ffi.check java/lang/Deprecated))) @@ -366,7 +366,7 @@ not)) (template [<name> <exception> <then?> <else?>] - [(def: #export (<name> field class) + [(def: .public (<name> field class) (-> Text (java/lang/Class java/lang/Object) (Try [Bit Bit (/.Type Value)])) (do {! try.monad} [fieldJ (..field field class) diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index 9b29382c7..c4a5abd0b 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -24,22 +24,24 @@ ["#." descriptor (#+ Descriptor)] ["#." reflection (#+ Reflection)]]) -(abstract: #export (Type category) +(abstract: .public (Type category) + {} + [(Signature category) (Descriptor category) (Reflection category)] - (type: #export Argument + (type: .public Argument [Text (Type Value)]) - (type: #export (Typed a) + (type: .public (Typed a) [(Type Value) a]) - (type: #export Constraint + (type: .public Constraint {#name Text #super_class (Type Class) #super_interfaces (List (Type Class))}) (template [<name> <style>] - [(def: #export (<name> type) + [(def: .public (<name> type) (All [category] (-> (Type category) (<style> category))) (let [[signature descriptor reflection] (:representation type)] <name>))] @@ -48,7 +50,7 @@ [descriptor Descriptor] ) - (def: #export (reflection type) + (def: .public (reflection type) (All [category] (-> (Type (<| Return' Value' category)) (Reflection (<| Return' Value' category)))) @@ -56,7 +58,7 @@ reflection)) (template [<category> <name> <signature> <descriptor> <reflection>] - [(def: #export <name> + [(def: .public <name> (Type <category>) (:abstraction [<signature> <descriptor> <reflection>]))] @@ -71,28 +73,28 @@ [Primitive char /signature.char /descriptor.char /reflection.char] ) - (def: #export (array type) + (def: .public (array type) (-> (Type Value) (Type Array)) (:abstraction [(/signature.array (..signature type)) (/descriptor.array (..descriptor type)) (/reflection.array (..reflection type))])) - (def: #export (class name parameters) + (def: .public (class name parameters) (-> External (List (Type Parameter)) (Type Class)) (:abstraction [(/signature.class name (list\map ..signature parameters)) (/descriptor.class name) (/reflection.class name)])) - (def: #export (declaration name variables) + (def: .public (declaration name variables) (-> External (List (Type Var)) (Type Declaration)) (:abstraction [(/signature.declaration name (list\map ..signature variables)) (/descriptor.declaration name) (/reflection.declaration name)])) - (def: #export (as_class type) + (def: .public (as_class type) (-> (Type Declaration) (Type Class)) (:abstraction (let [[signature descriptor reflection] (:representation type)] @@ -100,21 +102,21 @@ (/descriptor.as_class descriptor) (/reflection.as_class reflection)]))) - (def: #export wildcard + (def: .public wildcard (Type Parameter) (:abstraction [/signature.wildcard /descriptor.wildcard /reflection.wildcard])) - (def: #export (var name) + (def: .public (var name) (-> Text (Type Var)) (:abstraction [(/signature.var name) /descriptor.var /reflection.var])) - (def: #export (lower bound) + (def: .public (lower bound) (-> (Type Class) (Type Parameter)) (:abstraction (let [[signature descriptor reflection] (:representation bound)] @@ -122,7 +124,7 @@ (/descriptor.lower descriptor) (/reflection.lower reflection)]))) - (def: #export (upper bound) + (def: .public (upper bound) (-> (Type Class) (Type Parameter)) (:abstraction (let [[signature descriptor reflection] (:representation bound)] @@ -130,7 +132,7 @@ (/descriptor.upper descriptor) (/reflection.upper reflection)]))) - (def: #export (method [type_variables inputs output exceptions]) + (def: .public (method [type_variables inputs output exceptions]) (-> [(List (Type Var)) (List (Type Value)) (Type Return) @@ -145,7 +147,7 @@ (..descriptor output)]) (:assume ..void)])) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Type category))) (def: (= parameter subject) @@ -153,13 +155,13 @@ (..signature parameter) (..signature subject)))) - (implementation: #export hash + (implementation: .public hash (All [category] (Hash (Type category))) (def: &equivalence ..equivalence) (def: hash (|>> ..signature (\ /signature.hash hash)))) - (def: #export (primitive? type) + (def: .public (primitive? type) (-> (Type Value) (Either (Type Object) (Type Primitive))) (if (`` (or (~~ (template [<type>] @@ -176,7 +178,7 @@ (|> type (:as (Type Primitive)) #.Right) (|> type (:as (Type Object)) #.Left))) - (def: #export (void? type) + (def: .public (void? type) (-> (Type Return) (Either (Type Value) (Type Void))) (if (`` (or (~~ (template [<type>] @@ -187,7 +189,7 @@ (|> type (:as (Type Value)) #.Left))) ) -(def: #export (class? type) +(def: .public (class? type) (-> (Type Value) (Maybe External)) (let [repr (|> type ..descriptor /descriptor.descriptor)] (if (and (text.starts_with? /descriptor.class_prefix repr) @@ -202,6 +204,6 @@ (\ maybe.monad map (|>> //name.internal //name.external)))) #.None))) -(def: #export format +(def: .public format (All [a] (Format (Type a))) (|>> ..signature /signature.signature)) diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux index e4c4ccca3..05ecd1f29 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -24,10 +24,10 @@ [encoding ["#." name]]]]) -(type: #export Aliasing +(type: .public Aliasing (Dictionary Text Text)) -(def: #export fresh +(def: .public fresh Aliasing (dictionary.empty text.hash)) @@ -115,7 +115,7 @@ (\ <>.monad map //.var) (<>.before (<>.many (..bound aliasing))))) -(def: #export (method aliasing) +(def: .public (method aliasing) (-> Aliasing (-> (Type Method) (Type Method))) (|>> //.signature //signature.signature diff --git a/stdlib/source/library/lux/target/jvm/type/box.lux b/stdlib/source/library/lux/target/jvm/type/box.lux index 9479ef218..44ab2a6ee 100644 --- a/stdlib/source/library/lux/target/jvm/type/box.lux +++ b/stdlib/source/library/lux/target/jvm/type/box.lux @@ -6,7 +6,7 @@ [name (#+ External)]]]) (template [<name> <box>] - [(def: #export <name> External <box>)] + [(def: .public <name> External <box>)] [boolean "java.lang.Boolean"] [byte "java.lang.Byte"] diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux index 7f492290d..c42a007f2 100644 --- a/stdlib/source/library/lux/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/target/jvm/type/category.lux @@ -6,25 +6,25 @@ [type abstract]]]) -(abstract: #export Void' Any) -(abstract: #export (Value' kind) Any) -(abstract: #export (Return' kind) Any) -(abstract: #export Method Any) +(abstract: .public Void' {} Any) +(abstract: .public (Value' kind) {} Any) +(abstract: .public (Return' kind) {} Any) +(abstract: .public Method {} Any) -(type: #export Return (<| Return' Any)) -(type: #export Value (<| Return' Value' Any)) -(type: #export Void (<| Return' Void')) +(type: .public Return (<| Return' Any)) +(type: .public Value (<| Return' Value' Any)) +(type: .public Void (<| Return' Void')) -(abstract: #export (Object' brand) Any) -(type: #export Object (<| Return' Value' Object' Any)) +(abstract: .public (Object' brand) {} Any) +(type: .public Object (<| Return' Value' Object' Any)) -(abstract: #export (Parameter' brand) Any) -(type: #export Parameter (<| Return' Value' Object' Parameter' Any)) +(abstract: .public (Parameter' brand) {} Any) +(type: .public Parameter (<| Return' Value' Object' Parameter' Any)) (template [<parents> <child>] [(with_expansions [<raw> (template.identifier [<child> "'"])] - (abstract: #export <raw> Any) - (type: #export <child> + (abstract: .public <raw> {} Any) + (type: .public <child> (`` (<| Return' Value' (~~ (template.spliced <parents>)) <raw>))))] [[] Primitive] @@ -33,4 +33,4 @@ [[Object'] Array] ) -(abstract: #export Declaration Any) +(abstract: .public Declaration {} Any) diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux index 6f36f544b..df751407b 100644 --- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux @@ -20,15 +20,17 @@ [encoding ["#." name (#+ Internal External)]]]]) -(abstract: #export (Descriptor category) +(abstract: .public (Descriptor category) + {} + Text - (def: #export descriptor + (def: .public descriptor (-> (Descriptor Any) Text) (|>> :representation)) (template [<sigil> <category> <name>] - [(def: #export <name> + [(def: .public <name> (Descriptor <category>) (:abstraction <sigil>))] @@ -43,26 +45,26 @@ ["C" Primitive char] ) - (def: #export class_prefix "L") - (def: #export class_suffix ";") + (def: .public class_prefix "L") + (def: .public class_suffix ";") - (def: #export class + (def: .public class (-> External (Descriptor Class)) (|>> ///name.internal ///name.read (text.enclosed [..class_prefix ..class_suffix]) :abstraction)) - (def: #export (declaration name) + (def: .public (declaration name) (-> External (Descriptor Declaration)) (:transmutation (..class name))) - (def: #export as_class + (def: .public as_class (-> (Descriptor Declaration) (Descriptor Class)) (|>> :transmutation)) (template [<name> <category>] - [(def: #export <name> + [(def: .public <name> (Descriptor <category>) (:transmutation (..class "java.lang.Object")))] @@ -71,24 +73,24 @@ [wildcard Parameter] ) - (def: #export (lower descriptor) + (def: .public (lower descriptor) (-> (Descriptor Class) (Descriptor Parameter)) ..wildcard) - (def: #export upper + (def: .public upper (-> (Descriptor Class) (Descriptor Parameter)) (|>> :transmutation)) - (def: #export array_prefix "[") + (def: .public array_prefix "[") - (def: #export array + (def: .public array (-> (Descriptor Value) (Descriptor Array)) (|>> :representation (format ..array_prefix) :abstraction)) - (def: #export (method [inputs output]) + (def: .public (method [inputs output]) (-> [(List (Descriptor Value)) (Descriptor Return)] (Descriptor Method)) @@ -99,13 +101,13 @@ (text.enclosed ["(" ")"])) (:representation output)))) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Descriptor category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) - (def: #export class_name + (def: .public class_name (-> (Descriptor Object) Internal) (let [prefix_size (text.size ..class_prefix) suffix_size (text.size ..class_suffix)] diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index 86184ebbd..5a58e3dc0 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -30,19 +30,19 @@ ["#." name]]]]) (template [<name>] - [(abstract: #export (<name> class) Any)] + [(abstract: .public (<name> class) {} Any)] [Lower] [Upper] ) -(type: #export Mapping +(type: .public Mapping (Dictionary Text Type)) -(def: #export fresh +(def: .public fresh Mapping (dictionary.empty text.hash)) -(exception: #export (unknown_var {var Text}) +(exception: .public (unknown_var {var Text}) (exception.report ["Var" (%.text var)])) @@ -165,7 +165,7 @@ class ))))) -(def: #export class +(def: .public class (-> Mapping (Parser (Check Type))) (|>> ..parameter ..class')) @@ -192,7 +192,7 @@ (|> elementT array.Array .type))))) (<>.after (<text>.this //descriptor.array_prefix)))) -(def: #export (type mapping) +(def: .public (type mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) @@ -202,7 +202,7 @@ (..array type) )))) -(def: #export (boxed_type mapping) +(def: .public (boxed_type mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) @@ -212,21 +212,21 @@ (..array type) )))) -(def: #export (return mapping) +(def: .public (return mapping) (-> Mapping (Parser (Check Type))) ($_ <>.either ..void (..type mapping) )) -(def: #export (boxed_return mapping) +(def: .public (boxed_return mapping) (-> Mapping (Parser (Check Type))) ($_ <>.either ..void (..boxed_type mapping) )) -(def: #export (check operation input) +(def: .public (check operation input) (All [a] (-> (Parser (Check a)) Text (Check a))) (case (<text>.run operation input) (#try.Success check) diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux index 5dbada115..f54b961cc 100644 --- a/stdlib/source/library/lux/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/target/jvm/type/parser.lux @@ -23,7 +23,7 @@ ["#." name (#+ External)]]]]) (template [<category> <name> <signature> <type>] - [(def: #export <name> + [(def: .public <name> (Parser (Type <category>)) (<>.after (<text>.this (//signature.signature <signature>)) (<>\in <type>)))] @@ -40,7 +40,7 @@ [Parameter wildcard //signature.wildcard //.wildcard] ) -(def: #export primitive +(def: .public primitive (Parser (Type Primitive)) ($_ <>.either ..boolean @@ -66,7 +66,7 @@ (format var/tail //name.internal_separator)) (template [<type> <name> <head> <tail> <adapter>] - [(def: #export <name> + [(def: .public <name> (Parser <type>) (\ <>.functor map <adapter> (<text>.slice (<text>.and! (<text>.one_of! <head>) @@ -76,24 +76,24 @@ [Text var_name var/head var/tail function.identity] ) -(def: #export var' +(def: .public var' (Parser Text) (|> ..var_name (<>.after (<text>.this //signature.var_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) -(def: #export var +(def: .public var (Parser (Type Var)) (<>\map //.var ..var')) -(def: #export var? +(def: .public var? (-> (Type Value) (Maybe Text)) (|>> //.signature //signature.signature (<text>.run ..var') try.maybe)) -(def: #export name +(def: .public name (-> (Type Var) Text) (|>> //.signature //signature.signature @@ -127,7 +127,7 @@ (|>> ..class'' (\ <>.monad map (product.uncurry //.class)))) -(def: #export parameter +(def: .public parameter (Parser (Type Parameter)) (<>.rec (function (_ parameter) @@ -140,17 +140,17 @@ class ))))) -(def: #export array' +(def: .public array' (-> (Parser (Type Value)) (Parser (Type Array))) (|>> (<>.after (<text>.this //descriptor.array_prefix)) (<>\map //.array))) -(def: #export class +(def: .public class (Parser (Type Class)) (..class' ..parameter)) (template [<name> <prefix> <constructor>] - [(def: #export <name> + [(def: .public <name> (-> (Type Value) (Maybe (Type Class))) (|>> //.signature //signature.signature @@ -161,14 +161,14 @@ [upper? //signature.upper_prefix //.upper] ) -(def: #export read_class +(def: .public read_class (-> (Type Class) [External (List (Type Parameter))]) (|>> //.signature //signature.signature (<text>.run (..class'' ..parameter)) try.assumed)) -(def: #export value +(def: .public value (Parser (Type Value)) (<>.rec (function (_ value) @@ -178,11 +178,11 @@ (..array' value) )))) -(def: #export array +(def: .public array (Parser (Type Array)) (..array' ..value)) -(def: #export object +(def: .public object (Parser (Type Object)) ($_ <>.either ..class @@ -193,7 +193,7 @@ (<>.after (<text>.this //signature.arguments_start)) (<>.before (<text>.this //signature.arguments_end)))) -(def: #export return +(def: .public return (Parser (Type Return)) (<>.either ..void ..value)) @@ -203,7 +203,7 @@ (|> (..class' ..parameter) (<>.after (<text>.this //signature.exception_prefix)))) -(def: #export method +(def: .public method (-> (Type Method) [(List (Type Var)) (List (Type Value)) @@ -227,7 +227,7 @@ try.assumed))) (template [<name> <category> <parser>] - [(def: #export <name> + [(def: .public <name> (-> (Type Value) (Maybe <category>)) (|>> //.signature //signature.signature @@ -247,7 +247,7 @@ [object? (Type Object) ..object] ) -(def: #export declaration' +(def: .public declaration' (Parser [External (List (Type Var))]) (|> (<>.and ..class_name (|> (<>.some ..var) @@ -257,7 +257,7 @@ (<>.after (<text>.this //descriptor.class_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) -(def: #export declaration +(def: .public declaration (-> (Type Declaration) [External (List (Type Var))]) (|>> //.signature //signature.signature diff --git a/stdlib/source/library/lux/target/jvm/type/reflection.lux b/stdlib/source/library/lux/target/jvm/type/reflection.lux index 78ef5a45c..f92b41ae5 100644 --- a/stdlib/source/library/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux @@ -15,21 +15,23 @@ [encoding ["#." name (#+ External)]]]]) -(abstract: #export (Reflection category) +(abstract: .public (Reflection category) + {} + Text - (def: #export reflection + (def: .public reflection (-> (Reflection Any) Text) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Reflection category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) (template [<category> <name> <reflection>] - [(def: #export <name> + [(def: .public <name> (Reflection <category>) (:abstraction <reflection>))] @@ -44,19 +46,19 @@ [Primitive char "char"] ) - (def: #export class + (def: .public class (-> External (Reflection Class)) (|>> :abstraction)) - (def: #export (declaration name) + (def: .public (declaration name) (-> External (Reflection Declaration)) (:transmutation (..class name))) - (def: #export as_class + (def: .public as_class (-> (Reflection Declaration) (Reflection Class)) (|>> :transmutation)) - (def: #export (array element) + (def: .public (array element) (-> (Reflection Value) (Reflection Array)) (let [element' (:representation element) elementR (`` (cond (text.starts_with? //descriptor.array_prefix element') @@ -85,7 +87,7 @@ :abstraction))) (template [<name> <category>] - [(def: #export <name> + [(def: .public <name> (Reflection <category>) (:transmutation (..class "java.lang.Object")))] @@ -94,11 +96,11 @@ [wildcard Parameter] ) - (def: #export (lower reflection) + (def: .public (lower reflection) (-> (Reflection Class) (Reflection Parameter)) ..wildcard) - (def: #export upper + (def: .public upper (-> (Reflection Class) (Reflection Parameter)) (|>> :transmutation)) ) diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index 84a6a5982..4ebdb9248 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -18,15 +18,17 @@ [encoding ["#." name (#+ External)]]]]) -(abstract: #export (Signature category) +(abstract: .public (Signature category) + {} + Text - (def: #export signature + (def: .public signature (-> (Signature Any) Text) (|>> :representation)) (template [<category> <name> <descriptor>] - [(def: #export <name> + [(def: .public <name> (Signature <category>) (:abstraction (//descriptor.descriptor <descriptor>)))] @@ -41,34 +43,34 @@ [Primitive char //descriptor.char] ) - (def: #export array + (def: .public array (-> (Signature Value) (Signature Array)) (|>> :representation (format //descriptor.array_prefix) :abstraction)) - (def: #export wildcard + (def: .public wildcard (Signature Parameter) (:abstraction "*")) - (def: #export var_prefix "T") + (def: .public var_prefix "T") - (def: #export var + (def: .public var (-> Text (Signature Var)) (|>> (text.enclosed [..var_prefix //descriptor.class_suffix]) :abstraction)) - (def: #export var_name + (def: .public var_name (-> (Signature Var) Text) (|>> :representation (text.replace_all ..var_prefix "") (text.replace_all //descriptor.class_suffix ""))) - (def: #export lower_prefix "-") - (def: #export upper_prefix "+") + (def: .public lower_prefix "-") + (def: .public upper_prefix "+") (template [<name> <prefix>] - [(def: #export <name> + [(def: .public <name> (-> (Signature Class) (Signature Parameter)) (|>> :representation (format <prefix>) :abstraction))] @@ -76,10 +78,10 @@ [upper ..upper_prefix] ) - (def: #export parameters_start "<") - (def: #export parameters_end ">") + (def: .public parameters_start "<") + (def: .public parameters_end ">") - (def: #export (class name parameters) + (def: .public (class name parameters) (-> External (List (Signature Parameter)) (Signature Class)) (:abstraction (format //descriptor.class_prefix @@ -96,25 +98,25 @@ ..parameters_end)) //descriptor.class_suffix))) - (def: #export (declaration name variables) + (def: .public (declaration name variables) (-> External (List (Signature Var)) (Signature Declaration)) (:transmutation (..class name variables))) - (def: #export as_class + (def: .public as_class (-> (Signature Declaration) (Signature Class)) (|>> :transmutation)) - (def: #export arguments_start "(") - (def: #export arguments_end ")") + (def: .public arguments_start "(") + (def: .public arguments_end ")") - (def: #export exception_prefix "^") + (def: .public exception_prefix "^") (def: class_bound (|> (..class "java.lang.Object" (list)) ..signature (format ":"))) - (def: #export (method [type_variables inputs output exceptions]) + (def: .public (method [type_variables inputs output exceptions]) (-> [(List (Signature Var)) (List (Signature Value)) (Signature Return) @@ -141,14 +143,14 @@ (list\map (|>> :representation (format ..exception_prefix))) (text.join_with ""))))) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Signature category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) - (implementation: #export hash + (implementation: .public hash (All [category] (Hash (Signature category))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux index d22ca84e2..f5db348ef 100644 --- a/stdlib/source/library/lux/target/jvm/version.lux +++ b/stdlib/source/library/lux/target/jvm/version.lux @@ -7,16 +7,16 @@ [encoding ["#." unsigned (#+ U2)]]]) -(type: #export Version U2) -(type: #export Minor Version) -(type: #export Major Version) +(type: .public Version U2) +(type: .public Minor Version) +(type: .public Major Version) -(def: #export default_minor +(def: .public default_minor Minor (|> 0 //unsigned.u2 try.assumed)) (template [<number> <name>] - [(def: #export <name> + [(def: .public <name> Major (|> <number> //unsigned.u2 try.assumed))] @@ -34,5 +34,5 @@ [56 v12] ) -(def: #export writer +(def: .public writer //unsigned.writer/2) diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index 0f24e59e4..a94c483f6 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location Code int if cond function or and not let ^) + [lux (#- Location Code int if cond function or and not let ^ local) ["@" target] [abstract [equivalence (#+ Equivalence)] @@ -35,33 +35,35 @@ (def: input_separator ", ") -(abstract: #export (Code brand) +(abstract: .public (Code brand) + {} + Text - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (implementation: #export hash + (implementation: .public hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) - (def: #export manual + (def: .public manual (-> Text Code) (|>> :abstraction)) - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] + (abstract: (<brand> brand) {} Any) + (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -71,8 +73,8 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] + (abstract: .public <brand> {} Any) + (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] [Var [Location' Computation' Expression' Code]] @@ -80,17 +82,17 @@ [Label [Code]] ) - (def: #export nil + (def: .public nil Literal (:abstraction "nil")) - (def: #export bool + (def: .public bool (-> Bit Literal) (|>> (case> #0 "false" #1 "true") :abstraction)) - (def: #export int + (def: .public int (-> Int Literal) ## Integers must be turned into hexadecimal to avoid quirks in how Lua parses integers. ## In particular, the number -9223372036854775808 will be incorrectly parsed as a float by Lua. @@ -100,7 +102,7 @@ (format "0x") :abstraction))) - (def: #export float + (def: .public float (-> Frac Literal) (|>> (cond> [(f.= f.positive_infinity)] [(new> "(1.0/0.0)" [])] @@ -132,24 +134,24 @@ )) ))) - (def: #export string + (def: .public string (-> Text Literal) (|>> ..safe (text.enclosed' text.double_quote) :abstraction)) - (def: #export multi + (def: .public multi (-> (List Expression) Literal) (|>> (list\map ..code) (text.join_with ..input_separator) :abstraction)) - (def: #export array + (def: .public array (-> (List Expression) Literal) (|>> (list\map ..code) (text.join_with ..input_separator) (text.enclosed ["{" "}"]) :abstraction)) - (def: #export table + (def: .public table (-> (List [Text Expression]) Literal) (|>> (list\map (.function (_ [key value]) (format key " = " (:representation value)))) @@ -157,21 +159,21 @@ (text.enclosed ["{" "}"]) :abstraction)) - (def: #export (nth idx array) + (def: .public (nth idx array) (-> Expression Expression Access) (:abstraction (format (:representation array) "[" (:representation idx) "]"))) - (def: #export (the field table) + (def: .public (the field table) (-> Text Expression Computation) (:abstraction (format (:representation table) "." field))) - (def: #export length + (def: .public length (-> Expression Computation) (|>> :representation (text.enclosed ["#(" ")"]) :abstraction)) - (def: #export (apply/* args func) + (def: .public (apply/* args func) (-> (List Expression) Expression Computation) (|> args (list\map ..code) @@ -180,7 +182,7 @@ (format (:representation func)) :abstraction)) - (def: #export (do method args table) + (def: .public (do method args table) (-> Text (List Expression) Expression Computation) (|> args (list\map ..code) @@ -190,7 +192,7 @@ :abstraction)) (template [<op> <name>] - [(def: #export (<name> parameter subject) + [(def: .public (<name> parameter subject) (-> Expression Expression Expression) (:abstraction (format "(" (:representation subject) @@ -223,7 +225,7 @@ ) (template [<name> <unary>] - [(def: #export (<name> subject) + [(def: .public (<name> subject) (-> Expression Expression) (:abstraction (format "(" <unary> " " (:representation subject) ")")))] @@ -232,7 +234,7 @@ ) (template [<name> <type>] - [(def: #export <name> + [(def: .public <name> (-> Text <type>) (|>> :abstraction))] @@ -240,11 +242,11 @@ [label Label] ) - (def: #export statement + (def: .public statement (-> Expression Statement) (|>> :representation :abstraction)) - (def: #export (then pre! post!) + (def: .public (then pre! post!) (-> Statement Statement Statement) (:abstraction (format (:representation pre!) @@ -256,50 +258,50 @@ (|>> (list\map ..code) (text.join_with ..input_separator))) - (def: #export (local vars) + (def: .public (local vars) (-> (List Var) Statement) (:abstraction (format "local " (..locations vars)))) - (def: #export (set vars value) + (def: .public (set vars value) (-> (List Location) Expression Statement) (:abstraction (format (..locations vars) " = " (:representation value)))) - (def: #export (let vars value) + (def: .public (let vars value) (-> (List Var) Expression Statement) (:abstraction (format "local " (..locations vars) " = " (:representation value)))) - (def: #export (local/1 var value) + (def: .public (local/1 var value) (-> Var Expression Statement) (:abstraction (format "local " (:representation var) " = " (:representation value)))) - (def: #export (if test then! else!) + (def: .public (if test then! else!) (-> Expression Statement Statement Statement) (:abstraction (format "if " (:representation test) text.new_line "then" (..nested (:representation then!)) text.new_line "else" (..nested (:representation else!)) text.new_line "end"))) - (def: #export (when test then!) + (def: .public (when test then!) (-> Expression Statement Statement) (:abstraction (format "if " (:representation test) text.new_line "then" (..nested (:representation then!)) text.new_line "end"))) - (def: #export (while test body!) + (def: .public (while test body!) (-> Expression Statement Statement) (:abstraction (format "while " (:representation test) " do" (..nested (:representation body!)) text.new_line "end"))) - (def: #export (repeat until body!) + (def: .public (repeat until body!) (-> Expression Statement Statement) (:abstraction (format "repeat" (..nested (:representation body!)) text.new_line "until " (:representation until)))) - (def: #export (for_in vars source body!) + (def: .public (for_in vars source body!) (-> (List Var) Expression Statement Statement) (:abstraction (format "for " (|> vars @@ -309,7 +311,7 @@ (..nested (:representation body!)) text.new_line "end"))) - (def: #export (for_step var from to step body!) + (def: .public (for_step var from to step body!) (-> Var Expression Expression Expression Statement Statement) (:abstraction @@ -320,11 +322,11 @@ (..nested (:representation body!)) text.new_line "end"))) - (def: #export (return value) + (def: .public (return value) (-> Expression Statement) (:abstraction (format "return " (:representation value)))) - (def: #export (closure args body!) + (def: .public (closure args body!) (-> (List Var) Statement Expression) (|> (format "function " (|> args ..locations @@ -335,7 +337,7 @@ :abstraction)) (template [<name> <code>] - [(def: #export (<name> name args body!) + [(def: .public (<name> name args body!) (-> Var (List Var) Statement Statement) (:abstraction (format <code> " " (:representation name) @@ -349,20 +351,20 @@ [local_function "local function"] ) - (def: #export break + (def: .public break Statement (:abstraction "break")) - (def: #export (set_label label) + (def: .public (set_label label) (-> Label Statement) (:abstraction (format "::" (:representation label) "::"))) - (def: #export (go_to label) + (def: .public (go_to label) (-> Label Statement) (:abstraction (format "goto " (:representation label)))) ) -(def: #export (cond clauses else!) +(def: .public (cond clauses else!) (-> (List [Expression Statement]) Statement Statement) (list\fold (.function (_ [test then!] next!) (..if test then! next!)) @@ -384,12 +386,12 @@ <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) <definitions> (template.spliced <function>+)] - (def: #export (<apply> function <inputs>) + (def: .public (<apply> function <inputs>) (-> Expression <types> Computation) (..apply/* (.list <inputs>) function)) (template [<function>] - [(`` (def: #export (~~ (template.identifier [<function> "/" <arity>])) + [(`` (def: .public (~~ (template.identifier [<function> "/" <arity>])) (<apply> (..var <function>))))] <definitions>))] diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index e80fdbecd..c1056e777 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location Code Global static int if cond or and not comment for try) + [lux (#- Location Code Global static int if cond or and not comment for try global) ["@" target] [abstract [equivalence (#+ Equivalence)] @@ -43,33 +43,35 @@ (-> Text Text) (text.enclosed ["(" ")"])) -(abstract: #export (Code brand) +(abstract: .public (Code brand) + {} + Text - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (implementation: #export hash + (implementation: .public hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) - (def: #export manual + (def: .public manual (-> Text Code) (|>> :abstraction)) - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] + (abstract: (<brand> brand) {} Any) + (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -79,8 +81,8 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] + (abstract: .public <brand> {} Any) + (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] [Var [Location' Computation' Expression' Code]] @@ -90,22 +92,22 @@ [Label [Code]] ) - (type: #export Argument + (type: .public Argument {#reference? Bit #var Var}) - (def: #export ; + (def: .public ; (-> Expression Statement) (|>> :representation (text.suffix ..statement_suffix) :abstraction)) - (def: #export var + (def: .public var (-> Text Var) (|>> (format "$") :abstraction)) (template [<name> <type>] - [(def: #export <name> + [(def: .public <name> (-> Text <type>) (|>> :abstraction))] @@ -113,26 +115,26 @@ [label Label] ) - (def: #export (set_label label) + (def: .public (set_label label) (-> Label Statement) (:abstraction (format (:representation label) ":"))) - (def: #export (go_to label) + (def: .public (go_to label) (-> Label Statement) (:abstraction (format "goto " (:representation label) ..statement_suffix))) - (def: #export null + (def: .public null Literal (:abstraction "NULL")) - (def: #export bool + (def: .public bool (-> Bit Literal) (|>> (case> #0 "false" #1 "true") :abstraction)) - (def: #export int + (def: .public int (-> Int Literal) (.let [to_hex (\ n.hex encode)] (|>> .nat @@ -140,7 +142,7 @@ (format "0x") :abstraction))) - (def: #export float + (def: .public float (-> Frac Literal) (|>> (cond> [(f.= f.positive_infinity)] [(new> "+INF" [])] @@ -173,7 +175,7 @@ )) ))) - (def: #export string + (def: .public string (-> Text Literal) (|>> ..safe (text.enclosed [text.double_quote text.double_quote]) @@ -183,13 +185,13 @@ (-> (List Expression) Text) (|>> (list\map ..code) (text.join_with ..input_separator) ..group)) - (def: #export (apply/* args func) + (def: .public (apply/* args func) (-> (List Expression) Expression Computation) (|> (format (:representation func) (..arguments args)) :abstraction)) ## TODO: Remove when no longer using JPHP. - (def: #export (apply/*' args func) + (def: .public (apply/*' args func) (-> (List Expression) Expression Computation) (apply/* (list& func args) (..constant "call_user_func"))) @@ -203,7 +205,7 @@ ..group)) (template [<name> <reference?>] - [(def: #export <name> + [(def: .public <name> (-> Var Argument) (|>> [<reference?>]))] @@ -211,7 +213,7 @@ [reference #1] ) - (def: #export (closure uses arguments body!) + (def: .public (closure uses arguments body!) (-> (List Argument) (List Argument) Statement Literal) (let [uses (case uses #.End @@ -240,12 +242,12 @@ <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) <definitions> (template.spliced <function>+)] - (def: #export (<apply> function [<inputs>]) + (def: .public (<apply> function [<inputs>]) (-> Expression [<types>] Computation) (..apply/* (.list <inputs>) function)) (template [<function>] - [(`` (def: #export (~~ (template.identifier [<function> "/" <arity>])) + [(`` (def: .public (~~ (template.identifier [<function> "/" <arity>])) (<apply> (..constant <function>))))] <definitions>))] @@ -300,11 +302,11 @@ ["iconv_substr"] ["substr"]]] ) - (def: #export (key_value key value) + (def: .public (key_value key value) (-> Expression Expression Expression) (:abstraction (format (:representation key) " => " (:representation value)))) - (def: #export (array/* values) + (def: .public (array/* values) (-> (List Expression) Literal) (|> values (list\map ..code) @@ -313,11 +315,11 @@ (format "array") :abstraction)) - (def: #export (array_merge/+ required optionals) + (def: .public (array_merge/+ required optionals) (-> Expression (List Expression) Computation) (..apply/* (list& required optionals) (..constant "array_merge"))) - (def: #export (array/** kvs) + (def: .public (array/** kvs) (-> (List [Expression Expression]) Literal) (|> kvs (list\map (function (_ [key value]) @@ -327,32 +329,32 @@ (format "array") :abstraction)) - (def: #export (new constructor inputs) + (def: .public (new constructor inputs) (-> Constant (List Expression) Computation) (|> (format "new " (:representation constructor) (arguments inputs)) :abstraction)) - (def: #export (the field object) + (def: .public (the field object) (-> Text Expression Computation) (|> (format (:representation object) "->" field) :abstraction)) - (def: #export (do method inputs object) + (def: .public (do method inputs object) (-> Text (List Expression) Expression Computation) (|> (format (:representation (..the method object)) (..arguments inputs)) :abstraction)) - (def: #export (item idx array) + (def: .public (item idx array) (-> Expression Expression Access) (|> (format (:representation array) "[" (:representation idx) "]") :abstraction)) - (def: #export (global name) + (def: .public (global name) (-> Text Global) (|> (..var "GLOBALS") (..item (..string name)) :transmutation)) - (def: #export (? test then else) + (def: .public (? test then else) (-> Expression Expression Expression Computation) (|> (format (..group (:representation test)) " ? " (..group (:representation then)) " : " @@ -361,7 +363,7 @@ :abstraction)) (template [<name> <op>] - [(def: #export (<name> parameter subject) + [(def: .public (<name> parameter subject) (-> Expression Expression Computation) (|> (format (:representation subject) " " <op> " " (:representation parameter)) ..group @@ -389,7 +391,7 @@ ) (template [<unary> <name>] - [(def: #export <name> + [(def: .public <name> (-> Computation Computation) (|>> :representation (format <unary>) :abstraction))] @@ -398,22 +400,22 @@ ["-" opposite] ) - (def: #export (set var value) + (def: .public (set var value) (-> Location Expression Computation) (|> (format (:representation var) " = " (:representation value)) ..group :abstraction)) - (def: #export (set! var value) + (def: .public (set! var value) (-> Location Expression Statement) (:abstraction (format (:representation var) " = " (:representation value) ";"))) - (def: #export (set? var) + (def: .public (set? var) (-> Var Computation) (..apply/1 [var] (..constant "isset"))) (template [<name> <modifier>] - [(def: #export <name> + [(def: .public <name> (-> Var Statement) (|>> :representation (format <modifier> " ") (text.suffix ..statement_suffix) :abstraction))] @@ -421,7 +423,7 @@ ) (template [<name> <modifier> <location>] - [(def: #export (<name> location value) + [(def: .public (<name> location value) (-> <location> Expression Statement) (:abstraction (format <modifier> " " (:representation location) " = " (:representation value) @@ -431,7 +433,7 @@ [define_constant "const" Constant] ) - (def: #export (if test then! else!) + (def: .public (if test then! else!) (-> Expression Statement Statement Statement) (:abstraction (format "if" (..group (:representation test)) " " @@ -439,40 +441,40 @@ " else " (..block (:representation else!))))) - (def: #export (when test then!) + (def: .public (when test then!) (-> Expression Statement Statement) (:abstraction (format "if" (..group (:representation test)) " " (..block (:representation then!))))) - (def: #export (then pre! post!) + (def: .public (then pre! post!) (-> Statement Statement Statement) (:abstraction (format (:representation pre!) text.new_line (:representation post!)))) - (def: #export (while test body!) + (def: .public (while test body!) (-> Expression Statement Statement) (:abstraction (format "while" (..group (:representation test)) " " (..block (:representation body!))))) - (def: #export (do_while test body!) + (def: .public (do_while test body!) (-> Expression Statement Statement) (:abstraction (format "do " (..block (:representation body!)) " while" (..group (:representation test)) ..statement_suffix))) - (def: #export (for_each array value body!) + (def: .public (for_each array value body!) (-> Expression Var Statement Statement) (:abstraction (format "foreach(" (:representation array) " as " (:representation value) ") " (..block (:representation body!))))) - (type: #export Except + (type: .public Except {#class Constant #exception Var #handler Statement}) @@ -484,7 +486,7 @@ (format "catch" (..group declaration) " " (..block (:representation (get@ #handler except)))))) - (def: #export (try body! excepts) + (def: .public (try body! excepts) (-> Statement (List Except) Statement) (:abstraction (format "try " (..block (:representation body!)) @@ -494,7 +496,7 @@ (text.join_with text.new_line))))) (template [<name> <keyword>] - [(def: #export <name> + [(def: .public <name> (-> Expression Statement) (|>> :representation (format <keyword> " ") (text.suffix ..statement_suffix) :abstraction))] @@ -503,13 +505,13 @@ [echo "echo"] ) - (def: #export (define name value) + (def: .public (define name value) (-> Constant Expression Expression) (..apply/2 (..constant "define") [(|> name :representation ..string) value])) - (def: #export (define_function name arguments body!) + (def: .public (define_function name arguments body!) (-> Constant (List Argument) Statement Statement) (:abstraction (format "function " (:representation name) @@ -518,7 +520,7 @@ (..block (:representation body!))))) (template [<name> <keyword>] - [(def: #export <name> + [(def: .public <name> Statement (|> <keyword> (text.suffix ..statement_suffix) @@ -528,18 +530,18 @@ [continue "continue"] ) - (def: #export splat + (def: .public splat (-> Expression Expression) (|>> :representation (format "...") :abstraction)) ) -(def: #export (cond clauses else!) +(def: .public (cond clauses else!) (-> (List [Expression Statement]) Statement Statement) (list\fold (function (_ [test then!] next!) (..if test then! next!)) else! (list.reversed clauses))) -(def: #export command_line_arguments +(def: .public command_line_arguments Var (..var "argv")) diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index d507ba886..55d0eecea 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -47,33 +47,35 @@ (|>> (format text.new_line) (text.replace_all text.new_line nested_new_line))))) -(abstract: #export (Code brand) +(abstract: .public (Code brand) + {} + Text - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (implementation: #export hash + (implementation: .public hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) - (def: #export manual + (def: .public manual (-> Text Code) (|>> :abstraction)) - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) (template [<type> <super>] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (`` (abstract: #export (<brand> brand) Any)) - (`` (type: #export (<type> brand) + (`` (abstract: .public (<brand> brand) {} Any)) + (`` (type: .public (<type> brand) (<super> (<brand> brand)))))] [Expression Code] @@ -85,8 +87,8 @@ (template [<type> <super>] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (`` (abstract: #export <brand> Any)) - (`` (type: #export <type> (<super> <brand>))))] + (`` (abstract: .public <brand> {} Any)) + (`` (type: .public <type> (<super> <brand>))))] [Literal Computation] [Access Location] @@ -95,21 +97,21 @@ ) (template [<var> <brand>] - [(abstract: #export <brand> Any) + [(abstract: .public <brand> {} Any) - (type: #export <var> (Var <brand>))] + (type: .public <var> (Var <brand>))] [SVar Single] [PVar Poly] [KVar Keyword] ) - (def: #export var + (def: .public var (-> Text SVar) (|>> :abstraction)) (template [<name> <brand> <prefix>] - [(def: #export <name> + [(def: .public <name> (-> SVar (Var <brand>)) (|>> :representation (format <prefix>) :abstraction))] @@ -117,25 +119,25 @@ [keyword Keyword "**"] ) - (def: #export none + (def: .public none Literal (:abstraction "None")) - (def: #export bool + (def: .public bool (-> Bit Literal) (|>> (case> #0 "False" #1 "True") :abstraction)) - (def: #export int + (def: .public int (-> Int Literal) (|>> %.int :abstraction)) - (def: #export (long value) + (def: .public (long value) (-> Int Literal) (:abstraction (format (%.int value) "L"))) - (def: #export float + (def: .public float (-> Frac Literal) (`` (|>> (cond> (~~ (template [<test> <python>] [[<test>] @@ -167,13 +169,13 @@ )) ))) - (def: #export string + (def: .public string (-> Text Literal) (|>> ..safe (text.enclosed [text.double_quote text.double_quote]) :abstraction)) - (def: #export unicode + (def: .public unicode (-> Text Literal) (|>> ..string :representation @@ -194,7 +196,7 @@ right_delimiter)))) (template [<name> <pre> <post>] - [(def: #export <name> + [(def: .public <name> (-> (List (Expression Any)) Literal) (composite_literal <pre> <post> ..code))] @@ -202,23 +204,23 @@ [list "[" "]"] ) - (def: #export (slice from to list) + (def: .public (slice from to list) (-> (Expression Any) (Expression Any) (Expression Any) Access) (<| :abstraction ## ..expression (format (:representation list) "[" (:representation from) ":" (:representation to) "]"))) - (def: #export (slice_from from list) + (def: .public (slice_from from list) (-> (Expression Any) (Expression Any) Access) (<| :abstraction ## ..expression (format (:representation list) "[" (:representation from) ":]"))) - (def: #export dict + (def: .public dict (-> (List [(Expression Any) (Expression Any)]) (Computation Any)) (composite_literal "{" "}" (.function (_ [k v]) (format (:representation k) " : " (:representation v))))) - (def: #export (apply/* func args) + (def: .public (apply/* func args) (-> (Expression Any) (List (Expression Any)) (Computation Any)) (<| :abstraction ## ..expression @@ -234,7 +236,7 @@ ) (template [<name> <splat>] - [(def: #export (<name> args extra func) + [(def: .public (<name> args extra func) (-> (List (Expression Any)) (Expression Any) (Expression Any) (Computation Any)) (<| :abstraction ## ..expression @@ -248,16 +250,16 @@ [apply_keyword splat_keyword] ) - (def: #export (the name object) + (def: .public (the name object) (-> Text (Expression Any) (Computation Any)) (:abstraction (format (:representation object) "." name))) - (def: #export (do method args object) + (def: .public (do method args object) (-> Text (List (Expression Any)) (Expression Any) (Computation Any)) (..apply/* (..the method object) args)) (template [<name> <apply>] - [(def: #export (<name> args extra method) + [(def: .public (<name> args extra method) (-> (List (Expression Any)) (Expression Any) Text (-> (Expression Any) (Computation Any))) (|>> (..the method) (<apply> args extra)))] @@ -266,18 +268,18 @@ [do_keyword apply_keyword] ) - (def: #export (nth idx array) + (def: .public (nth idx array) (-> (Expression Any) (Expression Any) Location) (:abstraction (format (:representation array) "[" (:representation idx) "]"))) - (def: #export (? test then else) + (def: .public (? test then else) (-> (Expression Any) (Expression Any) (Expression Any) (Computation Any)) (<| :abstraction ..expression (format (:representation then) " if " (:representation test) " else " (:representation else)))) (template [<name> <op>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (-> (Expression Any) (Expression Any) (Computation Any)) (<| :abstraction ..expression @@ -307,7 +309,7 @@ ) (template [<name> <unary>] - [(def: #export (<name> subject) + [(def: .public (<name> subject) (-> (Expression Any) (Computation Any)) (<| :abstraction ## ..expression @@ -317,25 +319,25 @@ [opposite "-"] ) - (def: #export (lambda arguments body) + (def: .public (lambda arguments body) (-> (List (Var Any)) (Expression Any) (Computation Any)) (<| :abstraction ..expression (format "lambda " (|> arguments (list\map ..code) (text.join_with ", ")) ": " (:representation body)))) - (def: #export (set vars value) + (def: .public (set vars value) (-> (List (Location Any)) (Expression Any) (Statement Any)) (:abstraction (format (|> vars (list\map ..code) (text.join_with ", ")) " = " (:representation value)))) - (def: #export (delete where) + (def: .public (delete where) (-> (Location Any) (Statement Any)) (:abstraction (format "del " (:representation where)))) - (def: #export (if test then! else!) + (def: .public (if test then! else!) (-> (Expression Any) (Statement Any) (Statement Any) (Statement Any)) (:abstraction (format "if " (:representation test) ":" @@ -343,13 +345,13 @@ text.new_line "else:" (..nested (:representation else!))))) - (def: #export (when test then!) + (def: .public (when test then!) (-> (Expression Any) (Statement Any) (Statement Any)) (:abstraction (format "if " (:representation test) ":" (..nested (:representation then!))))) - (def: #export (then pre! post!) + (def: .public (then pre! post!) (-> (Statement Any) (Statement Any) (Statement Any)) (:abstraction (format (:representation pre!) @@ -357,7 +359,7 @@ (:representation post!)))) (template [<keyword> <0>] - [(def: #export <0> + [(def: .public <0> (Statement Any) (:abstraction <keyword>))] @@ -365,7 +367,7 @@ ["continue" continue] ) - (def: #export (while test body! else!) + (def: .public (while test body! else!) (-> (Expression Any) (Statement Any) (Maybe (Statement Any)) Loop) (:abstraction (format "while " (:representation test) ":" @@ -378,26 +380,26 @@ #.None "")))) - (def: #export (for_in var inputs body!) + (def: .public (for_in var inputs body!) (-> SVar (Expression Any) (Statement Any) Loop) (:abstraction (format "for " (:representation var) " in " (:representation inputs) ":" (..nested (:representation body!))))) - (def: #export statement + (def: .public statement (-> (Expression Any) (Statement Any)) (|>> :transmutation)) - (def: #export pass + (def: .public pass (Statement Any) (:abstraction "pass")) - (type: #export Except + (type: .public Except {#classes (List SVar) #exception SVar #handler (Statement Any)}) - (def: #export (try body! excepts) + (def: .public (try body! excepts) (-> (Statement Any) (List Except) (Statement Any)) (:abstraction (format "try:" @@ -410,7 +412,7 @@ (text.join_with ""))))) (template [<name> <keyword> <pre>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> (Expression Any) (Statement Any)) (:abstraction (format <keyword> (<pre> (:representation value)))))] @@ -420,7 +422,7 @@ [print "print" ..expression] ) - (def: #export (exec code globals) + (def: .public (exec code globals) (-> (Expression Any) (Maybe (Expression Any)) (Statement Any)) (let [extra (case globals (#.Some globals) @@ -431,24 +433,24 @@ (:abstraction (format "exec" (:representation (..tuple (list& code extra))))))) - (def: #export (def name args body) + (def: .public (def name args body) (-> SVar (List (Ex [k] (Var k))) (Statement Any) (Statement Any)) (:abstraction (format "def " (:representation name) "(" (|> args (list\map ..code) (text.join_with ", ")) "):" (..nested (:representation body))))) - (def: #export (import module_name) + (def: .public (import module_name) (-> Text (Statement Any)) (:abstraction (format "import " module_name))) - (def: #export (comment commentary on) + (def: .public (comment commentary on) (All [brand] (-> Text (Code brand) (Code brand))) (:abstraction (format "# " (..safe commentary) text.new_line (:representation on)))) ) -(def: #export (cond clauses else!) +(def: .public (cond clauses else!) (-> (List [(Expression Any) (Statement Any)]) (Statement Any) (Statement Any)) (list\fold (.function (_ [test then!] next!) (..if test then! next!)) @@ -470,12 +472,12 @@ <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) <definitions> (template.spliced <function>+)] - (def: #export (<apply> function <inputs>) + (def: .public (<apply> function <inputs>) (-> (Expression Any) <types> (Computation Any)) (..apply/* function (.list <inputs>))) (template [<function>] - [(`` (def: #export (~~ (template.identifier [<function> "/" <arity>])) + [(`` (def: .public (~~ (template.identifier [<function> "/" <arity>])) (<apply> (..var <function>))))] <definitions>))] diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index 20aeb8d4b..3b6601179 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -22,48 +22,48 @@ [type abstract]]]) -(abstract: #export (Code kind) +(abstract: .public (Code kind) Text {} (template [<type> <super>+] [(with_expansions [<kind> (template.identifier [<type> "'"])] - (abstract: #export (<kind> kind) Any) - (`` (type: #export <type> (|> Any <kind> (~~ (template.spliced <super>+))))))] + (abstract: .public (<kind> kind) Any) + (`` (type: .public <type> (|> Any <kind> (~~ (template.spliced <super>+))))))] [Expression [Code]] ) (template [<type> <super>+] [(with_expansions [<kind> (template.identifier [<type> "'"])] - (abstract: #export (<kind> kind) Any) - (`` (type: #export (<type> <brand>) (|> <brand> <kind> (~~ (template.spliced <super>+))))))] + (abstract: .public (<kind> kind) Any) + (`` (type: .public (<type> <brand>) (|> <brand> <kind> (~~ (template.spliced <super>+))))))] [Var [Expression' Code]] ) (template [<var> <kind>] - [(abstract: #export <kind> Any) - (type: #export <var> (Var <kind>))] + [(abstract: .public <kind> Any) + (type: .public <var> (Var <kind>))] [SVar Single] [PVar Poly] ) - (def: #export var + (def: .public var (-> Text SVar) (|>> :abstraction)) - (def: #export var_args + (def: .public var_args PVar (:abstraction "...")) - (def: #export manual + (def: .public manual (-> Text Code) (|>> :abstraction)) - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) @@ -84,7 +84,7 @@ (-> Text Text) (format "{" (nested expression) text.new_line "}")) - (def: #export (block expression) + (def: .public (block expression) (-> Expression Expression) (:abstraction (format "{" @@ -92,7 +92,7 @@ text.new_line "}"))) (template [<name> <r>] - [(def: #export <name> + [(def: .public <name> Expression (:abstraction <r>))] @@ -101,24 +101,24 @@ ) (template [<name>] - [(def: #export <name> Expression n/a)] + [(def: .public <name> Expression n/a)] [not_available] [not_applicable] [no_answer] ) - (def: #export bool + (def: .public bool (-> Bit Expression) (|>> (case> #0 "FALSE" #1 "TRUE") :abstraction)) - (def: #export int + (def: .public int (-> Int Expression) (|>> %.int :abstraction)) - (def: #export float + (def: .public float (-> Frac Expression) (|>> (cond> [(f.= f.positive_infinity)] [(new> "1.0/0.0" [])] @@ -149,23 +149,23 @@ )) ))) - (def: #export string + (def: .public string (-> Text Expression) (|>> ..safe %.text :abstraction)) - (def: #export (slice from to list) + (def: .public (slice from to list) (-> Expression Expression Expression Expression) (..self_contained (format (:representation list) "[" (:representation from) ":" (:representation to) "]"))) - (def: #export (slice_from from list) + (def: .public (slice_from from list) (-> Expression Expression Expression) (..self_contained (format (:representation list) "[-1" ":-" (:representation from) "]"))) - (def: #export (apply args func) + (def: .public (apply args func) (-> (List Expression) Expression Expression) (let [func (:representation func) spacing (|> " " (list.repeat (text.size func)) (text.join_with ""))] @@ -178,7 +178,7 @@ ")")))) (template [<name> <function>] - [(def: #export (<name> members) + [(def: .public (<name> members) (-> (List Expression) Expression) (..apply members (..var <function>)))] @@ -186,13 +186,13 @@ [list "list"] ) - (def: #export named_list + (def: .public named_list (-> (List [Text Expression]) Expression) (|>> (list\map (.function (_ [key value]) (:abstraction (format key "=" (:representation value))))) ..list)) - (def: #export (apply_kw args kw_args func) + (def: .public (apply_kw args kw_args func) (-> (List Expression) (List [Text Expression]) Expression Expression) (..self_contained (format (:representation func) @@ -218,12 +218,12 @@ <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) <definitions> (template.spliced <function>+)] - (def: #export (<apply> function [<inputs>]) + (def: .public (<apply> function [<inputs>]) (-> Expression [<types>] Expression) (..apply (.list <inputs>) function)) (template [<function>] - [(`` (def: #export (~~ (template.identifier [<function> "/" <arity>])) + [(`` (def: .public (~~ (template.identifier [<function> "/" <arity>])) (-> [<types>] Expression) (<apply> (..var <function>))))] @@ -237,30 +237,30 @@ [["paste"]]] ) - (def: #export as::integer + (def: .public as::integer (-> Expression Expression) (..apply/1 (..var "as.integer"))) - (def: #export (item idx list) + (def: .public (item idx list) (-> Expression Expression Expression) (..self_contained (format (:representation list) "[[" (:representation idx) "]]"))) - (def: #export (if test then else) + (def: .public (if test then else) (-> Expression Expression Expression Expression) (:abstraction (format "if(" (:representation test) ")" " " (.._block (:representation then)) " else " (.._block (:representation else))))) - (def: #export (when test then) + (def: .public (when test then) (-> Expression Expression Expression) (:abstraction (format "if(" (:representation test) ") {" (.._block (:representation then)) text.new_line "}"))) - (def: #export (cond clauses else) + (def: .public (cond clauses else) (-> (List [Expression Expression]) Expression Expression) (list\fold (.function (_ [test then] next) (if test then next)) @@ -268,7 +268,7 @@ (list.reversed clauses))) (template [<name> <op>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (-> Expression Expression Expression) (..self_contained (format (:representation subject) @@ -291,7 +291,7 @@ ) (template [<name> <func>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (-> Expression Expression Expression) (..apply (.list subject param) (..var <func>)))] @@ -302,12 +302,12 @@ [bit_ushr "bitwShiftR"] ) - (def: #export (bit_not subject) + (def: .public (bit_not subject) (-> Expression Expression) (..apply (.list subject) (..var "bitwNot"))) (template [<name> <op>] - [(def: #export <name> + [(def: .public <name> (-> Expression Expression) (|>> :representation (format <op>) ..self_contained))] @@ -315,23 +315,23 @@ [negate "-"] ) - (def: #export (length list) + (def: .public (length list) (-> Expression Expression) (..apply (.list list) (..var "length"))) - (def: #export (range from to) + (def: .public (range from to) (-> Expression Expression Expression) (..self_contained (format (:representation from) ":" (:representation to)))) - (def: #export (function inputs body) + (def: .public (function inputs body) (-> (List (Ex [k] (Var k))) Expression Expression) (let [args (|> inputs (list\map ..code) (text.join_with ", "))] (..self_contained (format "function(" args ") " (.._block (:representation body)))))) - (def: #export (try body warning error finally) + (def: .public (try body warning error finally) (-> Expression (Maybe Expression) (Maybe Expression) (Maybe Expression) Expression) (let [optional (: (-> Text (Maybe Expression) (-> Text Text) Text) (.function (_ parameter value preparation) @@ -346,20 +346,20 @@ (optional "finally" finally .._block) ")")))) - (def: #export (while test body) + (def: .public (while test body) (-> Expression Expression Expression) (..self_contained (format "while (" (:representation test) ") " (.._block (:representation body))))) - (def: #export (for_in var inputs body) + (def: .public (for_in var inputs body) (-> SVar Expression Expression Expression) (..self_contained (format "for (" (:representation var) " in " (:representation inputs) ")" (.._block (:representation body))))) (template [<name> <keyword>] - [(def: #export (<name> message) + [(def: .public (<name> message) (-> Expression Expression) (..apply (.list message) (..var <keyword>)))] @@ -367,17 +367,17 @@ [print "print"] ) - (def: #export (set! var value) + (def: .public (set! var value) (-> SVar Expression Expression) (..self_contained (format (:representation var) " <- " (:representation value)))) - (def: #export (set_item! idx value list) + (def: .public (set_item! idx value list) (-> Expression Expression SVar Expression) (..self_contained (format (:representation list) "[[" (:representation idx) "]] <- " (:representation value)))) - (def: #export (then pre post) + (def: .public (then pre post) (-> Expression Expression Expression) (:abstraction (format (:representation pre) diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 43f2c0243..fc08c16fa 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location Code static int if cond function or and not comment) + [lux (#- Location Code static int if cond function or and not comment local global) ["@" target] [abstract [equivalence (#+ Equivalence)] @@ -35,33 +35,35 @@ (|>> (format text.new_line) (text.replace_all text.new_line nested_new_line)))) -(abstract: #export (Code brand) +(abstract: .public (Code brand) + {} + Text - (implementation: #export code_equivalence + (implementation: .public code_equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (implementation: #export code_hash + (implementation: .public code_hash (All [brand] (Hash (Code brand))) (def: &equivalence ..code_equivalence) (def: hash (|>> :representation (\ text.hash hash)))) - (def: #export manual + (def: .public manual (-> Text Code) (|>> :abstraction)) - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] + (abstract: (<brand> brand) {} Any) + (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -73,8 +75,8 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] - (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] + (abstract: .public <brand> {} Any) + (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] [Access [Location' Computation' Expression' Code]] @@ -86,7 +88,7 @@ ) (template [<var> <prefix> <constructor>] - [(def: #export <constructor> + [(def: .public <constructor> (-> Text <var>) (|>> (format <prefix>) :abstraction))] @@ -95,13 +97,13 @@ [SVar "@@" static] ) - (def: #export local + (def: .public local (-> Text LVar) (|>> :abstraction)) (template [<var> <prefix> <modifier> <unpacker>] [(template [<name> <input> <output>] - [(def: #export <name> + [(def: .public <name> (-> <input> <output>) (|>> :representation (format <prefix>) :abstraction))] @@ -114,7 +116,7 @@ ) (template [<ruby_name> <lux_name>] - [(def: #export <lux_name> + [(def: .public <lux_name> (..global <ruby_name>))] ["@" latest_error] @@ -131,17 +133,17 @@ ) (template [<ruby_name> <lux_name>] - [(def: #export <lux_name> + [(def: .public <lux_name> (..local <ruby_name>))] ["ARGV" command_line_arguments] ) - (def: #export nil + (def: .public nil Literal (:abstraction "nil")) - (def: #export bool + (def: .public bool (-> Bit Literal) (|>> (case> #0 "false" #1 "true") @@ -165,7 +167,7 @@ ))) (template [<format> <name> <type> <prep>] - [(def: #export <name> + [(def: .public <name> (-> <type> Literal) (|>> <prep> <format> :abstraction))] @@ -174,7 +176,7 @@ [(<|) symbol Text (format ":")] ) - (def: #export float + (def: .public float (-> Frac Literal) (|>> (cond> [(f.= f.positive_infinity)] [(new> "(+1.0/0.0)" [])] @@ -189,21 +191,21 @@ [%.frac]) :abstraction)) - (def: #export (array_range from to array) + (def: .public (array_range from to array) (-> Expression Expression Expression Computation) (|> (format (:representation from) ".." (:representation to)) (text.enclosed ["[" "]"]) (format (:representation array)) :abstraction)) - (def: #export array + (def: .public array (-> (List Expression) Literal) (|>> (list\map (|>> :representation)) (text.join_with ..input_separator) (text.enclosed ["[" "]"]) :abstraction)) - (def: #export hash + (def: .public hash (-> (List [Expression Expression]) Literal) (|>> (list\map (.function (_ [k v]) (format (:representation k) " => " (:representation v)))) @@ -211,7 +213,7 @@ (text.enclosed ["{" "}"]) :abstraction)) - (def: #export (apply/* args func) + (def: .public (apply/* args func) (-> (List Expression) Expression Computation) (|> args (list\map (|>> :representation)) @@ -220,7 +222,7 @@ (format (:representation func)) :abstraction)) - (def: #export (apply_lambda/* args lambda) + (def: .public (apply_lambda/* args lambda) (-> (List Expression) Expression Computation) (|> args (list\map (|>> :representation)) @@ -229,18 +231,18 @@ (format (:representation lambda)) :abstraction)) - (def: #export (the field object) + (def: .public (the field object) (-> Text Expression Access) (:abstraction (format (:representation object) "." field))) - (def: #export (nth idx array) + (def: .public (nth idx array) (-> Expression Expression Access) (|> (:representation idx) (text.enclosed ["[" "]"]) (format (:representation array)) :abstraction)) - (def: #export (? test then else) + (def: .public (? test then else) (-> Expression Expression Expression Computation) (|> (format (:representation test) " ? " (:representation then) " : " @@ -248,20 +250,20 @@ (text.enclosed ["(" ")"]) :abstraction)) - (def: #export statement + (def: .public statement (-> Expression Statement) (|>> :representation (text.suffix ..statement_suffix) :abstraction)) - (def: #export (then pre! post!) + (def: .public (then pre! post!) (-> Statement Statement Statement) (:abstraction (format (:representation pre!) text.new_line (:representation post!)))) - (def: #export (set vars value) + (def: .public (set vars value) (-> (List Location) Expression Statement) (:abstraction (format (|> vars @@ -274,7 +276,7 @@ (format content text.new_line "end" ..statement_suffix)) - (def: #export (if test then! else!) + (def: .public (if test then! else!) (-> Expression Statement Statement Statement) (<| :abstraction ..block @@ -284,7 +286,7 @@ (..nested (:representation else!))))) (template [<name> <block>] - [(def: #export (<name> test then!) + [(def: .public (<name> test then!) (-> Expression Statement Statement) (<| :abstraction ..block @@ -295,7 +297,7 @@ [while "while"] ) - (def: #export (for_in var array iteration!) + (def: .public (for_in var array iteration!) (-> LVar Expression Statement Statement) (<| :abstraction ..block @@ -304,12 +306,12 @@ " do " (..nested (:representation iteration!))))) - (type: #export Rescue + (type: .public Rescue {#classes (List Text) #exception LVar #rescue Statement}) - (def: #export (begin body! rescues) + (def: .public (begin body! rescues) (-> Statement (List Rescue) Statement) (<| :abstraction ..block @@ -321,23 +323,23 @@ (..nested (:representation rescue))))) (text.join_with text.new_line))))) - (def: #export (catch expectation body!) + (def: .public (catch expectation body!) (-> Expression Statement Statement) (<| :abstraction ..block (format "catch(" (:representation expectation) ") do" (..nested (:representation body!))))) - (def: #export (return value) + (def: .public (return value) (-> Expression Statement) (:abstraction (format "return " (:representation value) ..statement_suffix))) - (def: #export (raise message) + (def: .public (raise message) (-> Expression Computation) (:abstraction (format "raise " (:representation message)))) (template [<name> <keyword>] - [(def: #export <name> + [(def: .public <name> Statement (|> <keyword> (text.suffix ..statement_suffix) @@ -348,7 +350,7 @@ [break "break"] ) - (def: #export (function name args body!) + (def: .public (function name args body!) (-> LVar (List LVar) Statement Statement) (<| :abstraction ..block @@ -359,7 +361,7 @@ (text.enclosed ["(" ")"])) (..nested (:representation body!))))) - (def: #export (lambda name args body!) + (def: .public (lambda name args body!) (-> (Maybe LVar) (List Var) Statement Literal) (let [proc (|> (format (|> args (list\map (|>> :representation)) @@ -378,7 +380,7 @@ :abstraction))) (template [<op> <name>] - [(def: #export (<name> parameter subject) + [(def: .public (<name> parameter subject) (-> Expression Expression Computation) (:abstraction (format "(" (:representation subject) " " <op> " " (:representation parameter) ")")))] @@ -406,7 +408,7 @@ ) (template [<unary> <name>] - [(def: #export (<name> subject) + [(def: .public (<name> subject) (-> Expression Computation) (:abstraction (format "(" <unary> (:representation subject) ")")))] @@ -414,17 +416,17 @@ ["-" opposite] ) - (def: #export (comment commentary on) + (def: .public (comment commentary on) (All [brand] (-> Text (Code brand) (Code brand))) (:abstraction (format "# " (..safe commentary) text.new_line (:representation on)))) ) -(def: #export (do method args object) +(def: .public (do method args object) (-> Text (List Expression) Expression Computation) (|> object (..the method) (..apply/* args))) -(def: #export (cond clauses else!) +(def: .public (cond clauses else!) (-> (List [Expression Statement]) Statement Statement) (list\fold (.function (_ [test then!] next!) (..if test then! next!)) @@ -446,12 +448,12 @@ <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) <definitions> (template.spliced <function>+)] - (def: #export (<apply> function <inputs>) + (def: .public (<apply> function <inputs>) (-> Expression <types> Computation) (..apply/* (.list <inputs>) function)) (template [<function>] - [(`` (def: #export (~~ (template.identifier [<function> "/" <arity>])) + [(`` (def: .public (~~ (template.identifier [<function> "/" <arity>])) (<apply> (..local <function>))))] <definitions>))] @@ -467,7 +469,7 @@ [["print"]]] ) -(def: #export throw/1 +(def: .public throw/1 (-> Expression Statement) (|>> (..apply/1 (..local "throw")) ..statement)) diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index fc60d76f7..011f681f9 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -26,49 +26,51 @@ (.let [nested_new_line (format text.new_line text.tab)] (text.replace_all text.new_line nested_new_line))) -(abstract: #export (Code k) +(abstract: .public (Code k) + {} + Text - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (implementation: #export hash + (implementation: .public hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) (template [<type> <brand> <super>+] - [(abstract: #export (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+)))))] + [(abstract: .public (<brand> brand) {} Any) + (`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+)))))] [Expression Expression' [Code]] ) (template [<type> <brand> <super>+] - [(abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+)))))] + [(abstract: .public <brand> {} Any) + (`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+)))))] [Var Var' [Expression' Code]] [Computation Computation' [Expression' Code]] ) - (type: #export Arguments + (type: .public Arguments {#mandatory (List Var) #rest (Maybe Var)}) - (def: #export manual + (def: .public manual (-> Text Code) (|>> :abstraction)) - (def: #export code + (def: .public code (-> (Code Any) Text) (|>> :representation)) - (def: #export var + (def: .public var (-> Text Var) (|>> :abstraction)) @@ -95,21 +97,21 @@ (text.enclosed ["(" ")"]) :abstraction))) - (def: #export nil + (def: .public nil Computation (:abstraction "'()")) - (def: #export bool + (def: .public bool (-> Bit Computation) (|>> (case> #0 "#f" #1 "#t") :abstraction)) - (def: #export int + (def: .public int (-> Int Computation) (|>> %.int :abstraction)) - (def: #export float + (def: .public float (-> Frac Computation) (|>> (cond> [(f.= f.positive_infinity)] [(new> "+inf.0" [])] @@ -124,9 +126,9 @@ [%.frac]) :abstraction)) - (def: #export positive_infinity Computation (..float f.positive_infinity)) - (def: #export negative_infinity Computation (..float f.negative_infinity)) - (def: #export not_a_number Computation (..float f.not_a_number)) + (def: .public positive_infinity Computation (..float f.positive_infinity)) + (def: .public negative_infinity Computation (..float f.negative_infinity)) + (def: .public not_a_number Computation (..float f.not_a_number)) (def: safe (-> Text Text) @@ -144,11 +146,11 @@ )) ))) - (def: #export string + (def: .public string (-> Text Computation) (|>> ..safe %.text :abstraction)) - (def: #export symbol + (def: .public symbol (-> Text Computation) (|>> (format "'") :abstraction)) @@ -166,12 +168,12 @@ (text.enclosed ["(" ")"]) :abstraction))))) - (def: #export (apply/* args func) + (def: .public (apply/* args func) (-> (List Expression) Expression Computation) (..form (#.Item func args))) (template [<name> <function>] - [(def: #export (<name> members) + [(def: .public (<name> members) (-> (List Expression) Computation) (..apply/* members (..var <function>)))] @@ -179,25 +181,25 @@ [list/* "list"] ) - (def: #export apply/0 + (def: .public apply/0 (-> Expression Computation) (..apply/* (list))) (template [<lux_name> <scheme_name>] - [(def: #export <lux_name> + [(def: .public <lux_name> (apply/0 (..var <scheme_name>)))] [newline/0 "newline"] ) (template [<apply> <arg>+ <type>+ <function>+] - [(`` (def: #export (<apply> procedure) + [(`` (def: .public (<apply> procedure) (-> Expression (~~ (template.spliced <type>+)) Computation) (function (_ (~~ (template.spliced <arg>+))) (..apply/* (list (~~ (template.spliced <arg>+))) procedure)))) (`` (template [<definition> <function>] - [(def: #export <definition> (<apply> (..var <function>)))] + [(def: .public <definition> (<apply> (..var <function>)))] (~~ (template.spliced <function>+))))] @@ -261,12 +263,12 @@ ## 1. To carry on, and then, when it's time to compile the compiler ## itself into Scheme, switch from 'invoke' to normal 'vector-ref'. ## Either way, the 'invoke' needs to go away. - (def: #export (vector_ref/2 vector index) + (def: .public (vector_ref/2 vector index) (-> Expression Expression Computation) (..form (list (..var "invoke") vector (..symbol "getRaw") index))) (template [<lux_name> <scheme_name>] - [(def: #export (<lux_name> param subject) + [(def: .public (<lux_name> param subject) (-> Expression Expression Computation) (..apply/2 (..var <scheme_name>) subject param))] @@ -294,7 +296,7 @@ ) (template [<lux_name> <scheme_name>] - [(def: #export <lux_name> + [(def: .public <lux_name> (-> (List Expression) Computation) (|>> (list& (..var <scheme_name>)) ..form))] @@ -303,7 +305,7 @@ ) (template [<lux_name> <scheme_name> <var> <pre>] - [(def: #export (<lux_name> bindings body) + [(def: .public (<lux_name> bindings body) (-> (List [<var> Expression]) Expression Computation) (..form (list (..var <scheme_name>) (|> bindings @@ -321,21 +323,21 @@ [letrec_values "letrec-values" Arguments ..arguments] ) - (def: #export (if test then else) + (def: .public (if test then else) (-> Expression Expression Expression Computation) (..form (list (..var "if") test then else))) - (def: #export (when test then) + (def: .public (when test then) (-> Expression Expression Computation) (..form (list (..var "when") test then))) - (def: #export (lambda arguments body) + (def: .public (lambda arguments body) (-> Arguments Expression Computation) (..form (list (..var "lambda") (..arguments arguments) body))) - (def: #export (define_function name arguments body) + (def: .public (define_function name arguments body) (-> Var Arguments Expression Computation) (..form (list (..var "define") (|> arguments @@ -343,27 +345,27 @@ ..arguments) body))) - (def: #export (define_constant name value) + (def: .public (define_constant name value) (-> Var Expression Computation) (..form (list (..var "define") name value))) - (def: #export begin + (def: .public begin (-> (List Expression) Computation) (|>> (#.Item (..var "begin")) ..form)) - (def: #export (set! name value) + (def: .public (set! name value) (-> Var Expression Computation) (..form (list (..var "set!") name value))) - (def: #export (with_exception_handler handler body) + (def: .public (with_exception_handler handler body) (-> Expression Expression Computation) (..form (list (..var "with-exception-handler") handler body))) - (def: #export (call_with_current_continuation body) + (def: .public (call_with_current_continuation body) (-> Expression Computation) (..form (list (..var "call-with-current-continuation") body))) - (def: #export (guard variable clauses else body) + (def: .public (guard variable clauses else body) (-> Var (List [Expression Expression]) (Maybe Expression) Expression Computation) (..form (list (..var "guard") (..form (|> (case else diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index f37c0a3c9..304846eec 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -41,7 +41,7 @@ [world ["." program]]]]) -(type: #export Tally +(type: .public Tally {#successes Nat #failures Nat #expected_coverage (Set Name) @@ -72,16 +72,16 @@ [failure_tally #failures] ) -(type: #export Assertion +(type: .public Assertion (Async [Tally Text])) -(type: #export Test +(type: .public Test (Random Assertion)) (def: separator text.new_line) -(def: #export (and' left right) +(def: .public (and' left right) {#.doc "Sequencing combinator."} (-> Assertion Assertion Assertion) (let [[read! write!] (: [(Async [Tally Text]) @@ -96,7 +96,7 @@ io.run)] read!)) -(def: #export (and left right) +(def: .public (and left right) {#.doc "Sequencing combinator."} (-> Test Test Test) (do {! random.monad} @@ -106,7 +106,7 @@ (def: context_prefix text.tab) -(def: #export (context description) +(def: .public (context description) (-> Text Test Test) (random\map (async\map (function (_ [tally documentation]) [tally (|> documentation @@ -118,14 +118,14 @@ (def: failure_prefix "[Failure] ") (def: success_prefix "[Success] ") -(def: #export failure +(def: .public failure (-> Text Test) (|>> (format ..failure_prefix) [..failure_tally] async\in random\in)) -(def: #export (assertion message condition) +(def: .public (assertion message condition) {#.doc "Check that a condition is #1, and fail with the given message otherwise."} (-> Text Bit Assertion) (<| async\in @@ -133,12 +133,12 @@ [..success_tally (format ..success_prefix message)] [..failure_tally (format ..failure_prefix message)]))) -(def: #export (test message condition) +(def: .public (test message condition) {#.doc "Check that a condition is #1, and fail with the given message otherwise."} (-> Text Bit Test) (random\in (..assertion message condition))) -(def: #export (lift message random) +(def: .public (lift message random) (-> Text (Random Bit) Test) (random\map (..assertion message) random)) @@ -146,11 +146,11 @@ Nat (hex "FEDCBA9876543210")) -(type: #export Seed +(type: .public Seed {#.doc "The seed value used for random testing (if that feature is used)."} Nat) -(def: #export (seed value test) +(def: .public (seed value test) (-> Seed Test Test) (function (_ prng) (let [[_ result] (random.run (random.pcg_32 [..pcg_32_magic_inc value]) @@ -166,9 +166,9 @@ (format documentation ..separator ..separator "Failed with this seed: " (%.nat seed))) -(exception: #export must_try_test_at_least_once) +(exception: .public must_try_test_at_least_once) -(def: #export (times amount test) +(def: .public (times amount test) (-> Nat Test Test) (case amount 0 (..failure (exception.error ..must_try_test_at_least_once [])) @@ -240,7 +240,7 @@ (def: failure_exit_code +1) (def: success_exit_code +0) -(def: #export (run! test) +(def: .public (run! test) (-> Test (Async Nothing)) (do async.monad [pre (async.future instant.now) @@ -318,7 +318,7 @@ (set.add [module remaining] output)))) (template [<macro> <function>] - [(syntax: #export (<macro> {coverage (<code>.tuple (<>.many <code>.any))} + [(syntax: .public (<macro> {coverage (<code>.tuple (<>.many <code>.any))} condition) (let [coverage (list\map (function (_ definition) (` ((~! ..reference) (~ definition)))) @@ -332,7 +332,7 @@ [cover ..|cover|] ) -(syntax: #export (for {coverage (<code>.tuple (<>.many <code>.any))} +(syntax: .public (for {coverage (<code>.tuple (<>.many <code>.any))} test) (let [coverage (list\map (function (_ definition) (` ((~! ..reference) (~ definition)))) @@ -350,7 +350,7 @@ [(update@ #expected_coverage (set.union coverage) tally) documentation])))))) -(syntax: #export (covering {module <code>.identifier} +(syntax: .public (covering {module <code>.identifier} test) (do meta.monad [.let [module (name.module module)] @@ -367,11 +367,11 @@ (~ (code.text coverage)) (~ test))))))) -(exception: #export (error_during_execution {error Text}) +(exception: .public (error_during_execution {error Text}) (exception.report ["Error" (%.text error)])) -(def: #export (in_parallel tests) +(def: .public (in_parallel tests) (-> (List Test) Test) (case (list.size tests) 0 diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index c1ab45cd2..cb7fdd619 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -24,7 +24,7 @@ ["." duration (#+ Duration)]]) (template [<name> <singular> <plural>] - [(def: #export <name> + [(def: .public <name> Nat (.nat (duration.query <singular> <plural>)))] @@ -38,7 +38,7 @@ Nat (.nat (duration.millis duration.day))) -(exception: #export (time_exceeds_a_day {time Nat}) +(exception: .public (time_exceeds_a_day {time Nat}) (exception.report ["Time (in milli-seconds)" (n\encode time)] ["Maximum (in milli-seconds)" (n\encode (dec limit))])) @@ -57,7 +57,7 @@ (\ <>.monad in 0))) (template [<maximum> <parser> <exception> <sub_parser>] - [(exception: #export (<exception> {value Nat}) + [(exception: .public (<exception> {value Nat}) (exception.report ["Value" (n\encode value)] ["Minimum" (n\encode 0)] @@ -76,33 +76,33 @@ [..seconds second_parser invalid_second ..section_parser] ) -(abstract: #export Time - Nat - +(abstract: .public Time {#.doc "Time is defined as milliseconds since the start of the day (00:00:00.000)."} - (def: #export midnight + Nat + + (def: .public midnight {#.doc "The instant corresponding to the start of the day: 00:00:00.000"} Time (:abstraction 0)) - (def: #export (of_millis milli_seconds) + (def: .public (of_millis milli_seconds) (-> Nat (Try Time)) (if (n.< ..limit milli_seconds) (#try.Success (:abstraction milli_seconds)) (exception.except ..time_exceeds_a_day [milli_seconds]))) - (def: #export millis + (def: .public millis (-> Time Nat) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Time) (def: (= param subject) (n.= (:representation param) (:representation subject)))) - (implementation: #export order + (implementation: .public order (Order Time) (def: &equivalence ..equivalence) @@ -110,7 +110,7 @@ (def: (< param subject) (n.< (:representation param) (:representation subject)))) - (`` (implementation: #export enum + (`` (implementation: .public enum (Enum Time) (def: &order ..order) @@ -125,7 +125,7 @@ dec :abstraction)))) - (def: #export parser + (def: .public parser (Parser Time) (let [millis (: (-> Duration Nat) (|>> duration.millis .nat)) @@ -168,13 +168,13 @@ ## (n.< 1,000 millis) ($_ text\compose "." (n\encode millis)))) -(type: #export Clock +(type: .public Clock {#hour Nat #minute Nat #second Nat #milli_second Nat}) -(def: #export (clock time) +(def: .public (clock time) (-> Time Clock) (let [time (|> time ..millis .int duration.of_millis) [hours time] [(duration.query duration.hour time) (duration.framed duration.hour time)] @@ -188,7 +188,7 @@ duration.millis .nat)})) -(def: #export (time clock) +(def: .public (time clock) (-> Clock (Try Time)) (|> ($_ duration.merged (duration.up (get@ #hour clock) duration.hour) @@ -208,7 +208,7 @@ ..separator (..padded second) (..millis_format milli_second)))) -(implementation: #export codec +(implementation: .public codec {#.doc (doc "Based on ISO 8601." "For example: 21:14:51.827")} (Codec Text Time) diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index 92d2a5199..6fc97fb81 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -49,7 +49,7 @@ (and (n.>= ..minimum_day day) (n.<= (..month_days year month) day))) -(exception: #export (invalid_day {year Year} {month Month} {day Nat}) +(exception: .public (invalid_day {year Year} {month Month} {day Nat}) (exception.report ["Value" (n\encode day)] ["Minimum" (n\encode ..minimum_day)] @@ -67,14 +67,14 @@ (def: separator "-") -(abstract: #export Date +(abstract: .public Date + {#.doc (doc "A date specified as a year/month/day triplet.")} + {#year Year #month Month #day Nat} - {#.doc (doc "A date specified as a year/month/day triplet.")} - - (def: #export (date year month day_of_month) + (def: .public (date year month day_of_month) {#.doc (doc "A date, within the allowed limits.")} (-> Year Month Nat (Try Date)) (if (..day_is_within_limits? year month day_of_month) @@ -85,7 +85,7 @@ #day day_of_month})) (exception.except ..invalid_day [year month day_of_month]))) - (def: #export epoch + (def: .public epoch Date (try.assumed (..date //year.epoch @@ -93,7 +93,7 @@ ..minimum_day))) (template [<name> <type> <field>] - [(def: #export <name> + [(def: .public <name> (-> Date <type>) (|>> :representation (get@ <field>)))] @@ -102,7 +102,7 @@ [day_of_month Nat #day] ) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Date) (def: (= reference sample) @@ -117,7 +117,7 @@ (n.= (get@ #day reference) (get@ #day sample)))))) - (implementation: #export order + (implementation: .public order (Order Date) (def: &equivalence ..equivalence) @@ -153,7 +153,7 @@ (\ <>.monad in 0))) (template [<minimum> <maximum> <parser> <exception>] - [(exception: #export (<exception> {value Nat}) + [(exception: .public (<exception> {value Nat}) (exception.report ["Value" (n\encode value)] ["Minimum" (n\encode <minimum>)] @@ -171,7 +171,7 @@ [1 12 month_parser invalid_month] ) -(def: #export parser +(def: .public parser (Parser Date) (do <>.monad [utc_year //year.parser @@ -189,7 +189,7 @@ ..separator (..padded (|> value ..month //month.number)) ..separator (..padded (..day_of_month value)))) -(implementation: #export codec +(implementation: .public codec {#.doc (doc "Based on ISO 8601." "For example: 2017-01-15")} (Codec Text Date) @@ -285,7 +285,7 @@ utc_year))) ## http://howardhinnant.github.io/date_algorithms.html -(def: #export (days date) +(def: .public (days date) (-> Date Int) (let [utc_month (|> date ..month //month.number) civil_year (..civil_year utc_month (..year date)) @@ -309,7 +309,7 @@ (i.- (.int ..days_since_epoch))))) ## http://howardhinnant.github.io/date_algorithms.html -(def: #export (of_days days) +(def: .public (of_days days) (-> Int Date) (let [days (i.+ (.int ..days_since_epoch) days) era (|> (if (i.< +0 days) @@ -342,7 +342,7 @@ (maybe.assume (dictionary.get month ..month_by_number)) day)))) -(implementation: #export enum +(implementation: .public enum (Enum Date) (def: &order ..order) diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux index 58bc46c1d..384802851 100644 --- a/stdlib/source/library/lux/time/day.lux +++ b/stdlib/source/library/lux/time/day.lux @@ -18,7 +18,7 @@ [number ["n" nat]]]]]) -(type: #export Day +(type: .public Day {#.doc (doc "A day of the week.")} #Sunday #Monday @@ -28,7 +28,7 @@ #Friday #Saturday) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Day) (def: (= reference sample) @@ -58,7 +58,7 @@ #Friday 5 #Saturday 6)) -(implementation: #export order +(implementation: .public order (Order Day) (def: &equivalence ..equivalence) @@ -66,7 +66,7 @@ (def: (< reference sample) (n.< (..nat reference) (..nat sample)))) -(implementation: #export enum +(implementation: .public enum (Enum Day) (def: &order ..order) @@ -91,11 +91,11 @@ #Saturday #Friday #Sunday #Saturday))) -(exception: #export (not_a_day_of_the_week {value Text}) +(exception: .public (not_a_day_of_the_week {value Text}) (exception.report ["Value" (text.format value)])) -(implementation: #export codec +(implementation: .public codec (Codec Text Day) (def: (encode value) @@ -122,7 +122,7 @@ [#..Sunday]) _ (exception.except ..not_a_day_of_the_week [value])))) -(def: #export week +(def: .public week {#.doc (doc "All the days, ordered by when they come in a week.")} (List Day) (list #Sunday @@ -140,14 +140,14 @@ [05 #Thursday] [06 #Friday] [07 #Saturday])] - (def: #export (number day) + (def: .public (number day) (-> Day Nat) (case day (^template [<number> <day>] [<day> <number>]) (<pairs>))) - (exception: #export (invalid_day {number Nat}) + (exception: .public (invalid_day {number Nat}) (exception.report ["Number" (\ n.decimal encode number)] ["Valid range" ($_ "lux text concat" @@ -155,7 +155,7 @@ " ~ " (\ n.decimal encode (..number #Saturday)))])) - (def: #export (by_number number) + (def: .public (by_number number) (-> Nat (Try Day)) (case number (^template [<number> <day>] @@ -164,7 +164,7 @@ _ (exception.except ..invalid_day [number]))) ) -(implementation: #export hash +(implementation: .public hash (Hash Day) (def: &equivalence ..equivalence) diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index ff9ad24d3..07f104b97 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -23,21 +23,21 @@ ["." // #_ ["#." year]]) -(abstract: #export Duration - Int - +(abstract: .public Duration {#.doc "Durations have a resolution of milli-seconds."} - (def: #export of_millis + Int + + (def: .public of_millis (-> Int Duration) (|>> :abstraction)) - (def: #export millis + (def: .public millis (-> Duration Int) (|>> :representation)) (template [<op> <name>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (-> Duration Duration Duration) (:abstraction (<op> (:representation param) (:representation subject))))] @@ -46,7 +46,7 @@ ) (template [<op> <name>] - [(def: #export (<name> scalar) + [(def: .public (<name> scalar) (-> Nat Duration Duration) (|>> :representation (<op> (.int scalar)) :abstraction))] @@ -54,21 +54,21 @@ [i./ down] ) - (def: #export inverse + (def: .public inverse (-> Duration Duration) (|>> :representation (i.* -1) :abstraction)) - (def: #export (query param subject) + (def: .public (query param subject) (-> Duration Duration Int) (i./ (:representation param) (:representation subject))) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Duration) (def: (= param subject) (i.= (:representation param) (:representation subject)))) - (implementation: #export order + (implementation: .public order (Order Duration) (def: &equivalence ..equivalence) @@ -76,7 +76,7 @@ (i.< (:representation param) (:representation subject)))) (template [<op> <name>] - [(def: #export <name> + [(def: .public <name> (-> Duration Bit) (|>> :representation (<op> +0)))] @@ -86,14 +86,14 @@ ) ) -(def: #export empty +(def: .public empty (..of_millis +0)) -(def: #export milli_second +(def: .public milli_second (..of_millis +1)) (template [<name> <scale> <base>] - [(def: #export <name> + [(def: .public <name> (..up <scale> <base>))] [second 1,000 milli_second] @@ -105,10 +105,10 @@ [normal_year //year.days day] ) -(def: #export leap_year +(def: .public leap_year (..merged ..day ..normal_year)) -(implementation: #export monoid +(implementation: .public monoid (Monoid Duration) (def: identity ..empty) @@ -183,17 +183,17 @@ (#.Left _) (..inverse span) (#.Right _) span))))) -(implementation: #export codec +(implementation: .public codec (Codec Text Duration) (def: encode ..encode) (def: decode (<text>.run ..parser))) -(def: #export (difference from to) +(def: .public (difference from to) (-> Duration Duration Duration) (|> from ..inverse (..merged to))) -(implementation: #export enum +(implementation: .public enum (Enum Duration) (def: &order ..order) diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index c89ffbd09..858a29632 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -32,49 +32,49 @@ ["." day (#+ Day)] ["." date (#+ Date)]]) -(abstract: #export Instant - Int - +(abstract: .public Instant {#.doc "Instant is defined as milli-seconds since the epoch."} - (def: #export of_millis + Int + + (def: .public of_millis (-> Int Instant) (|>> :abstraction)) - (def: #export millis + (def: .public millis (-> Instant Int) (|>> :representation)) - (def: #export (span from to) + (def: .public (span from to) (-> Instant Instant Duration) (duration.of_millis (i.- (:representation from) (:representation to)))) - (def: #export (after duration instant) + (def: .public (after duration instant) (-> Duration Instant Instant) (:abstraction (i.+ (duration.millis duration) (:representation instant)))) - (def: #export (relative instant) + (def: .public (relative instant) (-> Instant Duration) (|> instant :representation duration.of_millis)) - (def: #export (absolute offset) + (def: .public (absolute offset) (-> Duration Instant) (|> offset duration.millis :abstraction)) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Instant) (def: (= param subject) (\ i.equivalence = (:representation param) (:representation subject)))) - (implementation: #export order + (implementation: .public order (Order Instant) (def: &equivalence ..equivalence) (def: (< param subject) (\ i.order < (:representation param) (:representation subject)))) - (`` (implementation: #export enum + (`` (implementation: .public enum (Enum Instant) (def: &order ..order) @@ -86,7 +86,7 @@ )))) ) -(def: #export epoch +(def: .public epoch {#.doc "The instant corresponding to 1970-01-01T00:00:00Z."} Instant (..of_millis +0)) @@ -147,7 +147,7 @@ (duration.merged (duration.up time duration.milli_second)) ..absolute)))) -(implementation: #export codec +(implementation: .public codec {#.doc (doc "Based on ISO 8601." "For example: 2017-01-15T21:14:51.827Z")} (Codec Text Instant) @@ -155,7 +155,7 @@ (def: encode ..format) (def: decode (<text>.run ..parser))) -(def: #export now +(def: .public now {#.doc (doc "Yields the current instant, as measured from the operating-system's clock.")} (IO Instant) (io (..of_millis (for {@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") @@ -198,7 +198,7 @@ })))) (template [<field> <type> <post_processing>] - [(def: #export (<field> instant) + [(def: .public (<field> instant) (-> Instant <type>) (let [[date time] (..date_time instant)] (|> <field> <post_processing>)))] @@ -207,7 +207,7 @@ [time Time ..clock_time] ) -(def: #export (day_of_week instant) +(def: .public (day_of_week instant) (-> Instant Day) (let [offset (..relative instant) days (duration.query duration.day offset) @@ -231,7 +231,7 @@ +6 #day.Saturday _ (undefined)))) -(def: #export (of_date_time date time) +(def: .public (of_date_time date time) (-> Date Time Instant) (|> (date.days date) (i.* (duration.millis duration.day)) diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux index d2e7fb0e0..6e626f325 100644 --- a/stdlib/source/library/lux/time/month.lux +++ b/stdlib/source/library/lux/time/month.lux @@ -18,7 +18,7 @@ [number ["n" nat]]]]]) -(type: #export Month +(type: .public Month {#.doc (doc "A month of the year.")} #January #February @@ -33,7 +33,7 @@ #November #December) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Month) (def: (= reference sample) @@ -69,14 +69,14 @@ [10 #October] [11 #November] [12 #December])] - (def: #export (number month) + (def: .public (number month) (-> Month Nat) (case month (^template [<number> <month>] [<month> <number>]) (<pairs>))) - (exception: #export (invalid_month {number Nat}) + (exception: .public (invalid_month {number Nat}) (exception.report ["Number" (\ n.decimal encode number)] ["Valid range" ($_ "lux text concat" @@ -84,7 +84,7 @@ " ~ " (\ n.decimal encode (..number #December)))])) - (def: #export (by_number number) + (def: .public (by_number number) (-> Nat (Try Month)) (case number (^template [<number> <month>] @@ -93,7 +93,7 @@ _ (exception.except ..invalid_month [number]))) ) -(implementation: #export hash +(implementation: .public hash (Hash Month) (def: &equivalence ..equivalence) @@ -115,7 +115,7 @@ [31 #November] [37 #December])))) -(implementation: #export order +(implementation: .public order (Order Month) (def: &equivalence ..equivalence) @@ -123,7 +123,7 @@ (def: (< reference sample) (n.< (..number reference) (..number sample)))) -(implementation: #export enum +(implementation: .public enum (Enum Month) (def: &order ..order) @@ -158,7 +158,7 @@ #December #November #January #December))) -(def: #export (days month) +(def: .public (days month) {#.doc (doc "The amount of days of a month.")} (-> Month Nat) (case month @@ -180,14 +180,14 @@ [30 #November] [31 #December]))) -(def: #export (leap_year_days month) +(def: .public (leap_year_days month) {#.doc (doc "The amount of days of a month (in a leap year).")} (-> Month Nat) (case month #February (inc (..days month)) _ (..days month))) -(def: #export year +(def: .public year {#.doc (doc "All the months, ordered by when they come in a year.")} (List Month) (list #January @@ -203,11 +203,11 @@ #November #December)) -(exception: #export (not_a_month_of_the_year {value Text}) +(exception: .public (not_a_month_of_the_year {value Text}) (exception.report ["Value" (text.format value)])) -(implementation: #export codec +(implementation: .public codec (Codec Text Month) (def: (encode value) diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux index 5388b5ef8..d4331ba82 100644 --- a/stdlib/source/library/lux/time/year.lux +++ b/stdlib/source/library/lux/time/year.lux @@ -32,34 +32,36 @@ year (dec year))) -(exception: #export there_is_no_year_0) +(exception: .public there_is_no_year_0) + +(abstract: .public Year + {} -(abstract: #export Year Int - (def: #export (year value) + (def: .public (year value) (-> Int (Try Year)) (case value +0 (exception.except ..there_is_no_year_0 []) _ (#try.Success (:abstraction (..internal value))))) - (def: #export value + (def: .public value (-> Year Int) (|>> :representation ..external)) - (def: #export epoch + (def: .public epoch Year (:abstraction +1970)) ) -(def: #export days +(def: .public days 365) -(type: #export Period +(type: .public Period Nat) (template [<period> <name>] - [(def: #export <name> + [(def: .public <name> Period <period>)] @@ -73,7 +75,7 @@ (|> input (i.% factor) (i.= +0))) ## https://en.wikipedia.org/wiki/Leap_year#Algorithm -(def: #export (leap? year) +(def: .public (leap? year) (-> Year Bit) (let [year (|> year ..value ..internal)] (and (..divisible? (.int ..leap) year) @@ -86,7 +88,7 @@ (i.+ +1 days) days))) -(def: #export (leaps year) +(def: .public (leaps year) (-> Year Int) (let [year (|> year ..value ..internal) limit (if (i.> +0 year) @@ -109,7 +111,7 @@ (i\encode year) (n\encode (.nat year))))) -(def: #export parser +(def: .public parser (Parser Year) (do {! <>.monad} [sign (<>.or (<t>.this "-") (in [])) @@ -119,7 +121,7 @@ (#.Left _) (i.* -1 raw_year) (#.Right _) raw_year))))) -(implementation: #export codec +(implementation: .public codec {#.doc (doc "Based on ISO 8601." "For example: 2017")} (Codec Text Year) @@ -127,13 +129,13 @@ (def: encode ..encode) (def: decode (<t>.run ..parser))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Year) (def: (= reference subject) (i.= (..value reference) (..value subject)))) -(implementation: #export order +(implementation: .public order (Order Year) (def: &equivalence ..equivalence) diff --git a/stdlib/source/library/lux/tool/compiler.lux b/stdlib/source/library/lux/tool/compiler.lux index 1acd9aeea..10ad0d939 100644 --- a/stdlib/source/library/lux/tool/compiler.lux +++ b/stdlib/source/library/lux/tool/compiler.lux @@ -18,30 +18,30 @@ [descriptor (#+ Descriptor Module)] [document (#+ Document)]]]]) -(type: #export Code +(type: .public Code Text) -(type: #export Parameter +(type: .public Parameter Text) -(type: #export Input +(type: .public Input {#module Module #file Path #hash Nat #code Code}) -(type: #export (Compilation s d o) +(type: .public (Compilation s d o) {#dependencies (List Module) #process (-> s Archive (Try [s (Either (Compilation s d o) [Descriptor (Document d) Output])]))}) -(type: #export (Compiler s d o) +(type: .public (Compiler s d o) (-> Input (Compilation s d o))) -(type: #export (Instancer s d o) +(type: .public (Instancer s d o) (-> (Key d) (List Parameter) (Compiler s d o))) -(exception: #export (cannot_compile {module Module}) +(exception: .public (cannot_compile {module Module}) (exception.report ["Module" module])) diff --git a/stdlib/source/library/lux/tool/compiler/arity.lux b/stdlib/source/library/lux/tool/compiler/arity.lux index 61e0ea625..e0a3c06aa 100644 --- a/stdlib/source/library/lux/tool/compiler/arity.lux +++ b/stdlib/source/library/lux/tool/compiler/arity.lux @@ -5,10 +5,10 @@ [number ["n" nat]]]]]) -(type: #export Arity Nat) +(type: .public Arity Nat) (template [<comparison> <name>] - [(def: #export <name> (-> Arity Bit) (<comparison> 1))] + [(def: .public <name> (-> Arity Bit) (<comparison> 1))] [n.< nullary?] [n.= unary?] diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index 898f0edd3..e2fd13208 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -51,7 +51,7 @@ ["." document]]]] ]) -(def: #export (state target module expander host_analysis host generate generation_bundle) +(def: .public (state target module expander host_analysis host generate generation_bundle) (All [anchor expression directive] (-> Target Module @@ -74,7 +74,7 @@ #///directive.generation {#///directive.state generation_state #///directive.phase generate}}])) -(def: #export (with_default_directives expander host_analysis program anchorT,expressionT,directiveT extender) +(def: .public (with_default_directives expander host_analysis program anchorT,expressionT,directiveT extender) (All [anchor expression directive] (-> Expander ///analysis.Bundle @@ -228,7 +228,7 @@ (-> .Module Aliases) (|>> (get@ #.module_aliases) (dictionary.of_list text.hash))) -(def: #export (compiler expander prelude write_directive) +(def: .public (compiler expander prelude write_directive) (All [anchor expression directive] (-> Expander Module (-> directive Binary) (Instancer (///directive.State+ anchor expression directive) .Module))) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 9e54b2522..dac25756c 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -64,10 +64,10 @@ (with_expansions [<type_vars> (as_is anchor expression directive) <Operation> (as_is ///generation.Operation <type_vars>)] - (type: #export Phase_Wrapper + (type: .public Phase_Wrapper (All [s i o] (-> (Phase s i o) Any))) - (type: #export (Platform <type_vars>) + (type: .public (Platform <type_vars>) {#&file_system (file.System Async) #host (///generation.Host expression directive) #phase (///generation.Phase <type_vars>) @@ -221,7 +221,7 @@ generators (dictionary.merged directives (host_directive_bundle phase_wrapper))]) - (def: #export (initialize static module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender + (def: .public (initialize static module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender import compilation_sources) (All [<type_vars>] (-> Static @@ -356,17 +356,17 @@ (or (dependence? import (get@ #depends_on) module) (dependence? module (get@ #depended_by) import)))) - (exception: #export (module_cannot_import_itself {module Module}) + (exception: .public (module_cannot_import_itself {module Module}) (exception.report ["Module" (%.text module)])) - (exception: #export (cannot_import_circular_dependency {importer Module} + (exception: .public (cannot_import_circular_dependency {importer Module} {importee Module}) (exception.report ["Importer" (%.text importer)] ["importee" (%.text importee)])) - (exception: #export (cannot_import_twice {importer Module} + (exception: .public (cannot_import_twice {importer Module} {duplicates (Set Module)}) (exception.report ["Importer" (%.text importer)] @@ -523,7 +523,7 @@ try.assumed product.left)) - (def: #export (compile import static expander platform compilation context) + (def: .public (compile import static expander platform compilation context) (All [<type_vars>] (-> Import Static Expander <Platform> Compilation <Context> <Return>)) (let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index f8ddeff8e..34e1bbbb7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -20,7 +20,7 @@ ## TODO: Remove #module_hash, #imports & #module_state ASAP. ## TODO: Not just from this parser, but from the lux.Module type. -(def: #export writer +(def: .public writer (Writer .Module) (let [definition (: (Writer Definition) ($_ _.and _.bit _.type _.code _.any)) @@ -60,7 +60,7 @@ ## #module_state _.any))) -(def: #export parser +(def: .public parser (Parser .Module) (let [definition (: (Parser Definition) ($_ <>.and <b>.bit <b>.type <b>.code <b>.any)) @@ -100,7 +100,7 @@ ## #module_state (\ <>.monad in #.Cached)))) -(def: #export key +(def: .public key (Key .Module) (key.key {#signature.name (name_of ..compiler) #signature.version /version.version} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index 7dc985749..c79f514c3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -35,7 +35,7 @@ ["." reference (#+ Reference) ["." variable (#+ Register Variable)]]]]) -(type: #export #rec Primitive +(type: .public #rec Primitive #Unit (#Bit Bit) (#Nat Nat) @@ -44,15 +44,15 @@ (#Frac Frac) (#Text Text)) -(type: #export Tag +(type: .public Tag Nat) -(type: #export (Variant a) +(type: .public (Variant a) {#lefts Nat #right? Bit #value a}) -(def: #export (tag lefts right?) +(def: .public (tag lefts right?) (-> Nat Bit Nat) (if right? (inc lefts) @@ -64,35 +64,35 @@ (dec tag) tag)) -(def: #export (choice options pick) +(def: .public (choice options pick) (-> Nat Nat [Nat Bit]) (let [right? (n.= (dec options) pick)] [(..lefts pick right?) right?])) -(type: #export (Tuple a) +(type: .public (Tuple a) (List a)) -(type: #export (Composite a) +(type: .public (Composite a) (#Variant (Variant a)) (#Tuple (Tuple a))) -(type: #export #rec Pattern +(type: .public #rec Pattern (#Simple Primitive) (#Complex (Composite Pattern)) (#Bind Register)) -(type: #export (Branch' e) +(type: .public (Branch' e) {#when Pattern #then e}) -(type: #export (Match' e) +(type: .public (Match' e) [(Branch' e) (List (Branch' e))]) -(type: #export (Environment a) +(type: .public (Environment a) (List a)) -(type: #export #rec Analysis +(type: .public #rec Analysis (#Primitive Primitive) (#Structure (Composite Analysis)) (#Reference Reference) @@ -101,10 +101,10 @@ (#Apply Analysis Analysis) (#Extension (Extension Analysis))) -(type: #export Branch +(type: .public Branch (Branch' Analysis)) -(type: #export Match +(type: .public Match (Match' Analysis)) (implementation: primitive_equivalence @@ -128,7 +128,7 @@ _ false))) -(implementation: #export (composite_equivalence (^open "/\.")) +(implementation: .public (composite_equivalence (^open "/\.")) (All [a] (-> (Equivalence a) (Equivalence (Composite a)))) (def: (= reference sample) @@ -145,7 +145,7 @@ _ false))) -(implementation: #export (composite_hash super) +(implementation: .public (composite_hash super) (All [a] (-> (Hash a) (Hash (Composite a)))) (def: &equivalence @@ -188,7 +188,7 @@ (and (\ pattern_equivalence = reference_pattern sample_pattern) (\ equivalence = reference_body sample_body)))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Analysis) (def: (= reference sample) @@ -224,18 +224,18 @@ false))) (template [<name> <tag>] - [(template: #export (<name> content) - (<tag> content))] + [(template: .public (<name> content) + [(<tag> content)])] [control/case #..Case] ) -(template: #export (unit) - (#..Primitive #..Unit)) +(template: .public (unit) + [(#..Primitive #..Unit)]) (template [<name> <tag>] - [(template: #export (<name> value) - (#..Primitive (<tag> value)))] + [(template: .public (<name> value) + [(#..Primitive (<tag> value))])] [bit #..Bit] [nat #..Nat] @@ -245,29 +245,29 @@ [text #..Text] ) -(type: #export (Abstraction c) +(type: .public (Abstraction c) [(Environment c) Arity c]) -(type: #export (Application c) +(type: .public (Application c) [c (List c)]) (def: (last? size tag) (-> Nat Tag Bit) (n.= (dec size) tag)) -(template: #export (no_op value) - (|> 1 #variable.Local #reference.Variable #..Reference - (#..Function (list)) - (#..Apply value))) +(template: .public (no_op value) + [(|> 1 #variable.Local #reference.Variable #..Reference + (#..Function (list)) + (#..Apply value))]) -(def: #export (apply [abstraction inputs]) +(def: .public (apply [abstraction inputs]) (-> (Application Analysis) Analysis) (list\fold (function (_ input abstraction') (#Apply input abstraction')) abstraction inputs)) -(def: #export (application analysis) +(def: .public (application analysis) (-> Analysis (Application Analysis)) (loop [abstraction analysis inputs (list)] @@ -279,10 +279,10 @@ [abstraction inputs]))) (template [<name> <tag>] - [(template: #export (<name> content) - (.<| #..Reference - <tag> - content))] + [(template: .public (<name> content) + [(.<| #..Reference + <tag> + content)])] [variable #reference.Variable] [constant #reference.Constant] @@ -292,31 +292,31 @@ ) (template [<name> <tag>] - [(template: #export (<name> content) - (.<| #..Complex - <tag> - content))] + [(template: .public (<name> content) + [(.<| #..Complex + <tag> + content)])] [pattern/variant #..Variant] [pattern/tuple #..Tuple] ) (template [<name> <tag>] - [(template: #export (<name> content) - (.<| #..Structure - <tag> - content))] + [(template: .public (<name> content) + [(.<| #..Structure + <tag> + content)])] [variant #..Variant] [tuple #..Tuple] ) -(template: #export (pattern/unit) - (#..Simple #..Unit)) +(template: .public (pattern/unit) + [(#..Simple #..Unit)]) (template [<name> <tag>] - [(template: #export (<name> content) - (#..Simple (<tag> content)))] + [(template: .public (<name> content) + [(#..Simple (<tag> content))])] [pattern/bit #..Bit] [pattern/nat #..Nat] @@ -326,10 +326,10 @@ [pattern/text #..Text] ) -(template: #export (pattern/bind register) - (#..Bind register)) +(template: .public (pattern/bind register) + [(#..Bind register)]) -(def: #export (%analysis analysis) +(def: .public (%analysis analysis) (Format Analysis) (case analysis (#Primitive primitive) @@ -389,7 +389,7 @@ (text.enclosed ["(" ")"])))) (template [<special> <general>] - [(type: #export <special> + [(type: .public <special> (<general> .Lux Code Analysis))] [State+ extension.State] @@ -399,7 +399,7 @@ [Bundle extension.Bundle] ) -(def: #export (with_source_code source action) +(def: .public (with_source_code source action) (All [a] (-> Source (Operation a) (Operation a))) (function (_ [bundle state]) (let [old_source (get@ #.source state)] @@ -423,7 +423,7 @@ #.locals fresh_bindings #.captured fresh_bindings}) -(def: #export (with_scope action) +(def: .public (with_scope action) (All [a] (-> (Operation a) (Operation [Scope a]))) (function (_ [bundle state]) (case (action [bundle (update@ #.scopes (|>> (#.Item fresh_scope)) state)]) @@ -439,13 +439,13 @@ (#try.Failure error) (#try.Failure error)))) -(def: #export (with_current_module name) +(def: .public (with_current_module name) (All [a] (-> Text (Operation a) (Operation a))) (extension.localized (get@ #.current_module) (set@ #.current_module) (function.constant (#.Some name)))) -(def: #export (with_location location action) +(def: .public (with_location location action) (All [a] (-> Location (Operation a) (Operation a))) (if (text\= "" (product.left location)) action @@ -464,31 +464,31 @@ (format (%.location location) text.new_line error)) -(def: #export (failure error) +(def: .public (failure error) (-> Text Operation) (function (_ [bundle state]) (#try.Failure (locate_error (get@ #.location state) error)))) -(def: #export (except exception parameters) +(def: .public (except exception parameters) (All [e] (-> (Exception e) e Operation)) (..failure (exception.error exception parameters))) -(def: #export (assertion exception parameters condition) +(def: .public (assertion exception parameters condition) (All [e] (-> (Exception e) e Bit (Operation Any))) (if condition (\ phase.monad in []) (..except exception parameters))) -(def: #export (failure' error) +(def: .public (failure' error) (-> Text (phase.Operation Lux)) (function (_ state) (#try.Failure (locate_error (get@ #.location state) error)))) -(def: #export (except' exception parameters) +(def: .public (except' exception parameters) (All [e] (-> (Exception e) e (phase.Operation Lux))) (..failure' (exception.error exception parameters))) -(def: #export (with_stack exception message action) +(def: .public (with_stack exception message action) (All [e o] (-> (Exception e) e (Operation o) (Operation o))) (function (_ bundle,state) (case (exception.with exception message @@ -500,14 +500,14 @@ (let [[bundle state] bundle,state] (#try.Failure (locate_error (get@ #.location state) error)))))) -(def: #export (install state) +(def: .public (install state) (-> .Lux (Operation Any)) (function (_ [bundle _]) (#try.Success [[bundle state] []]))) (template [<name> <type> <field> <value>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> <type> (Operation Any)) (extension.update (set@ <field> <value>)))] @@ -516,11 +516,11 @@ [set_location Location #.location value] ) -(def: #export (location file) +(def: .public (location file) (-> Text Location) [file 1 0]) -(def: #export (source file code) +(def: .public (source file code) (-> Text Text Source) [(location file) 0 code]) @@ -534,13 +534,13 @@ #.var_counter 0 #.var_bindings (list)}) -(def: #export (info version host) +(def: .public (info version host) (-> Version Text Info) {#.target host #.version (%.nat version) #.mode #.Build}) -(def: #export (state info) +(def: .public (state info) (-> Info Lux) {#.info info #.source ..dummy_source diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux index 0895955dc..b099446ea 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux @@ -26,7 +26,7 @@ [archive (#+ Archive) [descriptor (#+ Module)]]]]]]]]) -(type: #export Eval +(type: .public Eval (-> Archive Nat Type Code (Operation Any))) (def: (context [module_id artifact_id]) @@ -34,7 +34,7 @@ ## TODO: Find a better way that doesn't rely on clever tricks. [(n.- module_id 0) artifact_id]) -(def: #export (evaluator expander synthesis_state generation_state generate) +(def: .public (evaluator expander synthesis_state generation_state generate) (All [anchor expression artifact] (-> Expander synthesis.State+ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux index 95f38c760..800d3091e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux @@ -13,22 +13,22 @@ [///// ["." phase]]) -(exception: #export (expansion_failed {macro Name} {inputs (List Code)} {error Text}) +(exception: .public (expansion_failed {macro Name} {inputs (List Code)} {error Text}) (exception.report ["Macro" (%.name macro)] ["Inputs" (exception.listing %.code inputs)] ["Error" error])) -(exception: #export (must_have_single_expansion {macro Name} {inputs (List Code)} {outputs (List Code)}) +(exception: .public (must_have_single_expansion {macro Name} {inputs (List Code)} {outputs (List Code)}) (exception.report ["Macro" (%.name macro)] ["Inputs" (exception.listing %.code inputs)] ["Outputs" (exception.listing %.code outputs)])) -(type: #export Expander +(type: .public Expander (-> Macro (List Code) Lux (Try (Try [Lux (List Code)])))) -(def: #export (expand expander name macro inputs) +(def: .public (expand expander name macro inputs) (-> Expander Name Macro (List Code) (Meta (List Code))) (function (_ state) (do try.monad @@ -40,7 +40,7 @@ (#try.Failure error) ((meta.failure (exception.error ..expansion_failed [name inputs error])) state))))) -(def: #export (expand_one expander name macro inputs) +(def: .public (expand_one expander name macro inputs) (-> Expander Name Macro (List Code) (Meta Code)) (do meta.monad [expansion (expand expander name macro inputs)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux index bb8a578bd..5383d2ae4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux @@ -20,11 +20,11 @@ [archive [descriptor (#+ Module)]]]]]) -(type: #export (Component state phase) +(type: .public (Component state phase) {#state state #phase phase}) -(type: #export (State anchor expression directive) +(type: .public (State anchor expression directive) {#analysis (Component analysis.State+ analysis.Phase) #synthesis (Component synthesis.State+ @@ -32,26 +32,26 @@ #generation (Component (generation.State+ anchor expression directive) (generation.Phase anchor expression directive))}) -(type: #export Import +(type: .public Import {#module Module #alias Text}) -(type: #export Requirements +(type: .public Requirements {#imports (List Import) #referrals (List Code)}) -(def: #export no_requirements +(def: .public no_requirements Requirements {#imports (list) #referrals (list)}) -(def: #export (merge_requirements left right) +(def: .public (merge_requirements left right) (-> Requirements Requirements Requirements) {#imports (list\compose (get@ #imports left) (get@ #imports right)) #referrals (list\compose (get@ #referrals left) (get@ #referrals right))}) (template [<special> <general>] - [(type: #export (<special> anchor expression directive) + [(type: .public (<special> anchor expression directive) (<general> (..State anchor expression directive) Code Requirements))] [State+ extension.State] @@ -62,7 +62,7 @@ ) (template [<name> <component> <phase>] - [(def: #export <name> + [(def: .public <name> (All [anchor expression directive] (Operation anchor expression directive <phase>)) (function (_ [bundle state]) @@ -74,7 +74,7 @@ ) (template [<name> <component> <operation>] - [(def: #export <name> + [(def: .public <name> (All [anchor expression directive output] (-> (<operation> output) (Operation anchor expression directive output))) @@ -87,7 +87,7 @@ [lift_generation #..generation (generation.Operation anchor expression directive)] ) -(def: #export (set_current_module module) +(def: .public (set_current_module module) (All [anchor expression directive] (-> Module (Operation anchor expression directive Any))) (do phase.monad diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux index 856a044fb..f32b12865 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -30,18 +30,18 @@ ["." descriptor (#+ Module)] ["." artifact]]]]]) -(type: #export Context +(type: .public Context [archive.ID artifact.ID]) -(type: #export (Buffer directive) +(type: .public (Buffer directive) (Row [artifact.ID (Maybe Text) directive])) -(exception: #export (cannot_interpret {error Text}) +(exception: .public (cannot_interpret {error Text}) (exception.report ["Error" error])) (template [<name>] - [(exception: #export (<name> {artifact_id artifact.ID}) + [(exception: .public (<name> {artifact_id artifact.ID}) (exception.report ["Artifact ID" (%.nat artifact_id)]))] @@ -49,7 +49,7 @@ [no_buffer_for_saving_code] ) -(interface: #export (Host expression directive) +(interface: .public (Host expression directive) (: (-> Context expression (Try Any)) evaluate!) (: (-> directive (Try Any)) @@ -64,7 +64,7 @@ (: (-> Context (Maybe Text) directive (Try Any)) re_load)) -(type: #export (State anchor expression directive) +(type: .public (State anchor expression directive) {#module Module #anchor (Maybe anchor) #host (Host expression directive) @@ -75,7 +75,7 @@ #log (Row Text)}) (template [<special> <general>] - [(type: #export (<special> anchor expression directive) + [(type: .public (<special> anchor expression directive) (<general> (State anchor expression directive) Synthesis expression))] [State+ extension.State] @@ -86,7 +86,7 @@ [Extender extension.Extender] ) -(def: #export (state host module) +(def: .public (state host module) (All [anchor expression directive] (-> (Host expression directive) Module @@ -100,14 +100,14 @@ #context #.None #log row.empty}) -(def: #export empty_buffer Buffer row.empty) +(def: .public empty_buffer Buffer row.empty) (template [<tag> <with_declaration> <with_type> <with_value> <set> <get> <get_type> <exception>] - [(exception: #export <exception>) + [(exception: .public <exception>) - (def: #export <with_declaration> + (def: .public <with_declaration> (All [anchor expression directive output] <with_type>) (function (_ body) (function (_ [bundle state]) @@ -119,7 +119,7 @@ (#try.Failure error) (#try.Failure error))))) - (def: #export <get> + (def: .public <get> (All [anchor expression directive] (Operation anchor expression directive <get_type>)) (function (_ (^@ stateE [bundle state])) @@ -130,7 +130,7 @@ #.None (exception.except <exception> [])))) - (def: #export (<set> value) + (def: .public (<set> value) (All [anchor expression directive] (-> <get_type> (Operation anchor expression directive Any))) (function (_ [bundle state]) @@ -152,20 +152,20 @@ set_buffer buffer (Buffer directive) no_active_buffer] ) -(def: #export get_registry +(def: .public get_registry (All [anchor expression directive] (Operation anchor expression directive artifact.Registry)) (function (_ (^@ stateE [bundle state])) (#try.Success [stateE (get@ #registry state)]))) -(def: #export (set_registry value) +(def: .public (set_registry value) (All [anchor expression directive] (-> artifact.Registry (Operation anchor expression directive Any))) (function (_ [bundle state]) (#try.Success [[bundle (set@ #registry value state)] []]))) -(def: #export next +(def: .public next (All [anchor expression directive] (Operation anchor expression directive Nat)) (do phase.monad @@ -173,22 +173,22 @@ _ (extension.update (update@ #counter inc))] (in count))) -(def: #export (gensym prefix) +(def: .public (gensym prefix) (All [anchor expression directive] (-> Text (Operation anchor expression directive Text))) (\ phase.monad map (|>> %.nat (format prefix)) ..next)) -(def: #export (enter_module module) +(def: .public (enter_module module) (All [anchor expression directive] (-> Module (Operation anchor expression directive Any))) (extension.update (set@ #module module))) -(def: #export module +(def: .public module (All [anchor expression directive] (Operation anchor expression directive Module)) (extension.read (get@ #module))) -(def: #export (evaluate! label code) +(def: .public (evaluate! label code) (All [anchor expression directive] (-> Context expression (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) @@ -199,7 +199,7 @@ (#try.Failure error) (exception.except ..cannot_interpret error)))) -(def: #export (execute! code) +(def: .public (execute! code) (All [anchor expression directive] (-> directive (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) @@ -210,7 +210,7 @@ (#try.Failure error) (exception.except ..cannot_interpret error)))) -(def: #export (define! context custom code) +(def: .public (define! context custom code) (All [anchor expression directive] (-> Context (Maybe Text) expression (Operation anchor expression directive [Text Any directive]))) (function (_ (^@ stateE [bundle state])) @@ -221,7 +221,7 @@ (#try.Failure error) (exception.except ..cannot_interpret error)))) -(def: #export (save! artifact_id custom code) +(def: .public (save! artifact_id custom code) (All [anchor expression directive] (-> artifact.ID (Maybe Text) directive (Operation anchor expression directive Any))) (do {! phase.monad} @@ -237,7 +237,7 @@ (phase.except ..no_buffer_for_saving_code [artifact_id])))) (template [<name> <artifact>] - [(def: #export (<name> name) + [(def: .public (<name> name) (All [anchor expression directive] (-> Text (Operation anchor expression directive artifact.ID))) (function (_ (^@ stateE [bundle state])) @@ -253,14 +253,14 @@ [learn_directive artifact.directive] ) -(exception: #export (unknown_definition {name Name} +(exception: .public (unknown_definition {name Name} {known_definitions (List Text)}) (exception.report ["Definition" (name.short name)] ["Module" (name.module name)] ["Known Definitions" (exception.listing function.identity known_definitions)])) -(def: #export (remember archive name) +(def: .public (remember archive name) (All [anchor expression directive] (-> Archive Name (Operation anchor expression directive Context))) (function (_ (^@ stateE [bundle state])) @@ -279,9 +279,9 @@ (#.Some id) (#try.Success [stateE [module_id id]])))))) -(exception: #export no_context) +(exception: .public no_context) -(def: #export (module_id module archive) +(def: .public (module_id module archive) (All [anchor expression directive] (-> Module Archive (Operation anchor expression directive archive.ID))) (function (_ (^@ stateE [bundle state])) @@ -289,7 +289,7 @@ [module_id (archive.id module archive)] (in [stateE module_id])))) -(def: #export (context archive) +(def: .public (context archive) (All [anchor expression directive] (-> Archive (Operation anchor expression directive Context))) (function (_ (^@ stateE [bundle state])) @@ -302,7 +302,7 @@ [module_id (archive.id (get@ #module state) archive)] (in [stateE [module_id id]]))))) -(def: #export (with_context id body) +(def: .public (with_context id body) (All [anchor expression directive a] (-> artifact.ID (Operation anchor expression directive a) @@ -313,7 +313,7 @@ (in [[bundle' (set@ #context (get@ #context state) state')] output])))) -(def: #export (with_new_context archive body) +(def: .public (with_new_context archive body) (All [anchor expression directive a] (-> Archive (Operation anchor expression directive a) (Operation anchor expression directive [Context a]))) @@ -328,7 +328,7 @@ [[module_id id] output]]))))) -(def: #export (log! message) +(def: .public (log! message) (All [anchor expression directive a] (-> Text (Operation anchor expression directive Any))) (function (_ [bundle state]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux index faa4089a1..d760db44f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux @@ -28,7 +28,7 @@ [meta [archive (#+ Archive)]]]]]]) -(exception: #export (unrecognized_syntax {code Code}) +(exception: .public (unrecognized_syntax {code Code}) (exception.report ["Code" (%.code code)])) ## TODO: Had to split the 'compile' function due to compilation issues @@ -132,7 +132,7 @@ _ (//.except ..unrecognized_syntax [location.dummy code']))) -(def: #export (phase expander) +(def: .public (phase expander) (-> Expander Phase) (function (compile archive code) (let [[location code'] code] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux index 7f539ae4e..0d106fe5a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -34,29 +34,29 @@ [/// ["#" phase]]]]]]) -(exception: #export (cannot_match_with_pattern {type Type} {pattern Code}) +(exception: .public (cannot_match_with_pattern {type Type} {pattern Code}) (exception.report ["Type" (%.type type)] ["Pattern" (%.code pattern)])) -(exception: #export (sum_has_no_case {case Nat} {type Type}) +(exception: .public (sum_has_no_case {case Nat} {type Type}) (exception.report ["Case" (%.nat case)] ["Type" (%.type type)])) -(exception: #export (not_a_pattern {code Code}) +(exception: .public (not_a_pattern {code Code}) (exception.report ["Code" (%.code code)])) -(exception: #export (cannot_simplify_for_pattern_matching {type Type}) +(exception: .public (cannot_simplify_for_pattern_matching {type Type}) (exception.report ["Type" (%.type type)])) -(exception: #export (non_exhaustive_pattern_matching {input Code} {branches (List [Code Code])} {coverage Coverage}) +(exception: .public (non_exhaustive_pattern_matching {input Code} {branches (List [Code Code])} {coverage Coverage}) (exception.report ["Input" (%.code input)] ["Branches" (%.code (code.record branches))] ["Coverage" (/coverage.%coverage coverage)])) -(exception: #export (cannot_have_empty_branches {message Text}) +(exception: .public (cannot_have_empty_branches {message Text}) message) (def: (re_quantify envs baseT) @@ -298,7 +298,7 @@ (/.except ..not_a_pattern pattern) )) -(def: #export (case analyse branches archive inputC) +(def: .public (case analyse branches archive inputC) (-> Phase (List [Code Code]) Phase) (.case branches (#.Item [patternH bodyH] branchesT) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux index 91052853b..6b949ea29 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux @@ -24,7 +24,7 @@ [/// ["#" phase ("#\." monad)]]]]) -(exception: #export (invalid_tuple_pattern) +(exception: .public (invalid_tuple_pattern) "Tuple size must be >= 2") (def: cases @@ -47,7 +47,7 @@ ## The #Partial tag covers arbitrary partial coverages in a general ## way, while the other tags cover more specific cases for bits ## and variants. -(type: #export #rec Coverage +(type: .public #rec Coverage #Partial (#Bit Bit) (#Variant (Maybe Nat) (Dictionary Nat Coverage)) @@ -55,7 +55,7 @@ (#Alt Coverage Coverage) #Exhaustive) -(def: #export (exhaustive? coverage) +(def: .public (exhaustive? coverage) (-> Coverage Bit) (case coverage (#Exhaustive _) @@ -64,7 +64,7 @@ _ #0)) -(def: #export (%coverage value) +(def: .public (%coverage value) (Format Coverage) (case value #Partial @@ -94,7 +94,7 @@ #Exhaustive "#Exhaustive")) -(def: #export (determine pattern) +(def: .public (determine pattern) (-> Pattern (Operation Coverage)) (case pattern (^or (#/.Simple #/.Unit) @@ -165,7 +165,7 @@ ## always be a pattern prior to them that would match the input. ## Because of that, the presence of redundant patterns is assumed to ## be a bug, likely due to programmer carelessness. -(exception: #export (redundant_pattern {so_far Coverage} {addition Coverage}) +(exception: .public (redundant_pattern {so_far Coverage} {addition Coverage}) (exception.report ["Coverage so-far" (%coverage so_far)] ["Coverage addition" (%coverage addition)])) @@ -210,7 +210,7 @@ (open: "coverage/." ..equivalence) -(exception: #export (variants_do_not_match {addition_cases Nat} {so_far_cases Nat}) +(exception: .public (variants_do_not_match {addition_cases Nat} {so_far_cases Nat}) (exception.report ["So-far Cases" (%.nat so_far_cases)] ["Addition Cases" (%.nat addition_cases)])) @@ -219,7 +219,7 @@ ## necessary to merge them all to figure out if the entire ## pattern-matching expression is exhaustive and whether it contains ## redundant patterns. -(def: #export (merged addition so_far) +(def: .public (merged addition so_far) (-> Coverage Coverage (Try Coverage)) (case [addition so_far] [#Partial #Partial] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux index 0ebfb304f..3797288ae 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -27,13 +27,13 @@ [reference (#+) [variable (#+)]]]]]]) -(exception: #export (cannot_analyse {expected Type} {function Text} {argument Text} {body Code}) +(exception: .public (cannot_analyse {expected Type} {function Text} {argument Text} {body Code}) (ex.report ["Type" (%.type expected)] ["Function" function] ["Argument" argument] ["Body" (%.code body)])) -(exception: #export (cannot_apply {functionT Type} {functionC Code} {arguments (List Code)}) +(exception: .public (cannot_apply {functionT Type} {functionC Code} {arguments (List Code)}) (ex.report ["Function type" (%.type functionT)] ["Function" (%.code functionC)] ["Arguments" (|> arguments @@ -42,7 +42,7 @@ (format (%.nat idx) " " (%.code argC)))) (text.join_with text.new_line))])) -(def: #export (function analyse function_name arg_name archive body) +(def: .public (function analyse function_name arg_name archive body) (-> Phase Text Text Phase) (do {! ///.monad} [functionT (///extension.lift meta.expected_type)] @@ -105,7 +105,7 @@ (/.failure "") ))))) -(def: #export (apply analyse argsC+ functionT functionA archive functionC) +(def: .public (apply analyse argsC+ functionT functionA archive functionC) (-> Phase (List Code) Type Analysis Phase) (<| (/.with_stack ..cannot_apply [functionT functionC argsC+]) (do ///.monad diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux index 8daf5242f..f7980c7ec 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux @@ -28,29 +28,29 @@ [meta [archive (#+ Archive)]]]]]]) -(exception: #export (variant_tag_out_of_bounds {size Nat} {tag Tag} {type Type}) +(exception: .public (variant_tag_out_of_bounds {size Nat} {tag Tag} {type Type}) (exception.report ["Tag" (%.nat tag)] ["Variant size" (%.int (.int size))] ["Variant type" (%.type type)])) -(exception: #export (cannot_infer {type Type} {args (List Code)}) +(exception: .public (cannot_infer {type Type} {args (List Code)}) (exception.report ["Type" (%.type type)] ["Arguments" (exception.listing %.code args)])) -(exception: #export (cannot_infer_argument {inferred Type} {argument Code}) +(exception: .public (cannot_infer_argument {inferred Type} {argument Code}) (exception.report ["Inferred Type" (%.type inferred)] ["Argument" (%.code argument)])) -(exception: #export (smaller_variant_than_expected {expected Nat} {actual Nat}) +(exception: .public (smaller_variant_than_expected {expected Nat} {actual Nat}) (exception.report ["Expected" (%.int (.int expected))] ["Actual" (%.int (.int actual))])) (template [<name>] - [(exception: #export (<name> {type Type}) + [(exception: .public (<name> {type Type}) (%.type type))] [not_a_variant_type] @@ -107,7 +107,7 @@ ## tagged variants). ## But, so long as the type being used for the inference can be treated ## as a function type, this method of inference should work. -(def: #export (general archive analyse inferT args) +(def: .public (general archive analyse inferT args) (-> Archive Phase Type (List Code) (Operation [Type (List Analysis)])) (case args #.End @@ -234,12 +234,12 @@ _ (/.except ..not_a_record_type inferT))) -(def: #export (record inferT) +(def: .public (record inferT) (-> Type (Operation Type)) (record' (n.- 2 0) inferT inferT)) ## Turns a variant type into the kind of function type suitable for inference. -(def: #export (variant tag expected_size inferT) +(def: .public (variant tag expected_size inferT) (-> Nat Nat Type (Operation Type)) (loop [depth 0 currentT inferT] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux index b0d9920df..4bdb708bd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux @@ -22,19 +22,19 @@ [/// ["#" phase]]]]) -(type: #export Tag Text) +(type: .public Tag Text) -(exception: #export (unknown_module {module Text}) +(exception: .public (unknown_module {module Text}) (exception.report ["Module" module])) -(exception: #export (cannot_declare_tag_twice {module Text} {tag Text}) +(exception: .public (cannot_declare_tag_twice {module Text} {tag Text}) (exception.report ["Module" module] ["Tag" tag])) (template [<name>] - [(exception: #export (<name> {tags (List Text)} {owner Type}) + [(exception: .public (<name> {tags (List Text)} {owner Type}) (exception.report ["Tags" (text.join_with " " tags)] ["Type" (%.type owner)]))] @@ -43,7 +43,7 @@ [cannot_declare_tags_for_foreign_type] ) -(exception: #export (cannot_define_more_than_once {name Name} {already_existing Global}) +(exception: .public (cannot_define_more_than_once {name Name} {already_existing Global}) (exception.report ["Definition" (%.name name)] ["Original" (case already_existing @@ -53,7 +53,7 @@ (#.Definition definition) (format "definition " (%.name name)))])) -(exception: #export (can_only_change_state_of_active_module {module Text} {state Module_State}) +(exception: .public (can_only_change_state_of_active_module {module Text} {state Module_State}) (exception.report ["Module" module] ["Desired state" (case state @@ -61,13 +61,13 @@ #.Compiled "Compiled" #.Cached "Cached")])) -(exception: #export (cannot_set_module_annotations_more_than_once {module Text} {old Code} {new Code}) +(exception: .public (cannot_set_module_annotations_more_than_once {module Text} {old Code} {new Code}) (exception.report ["Module" module] ["Old annotations" (%.code old)] ["New annotations" (%.code new)])) -(def: #export (empty hash) +(def: .public (empty hash) (-> Nat Module) {#.module_hash hash #.module_aliases (list) @@ -78,7 +78,7 @@ #.module_annotations #.None #.module_state #.Active}) -(def: #export (set_annotations annotations) +(def: .public (set_annotations annotations) (-> Code (Operation Any)) (///extension.lift (do ///.monad @@ -95,7 +95,7 @@ (#.Some old) (/.except' cannot_set_module_annotations_more_than_once [self_name old annotations]))))) -(def: #export (import module) +(def: .public (import module) (-> Text (Operation Any)) (///extension.lift (do ///.monad @@ -110,7 +110,7 @@ state) []]))))) -(def: #export (alias alias module) +(def: .public (alias alias module) (-> Text Text (Operation Any)) (///extension.lift (do ///.monad @@ -122,7 +122,7 @@ state) []]))))) -(def: #export (exists? module) +(def: .public (exists? module) (-> Text (Operation Bit)) (///extension.lift (function (_ state) @@ -132,7 +132,7 @@ (case> (#.Some _) #1 #.None #0) [state] #try.Success)))) -(def: #export (define name definition) +(def: .public (define name definition) (-> Text Global (Operation Any)) (///extension.lift (do ///.monad @@ -153,7 +153,7 @@ (#.Some already_existing) ((/.except' ..cannot_define_more_than_once [[self_name name] already_existing]) state)))))) -(def: #export (create hash name) +(def: .public (create hash name) (-> Nat Text (Operation Any)) (///extension.lift (function (_ state) @@ -162,7 +162,7 @@ state) []])))) -(def: #export (with_module hash name action) +(def: .public (with_module hash name action) (All [a] (-> Nat Text (Operation a) (Operation [Module a]))) (do ///.monad [_ (create hash name) @@ -172,7 +172,7 @@ (in [module output]))) (template [<setter> <asker> <tag>] - [(def: #export (<setter> module_name) + [(def: .public (<setter> module_name) (-> Text (Operation Any)) (///extension.lift (function (_ state) @@ -192,7 +192,7 @@ #.None ((/.except' unknown_module module_name) state))))) - (def: #export (<asker> module_name) + (def: .public (<asker> module_name) (-> Text (Operation Bit)) (///extension.lift (function (_ state) @@ -243,7 +243,7 @@ tags)] (in []))) -(def: #export (declare_tags tags exported? type) +(def: .public (declare_tags tags exported? type) (-> (List Tag) Bit Type (Operation Any)) (do ///.monad [self_name (///extension.lift meta.current_module_name) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index 4840dca2a..2b82d55a4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -12,7 +12,7 @@ ["#" phase]]]]]) (template [<name> <type> <tag>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> <type> (Operation Analysis)) (do ///.monad [_ (//type.infer <type>)] @@ -26,7 +26,7 @@ [text .Text #/.Text] ) -(def: #export unit +(def: .public unit (Operation Analysis) (do ///.monad [_ (//type.infer .Any)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux index 25f478f04..92e43368e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -20,12 +20,12 @@ ["#." reference] ["#" phase]]]]]) -(exception: #export (foreign_module_has_not_been_imported {current Text} {foreign Text}) +(exception: .public (foreign_module_has_not_been_imported {current Text} {foreign Text}) (exception.report ["Current" current] ["Foreign" foreign])) -(exception: #export (definition_has_not_been_exported {definition Name}) +(exception: .public (definition_has_not_been_exported {definition Name}) (exception.report ["Definition" (%.name definition)])) @@ -66,7 +66,7 @@ #.None (in #.None)))) -(def: #export (reference reference) +(def: .public (reference reference) (-> Name (Operation Analysis)) (case reference ["" simple_name] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux index 3ccfd3551..2906b9fe8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux @@ -73,7 +73,7 @@ _ (..captured name scope))) -(def: #export (find name) +(def: .public (find name) (-> Text (Operation (Maybe [Type Variable]))) (///extension.lift (function (_ state) @@ -103,10 +103,10 @@ (#.Some [ref_type ref])])) ))))) -(exception: #export cannot_create_local_binding_without_a_scope) -(exception: #export invalid_scope_alteration) +(exception: .public cannot_create_local_binding_without_a_scope) +(exception: .public invalid_scope_alteration) -(def: #export (with_local [name type] action) +(def: .public (with_local [name type] action) (All [a] (-> [Text Type] (Operation a) (Operation a))) (function (_ [bundle state]) (case (get@ #.scopes state) @@ -155,7 +155,7 @@ #.locals init_locals #.captured init_captured}) -(def: #export (with_scope name action) +(def: .public (with_scope name action) (All [a] (-> Text (Operation a) (Operation a))) (function (_ [bundle state]) (let [parent_name (case (get@ #.scopes state) @@ -177,9 +177,9 @@ (#try.Failure error))) )) -(exception: #export cannot_get_next_reference_when_there_is_no_scope) +(exception: .public cannot_get_next_reference_when_there_is_no_scope) -(def: #export next_local +(def: .public next_local (Operation Register) (///extension.lift (function (_ state) @@ -199,7 +199,7 @@ (#.Captured register) (#variable.Foreign register))) -(def: #export (environment scope) +(def: .public (environment scope) (-> Scope (List Variable)) (|> scope (get@ [#.captured #.mappings]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 5e3717c5b..50afd0eed 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -36,13 +36,13 @@ [meta [archive (#+ Archive)]]]]]]) -(exception: #export (invalid_variant_type {type Type} {tag Tag} {code Code}) +(exception: .public (invalid_variant_type {type Type} {tag Tag} {code Code}) (ex.report ["Type" (%.type type)] ["Tag" (%.nat tag)] ["Expression" (%.code code)])) (template [<name>] - [(exception: #export (<name> {type Type} {members (List Code)}) + [(exception: .public (<name> {type Type} {members (List Code)}) (ex.report ["Type" (%.type type)] ["Expression" (%.code (` [(~+ members)]))]))] @@ -50,11 +50,11 @@ [cannot_analyse_tuple] ) -(exception: #export (not_a_quantified_type {type Type}) +(exception: .public (not_a_quantified_type {type Type}) (%.type type)) (template [<name>] - [(exception: #export (<name> {type Type} {tag Tag} {code Code}) + [(exception: .public (<name> {type Type} {tag Tag} {code Code}) (ex.report ["Type" (%.type type)] ["Tag" (%.nat tag)] ["Expression" (%.code code)]))] @@ -63,12 +63,12 @@ [cannot_infer_numeric_tag] ) -(exception: #export (record_keys_must_be_tags {key Code} {record (List [Code Code])}) +(exception: .public (record_keys_must_be_tags {key Code} {record (List [Code Code])}) (ex.report ["Key" (%.code key)] ["Record" (%.code (code.record record))])) (template [<name>] - [(exception: #export (<name> {key Name} {record (List [Name Code])}) + [(exception: .public (<name> {key Name} {record (List [Name Code])}) (ex.report ["Tag" (%.code (code.tag key))] ["Record" (%.code (code.record (list\map (function (_ [keyI valC]) [(code.tag keyI) valC]) @@ -77,11 +77,11 @@ [cannot_repeat_tag] ) -(exception: #export (tag_does_not_belong_to_record {key Name} {type Type}) +(exception: .public (tag_does_not_belong_to_record {key Name} {type Type}) (ex.report ["Tag" (%.code (code.tag key))] ["Type" (%.type type)])) -(exception: #export (record_size_mismatch {expected Nat} {actual Nat} {type Type} {record (List [Name Code])}) +(exception: .public (record_size_mismatch {expected Nat} {actual Nat} {type Type} {record (List [Name Code])}) (ex.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)] ["Type" (%.type type)] @@ -90,7 +90,7 @@ [(code.tag keyI) valueC])) code.record))])) -(def: #export (sum analyse lefts right? archive) +(def: .public (sum analyse lefts right? archive) (-> Phase Nat Bit Phase) (let [tag (/.tag lefts right?)] (function (recur valueC) @@ -192,7 +192,7 @@ (/.except ..cannot_analyse_tuple [expectedT members]))))] (in (/.tuple membersA+)))) -(def: #export (product archive analyse membersC) +(def: .public (product archive analyse membersC) (-> Archive Phase (List Code) (Operation Analysis)) (do {! ///.monad} [expectedT (///extension.lift meta.expected_type)] @@ -259,7 +259,7 @@ (/.except ..invalid_tuple_type [expectedT membersC]) )))) -(def: #export (tagged_sum analyse tag archive valueC) +(def: .public (tagged_sum analyse tag archive valueC) (-> Phase Name Phase) (do {! ///.monad} [tag (///extension.lift (meta.normal tag)) @@ -281,7 +281,7 @@ ## records, so they must be normalized for further analysis. ## Normalization just means that all the tags get resolved to their ## canonical form (with their corresponding module identified). -(def: #export (normal record) +(def: .public (normal record) (-> (List [Code Code]) (Operation (List [Name Code]))) (monad.map ///.monad (function (_ [key val]) @@ -298,7 +298,7 @@ ## Lux already possesses the means to analyse tuples, so ## re-implementing the same functionality for records makes no sense. ## Records, thus, get transformed into tuples by ordering the elements. -(def: #export (order record) +(def: .public (order record) (-> (List [Name Code]) (Operation [(List Code) Type])) (case record ## empty_record = empty_tuple = unit = [] @@ -336,7 +336,7 @@ (in [ordered_tuple recordT])) )) -(def: #export (record archive analyse members) +(def: .public (record archive analyse members) (-> Archive Phase (List [Code Code]) (Operation Analysis)) (case members (^ (list)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux index f530c80ae..374663c95 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux @@ -16,12 +16,12 @@ [/// ["#" phase]]]]) -(def: #export (with_type expected) +(def: .public (with_type expected) (All [a] (-> Type (Operation a) (Operation a))) (///extension.localized (get@ #.expected) (set@ #.expected) (function.constant (#.Some expected)))) -(def: #export (with_env action) +(def: .public (with_env action) (All [a] (-> (Check a) (Operation a))) (function (_ (^@ stateE [bundle state])) (case (action (get@ #.type_context state)) @@ -32,19 +32,19 @@ (#try.Failure error) ((/.failure error) stateE)))) -(def: #export with_fresh_env +(def: .public with_fresh_env (All [a] (-> (Operation a) (Operation a))) (///extension.localized (get@ #.type_context) (set@ #.type_context) (function.constant check.fresh_context))) -(def: #export (infer actualT) +(def: .public (infer actualT) (-> Type (Operation Any)) (do ///.monad [expectedT (///extension.lift meta.expected_type)] (with_env (check.check expectedT actualT)))) -(def: #export (with_inference action) +(def: .public (with_inference action) (All [a] (-> (Operation a) (Operation [Type a]))) (do ///.monad [[_ varT] (..with_env diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux index ef7cffba4..8bb5d475f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux @@ -24,20 +24,20 @@ [reference (#+) [variable (#+)]]]]]) -(exception: #export (not_a_directive {code Code}) +(exception: .public (not_a_directive {code Code}) (exception.report ["Directive" (%.code code)])) -(exception: #export (invalid_macro_call {code Code}) +(exception: .public (invalid_macro_call {code Code}) (exception.report ["Code" (%.code code)])) -(exception: #export (macro_was_not_found {name Name}) +(exception: .public (macro_was_not_found {name Name}) (exception.report ["Name" (%.name name)])) (with_expansions [<lux_def_module> (as_is [|form_location| (#.Form (list& [|text_location| (#.Text "lux def module")] annotations))])] - (def: #export (phase expander) + (def: .public (phase expander) (-> Expander Phase) (let [analyze (//analysis.phase expander)] (function (recur archive code) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux index 60f625250..0620b8c01 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux @@ -21,61 +21,61 @@ [meta [archive (#+ Archive)]]]) -(type: #export Name +(type: .public Name Text) -(type: #export (Extension a) +(type: .public (Extension a) [Name (List a)]) -(def: #export equivalence +(def: .public equivalence (All [a] (-> (Equivalence a) (Equivalence (Extension a)))) (|>> list.equivalence (product.equivalence text.equivalence))) -(def: #export hash +(def: .public hash (All [a] (-> (Hash a) (Hash (Extension a)))) (|>> list.hash (product.hash text.hash))) (with_expansions [<Bundle> (as_is (Dictionary Name (Handler s i o)))] - (type: #export (Handler s i o) + (type: .public (Handler s i o) (-> Name (//.Phase [<Bundle> s] i o) (//.Phase [<Bundle> s] (List i) o))) - (type: #export (Bundle s i o) + (type: .public (Bundle s i o) <Bundle>)) -(def: #export empty +(def: .public empty Bundle (dictionary.empty text.hash)) -(type: #export (State s i o) +(type: .public (State s i o) {#bundle (Bundle s i o) #state s}) -(type: #export (Operation s i o v) +(type: .public (Operation s i o v) (//.Operation (State s i o) v)) -(type: #export (Phase s i o) +(type: .public (Phase s i o) (//.Phase (State s i o) i o)) -(exception: #export (cannot_overwrite {name Name}) +(exception: .public (cannot_overwrite {name Name}) (exception.report ["Extension" (%.text name)])) -(exception: #export (incorrect_arity {name Name} {arity Nat} {args Nat}) +(exception: .public (incorrect_arity {name Name} {arity Nat} {args Nat}) (exception.report ["Extension" (%.text name)] ["Expected" (%.nat arity)] ["Actual" (%.nat args)])) -(exception: #export [a] (invalid_syntax {name Name} {%format (Format a)} {inputs (List a)}) +(exception: .public [a] (invalid_syntax {name Name} {%format (Format a)} {inputs (List a)}) (exception.report ["Extension" (%.text name)] ["Inputs" (exception.listing %format inputs)])) -(exception: #export [s i o] (unknown {name Name} {bundle (Bundle s i o)}) +(exception: .public [s i o] (unknown {name Name} {bundle (Bundle s i o)}) (exception.report ["Extension" (%.text name)] ["Available" (|> bundle @@ -83,10 +83,10 @@ (list.sort text\<) (exception.listing %.text))])) -(type: #export (Extender s i o) +(type: .public (Extender s i o) (-> Any (Handler s i o))) -(def: #export (install extender name handler) +(def: .public (install extender name handler) (All [s i o] (-> (Extender s i o) Text (Handler s i o) (Operation s i o Any))) (function (_ [bundle state]) @@ -98,7 +98,7 @@ _ (exception.except ..cannot_overwrite name)))) -(def: #export (with extender extensions) +(def: .public (with extender extensions) (All [s i o] (-> Extender (Bundle s i o) (Operation s i o Any))) (|> extensions @@ -108,7 +108,7 @@ (..install extender extension handle)) []))) -(def: #export (apply archive phase [name parameters]) +(def: .public (apply archive phase [name parameters]) (All [s i o] (-> Archive (Phase s i o) (Extension i) (Operation s i o o))) (function (_ (^@ stateE [bundle state])) @@ -120,7 +120,7 @@ #.None (exception.except ..unknown [name bundle])))) -(def: #export (localized get set transform) +(def: .public (localized get set transform) (All [s s' i o v] (-> (-> s s') (-> s' s s) (-> s' s') (-> (Operation s i o v) (Operation s i o v)))) @@ -134,7 +134,7 @@ (#try.Failure error) (#try.Failure error)))))) -(def: #export (temporary transform) +(def: .public (temporary transform) (All [s i o v] (-> (-> s s) (-> (Operation s i o v) (Operation s i o v)))) @@ -147,24 +147,24 @@ (#try.Failure error) (#try.Failure error))))) -(def: #export (with_state state) +(def: .public (with_state state) (All [s i o v] (-> s (-> (Operation s i o v) (Operation s i o v)))) (..temporary (function.constant state))) -(def: #export (read get) +(def: .public (read get) (All [s i o v] (-> (-> s v) (Operation s i o v))) (function (_ [bundle state]) (#try.Success [[bundle state] (get state)]))) -(def: #export (update transform) +(def: .public (update transform) (All [s i o] (-> (-> s s) (Operation s i o Any))) (function (_ [bundle state]) (#try.Success [[bundle (transform state)] []]))) -(def: #export (lift action) +(def: .public (lift action) (All [s i o v] (-> (//.Operation s v) (//.Operation [(Bundle s i o) s] v))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux index 0def3e75d..096b659a2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux @@ -10,7 +10,7 @@ ["." / #_ ["#." lux]]) -(def: #export (bundle eval host_specific) +(def: .public (bundle eval host_specific) (-> Eval Bundle Bundle) (dictionary.merged host_specific (/lux.bundle eval))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux index 348124448..ea770d3a9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux @@ -28,7 +28,7 @@ [/// ["." phase]]]]]]) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "common_lisp") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index a0c430e81..b085da3c0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -204,7 +204,7 @@ (in (#analysis.Extension extension (list (analysis.nat arity) abstractionA)))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "js") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 87dca360f..b98b2732a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -115,7 +115,7 @@ (getDeclaredAnnotations [] [java/lang/annotation/Annotation])]) (template [<name>] - [(exception: #export (<name> {class External} {field Text}) + [(exception: .public (<name> {class External} {field Text}) (exception.report ["Class" (%.text class)] ["Field" (%.text field)]))] @@ -124,13 +124,13 @@ [deprecated_field] ) -(exception: #export (deprecated_method {class External} {method Text} {type .Type}) +(exception: .public (deprecated_method {class External} {method Text} {type .Type}) (exception.report ["Class" (%.text class)] ["Method" (%.text method)] ["Type" (%.type type)])) -(exception: #export (deprecated_class {class External}) +(exception: .public (deprecated_class {class External}) (exception.report ["Class" (%.text class)])) @@ -156,7 +156,7 @@ "java.lang.Object") (def: inheritance_relationship_type_name "_jvm_inheritance") -(def: #export (inheritance_relationship_type class super_class super_interfaces) +(def: .public (inheritance_relationship_type class super_class super_interfaces) (-> .Type .Type (List .Type) .Type) (#.Primitive ..inheritance_relationship_type_name (list& class super_class super_interfaces))) @@ -164,7 +164,7 @@ ## TODO: Get rid of this template block and use the definition in ## lux/ffi.jvm.lux ASAP (template [<name> <class>] - [(def: #export <name> .Type (#.Primitive <class> #.End))] + [(def: .public <name> .Type (#.Primitive <class> #.End))] ## Boxes [Boolean box.boolean] @@ -202,7 +202,7 @@ #exceptions (List .Type)}) (template [<name>] - [(exception: #export (<name> {type .Type}) + [(exception: .public (<name> {type .Type}) (exception.report ["Type" (%.type type)]))] @@ -213,7 +213,7 @@ ) (template [<name>] - [(exception: #export (<name> {class External}) + [(exception: .public (<name> {class External}) (exception.report ["Class/type" (%.text class)]))] @@ -223,7 +223,7 @@ ) (template [<name>] - [(exception: #export (<name> {class External} + [(exception: .public (<name> {class External} {method Text} {inputsJT (List (Type Value))} {hints (List Method_Signature)}) @@ -237,14 +237,14 @@ [too_many_candidates] ) -(exception: #export (cannot_cast {from .Type} {to .Type} {value Code}) +(exception: .public (cannot_cast {from .Type} {to .Type} {value Code}) (exception.report ["From" (%.type from)] ["To" (%.type to)] ["Value" (%.code value)])) (template [<name>] - [(exception: #export (<name> {message Text}) + [(exception: .public (<name> {message Text}) message)] [primitives_cannot_have_type_parameters] @@ -333,7 +333,7 @@ (///bundle.install "<" (//lux.binary ..char ..char Bit)) ))) -(def: #export boxes +(def: .public boxes (Dictionary External [External (Type Primitive)]) (|> (list [(reflection.reflection reflection.boolean) [box.boolean jvm.boolean]] [(reflection.reflection reflection.byte) [box.byte jvm.byte]] @@ -843,7 +843,7 @@ (/////analysis.except cannot_possibly_be_an_instance (format sub_class " !<= " object_class)))))])) (template [<name> <category> <parser>] - [(def: #export (<name> mapping typeJ) + [(def: .public (<name> mapping typeJ) (-> Mapping (Type <category>) (Operation .Type)) (case (|> typeJ ..signature (<text>.run (<parser> mapping))) (#try.Success check) @@ -1343,7 +1343,7 @@ (/////analysis.except ..too_many_candidates [class_name ..constructor_method inputsJT candidates])))) (template [<name> <category> <parser>] - [(def: #export <name> + [(def: .public <name> (Parser (Type <category>)) (<text>.then <parser> <code>.text))] @@ -1494,21 +1494,21 @@ ))) ))) -(type: #export (Annotation_Parameter a) +(type: .public (Annotation_Parameter a) [Text a]) (def: annotation_parameter (Parser (Annotation_Parameter Code)) (<code>.tuple (<>.and <code>.text <code>.any))) -(type: #export (Annotation a) +(type: .public (Annotation a) [Text (List (Annotation_Parameter a))]) -(def: #export annotation +(def: .public annotation (Parser (Annotation Code)) (<code>.form (<>.and <code>.text (<>.some ..annotation_parameter)))) -(def: #export argument +(def: .public argument (Parser Argument) (<code>.tuple (<>.and <code>.text ..type))) @@ -1587,7 +1587,7 @@ ) (template [<name>] - [(exception: #export (<name> {methods (List [Text (Type Method)])}) + [(exception: .public (<name> {methods (List [Text (Type Method)])}) (exception.report ["Methods" (exception.listing (function (_ [name type]) @@ -1598,21 +1598,21 @@ [invalid_overriden_methods] ) -(type: #export Visibility +(type: .public Visibility #Public #Private #Protected #Default) -(type: #export Finality Bit) -(type: #export Strictness Bit) +(type: .public Finality Bit) +(type: .public Strictness Bit) -(def: #export public_tag "public") -(def: #export private_tag "private") -(def: #export protected_tag "protected") -(def: #export default_tag "default") +(def: .public public_tag "public") +(def: .public private_tag "private") +(def: .public protected_tag "protected") +(def: .public default_tag "default") -(def: #export visibility +(def: .public visibility (Parser Visibility) ($_ <>.or (<code>.text! ..public_tag) @@ -1620,7 +1620,7 @@ (<code>.text! ..protected_tag) (<code>.text! ..default_tag))) -(def: #export (visibility_analysis visibility) +(def: .public (visibility_analysis visibility) (-> Visibility Analysis) (/////analysis.text (case visibility #Public ..public_tag @@ -1628,7 +1628,7 @@ #Protected ..protected_tag #Default ..default_tag))) -(type: #export (Constructor a) +(type: .public (Constructor a) [Visibility Strictness (List (Annotation a)) @@ -1639,9 +1639,9 @@ (List (Typed a)) a]) -(def: #export constructor_tag "init") +(def: .public constructor_tag "init") -(def: #export constructor_definition +(def: .public constructor_definition (Parser (Constructor Code)) (<| <code>.form (<>.after (<code>.text! ..constructor_tag)) @@ -1656,7 +1656,7 @@ (<code>.tuple (<>.some ..input)) <code>.any))) -(def: #export (analyse_constructor_method analyse archive selfT mapping method) +(def: .public (analyse_constructor_method analyse archive selfT mapping method) (-> Phase Archive .Type Mapping (Constructor Code) (Operation Analysis)) (let [[visibility strict_fp? annotations vars exceptions @@ -1705,7 +1705,7 @@ (/////analysis.tuple (list bodyA))) )))))) -(type: #export (Virtual_Method a) +(type: .public (Virtual_Method a) [Text Visibility Finality @@ -1720,7 +1720,7 @@ (def: virtual_tag "virtual") -(def: #export virtual_method_definition +(def: .public virtual_method_definition (Parser (Virtual_Method Code)) (<| <code>.form (<>.after (<code>.text! ..virtual_tag)) @@ -1737,7 +1737,7 @@ (<code>.tuple (<>.some ..class)) <code>.any))) -(def: #export (analyse_virtual_method analyse archive selfT mapping method) +(def: .public (analyse_virtual_method analyse archive selfT mapping method) (-> Phase Archive .Type Mapping (Virtual_Method Code) (Operation Analysis)) (let [[method_name visibility final? strict_fp? annotations vars @@ -1783,7 +1783,7 @@ (/////analysis.tuple (list bodyA))) )))))) -(type: #export (Static_Method a) +(type: .public (Static_Method a) [Text Visibility Strictness @@ -1794,9 +1794,9 @@ (Type Return) a]) -(def: #export static_tag "static") +(def: .public static_tag "static") -(def: #export static_method_definition +(def: .public static_method_definition (Parser (Static_Method Code)) (<| <code>.form (<>.after (<code>.text! ..static_tag)) @@ -1811,7 +1811,7 @@ ..return <code>.any))) -(def: #export (analyse_static_method analyse archive mapping method) +(def: .public (analyse_static_method analyse archive mapping method) (-> Phase Archive Mapping (Static_Method Code) (Operation Analysis)) (let [[method_name visibility strict_fp? annotations vars exceptions @@ -1855,7 +1855,7 @@ (/////analysis.tuple (list bodyA))) )))))) -(type: #export (Overriden_Method a) +(type: .public (Overriden_Method a) [(Type Class) Text Bit @@ -1867,9 +1867,9 @@ (List (Type Class)) a]) -(def: #export overriden_tag "override") +(def: .public overriden_tag "override") -(def: #export overriden_method_definition +(def: .public overriden_method_definition (Parser (Overriden_Method Code)) (<| <code>.form (<>.after (<code>.text! ..overriden_tag)) @@ -1886,12 +1886,12 @@ <code>.any ))) -(exception: #export (unknown_super {name Text} {supers (List (Type Class))}) +(exception: .public (unknown_super {name Text} {supers (List (Type Class))}) (exception.report ["Name" (%.text name)] ["Available" (exception.listing (|>> jvm_parser.read_class product.left) supers)])) -(exception: #export (mismatched_super_parameters {name Text} {expected Nat} {actual Nat}) +(exception: .public (mismatched_super_parameters {name Text} {expected Nat} {actual Nat}) (exception.report ["Name" (%.text name)] ["Expected" (%.nat expected)] @@ -1923,7 +1923,7 @@ #.None (phase.lift (exception.except ..unknown_super [parent_name supers]))))) -(def: #export (with_fresh_type_vars vars mapping) +(def: .public (with_fresh_type_vars vars mapping) (-> (List (Type Var)) Mapping (Operation Mapping)) (do {! phase.monad} [pairings (monad.map ! (function (_ var) @@ -1937,7 +1937,7 @@ mapping pairings)))) -(def: #export (with_override_mapping supers parent_type mapping) +(def: .public (with_override_mapping supers parent_type mapping) (-> (List (Type Class)) (Type Class) Mapping (Operation Mapping)) (do phase.monad [override_mapping (..override_mapping mapping supers parent_type)] @@ -1946,7 +1946,7 @@ mapping override_mapping)))) -(def: #export (hide_method_body arity bodyA) +(def: .public (hide_method_body arity bodyA) (-> Nat Analysis Analysis) (<| /////analysis.tuple (list (/////analysis.unit)) @@ -1975,7 +1975,7 @@ bodyA} (list)])))) -(def: #export (analyse_overriden_method analyse archive selfT mapping supers method) +(def: .public (analyse_overriden_method analyse archive selfT mapping supers method) (-> Phase Archive .Type Mapping (List (Type Class)) (Overriden_Method Code) (Operation Analysis)) (let [[parent_type method_name strict_fp? annotations vars @@ -2023,10 +2023,10 @@ (..hide_method_body (list.size arguments) bodyA)) )))))) -(type: #export (Method_Definition a) +(type: .public (Method_Definition a) (#Overriden_Method (Overriden_Method a))) -(def: #export parameter_types +(def: .public parameter_types (-> (List (Type Var)) (Check (List [(Type Var) .Type]))) (monad.map check.monad (function (_ parameterJ) @@ -2048,7 +2048,7 @@ not)) sub_set)) -(exception: #export (class_parameter_mismatch {expected (List Text)} +(exception: .public (class_parameter_mismatch {expected (List Text)} {actual (List (Type Parameter))}) (exception.report ["Expected (amount)" (%.nat (list.size expected))] @@ -2083,7 +2083,7 @@ local (format "anonymous-class" (%.nat id))] (format global ..jvm_package_separator local))) -(def: #export (require_complete_method_concretion class_loader supers methods) +(def: .public (require_complete_method_concretion class_loader supers methods) (-> java/lang/ClassLoader (List (Type Class)) (List (Overriden_Method Code)) (Operation Any)) (do {! phase.monad} [required_abstract_methods (phase.lift (all_abstract_methods class_loader supers)) @@ -2169,7 +2169,7 @@ (///bundle.install "anonymous" (class::anonymous class_loader)) ))) -(def: #export (bundle class_loader) +(def: .public (bundle class_loader) (-> java/lang/ClassLoader Bundle) (<| (///bundle.prefix "jvm") (|> ///bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux index 50c8dfe2a..2fe863c2a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux @@ -235,7 +235,7 @@ (in (#analysis.Extension extension (list (analysis.nat arity) abstractionA)))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "lua") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 470078b0f..b3f48d4ce 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -34,7 +34,7 @@ [meta [archive (#+ Archive)]]]]]]) -(def: #export (custom [syntax handler]) +(def: .public (custom [syntax handler]) (All [s] (-> [(Parser s) (-> Text Phase Archive s (Operation Analysis))] @@ -63,25 +63,25 @@ (in (#////analysis.Extension extension_name argsA))) (////analysis.except ///.incorrect_arity [extension_name num_expected num_actual])))))) -(def: #export (nullary valueT) +(def: .public (nullary valueT) (-> Type Handler) (simple (list) valueT)) -(def: #export (unary inputT outputT) +(def: .public (unary inputT outputT) (-> Type Type Handler) (simple (list inputT) outputT)) -(def: #export (binary subjectT paramT outputT) +(def: .public (binary subjectT paramT outputT) (-> Type Type Type Handler) (simple (list subjectT paramT) outputT)) -(def: #export (trinary subjectT param0T param1T outputT) +(def: .public (trinary subjectT param0T param1T outputT) (-> Type Type Type Type Handler) (simple (list subjectT param0T param1T) outputT)) ## TODO: Get rid of this ASAP (as_is - (exception: #export (char_text_must_be_size_1 {text Text}) + (exception: .public (char_text_must_be_size_1 {text Text}) (exception.report ["Text" (%.text text)])) @@ -289,7 +289,7 @@ (///bundle.install "clip" (trinary Nat Nat Text Text)) ))) -(def: #export (bundle eval) +(def: .public (bundle eval) (-> Eval Bundle) (<| (///bundle.prefix "lux") (|> ///bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux index 0a7fc2d7d..306eb960e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux @@ -200,7 +200,7 @@ _ (analysis/type.infer Text)] (in (#analysis.Extension extension (list formatA dataA)))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "php") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux index 00a5a803a..915933925 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux @@ -216,7 +216,7 @@ _ (analysis/type.infer .Any)] (in (#analysis.Extension extension (list codeA globalsA)))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "python") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux index 6dfbf707e..00e210a54 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux @@ -28,7 +28,7 @@ [/// ["." phase]]]]]]) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "r") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux index a5328bc54..1cc151f14 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -185,7 +185,7 @@ [_ (analysis/type.infer Bit)] (in (#analysis.Extension extension (list (analysis.text name))))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "ruby") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux index 5a6776b13..2d729e701 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux @@ -145,7 +145,7 @@ _ (analysis/type.infer Any)] (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "scheme") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux index 1869c6ff4..a6ce28fc1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux @@ -11,17 +11,17 @@ ["." dictionary (#+ Dictionary)]]]]] [// (#+ Handler Bundle)]) -(def: #export empty +(def: .public empty Bundle (dictionary.empty text.hash)) -(def: #export (install name anonymous) +(def: .public (install name anonymous) (All [s i o] (-> Text (Handler s i o) (-> (Bundle s i o) (Bundle s i o)))) (dictionary.put name anonymous)) -(def: #export (prefix prefix) +(def: .public (prefix prefix) (All [s i o] (-> Text (-> (Bundle s i o) (Bundle s i o)))) (|>> dictionary.entries diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index 446c63e08..00ed63ebf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -298,7 +298,7 @@ (generation.log! (format "Class " name)))] (in directive.no_requirements)))])) -(def: #export bundle +(def: .public bundle (Bundle Anchor (Bytecode Any) Definition) (<| (bundle.prefix "jvm") (|> bundle.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index ce82ca51e..2861e1201 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -8,8 +8,8 @@ [io (#+ IO)] ["." try] ["." exception (#+ exception:)] - ["p" parser - ["s" code (#+ Parser)]]] + ["<>" parser + ["<.>" code (#+ Parser)]]] [data ["." product] ["." maybe] @@ -44,7 +44,7 @@ [meta ["." archive (#+ Archive)]]]]]]) -(def: #export (custom [syntax handler]) +(def: .public (custom [syntax handler]) (All [anchor expression directive s] (-> [(Parser s) (-> Text @@ -54,7 +54,7 @@ (Operation anchor expression directive Requirements))] (Handler anchor expression directive))) (function (_ extension_name phase archive inputs) - (case (s.run syntax inputs) + (case (<code>.run syntax inputs) (#try.Success inputs) (handler extension_name phase archive inputs) @@ -83,7 +83,7 @@ codeV (/////generation.evaluate! (..context [module_id id]) codeG)] (in [code//type codeG codeV])))) -(def: #export (evaluate! archive type codeC) +(def: .public (evaluate! archive type codeC) (All [anchor expression directive] (-> Archive Type Code (Operation anchor expression directive [Type expression Any]))) (do phase.monad @@ -170,7 +170,7 @@ _ (/////generation.save! id #.None directive)] (in [codeG value]))))) - (def: #export (<full> archive extension codeT codeC) + (def: .public (<full> archive extension codeT codeC) (All [anchor expression directive] (-> Archive Text Type Code (Operation anchor expression directive [expression Any]))) @@ -220,15 +220,16 @@ (-> Expander /////analysis.Bundle Handler) (function (_ extension_name phase archive inputsC+) (case inputsC+ - (^ (list [_ (#.Identifier ["" short_name])] valueC annotationsC [_ (#.Bit exported?)])) + (^ (list [_ (#.Identifier ["" short_name])] valueC annotationsC exported?C)) (do phase.monad [current_module (/////directive.lift_analysis (///.lift meta.current_module_name)) .let [full_name [current_module short_name]] [type valueT value] (..definition archive full_name #.None valueC) - [_ annotationsT annotations] (evaluate! archive Code annotationsC) + [_ _ exported?] (evaluate! archive Bit exported?C) + [_ _ annotations] (evaluate! archive Code annotationsC) _ (/////directive.lift_analysis - (module.define short_name (#.Right [exported? type (:as Code annotations) value]))) + (module.define short_name (#.Right [(:as Bit exported?) type (:as Code annotations) value]))) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] (in /////directive.no_requirements)) @@ -239,14 +240,16 @@ (def: (def::type_tagged expander host_analysis) (-> Expander /////analysis.Bundle Handler) (..custom - [($_ p.and s.local_identifier s.any s.any (s.tuple (p.some s.text)) s.bit) - (function (_ extension_name phase archive [short_name valueC annotationsC tags exported?]) + [($_ <>.and <code>.local_identifier <code>.any <code>.any (<code>.tuple (<>.some <code>.text)) <code>.any) + (function (_ extension_name phase archive [short_name valueC annotationsC tags exported?C]) (do phase.monad [current_module (/////directive.lift_analysis (///.lift meta.current_module_name)) .let [full_name [current_module short_name]] - [_ annotationsT annotations] (evaluate! archive Code annotationsC) - .let [annotations (:as Code annotations)] + [_ _ exported?] (evaluate! archive Bit exported?C) + [_ _ annotations] (evaluate! archive Code annotationsC) + .let [exported? (:as Bit exported?) + annotations (:as Code annotations)] [type valueT value] (..definition archive full_name (#.Some .Type) valueC) _ (/////directive.lift_analysis (do phase.monad @@ -258,17 +261,17 @@ (def: imports (Parser (List Import)) - (|> (s.tuple (p.and s.text s.text)) - p.some - s.tuple)) + (|> (<code>.tuple (<>.and <code>.text <code>.text)) + <>.some + <code>.tuple)) (def: def::module Handler (..custom - [($_ p.and s.any ..imports) + [($_ <>.and <code>.any ..imports) (function (_ extension_name phase archive [annotationsC imports]) (do {! phase.monad} - [[_ annotationsT annotationsV] (evaluate! archive Code annotationsC) + [[_ _ annotationsV] (evaluate! archive Code annotationsC) .let [annotationsV (:as Code annotationsV)] _ (/////directive.lift_analysis (do ! @@ -283,7 +286,7 @@ (in {#/////directive.imports imports #/////directive.referrals (list)})))])) -(exception: #export (cannot_alias_an_alias {local Alias} {foreign Alias} {target Name}) +(exception: .public (cannot_alias_an_alias {local Alias} {foreign Alias} {target Name}) (exception.report ["Local alias" (%.name local)] ["Foreign alias" (%.name foreign)] @@ -304,7 +307,7 @@ (def: def::alias Handler (..custom - [($_ p.and s.local_identifier s.identifier) + [($_ <>.and <code>.local_identifier <code>.identifier) (function (_ extension_name phase archive [alias def_name]) (do phase.monad [_ (///.lift @@ -437,7 +440,7 @@ (dictionary.put "program" (def::program program)) ))) -(def: #export (bundle expander host_analysis program anchorT,expressionT,directiveT extender) +(def: .public (bundle expander host_analysis program anchorT,expressionT,directiveT extender) (All [anchor expression directive] (-> Expander /////analysis.Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux index 740236dc8..6d5995330 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux @@ -12,7 +12,7 @@ [common_lisp [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux index 4900dea03..13b4a40e4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux @@ -38,7 +38,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -168,7 +168,7 @@ (/.install "error" (unary _.error/1)) ))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/host.lux index 9895f051a..a4aa3e5e8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/host.lux @@ -33,7 +33,7 @@ ["//#" /// #_ ["#." phase]]]]]]) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "common_lisp") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux index 64db8196b..d4580215f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux @@ -12,7 +12,7 @@ [js [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux index 240bec8b5..af7b75366 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux @@ -32,7 +32,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -180,7 +180,7 @@ (/.install "log" (unary io//log)) (/.install "error" (unary //runtime.io//error))))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux index ff601d308..9daf4b072 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux @@ -146,7 +146,7 @@ 1 (_.apply/* g!abstraction g!inputs) _ (_.apply/1 g!abstraction (_.array g!inputs)))))))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "js") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux index 16a34222e..43bc68142 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux @@ -12,7 +12,7 @@ [jvm [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle ($_ dictionary.merged /common.bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux index 61d56f794..b21b16ad4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux @@ -42,7 +42,7 @@ [meta [archive (#+ Archive)]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text Phase Archive s (Operation (Bytecode Any)))] @@ -404,7 +404,7 @@ (/////bundle.install "log" (unary ..io::log)) (/////bundle.install "error" (unary ..io::error))))) -(def: #export bundle +(def: .public bundle Bundle (<| (/////bundle.prefix "lux") (|> bundle::lux diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux index 60e733c8a..b3f22b503 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -319,7 +319,7 @@ ))) (template [<name> <category> <parser>] - [(def: #export <name> + [(def: .public <name> (Parser (Type <category>)) (<t>.then <parser> <s>.text))] @@ -330,11 +330,11 @@ [return Return parser.return] ) -(exception: #export (not_an_object_array {arrayJT (Type Array)}) +(exception: .public (not_an_object_array {arrayJT (Type Array)}) (exception.report ["JVM Type" (|> arrayJT type.signature signature.signature)])) -(def: #export object_array +(def: .public object_array (Parser (Type Object)) (do <>.monad [arrayJT (<t>.then parser.array <s>.text)] @@ -1090,7 +1090,7 @@ (/////bundle.install "anonymous" class::anonymous) ))) -(def: #export bundle +(def: .public bundle Bundle (<| (/////bundle.prefix "jvm") (|> ..bundle::conversion diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux index 492f43b94..93062f68c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux @@ -12,7 +12,7 @@ [lua [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux index f1f6ccaa1..656ccac5c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux @@ -35,7 +35,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -170,7 +170,7 @@ (/.install "log" (unary ..io//log!)) (/.install "error" (unary (!unary "error")))))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux index 873a37be7..1a633675d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux @@ -183,7 +183,7 @@ 1 (_.apply/* g!inputs abstractionG) _ (_.apply/1 abstractionG (_.array g!inputs)))))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lua") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux index 6805ccc27..552a0756c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux @@ -12,7 +12,7 @@ [php [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux index 6cc7e61d0..11be7a215 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux @@ -38,7 +38,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -181,7 +181,7 @@ (/.install "log" (unary //runtime.io//log!)) (/.install "error" (unary //runtime.io//throw!))))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux index f7a42c5d2..3a294d06e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux @@ -129,7 +129,7 @@ dataG (phase archive dataS)] (in (_.pack/2 [formatG (_.splat dataG)]))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "php") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux index 55e2e4756..b0bab688a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux @@ -12,7 +12,7 @@ [python [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux index 5be155ab3..4f6c64210 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux @@ -35,7 +35,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -160,7 +160,7 @@ (/.install "log" (unary //runtime.io::log!)) (/.install "error" (unary //runtime.io::throw!))))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux index 87f343233..349186b55 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux @@ -150,7 +150,7 @@ globalsG (phase archive globalsS)] (in (//runtime.lux::exec codeG globalsG))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "python") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux index f137406ab..504e5d5e9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux @@ -12,7 +12,7 @@ [r [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux index 8604be023..f547703e3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux @@ -38,7 +38,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -167,7 +167,7 @@ ## (/.install "error" (unary _.error/1)) ## ))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/host.lux index 37390f799..f36b10e83 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/host.lux @@ -33,7 +33,7 @@ ["//#" /// #_ ["#." phase]]]]]]) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "r") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux index dfeee165e..42518bd79 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux @@ -12,7 +12,7 @@ [ruby [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux index c2119b731..c1f9be2b9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux @@ -35,7 +35,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -175,7 +175,7 @@ (/.install "error" (unary ..io//error!)) ))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux index cb2e4d28b..25d29d1a8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux @@ -122,7 +122,7 @@ (\ ////////phase.monad in (_.require/1 (_.string module))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "ruby") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux index 9d74e5fc6..2fd37b5d7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux @@ -12,7 +12,7 @@ [scheme [runtime (#+ Bundle)]]]]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux index e725c9b95..c04ee1e90 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux @@ -38,7 +38,7 @@ [/// ["#" phase]]]]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text (Generator s))] @@ -163,7 +163,7 @@ (/.install "error" (unary _.raise/1)) ))) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "lux") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux index 0552946f9..680cec039 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux @@ -96,7 +96,7 @@ inputsG (monad.map ! (phase archive) inputsS)] (in (_.apply/* inputsG abstractionG))))])) -(def: #export bundle +(def: .public bundle Bundle (<| (/.prefix "scheme") (|> /.empty diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/synthesis.lux index 7e9e85d6e..557dac7ac 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/synthesis.lux @@ -6,6 +6,6 @@ [/// [synthesis (#+ Bundle)]]]) -(def: #export bundle +(def: .public bundle Bundle bundle.empty) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux index c7ef94ce9..3a0578db1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux @@ -23,7 +23,7 @@ [reference (#+) [variable (#+)]]]]]]]) -(def: #export (generate archive synthesis) +(def: .public (generate archive synthesis) Phase (case synthesis (^template [<tag> <generator>] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux index 43c2cab45..624915eed 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux @@ -35,15 +35,15 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export register +(def: .public register (-> Register Var/1) (|>> (///reference.local //reference.system) :assume)) -(def: #export capture +(def: .public capture (-> Register Var/1) (|>> (///reference.foreign //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueG (expression archive valueS) @@ -51,7 +51,7 @@ (in (_.let (list [(..register register) valueG]) (list bodyG))))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testG (expression archive testS) @@ -59,7 +59,7 @@ elseG (expression archive elseS)] (in (_.if testG thenG elseG)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueG (expression archive valueS)] @@ -240,7 +240,7 @@ (_.error/1 (_.string ////synthesis/case.pattern_matching_error)) @done))))) -(def: #export (case expression archive [valueS pathP]) +(def: .public (case expression archive [valueS pathP]) (Generator [Synthesis Path]) (do {! ///////phase.monad} [initG (expression archive valueS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension.lux index 1880d7700..17052fb88 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension.lux @@ -9,6 +9,6 @@ [/ ["." common]]) -(def: #export bundle +(def: .public bundle Bundle common.bundle) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux index f5d416ee1..6cd07080a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux @@ -126,7 +126,7 @@ (bundle.install "error" (unary _.error/1)) ))) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "lux") (|> lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux index ad4bedbfa..2ca666bd4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux @@ -29,7 +29,7 @@ [reference [variable (#+ Register Variable)]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionG (expression archive functionS) @@ -58,7 +58,7 @@ (def: input (|>> inc //case.register)) -(def: #export (function expression archive [environment arity bodyS]) +(def: .public (function expression archive [environment arity bodyS]) (Generator (Abstraction Synthesis)) (do {! ///////phase.monad} [@scope (\ ! map (|>> %.nat (format "function_scope") _.tag) /////generation.next) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux index 61b5cf216..b17b5fd09 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux @@ -32,7 +32,7 @@ [reference [variable (#+ Register)]]]]]]]) -(def: #export (scope expression archive [start initsS+ bodyS]) +(def: .public (scope expression archive [start initsS+ bodyS]) (Generator (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop @@ -57,7 +57,7 @@ (_.setq @output bodyG))) @output)))))) -(def: #export (recur expression archive argsS+) +(def: .public (recur expression archive argsS+) (Generator (List Synthesis)) (do {! ///////phase.monad} [[tag offset] /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux index 82ab68128..c3417e461 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux @@ -4,18 +4,18 @@ [target ["_" common_lisp (#+ Expression)]]]]) -(def: #export bit +(def: .public bit (-> Bit (Expression Any)) _.bool) -(def: #export i64 +(def: .public i64 (-> (I64 Any) (Expression Any)) (|>> .int _.int)) -(def: #export f64 +(def: .public f64 (-> Frac (Expression Any)) _.double) -(def: #export text +(def: .public text (-> Text (Expression Any)) _.string) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux index 83bbc6a95..a12a8c590 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System (Expression Any)) (def: constant _.var) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index b69836192..0c557720d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -42,7 +42,7 @@ 0) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> [_.Tag Register] (Expression Any) (Expression Any)))] [Operation /////generation.Operation] @@ -51,10 +51,10 @@ [Bundle /////generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation (Expression Any)))) -(def: #export unit +(def: .public unit (_.string /////synthesis.unit)) (def: (flag value) @@ -67,27 +67,27 @@ (-> (Expression Any) (Expression Any) (Expression Any) (Computation Any)) (_.list/* (list tag last? value))) -(def: #export (variant [lefts right? value]) +(def: .public (variant [lefts right? value]) (-> (Variant (Expression Any)) (Computation Any)) (variant' (_.int (.int lefts)) (flag right?) value)) -(def: #export none +(def: .public none (Computation Any) (|> ..unit [0 #0] ..variant)) -(def: #export some +(def: .public some (-> (Expression Any) (Computation Any)) (|>> [1 #1] ..variant)) -(def: #export left +(def: .public left (-> (Expression Any) (Computation Any)) (|>> [0 #0] ..variant)) -(def: #export right +(def: .public right (-> (Expression Any) (Computation Any)) (|>> [1 #1] ..variant)) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -112,7 +112,7 @@ (#.Left name) (let [g!name (code.local_identifier name) code_nameC (code.local_identifier (format "@" name))] - (in (list (` (def: #export (~ g!name) + (in (list (` (def: .public (~ g!name) _.Var/1 (~ runtime_name))) @@ -127,7 +127,7 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` (_.Expression Any))) inputs)] - (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (in (list (` (def: .public ((~ g!name) (~+ inputsC)) (-> (~+ inputs_typesC) (_.Computation Any)) (_.call/* (~ runtime_name) (list (~+ inputsC))))) @@ -279,7 +279,7 @@ runtime//text runtime//io))) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux index a0b6b78e9..df957a3cd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux @@ -14,7 +14,7 @@ ["//#" /// #_ ["#." phase ("#\." monad)]]]]) -(def: #export (tuple expression archive elemsS+) +(def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -28,7 +28,7 @@ (monad.map ///////phase.monad (expression archive)) (///////phase\map _.vector/*)))) -(def: #export (variant expression archive [lefts right? valueS]) +(def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux index 7c50630d7..95121edc4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux @@ -24,17 +24,17 @@ (syntax: (Vector {size s.nat} elemT) (in (list (` [(~+ (list.repeat size elemT))])))) -(type: #export (Nullary of) (-> (Vector 0 of) of)) -(type: #export (Unary of) (-> (Vector 1 of) of)) -(type: #export (Binary of) (-> (Vector 2 of) of)) -(type: #export (Trinary of) (-> (Vector 3 of) of)) -(type: #export (Variadic of) (-> (List of) of)) +(type: .public (Nullary of) (-> (Vector 0 of) of)) +(type: .public (Unary of) (-> (Vector 1 of) of)) +(type: .public (Binary of) (-> (Vector 2 of) of)) +(type: .public (Trinary of) (-> (Vector 3 of) of)) +(type: .public (Variadic of) (-> (List of) of)) (syntax: (arity: {arity s.nat} {name s.local_identifier} type) (with_gensyms [g!_ g!extension g!name g!phase g!archive g!inputs g!of g!anchor g!expression g!directive] (do {! meta.monad} [g!input+ (monad.seq ! (list.repeat arity (macro.gensym "input")))] - (in (list (` (def: #export ((~ (code.local_identifier name)) (~ g!extension)) + (in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!extension)) (All [(~ g!anchor) (~ g!expression) (~ g!directive)] (-> ((~ type) (~ g!expression)) (generation.Handler (~ g!anchor) (~ g!expression) (~ g!directive)))) @@ -56,7 +56,7 @@ (arity: 2 binary ..Binary) (arity: 3 trinary ..Trinary) -(def: #export (variadic extension) +(def: .public (variadic extension) (All [anchor expression directive] (-> (Variadic expression) (generation.Handler anchor expression directive))) (function (_ extension_name) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux index e1c4dd247..608217f8f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux @@ -63,7 +63,7 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot_recur_as_an_expression) +(exception: .public cannot_recur_as_an_expression) (def: (expression archive synthesis) Phase @@ -112,6 +112,6 @@ (#synthesis.Extension extension) (///extension.apply archive expression extension))) -(def: #export generate +(def: .public generate Phase ..expression) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux index 7758725c1..51e58fb51 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux @@ -31,11 +31,11 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export register +(def: .public register (-> Register Var) (|>> (///reference.local //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -45,7 +45,7 @@ (_.return bodyO)) (list valueO))))) -(def: #export (let! statement expression archive [valueS register bodyS]) +(def: .public (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -54,7 +54,7 @@ (_.define (..register register) valueO) bodyO)))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -62,7 +62,7 @@ elseO (expression archive elseS)] (in (_.? testO thenO elseO)))) -(def: #export (if! statement expression archive [testS thenS elseS]) +(def: .public (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -72,7 +72,7 @@ thenO elseO)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] @@ -304,7 +304,7 @@ pattern_matching!) (_.throw (_.string ////synthesis/case.pattern_matching_error)))))) -(def: #export (case! statement expression archive [valueS pathP]) +(def: .public (case! statement expression archive [valueS pathP]) (Generator! [Synthesis Path]) (do ///////phase.monad [stack_init (expression archive valueS) @@ -315,7 +315,7 @@ (_.define @savepoint (_.array (list))) pattern_matching!)))) -(def: #export (case statement expression archive [valueS pathP]) +(def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) (do ///////phase.monad [pattern_matching! (..case! statement expression archive [valueS pathP])] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux index f2f326f8f..00ac84cf8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -27,7 +27,7 @@ [reference [variable (#+ Register Variable)]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionO (expression archive functionS) @@ -65,7 +65,7 @@ (-> Context Text) (format (///reference.artifact function_name) "_scope")) -(def: #export (function statement expression archive [environment arity bodyS]) +(def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) (do {! ///////phase.monad} [[function_name body!] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux index dcb7daa43..602ef1191 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux @@ -41,7 +41,7 @@ list.reversed (list\fold _.then body))) -(def: #export (scope! statement expression archive [start initsS+ bodyS]) +(def: .public (scope! statement expression archive [start initsS+ bodyS]) (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop @@ -60,7 +60,7 @@ (_.do_while (_.boolean true) body!))))))) -(def: #export (scope statement expression archive [start initsS+ bodyS]) +(def: .public (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop @@ -76,7 +76,7 @@ (def: @temp (_.var "lux_recur_values")) -(def: #export (recur! statement expression archive argsS+) +(def: .public (recur! statement expression archive argsS+) (Generator! (List Synthesis)) (do {! ///////phase.monad} [[offset @scope] /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/primitive.lux index ede743c5d..711a72275 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/primitive.lux @@ -6,16 +6,16 @@ ["." // #_ ["#." runtime]]) -(def: #export bit +(def: .public bit _.boolean) -(def: #export (i64 value) +(def: .public (i64 value) (-> (I64 Any) Computation) (//runtime.i64 (|> value //runtime.high .int _.i32) (|> value //runtime.low .int _.i32))) -(def: #export f64 +(def: .public f64 _.number) -(def: #export text +(def: .public text _.string) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/reference.lux index b21262192..646852129 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System Expression) (def: constant _.var) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 350faeeec..5d09cbd16 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -44,7 +44,7 @@ ["." artifact (#+ Registry)]]]]]]) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> [Register Text] Expression Statement))] [Operation /////generation.Operation] @@ -53,29 +53,29 @@ [Bundle /////generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation Expression))) -(type: #export Phase! +(type: .public Phase! (-> Phase Archive Synthesis (Operation Statement))) -(type: #export (Generator! i) +(type: .public (Generator! i) (-> Phase! Phase Archive i (Operation Statement))) -(def: #export high +(def: .public high (-> (I64 Any) (I64 Any)) (i64.right_shifted 32)) -(def: #export low +(def: .public low (-> (I64 Any) (I64 Any)) (let [mask (dec (i64.left_shifted 32 1))] (|>> (i64.and mask)))) -(def: #export unit +(def: .public unit Computation (_.string /////synthesis.unit)) -(def: #export (flag value) +(def: .public (flag value) (-> Bit Computation) (if value (_.string "") @@ -85,7 +85,7 @@ (-> Var (-> Var Expression) Statement) (_.define name (definition name))) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -106,7 +106,7 @@ (case declaration (#.Left name) (let [g!name (code.local_identifier name)] - (in (list (` (def: #export (~ g!name) + (in (list (` (def: .public (~ g!name) Var (~ runtime_name))) @@ -120,7 +120,7 @@ (let [g!name (code.local_identifier name) inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (in (list (` (def: .public ((~ g!name) (~+ inputsC)) (-> (~+ inputs_typesC) Computation) (_.apply/* (~ runtime_name) (list (~+ inputsC))))) @@ -172,9 +172,9 @@ (_.return (_.do "slice" (list right_index) tuple))) ))))) -(def: #export variant_tag_field "_lux_tag") -(def: #export variant_flag_field "_lux_flag") -(def: #export variant_value_field "_lux_value") +(def: .public variant_tag_field "_lux_tag") +(def: .public variant_flag_field "_lux_flag") +(def: .public variant_value_field "_lux_value") (runtime: variant//new (let [@this (_.var "this")] @@ -186,7 +186,7 @@ (_.set (_.the ..variant_value_field @this) value) ))))) -(def: #export (variant tag last? value) +(def: .public (variant tag last? value) (-> Expression Expression Expression Computation) (_.new ..variant//new (list tag last? value))) @@ -264,8 +264,8 @@ @lux//program_args )) -(def: #export i64_low_field Text "_lux_low") -(def: #export i64_high_field Text "_lux_high") +(def: .public i64_low_field Text "_lux_low") +(def: .public i64_high_field Text "_lux_high") (runtime: i64//new (let [@this (_.var "this")] @@ -276,7 +276,7 @@ (_.set (_.the ..i64_low_field @this) low) ))))) -(def: #export (i64 high low) +(def: .public (i64 high low) (-> Expression Expression Computation) (_.new ..i64//new (list high low))) @@ -771,7 +771,7 @@ (def: module_id 0) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux index 5cbacf111..ebaaa7f49 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux @@ -14,7 +14,7 @@ ["//#" /// ["#." phase ("#\." monad)]]]]) -(def: #export (tuple generate archive elemsS+) +(def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -28,7 +28,7 @@ [elemsT+ (monad.map ! (generate archive) elemsS+)] (in (_.array elemsT+))))) -(def: #export (variant generate archive [lefts right? valueS]) +(def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux index 629f7704e..bece6d582 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux @@ -19,7 +19,7 @@ ["." reference] ["#" phase ("#\." monad)]]]]]) -(def: #export (generate archive synthesis) +(def: .public (generate archive synthesis) Phase (case synthesis (^template [<tag> <generator>] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux index bdf4fb89c..37f9134fb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux @@ -208,7 +208,7 @@ _.aconst_null (_.goto @end))))) -(def: #export (if phase archive [conditionS thenS elseS]) +(def: .public (if phase archive [conditionS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do phase.monad [conditionG (phase archive conditionS) @@ -227,7 +227,7 @@ elseG (_.set_label @end)))))) -(def: #export (let phase archive [inputS register bodyS]) +(def: .public (let phase archive [inputS register bodyS]) (Generator [Synthesis Register Synthesis]) (do phase.monad [inputG (phase archive inputS) @@ -237,7 +237,7 @@ (_.astore register) bodyG)))) -(def: #export (get phase archive [path recordS]) +(def: .public (get phase archive [path recordS]) (Generator [(List synthesis.Member) Synthesis]) (do phase.monad [recordG (phase archive recordS)] @@ -252,7 +252,7 @@ recordG (list.reversed path))))) -(def: #export (case phase archive [valueS path]) +(def: .public (case phase archive [valueS path]) (Generator [Synthesis Path]) (do phase.monad [@end //runtime.forge_label diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux index 82f5b442b..d830d478f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux @@ -15,7 +15,7 @@ (def: extension ".class") -(def: #export (write_class! name bytecode) +(def: .public (write_class! name bytecode) (-> Text Binary (IO Text)) (let [file_path (format name ..extension)] (do io.monad diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux index d13e7ebed..7a8dd2860 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux @@ -58,7 +58,7 @@ [reference [variable (#+ Register)]]]]]]) -(def: #export (with generate archive @begin class environment arity body) +(def: .public (with generate archive @begin class environment arity body) (-> Phase Archive Label External (Environment Synthesis) Arity (Bytecode Any) (Operation [(List (Resource Field)) (List (Resource Method)) @@ -95,7 +95,7 @@ Internal)) (|>> type.reflection reflection.reflection name.internal)) -(def: #export (abstraction generate archive [environment arity bodyS]) +(def: .public (abstraction generate archive [environment arity bodyS]) (Generator Abstraction) (do phase.monad [@begin //runtime.forge_label @@ -116,7 +116,7 @@ _ (generation.save! function_class #.None [function_class bytecode])] (in instance))) -(def: #export (apply generate archive [abstractionS inputsS]) +(def: .public (apply generate archive [abstractionS inputsS]) (Generator Apply) (do {! phase.monad} [abstractionG (generate archive abstractionS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux index eb1f78ed9..04e3d4cda 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux @@ -13,12 +13,12 @@ [constant ["." arity]]]]) -(def: #export artifact_id +(def: .public artifact_id 1) -(def: #export class +(def: .public class (type.class (%.nat artifact_id) (list))) -(def: #export init +(def: .public init (Type Method) (type.method [(list) (list arity.type) type.void (list)])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux index d6bb70600..53d058584 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux @@ -21,6 +21,6 @@ field.final )) -(def: #export (constant name type) +(def: .public (constant name type) (-> Text (Type Value) (Resource Field)) (field.field ..modifier name type (row.row))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant/arity.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant/arity.lux index a1e0a589d..7bb5a7f15 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant/arity.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant/arity.lux @@ -11,12 +11,12 @@ [///////// [arity (#+ Arity)]]]) -(def: #export name "arity") -(def: #export type type.int) +(def: .public name "arity") +(def: .public type type.int) -(def: #export minimum Arity 1) -(def: #export maximum Arity 8) +(def: .public minimum Arity 1) +(def: .public maximum Arity 8) -(def: #export constant +(def: .public constant (Resource Field) (//.constant ..name ..type)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux index aa200182d..328921a19 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux @@ -21,16 +21,16 @@ [reference [variable (#+ Register)]]]]) -(def: #export type ////type.value) +(def: .public type ////type.value) -(def: #export (get class name) +(def: .public (get class name) (-> (Type Class) Text (Bytecode Any)) ($_ _.compose ////reference.this (_.getfield class name ..type) )) -(def: #export (put naming class register value) +(def: .public (put naming class register value) (-> (-> Register Text) (Type Class) Register (Bytecode Any) (Bytecode Any)) ($_ _.compose ////reference.this @@ -44,11 +44,11 @@ field.final )) -(def: #export (variable name type) +(def: .public (variable name type) (-> Text (Type Value) (Resource Field)) (field.field ..modifier name type (row.row))) -(def: #export (variables naming amount) +(def: .public (variables naming amount) (-> (-> Register Text) Nat (List (Resource Field))) (|> amount list.indices diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux index ccfd84401..10dbc1bcc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux @@ -23,18 +23,18 @@ [reference [variable (#+ Register)]]]]]]) -(def: #export (closure environment) +(def: .public (closure environment) (-> (Environment Synthesis) (List (Type Value))) (list.repeat (list.size environment) //.type)) -(def: #export (get class register) +(def: .public (get class register) (-> (Type Class) Register (Bytecode Any)) (//.get class (/////reference.foreign_name register))) -(def: #export (put class register value) +(def: .public (put class register value) (-> (Type Class) Register (Bytecode Any) (Bytecode Any)) (//.put /////reference.foreign_name class register value)) -(def: #export variables +(def: .public variables (-> (Environment Synthesis) (List (Resource Field))) (|>> list.size (//.variables /////reference.foreign_name))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux index 7e5e8a6ca..adc3da6c8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux @@ -30,7 +30,7 @@ [reference [variable (#+ Register)]]]]]]]) -(def: #export (initial amount) +(def: .public (initial amount) (-> Nat (Bytecode Any)) ($_ _.compose (|> _.aconst_null @@ -38,19 +38,19 @@ (monad.seq _.monad)) (_\in []))) -(def: #export (get class register) +(def: .public (get class register) (-> (Type Class) Register (Bytecode Any)) (//.get class (/////reference.partial_name register))) -(def: #export (put class register value) +(def: .public (put class register value) (-> (Type Class) Register (Bytecode Any) (Bytecode Any)) (//.put /////reference.partial_name class register value)) -(def: #export variables +(def: .public variables (-> Arity (List (Resource Field))) (|>> (n.- ///arity.minimum) (//.variables /////reference.partial_name))) -(def: #export (new arity) +(def: .public (new arity) (-> Arity (Bytecode Any)) (if (arity.multiary? arity) ($_ _.compose diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux index a3e4fc738..4bc179078 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux @@ -13,17 +13,17 @@ ["." ///// #_ ["#." abstract]]) -(def: #export field "partials") -(def: #export type type.int) +(def: .public field "partials") +(def: .public type type.int) -(def: #export initial +(def: .public initial (Bytecode Any) (|> +0 signed.s1 try.assumed _.bipush)) (def: this _.aload_0) -(def: #export value +(def: .public value (Bytecode Any) ($_ _.compose ..this diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux index 9cbde4b63..4dbadacb0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux @@ -6,7 +6,7 @@ ["." modifier (#+ Modifier) ("#\." monoid)] ["." method (#+ Method)]]]]]) -(def: #export modifier +(def: .public modifier (Modifier Method) ($_ modifier\compose method.public diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index 46b871096..9f4bc4e13 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -77,7 +77,7 @@ (def: this_offset 1) -(def: #export (method class environment function_arity @begin body apply_arity) +(def: .public (method class environment function_arity @begin body apply_arity) (-> (Type Class) (Environment Synthesis) Arity Label (Bytecode Any) Arity (Resource Method)) (let [num_partials (dec function_arity) over_extent (i.- (.int apply_arity) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux index 347ab1a8a..07473f901 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux @@ -18,15 +18,15 @@ [////// [arity (#+ Arity)]]]]) -(def: #export name "impl") +(def: .public name "impl") -(def: #export (type arity) +(def: .public (type arity) (-> Arity (Type category.Method)) (type.method [(list.repeat arity ////type.value) ////type.value (list)])) -(def: #export (method' name arity @begin body) +(def: .public (method' name arity @begin body) (-> Text Arity Label (Bytecode Any) (Resource Method)) (method.method //.modifier name (..type arity) @@ -37,6 +37,6 @@ _.areturn )))) -(def: #export method +(def: .public method (-> Arity Label (Bytecode Any) (Resource Method)) (method' ..name)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index f44d62118..b99f5661a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -41,13 +41,13 @@ [reference [variable (#+ Register)]]]]]]]) -(def: #export name "<init>") +(def: .public name "<init>") (def: (partials arity) (-> Arity (List (Type Value))) (list.repeat (dec arity) ////type.value)) -(def: #export (type environment arity) +(def: .public (type environment arity) (-> (Environment Synthesis) Arity (Type category.Method)) (type.method [(list\compose (///foreign.closure environment) (if (arity.multiary? arity) @@ -58,7 +58,7 @@ (def: no_partials (|> 0 unsigned.u1 try.assumed _.bipush)) -(def: #export (super environment_size arity) +(def: .public (super environment_size arity) (-> Nat Arity (Bytecode Any)) (let [arity_register (inc environment_size)] ($_ _.compose @@ -78,7 +78,7 @@ (_.aload (offset register))))) (monad.seq _.monad))) -(def: #export (method class environment arity) +(def: .public (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) (let [environment_size (list.size environment) offset_foreign (: (-> Register Register) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux index 1707b1413..45ea0b010 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux @@ -42,7 +42,7 @@ ["." arity (#+ Arity)] ["." phase]]]]]]) -(def: #export (instance' foreign_setup class environment arity) +(def: .public (instance' foreign_setup class environment arity) (-> (List (Bytecode Any)) (Type Class) (Environment Synthesis) Arity (Bytecode Any)) ($_ _.compose (_.new class) @@ -51,13 +51,13 @@ (///partial.new arity) (_.invokespecial class //init.name (//init.type environment arity)))) -(def: #export (instance generate archive class environment arity) +(def: .public (instance generate archive class environment arity) (-> Phase Archive (Type Class) (Environment Synthesis) Arity (Operation (Bytecode Any))) (do {! phase.monad} [foreign* (monad.map ! (generate archive) environment)] (in (instance' foreign* class environment arity)))) -(def: #export (method class environment arity) +(def: .public (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) (let [after_this (: (-> Nat Nat) (n.+ 1)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux index 8ad6fd92e..615cc0388 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux @@ -26,9 +26,9 @@ [/// ["." arity (#+ Arity)]]]]]]) -(def: #export name "reset") +(def: .public name "reset") -(def: #export (type class) +(def: .public (type class) (-> (Type Class) (Type category.Method)) (type.method [(list) class (list)])) @@ -38,7 +38,7 @@ list.indices (list\map (///foreign.get class)))) -(def: #export (method class environment arity) +(def: .public (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) (method.method //.modifier ..name (..type class) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index fc9f4d3ca..b58414fd9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -60,18 +60,18 @@ (def: init::type (type.method [(list) type.void (list)])) (def: init::modifier ($_ modifier\compose method.public method.static method.strict)) -(exception: #export (cannot_load {class Text} {error Text}) +(exception: .public (cannot_load {class Text} {error Text}) (exception.report ["Class" class] ["Error" error])) -(exception: #export (invalid_field {class Text} {field Text} {error Text}) +(exception: .public (invalid_field {class Text} {field Text} {error Text}) (exception.report ["Class" class] ["Field" field] ["Error" error])) -(exception: #export (invalid_value {class Text}) +(exception: .public (invalid_value {class Text}) (exception.report ["Class" class])) @@ -144,7 +144,7 @@ [[value definition] (evaluate! library loader class_name valueG)] (in [class_name value definition])))) -(def: #export host +(def: .public host (IO //runtime.Host) (io (let [library (loader.new_library []) loader (loader.memory library)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux index 91c433788..857066e4b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux @@ -37,7 +37,7 @@ (def: no_op (_\in [])) -(def: #export (recur translate archive updatesS) +(def: .public (recur translate archive updatesS) (Generator (List Synthesis)) (do {! phase.monad} [[@begin offset] generation.anchor @@ -71,7 +71,7 @@ (monad.seq _.monad)) (_.goto @begin))))) -(def: #export (scope translate archive [offset initsS+ iterationS]) +(def: .public (scope translate archive [offset initsS+ iterationS]) (Generator [Nat (List Synthesis) Synthesis]) (do {! phase.monad} [@begin //runtime.forge_label diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux index 42f9a24fa..7c35b11de 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux @@ -17,14 +17,14 @@ (def: $Long (type.class "java.lang.Long" (list))) (def: $Double (type.class "java.lang.Double" (list))) -(def: #export (bit value) +(def: .public (bit value) (-> Bit (Bytecode Any)) (_.getstatic $Boolean (if value "TRUE" "FALSE") $Boolean)) (def: wrap_i64 (_.invokestatic $Long "valueOf" (type.method [(list type.long) $Long (list)]))) -(def: #export (i64 value) +(def: .public (i64 value) (-> (I64 Any) (Bytecode Any)) (case (.int value) (^template [<int> <instruction>] @@ -76,7 +76,7 @@ (import: java/lang/Double (#static doubleToRawLongBits #manual [double] int)) -(def: #export (f64 value) +(def: .public (f64 value) (-> Frac (Bytecode Any)) (case value (^template [<int> <instruction>] @@ -117,5 +117,5 @@ [_ constantI] ..wrap_f64)))) -(def: #export text +(def: .public text _.string) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux index e87a3f0df..0a749f337 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux @@ -25,11 +25,17 @@ ["#." runtime (#+ Definition)] ["#." function/abstract]]) -(def: #export class "LuxProgram") +(def: .public class + "LuxProgram") -(def: ^Object (type.class "java.lang.Object" (list))) -(def: ^String (type.class "java.lang.String" (list))) -(def: ^Args (type.array ^String)) +(def: ^Object + (type.class "java.lang.Object" (list))) + +(def: ^String + (type.class "java.lang.String" (list))) + +(def: ^Args + (type.array ^String)) (def: main::type (type.method [(list ..^Args) type.void (list)])) @@ -121,7 +127,7 @@ _.aconst_null //runtime.apply)) -(def: #export (program program) +(def: .public (program program) (-> (Bytecode Any) Definition) (let [super_class (|> ..^Object type.reflection reflection.reflection name.internal) main (method.method ..main::modifier "main" ..main::type diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux index 2e3fe8618..d983068b9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux @@ -26,12 +26,12 @@ [meta [archive (#+ Archive)]]]]]]) -(def: #export this +(def: .public this (Bytecode Any) _.aload_0) (template [<name> <prefix>] - [(def: #export <name> + [(def: .public <name> (-> Register Text) (|>> %.nat (format <prefix>)))] @@ -50,7 +50,7 @@ (..foreign_name variable) //type.value))))) -(def: #export (variable archive variable) +(def: .public (variable archive variable) (-> Archive Variable (Operation (Bytecode Any))) (case variable (#variable.Local variable) @@ -59,7 +59,7 @@ (#variable.Foreign variable) (..foreign archive variable))) -(def: #export (constant archive name) +(def: .public (constant archive name) (-> Archive Name (Operation (Bytecode Any))) (do {! ////.monad} [bytecode_name (\ ! map //runtime.class_name diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux index a1ae79528..757716fe7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux @@ -60,14 +60,14 @@ [io (#+ lux_context)] [archive (#+ Archive)]]]]]]) -(type: #export Byte_Code Binary) +(type: .public Byte_Code Binary) -(type: #export Definition [Text Byte_Code]) +(type: .public Definition [Text Byte_Code]) -(type: #export Anchor [Label Register]) +(type: .public Anchor [Label Register]) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> Anchor (Bytecode Any) Definition))] [Operation generation.Operation] @@ -76,13 +76,13 @@ [Bundle generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation (Bytecode Any)))) -(type: #export Host +(type: .public Host (generation.Host (Bytecode Any) Definition)) -(def: #export (class_name [module id]) +(def: .public (class_name [module id]) (-> generation.Context Text) (format lux_context "/" (%.nat version.version) @@ -92,7 +92,7 @@ (def: artifact_id 0) -(def: #export class +(def: .public class (type.class (%.nat ..artifact_id) (list))) (def: procedure @@ -111,7 +111,7 @@ (Bytecode Any) _.aload_0) -(def: #export (get index) +(def: .public (get index) (-> (Bytecode Any) (Bytecode Any)) ($_ _.compose index @@ -127,11 +127,11 @@ _.aastore ## A )) -(def: #export unit (_.string synthesis.unit)) +(def: .public unit (_.string synthesis.unit)) (def: variant::name "variant") (def: variant::type (type.method [(list) (list //type.tag //type.flag //type.value) //type.variant (list)])) -(def: #export variant (..procedure ..variant::name ..variant::type)) +(def: .public variant (..procedure ..variant::name ..variant::type)) (def: variant_tag _.iconst_0) (def: variant_last? _.iconst_1) @@ -156,10 +156,10 @@ (..set! ..variant_value $value) ## A[3] _.areturn))))) -(def: #export left_flag _.aconst_null) -(def: #export right_flag ..unit) +(def: .public left_flag _.aconst_null) +(def: .public right_flag ..unit) -(def: #export left_injection +(def: .public left_injection (Bytecode Any) ($_ _.compose _.iconst_0 @@ -168,7 +168,7 @@ _.pop2 ..variant)) -(def: #export right_injection +(def: .public right_injection (Bytecode Any) ($_ _.compose _.iconst_1 @@ -177,9 +177,9 @@ _.pop2 ..variant)) -(def: #export some_injection ..right_injection) +(def: .public some_injection ..right_injection) -(def: #export none_injection +(def: .public none_injection (Bytecode Any) ($_ _.compose _.iconst_0 @@ -205,7 +205,7 @@ (def: decode_frac::name "decode_frac") (def: decode_frac::type (type.method [(list) (list //type.text) //type.variant (list)])) -(def: #export decode_frac (..procedure ..decode_frac::name ..decode_frac::type)) +(def: .public decode_frac (..procedure ..decode_frac::name ..decode_frac::type)) (def: decode_frac::method (method.method ..modifier ..decode_frac::name @@ -219,7 +219,7 @@ (//value.wrap type.double) ))))) -(def: #export log! +(def: .public log! (Bytecode Any) (let [^PrintStream (type.class "java.io.PrintStream" (list)) ^System (type.class "java.lang.System" (list)) @@ -254,17 +254,17 @@ _.athrow)))) (def: pm_failure::name "pm_failure") -(def: #export pm_failure (..procedure ..pm_failure::name ..failure::type)) +(def: .public pm_failure (..procedure ..pm_failure::name ..failure::type)) (def: pm_failure::method (..failure ..pm_failure::name "Invalid expression for pattern-matching.")) -(def: #export stack_head _.iconst_0) -(def: #export stack_tail _.iconst_1) +(def: .public stack_head _.iconst_0) +(def: .public stack_tail _.iconst_1) (def: push::name "push") (def: push::type (type.method [(list) (list //type.stack //type.value) //type.stack (list)])) -(def: #export push (..procedure ..push::name ..push::type)) +(def: .public push (..procedure ..push::name ..push::type)) (def: push::method (method.method ..modifier ..push::name @@ -284,7 +284,7 @@ (def: case::name "case") (def: case::type (type.method [(list) (list //type.variant //type.tag //type.flag) //type.value (list)])) -(def: #export case (..procedure ..case::name ..case::type)) +(def: .public case (..procedure ..case::name ..case::type)) (def: case::method (method.method ..modifier ..case::name ..case::type @@ -361,10 +361,10 @@ (def: projection_type (type.method [(list) (list //type.tuple //type.offset) //type.value (list)])) (def: left_projection::name "left") -(def: #export left_projection (..procedure ..left_projection::name ..projection_type)) +(def: .public left_projection (..procedure ..left_projection::name ..projection_type)) (def: right_projection::name "right") -(def: #export right_projection (..procedure ..right_projection::name ..projection_type)) +(def: .public right_projection (..procedure ..right_projection::name ..projection_type)) (def: projection::method2 [(Resource Method) (Resource Method)] @@ -445,18 +445,18 @@ [left_projection::method right_projection::method])) -(def: #export apply::name "apply") +(def: .public apply::name "apply") -(def: #export (apply::type arity) +(def: .public (apply::type arity) (-> Arity (Type category.Method)) (type.method [(list) (list.repeat arity //type.value) //type.value (list)])) -(def: #export apply +(def: .public apply (_.invokevirtual //function.class ..apply::name (..apply::type 1))) (def: try::name "try") (def: try::type (type.method [(list) (list //function.class) //type.variant (list)])) -(def: #export try (..procedure ..try::name ..try::type)) +(def: .public try (..procedure ..try::name ..try::type)) (def: false _.iconst_0) (def: true _.iconst_1) @@ -596,13 +596,13 @@ [_ (generation.execute! [class bytecode])] (generation.save! //function.artifact_id #.None [class bytecode])))) -(def: #export generate +(def: .public generate (Operation Any) (do ////.monad [_ ..generate_runtime] ..generate_function)) -(def: #export forge_label +(def: .public forge_label (Operation Label) (let [shift (n./ 4 i64.width)] ## This shift is done to avoid the possibility of forged labels diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux index 06b60b6c1..062708388 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux @@ -26,7 +26,7 @@ (def: $Object (type.class "java.lang.Object" (list))) -(def: #export (tuple generate archive membersS) +(def: .public (tuple generate archive membersS) (Generator (Tuple Synthesis)) (case membersS #.End @@ -52,7 +52,7 @@ _ (_.anewarray $Object)] (monad.seq ! membersI)))))) -(def: #export (tag lefts right?) +(def: .public (tag lefts right?) (-> Nat Bit (Bytecode Any)) (case (if right? (.inc lefts) @@ -75,13 +75,13 @@ (#try.Failure _) (_.int (.i64 tag)))))) -(def: #export (flag right?) +(def: .public (flag right?) (-> Bit (Bytecode Any)) (if right? //runtime.right_flag //runtime.left_flag)) -(def: #export (variant generate archive [lefts right? valueS]) +(def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (do phase.monad [valueI (generate archive valueS)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/type.lux index 4c6f14a3f..2bc32f589 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/type.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/type.lux @@ -5,19 +5,19 @@ [jvm ["." type]]]]]) -(def: #export frac (type.class "java.lang.Double" (list))) -(def: #export text (type.class "java.lang.String" (list))) +(def: .public frac (type.class "java.lang.Double" (list))) +(def: .public text (type.class "java.lang.String" (list))) -(def: #export value (type.class "java.lang.Object" (list))) +(def: .public value (type.class "java.lang.Object" (list))) -(def: #export tag type.int) -(def: #export flag ..value) -(def: #export variant (type.array ..value)) +(def: .public tag type.int) +(def: .public flag ..value) +(def: .public variant (type.array ..value)) -(def: #export offset type.int) -(def: #export index ..offset) -(def: #export tuple (type.array ..value)) +(def: .public offset type.int) +(def: .public index ..offset) +(def: .public tuple (type.array ..value)) -(def: #export stack (type.array ..value)) +(def: .public stack (type.array ..value)) -(def: #export error (type.class "java.lang.Throwable" (list))) +(def: .public error (type.class "java.lang.Throwable" (list))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux index 36edc060a..138a9d2fb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux @@ -8,7 +8,7 @@ [category (#+ Primitive)] ["." box]]]]]]) -(def: #export field "value") +(def: .public field "value") (template [<name> <boolean> <byte> <short> <int> <long> <float> <double> <char>] [(def: (<name> type) @@ -35,13 +35,13 @@ "longValue" "floatValue" "doubleValue" "charValue"] ) -(def: #export (wrap type) +(def: .public (wrap type) (-> (Type Primitive) (Bytecode Any)) (let [wrapper (type.class (primitive_wrapper type) (list))] (_.invokestatic wrapper "valueOf" (type.method [(list) (list type) wrapper (list)])))) -(def: #export (unwrap type) +(def: .public (unwrap type) (-> (Type Primitive) (Bytecode Any)) (let [wrapper (type.class (primitive_wrapper type) (list))] ($_ _.compose diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux index b51cd2930..56860a588 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux @@ -65,7 +65,7 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot_recur_as_an_expression) +(exception: .public cannot_recur_as_an_expression) (def: (expression archive synthesis) Phase @@ -114,6 +114,6 @@ (#synthesis.Extension extension) (///extension.apply archive expression extension))) -(def: #export generate +(def: .public generate Phase ..expression) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux index 273e1d0ae..db4de757c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux @@ -30,15 +30,15 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export register +(def: .public register (-> Register Var) (|>> (///reference.local //reference.system) :assume)) -(def: #export capture +(def: .public capture (-> Register Var) (|>> (///reference.foreign //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -49,7 +49,7 @@ (_.closure (list (..register register))) (_.apply/* (list valueO)))))) -(def: #export (let! statement expression archive [valueS register bodyS]) +(def: .public (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -58,7 +58,7 @@ (_.local/1 (..register register) valueO) bodyO)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] @@ -73,7 +73,7 @@ valueO (list.reversed pathP))))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -85,7 +85,7 @@ (_.closure (list)) (_.apply/* (list)))))) -(def: #export (if! statement expression archive [testS thenS elseS]) +(def: .public (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -247,7 +247,7 @@ pattern_matching!) (_.statement (|> (_.var "error") (_.apply/* (list (_.string ////synthesis/case.pattern_matching_error))))))))) -(def: #export dependencies +(def: .public dependencies (-> Path (List Var)) (|>> ////synthesis/case.storage (get@ #////synthesis/case.dependencies) @@ -260,7 +260,7 @@ (#///////variable.Foreign register) (..capture register)))))) -(def: #export (case! statement expression archive [valueS pathP]) +(def: .public (case! statement expression archive [valueS pathP]) (Generator! [Synthesis Path]) (do ///////phase.monad [stack_init (expression archive valueS) @@ -271,7 +271,7 @@ (_.local/1 @savepoint (_.array (list))) pattern_matching!)))) -(def: #export (case statement expression archive [valueS pathP]) +(def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) (|> [valueS pathP] (..case! statement expression archive) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index 21c78c6f9..e26940c60 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -29,7 +29,7 @@ [reference [variable (#+ Register Variable)]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionO (expression archive functionS) @@ -63,7 +63,7 @@ (-> Context Label) (_.label (format (///reference.artifact function_name) "_scope"))) -(def: #export (function statement expression archive [environment arity bodyS]) +(def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) (do {! ///////phase.monad} [[function_name body!] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index d9ae9c51f..d19421620 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -47,7 +47,7 @@ (_.set variables (_.multi bindings))) body)))) -(def: #export (scope! statement expression archive as_expression? [start initsS+ bodyS]) +(def: .public (scope! statement expression archive as_expression? [start initsS+ bodyS]) ## (Generator! (Scope Synthesis)) (-> Phase! Phase Archive Bit (Scope Synthesis) (Operation [(List Expression) Statement])) @@ -71,7 +71,7 @@ (_.set_label @scope) body!))])))) -(def: #export (scope statement expression archive [start initsS+ bodyS]) +(def: .public (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop @@ -111,7 +111,7 @@ _ (/////generation.save! artifact_id #.None directive)] (in (|> instantiation (_.apply/* initsO+)))))) -(def: #export (recur! statement expression archive argsS+) +(def: .public (recur! statement expression archive argsS+) (Generator! (List Synthesis)) (do {! ///////phase.monad} [[offset @scope] /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux index 7d010b4cb..f819ca279 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux @@ -5,7 +5,7 @@ ["_" lua (#+ Literal)]]]]) (template [<name> <type> <implementation>] - [(def: #export <name> + [(def: .public <name> (-> <type> Literal) <implementation>)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux index 52bc69a29..b24890947 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System Expression) (def: constant _.var) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux index 935caf949..d77a51d8a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux @@ -39,7 +39,7 @@ ["." artifact (#+ Registry)]]]]]]) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> [Register Label] Expression Statement))] [Operation /////generation.Operation] @@ -48,16 +48,16 @@ [Bundle /////generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation Expression))) -(type: #export Phase! +(type: .public Phase! (-> Phase Archive Synthesis (Operation Statement))) -(type: #export (Generator! i) +(type: .public (Generator! i) (-> Phase! Phase Archive i (Operation Statement))) -(def: #export unit +(def: .public unit (_.string /////synthesis.unit)) (def: (flag value) @@ -66,9 +66,9 @@ ..unit _.nil)) -(def: #export variant_tag_field "_lux_tag") -(def: #export variant_flag_field "_lux_flag") -(def: #export variant_value_field "_lux_value") +(def: .public variant_tag_field "_lux_tag") +(def: .public variant_flag_field "_lux_flag") +(def: .public variant_value_field "_lux_value") (def: (variant' tag last? value) (-> Expression Expression Expression Literal) @@ -76,25 +76,25 @@ [..variant_flag_field last?] [..variant_value_field value]))) -(def: #export (variant tag last? value) +(def: .public (variant tag last? value) (-> Nat Bit Expression Literal) (variant' (_.int (.int tag)) (flag last?) value)) -(def: #export none +(def: .public none Literal (..variant 0 #0 ..unit)) -(def: #export some +(def: .public some (-> Expression Literal) (..variant 1 #1)) -(def: #export left +(def: .public left (-> Expression Literal) (..variant 0 #0)) -(def: #export right +(def: .public right (-> Expression Literal) (..variant 1 #1)) @@ -102,7 +102,7 @@ (-> Var (-> Var Statement) Statement) (definition name)) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -130,7 +130,7 @@ (#.Left name) (macro.with_gensyms [g!_] (let [g!name (code.local_identifier name)] - (in (list (` (def: #export (~ g!name) + (in (list (` (def: .public (~ g!name) Var (~ runtime_name))) @@ -146,7 +146,7 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (in (list (` (def: .public ((~ g!name) (~+ inputsC)) (-> (~+ inputs_typesC) Computation) (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) @@ -418,7 +418,7 @@ ..runtime//array )) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux index 8b070c7a3..8c78dea65 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux @@ -14,7 +14,7 @@ ["//#" /// #_ ["#." phase ("#\." monad)]]]]) -(def: #export (tuple generate archive elemsS+) +(def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -28,7 +28,7 @@ (monad.map ///////phase.monad (generate archive)) (///////phase\map _.array)))) -(def: #export (variant generate archive [lefts right? valueS]) +(def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux index aad40560a..1366ae632 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux @@ -59,9 +59,9 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot_recur_as_an_expression) +(exception: .public cannot_recur_as_an_expression) -(def: #export (expression archive synthesis) +(def: .public (expression archive synthesis) Phase (case synthesis (^template [<tag> <generator>] @@ -98,6 +98,6 @@ (#////synthesis.Extension extension) (///extension.apply archive expression extension))) -(def: #export generate +(def: .public generate Phase ..expression) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index 3bbbd7d21..2906c63ed 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -34,15 +34,15 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export register +(def: .public register (-> Register Var) (|>> (///reference.local //reference.system) :assume)) -(def: #export capture +(def: .public capture (-> Register Var) (|>> (///reference.foreign //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueG (expression archive valueS) @@ -52,7 +52,7 @@ _.array/* (_.item (_.int +1)))))) -(def: #export (let! statement expression archive [valueS register bodyS]) +(def: .public (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -61,7 +61,7 @@ (_.set! (..register register) valueO) body!)))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testG (expression archive testS) @@ -69,7 +69,7 @@ elseG (expression archive elseS)] (in (_.? testG thenG elseG)))) -(def: #export (if! statement expression archive [testS thenS elseS]) +(def: .public (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) (do ///////phase.monad [test! (expression archive testS) @@ -79,7 +79,7 @@ then! else!)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueG (expression archive valueS)] @@ -261,7 +261,7 @@ (-> Text (Operation Text)) (\ ///////phase.monad map (|>> %.nat (format prefix)) /////generation.next)) -(def: #export dependencies +(def: .public dependencies (-> Path (List Var)) (|>> ////synthesis/case.storage (get@ #////synthesis/case.dependencies) @@ -274,7 +274,7 @@ (#///////variable.Foreign register) (..capture register)))))) -(def: #export (case! statement expression archive [valueS pathP]) +(def: .public (case! statement expression archive [valueS pathP]) (Generator! [Synthesis Path]) (do ///////phase.monad [stack_init (expression archive valueS) @@ -284,7 +284,7 @@ (_.set! @savepoint (_.array/* (list))) pattern_matching!)))) -(def: #export (case statement expression archive [valueS pathP]) +(def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) (do {! ///////phase.monad} [[[case_module case_artifact] case!] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension.lux index 1880d7700..17052fb88 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension.lux @@ -9,6 +9,6 @@ [/ ["." common]]) -(def: #export bundle +(def: .public bundle Bundle common.bundle) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux index f3ad84b3d..a630b31c3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux @@ -100,7 +100,7 @@ (bundle.install "exit" (unary _.exit/1)) (bundle.install "current-time" (nullary (|>> _.time/0 (_.* (_.int +1,000)))))))) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "lux") (|> lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux index 93a099ce0..f4df9c34b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux @@ -29,7 +29,7 @@ [reference [variable (#+ Register Variable)]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionG (expression archive functionS) @@ -67,7 +67,7 @@ (_.return @selfL)))) (_.apply/* inits @selfG)]))) -(def: #export (function statement expression archive [environment arity bodyS]) +(def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) (do {! ///////phase.monad} [[function_name body!] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 54a001a41..32e6346cf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -47,7 +47,7 @@ list.reversed (list\fold _.then body))) -(def: #export (scope! statement expression archive [start initsS+ bodyS]) +(def: .public (scope! statement expression archive [start initsS+ bodyS]) (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop @@ -66,7 +66,7 @@ (_.set_label @scope) body!)))))) -(def: #export (scope statement expression archive [start initsS+ bodyS]) +(def: .public (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop @@ -107,7 +107,7 @@ (def: @temp (_.var "lux_recur_values")) -(def: #export (recur! statement expression archive argsS+) +(def: .public (recur! statement expression archive argsS+) (Generator! (List Synthesis)) (do {! ///////phase.monad} [[offset @scope] /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux index 9101ee48d..cc9af8550 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux @@ -11,11 +11,11 @@ ["." // #_ ["#." runtime]]) -(def: #export bit +(def: .public bit (-> Bit Literal) _.bool) -(def: #export (i64 value) +(def: .public (i64 value) (-> (I64 Any) Expression) (let [h32 (|> value //runtime.high .int _.int) l32 (|> value //runtime.low .int _.int)] @@ -23,10 +23,10 @@ (_.bit_shl (_.int +32)) (_.bit_or l32)))) -(def: #export f64 +(def: .public f64 (-> Frac Literal) _.float) -(def: #export text +(def: .public text (-> Text Literal) _.string) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/reference.lux index 5dce15a26..487d08e32 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System Expression) (def: constant _.global) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux index a18335967..4a5b7b5e0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux @@ -39,7 +39,7 @@ ["." artifact (#+ Registry)]]]]]]) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> [Nat Label] Expression Statement))] [Operation /////generation.Operation] @@ -48,16 +48,16 @@ [Bundle /////generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation Expression))) -(type: #export Phase! +(type: .public Phase! (-> Phase Archive Synthesis (Operation Statement))) -(type: #export (Generator! i) +(type: .public (Generator! i) (-> Phase! Phase Archive i (Operation Statement))) -(def: #export unit +(def: .public unit (_.string /////synthesis.unit)) (def: (flag value) @@ -70,7 +70,7 @@ (-> Constant (-> Constant Statement) Statement) (definition name)) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -98,7 +98,7 @@ (#.Left name) (macro.with_gensyms [g!_] (let [g!name (code.local_identifier name)] - (in (list (` (def: #export (~ g!name) + (in (list (` (def: .public (~ g!name) Var (~ runtime_name))) @@ -114,7 +114,7 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (in (list (` (def: .public ((~ g!name) (~+ inputsC)) (-> (~+ inputs_typesC) Computation) (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) @@ -145,7 +145,7 @@ @io//throw! )) -(def: #export tuple_size_field +(def: .public tuple_size_field "_lux_size") (def: tuple_size @@ -241,34 +241,34 @@ (_.array_slice/2 [(_.do "getArrayCopy" (list) tuple) right_index]))))) ))))) -(def: #export variant_tag_field "_lux_tag") -(def: #export variant_flag_field "_lux_flag") -(def: #export variant_value_field "_lux_value") +(def: .public variant_tag_field "_lux_tag") +(def: .public variant_flag_field "_lux_flag") +(def: .public variant_value_field "_lux_value") (runtime: (sum//make tag last? value) (_.return (_.array/** (list [(_.string ..variant_tag_field) tag] [(_.string ..variant_flag_field) last?] [(_.string ..variant_value_field) value])))) -(def: #export (variant tag last? value) +(def: .public (variant tag last? value) (-> Nat Bit Expression Computation) (sum//make (_.int (.int tag)) (..flag last?) value)) -(def: #export none +(def: .public none Computation (..variant 0 #0 ..unit)) -(def: #export some +(def: .public some (-> Expression Computation) (..variant 1 #1)) -(def: #export left +(def: .public left (-> Expression Computation) (..variant 0 #0)) -(def: #export right +(def: .public right (-> Expression Computation) (..variant 1 #1)) @@ -336,11 +336,11 @@ @lux//program_args )) -(def: #export high +(def: .public high (-> (I64 Any) (I64 Any)) (i64.right_shifted 32)) -(def: #export low +(def: .public low (-> (I64 Any) (I64 Any)) (let [mask (dec (i64.left_shifted 32 1))] (|>> (i64.and mask)))) @@ -596,7 +596,7 @@ runtime//io )) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux index 601361f31..69979afd6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux @@ -17,7 +17,7 @@ ["//#" /// #_ ["#." phase ("#\." monad)]]]]) -(def: #export (tuple expression archive elemsS+) +(def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -33,7 +33,7 @@ (///////phase\map (|>> _.array/* (//runtime.tuple//make size))))))) -(def: #export (variant expression archive [lefts right? valueS]) +(def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux index 1d01ba8b0..4426bc6c8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux @@ -59,9 +59,9 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot_recur_as_an_expression) +(exception: .public cannot_recur_as_an_expression) -(def: #export (expression archive synthesis) +(def: .public (expression archive synthesis) Phase (case synthesis (^template [<tag> <generator>] @@ -108,6 +108,6 @@ (#////synthesis.Extension extension) (///extension.apply archive expression extension))) -(def: #export generate +(def: .public generate Phase ..expression) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index 59ccb6098..84bc0c2ca 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -34,20 +34,20 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export (gensym prefix) +(def: .public (gensym prefix) (-> Text (Operation SVar)) (///////phase\map (|>> %.nat (format prefix) _.var) /////generation.next)) -(def: #export register +(def: .public register (-> Register SVar) (|>> (///reference.local //reference.system) :assume)) -(def: #export capture +(def: .public capture (-> Register SVar) (|>> (///reference.foreign //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -57,7 +57,7 @@ bodyO) (list valueO))))) -(def: #export (let! statement expression archive [valueS register bodyS]) +(def: .public (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -66,7 +66,7 @@ (_.set (list (..register register)) valueO) bodyO)))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -74,7 +74,7 @@ elseO (expression archive elseS)] (in (_.? testO thenO elseO)))) -(def: #export (if! statement expression archive [testS thenS elseS]) +(def: .public (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) (do ///////phase.monad [test! (expression archive testS) @@ -84,7 +84,7 @@ then! else!)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] @@ -295,7 +295,7 @@ pattern_matching!) (_.raise (_.Exception/1 (_.string case.pattern_matching_error))))))) -(def: #export dependencies +(def: .public dependencies (-> Path (List SVar)) (|>> case.storage (get@ #case.dependencies) @@ -308,7 +308,7 @@ (#///////variable.Foreign register) (..capture register)))))) -(def: #export (case! in_closure? statement expression archive [valueS pathP]) +(def: .public (case! in_closure? statement expression archive [valueS pathP]) (-> Bit (Generator! [Synthesis Path])) (do ///////phase.monad [stack_init (expression archive valueS) @@ -319,7 +319,7 @@ pattern_matching! )))) -(def: #export (case statement expression archive [valueS pathP]) +(def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) (do ///////phase.monad [[[case_module case_artifact] pattern_matching!] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index c7ff46333..0b4ecc5e6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -31,14 +31,14 @@ [archive (#+ Archive) ["." artifact]]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] (in (_.apply/* functionO argsO+)))) -(def: #export capture +(def: .public capture (-> Register SVar) (|>> (///reference.foreign //reference.system) :assume)) @@ -66,7 +66,7 @@ (def: input (|>> inc //case.register)) -(def: #export (function statement expression archive [environment arity bodyS]) +(def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) (do {! ///////phase.monad} [[[function_module function_artifact] body!] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 8f4386405..b627e5c44 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -41,13 +41,13 @@ list.reversed (list\fold _.then body))) -(def: #export (set_scope body!) +(def: .public (set_scope body!) (-> (Statement Any) (Statement Any)) (_.while (_.bool true) body! #.None)) -(def: #export (scope! statement expression archive [start initsS+ bodyS]) +(def: .public (scope! statement expression archive [start initsS+ bodyS]) (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop @@ -64,7 +64,7 @@ ..set_scope body!))))) -(def: #export (scope statement expression archive [start initsS+ bodyS]) +(def: .public (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop @@ -106,7 +106,7 @@ _ (/////generation.save! loop_artifact #.None directive)] (in (_.apply/* instantiation initsO+))))) -(def: #export (recur! statement expression archive argsS+) +(def: .public (recur! statement expression archive argsS+) (Generator! (List Synthesis)) (do {! ///////phase.monad} [offset /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux index 60175358f..9d02d3974 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux @@ -7,7 +7,7 @@ ["#." runtime]]) (template [<type> <name> <implementation>] - [(def: #export <name> + [(def: .public <name> (-> <type> (Expression Any)) <implementation>)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/reference.lux index eeb4604a3..b53b3ff9d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System (Expression Any)) (def: constant _.var) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index b653d67b7..49507ed33 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -41,7 +41,7 @@ ["." artifact (#+ Registry)]]]]]]) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> Register (Expression Any) (Statement Any)))] [Operation /////generation.Operation] @@ -50,19 +50,19 @@ [Bundle /////generation.Bundle] ) -(type: #export Phase! +(type: .public Phase! (-> Phase Archive Synthesis (Operation (Statement Any)))) -(type: #export (Generator! i) +(type: .public (Generator! i) (-> Phase! Phase Archive i (Operation (Statement Any)))) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation (Expression Any)))) (def: prefix "LuxRuntime") -(def: #export +(def: .public unit (_.unicode /////synthesis.unit)) @@ -76,25 +76,25 @@ (-> (Expression Any) (Expression Any) (Expression Any) Literal) (_.tuple (list tag last? value))) -(def: #export (variant tag last? value) +(def: .public (variant tag last? value) (-> Nat Bit (Expression Any) Literal) (variant' (_.int (.int tag)) (flag last?) value)) -(def: #export none +(def: .public none Literal (..variant 0 #0 unit)) -(def: #export some +(def: .public some (-> (Expression Any) Literal) (..variant 1 #1)) -(def: #export left +(def: .public left (-> (Expression Any) Literal) (..variant 0 #0)) -(def: #export right +(def: .public right (-> (Expression Any) Literal) (..variant 1 #1)) @@ -109,7 +109,7 @@ (-> SVar (-> SVar (Statement Any)) (Statement Any)) (definition name)) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -131,7 +131,7 @@ (let [nameC (code.local_identifier name) code_nameC (code.local_identifier (format "@" name)) runtime_nameC (` (runtime_name (~ (code.text name))))] - (in (list (` (def: #export (~ nameC) SVar (~ runtime_nameC))) + (in (list (` (def: .public (~ nameC) SVar (~ runtime_nameC))) (` (def: (~ code_nameC) (Statement Any) (..feature (~ runtime_nameC) @@ -146,7 +146,7 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` (_.Expression Any))) inputs)] - (in (list (` (def: #export ((~ nameC) (~+ inputsC)) + (in (list (` (def: .public ((~ nameC) (~+ inputsC)) (-> (~+ inputs_typesC) (Computation Any)) (_.apply/* (~ runtime_nameC) (list (~+ inputsC))))) (` (def: (~ code_nameC) @@ -445,7 +445,7 @@ (def: module_id 0) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (/////generation.with_buffer (do ///////phase.monad diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux index 4e7bc841d..1ab751074 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux @@ -14,7 +14,7 @@ ["//#" /// #_ ["#." phase ("#\." monad)]]]]) -(def: #export (tuple generate archive elemsS+) +(def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -28,7 +28,7 @@ (monad.map ///////phase.monad (generate archive)) (///////phase\map _.list)))) -(def: #export (variant generate archive [lefts right? valueS]) +(def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux index 80171bbfb..a87076394 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux @@ -25,7 +25,7 @@ [reference (#+) [variable (#+)]]]]]]]) -(def: #export (generate archive synthesis) +(def: .public (generate archive synthesis) Phase (case synthesis (^template [<tag> <generator>] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux index dcaf7f395..87cae6c43 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux @@ -36,15 +36,15 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export register +(def: .public register (-> Register SVar) (|>> (///reference.local //reference.system) :assume)) -(def: #export capture +(def: .public capture (-> Register SVar) (|>> (///reference.foreign //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -54,7 +54,7 @@ (_.set! (..register register) valueO) bodyO))))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -62,7 +62,7 @@ elseO (expression archive elseS)] (in (_.if testO thenO elseO)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] @@ -229,7 +229,7 @@ (#.Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))) #.None)))) -(def: #export (case expression archive [valueS pathP]) +(def: .public (case expression archive [valueS pathP]) (Generator [Synthesis Path]) (do {! ///////phase.monad} [valueO (expression archive valueS)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux index dfdec59ce..bbfa2e83d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux @@ -32,7 +32,7 @@ [archive ["." artifact]]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionO (expression archive functionS) @@ -71,7 +71,7 @@ (_.set! (|> register inc //case.register) (|> $curried (_.item (|> register inc .int _.int))))) -(def: #export (function expression archive [environment arity bodyS]) +(def: .public (function expression archive [environment arity bodyS]) (Generator (Abstraction Synthesis)) (do {! ///////phase.monad} [[[function_module function_artifact] bodyO] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux index 47bb19e87..32ec3b041 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux @@ -33,7 +33,7 @@ [reference [variable (#+ Register)]]]]]]]) -(def: #export (scope expression archive [offset initsS+ bodyS]) +(def: .public (scope expression archive [offset initsS+ bodyS]) (Generator (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop @@ -57,7 +57,7 @@ bodyO)) (_.apply initsO+ $scope))))))) -(def: #export (recur expression archive argsS+) +(def: .public (recur expression archive argsS+) (Generator (List Synthesis)) (do {! ///////phase.monad} [$scope /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux index 9b7f40e86..1d4788f77 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux @@ -7,7 +7,7 @@ ["#." runtime]]) (template [<name> <type> <code>] - [(def: #export <name> + [(def: .public <name> (-> <type> Expression) <code>)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux index 18157701d..037259b8a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux @@ -25,31 +25,31 @@ [".T" loop])) ## [Types] -(type: #export Translator +(type: .public Translator (-> ls.Synthesis (Meta Expression))) -(type: #export Proc +(type: .public Proc (-> Translator (List ls.Synthesis) (Meta Expression))) -(type: #export Bundle +(type: .public Bundle (Dict Text Proc)) (syntax: (Vector {size s.nat} elemT) (in (list (` [(~+ (list.repeat size elemT))])))) -(type: #export Nullary (-> (Vector +0 Expression) Expression)) -(type: #export Unary (-> (Vector +1 Expression) Expression)) -(type: #export Binary (-> (Vector +2 Expression) Expression)) -(type: #export Trinary (-> (Vector +3 Expression) Expression)) -(type: #export Variadic (-> (List Expression) Expression)) +(type: .public Nullary (-> (Vector +0 Expression) Expression)) +(type: .public Unary (-> (Vector +1 Expression) Expression)) +(type: .public Binary (-> (Vector +2 Expression) Expression)) +(type: .public Trinary (-> (Vector +3 Expression) Expression)) +(type: .public Variadic (-> (List Expression) Expression)) ## [Utils] -(def: #export (install name unnamed) +(def: .public (install name unnamed) (-> Text (-> Text Proc) (-> Bundle Bundle)) (dict.put name (unnamed name))) -(def: #export (prefix prefix bundle) +(def: .public (prefix prefix bundle) (-> Text Bundle Bundle) (|> bundle dict.entries @@ -66,7 +66,7 @@ (with_gensyms [g!_ g!proc g!name g!translate g!inputs] (do {@ macro.monad} [g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))] - (in (list (` (def: #export ((~ (code.local_identifier name)) (~ g!proc)) + (in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!proc)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Expression) (-> Text ..Proc)) (function ((~ g!_) (~ g!name)) @@ -88,7 +88,7 @@ (arity: binary +2) (arity: trinary +3) -(def: #export (variadic proc) +(def: .public (variadic proc) (-> Variadic (-> Text Proc)) (function (_ proc_name) (function (_ translate inputsS) @@ -111,10 +111,10 @@ Unary (runtimeT.lux//try riskyO)) -(exception: #export (Wrong_Syntax {message Text}) +(exception: .public (Wrong_Syntax {message Text}) message) -(def: #export (wrong_syntax procedure args) +(def: .public (wrong_syntax procedure args) (-> Text (List ls.Synthesis) Text) (format "Procedure: " procedure "\n" "Arguments: " (%code (code.tuple args)))) @@ -328,7 +328,7 @@ (runtimeT.io//current_time! runtimeT.unit))))))) ## [Bundles] -(def: #export procedures +(def: .public procedures Bundle (<| (prefix "lux") (|> lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux index f97ae27e0..c99ceb072 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux @@ -81,7 +81,7 @@ ## (@.install "get" (@.binary table//get)) ## (@.install "set" (@.trinary table//set))))) -(def: #export procedures +(def: .public procedures @.Bundle (<| (@.prefix "lua") (dict.empty text.Hash<Text>) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/reference.lux index bbdb06ba0..4e518e02a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System Expression) (def: constant _.var) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux index 824f53012..446f2ba72 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux @@ -45,7 +45,7 @@ 0) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> _.SVar _.Expression _.Expression))] [Operation /////generation.Operation] @@ -54,10 +54,10 @@ [Bundle /////generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation Expression))) -(def: #export unit +(def: .public unit Expression (_.string /////synthesis.unit)) @@ -76,7 +76,7 @@ ## else (.int input))) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -100,7 +100,7 @@ (case declaration (#.Left name) (let [g!name (code.local_identifier name)] - (in (list (` (def: #export (~ g!name) + (in (list (` (def: .public (~ g!name) _.SVar (~ runtime_name))) @@ -113,7 +113,7 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (in (list (` (def: .public ((~ g!name) (~+ inputsC)) (-> (~+ inputs_typesC) _.Expression) (_.apply (list (~+ inputsC)) (~ runtime_name)))) @@ -124,11 +124,11 @@ (_.function (list (~+ inputsC)) (~ code)))))))))))))) -(def: #export variant_tag_field "luxVT") -(def: #export variant_flag_field "luxVF") -(def: #export variant_value_field "luxVV") +(def: .public variant_tag_field "luxVT") +(def: .public variant_flag_field "luxVF") +(def: .public variant_value_field "luxVV") -(def: #export (flag value) +(def: .public (flag value) (-> Bit Expression) (if value (_.string "") @@ -139,25 +139,25 @@ [..variant_flag_field last?] [..variant_value_field value]))) -(def: #export (variant tag last? value) +(def: .public (variant tag last? value) (-> Nat Bit Expression Expression) (adt::variant (_.int (.int tag)) (flag last?) value)) -(def: #export none +(def: .public none Expression (variant 0 #0 ..unit)) -(def: #export some +(def: .public some (-> Expression Expression) (variant 1 #1)) -(def: #export left +(def: .public left (-> Expression Expression) (variant 0 #0)) -(def: #export right +(def: .public right (-> Expression Expression) (variant 1 #1)) @@ -174,8 +174,8 @@ (-> Expression Expression) (_.apply (list value) (_.var "as.double"))) -(def: #export i64_high_field "luxIH") -(def: #export i64_low_field "luxIL") +(def: .public i64_high_field "luxIH") +(def: .public i64_low_field "luxIL") (runtime: (i64::unsigned_low input) (with_vars [low] @@ -205,13 +205,13 @@ (-> Nat Nat) (|>> (i64.and (hex "FFFFFFFF")))) -(def: #export (i64 value) +(def: .public (i64 value) (-> Int Expression) (let [value (.nat value)] (i64::new (|> value ..high_32 ..cap_32 _.int) (|> value ..low_32 ..cap_32 _.int)))) -(def: #export (lux_i64 high low) +(def: .public (lux_i64 high low) (-> Int Int Int) (|> high (i64.left_shifted 32) @@ -227,8 +227,8 @@ [i64::max i\top] ) -(def: #export i64_high (_.item (_.string ..i64_high_field))) -(def: #export i64_low (_.item (_.string ..i64_low_field))) +(def: .public i64_high (_.item (_.string ..i64_high_field))) +(def: .public i64_low (_.item (_.string ..i64_low_field))) (runtime: (i64::not input) (i64::new (|> input i64_high _.bit_not) @@ -839,7 +839,7 @@ runtime::io )) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux index 4ea0f31a2..3c74989df 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux @@ -17,7 +17,7 @@ ["//#" /// #_ ["#." phase ("#\." monad)]]]]) -(def: #export (tuple expression archive elemsS+) +(def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -31,7 +31,7 @@ (monad.map ///////phase.monad (expression archive)) (///////phase\map _.list)))) -(def: #export (variant expression archive [lefts right? valueS]) +(def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux index f3643d685..7ae3e429a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux @@ -17,7 +17,7 @@ ## This universe constant is for languages where one can't just turn all compiled definitions ## into the local variables of some scoping function. -(def: #export universe +(def: .public universe (for {## In the case of Lua, there is a limit of 200 locals in a function's scope. @.lua (not ("lua script universe")) ## Cannot make all definitions be local variables because of limitations with JRuby. @@ -37,20 +37,20 @@ @.scheme <label>} ""))) -(def: #export (artifact [module artifact]) +(def: .public (artifact [module artifact]) (-> Context Text) (format "l" (%.nat version.version) ..universe_label "m" (%.nat module) "a" (%.nat artifact))) -(interface: #export (System expression) +(interface: .public (System expression) (: (-> Text expression) constant) (: (-> Text expression) variable)) -(def: #export (constant system archive name) +(def: .public (constant system archive name) (All [anchor expression directive] (-> (System expression) Archive Name (////generation.Operation anchor expression directive expression))) @@ -58,7 +58,7 @@ (////generation.remember archive name))) (template [<sigil> <name>] - [(def: #export (<name> system) + [(def: .public (<name> system) (All [expression] (-> (System expression) (-> Register expression))) @@ -68,7 +68,7 @@ ["l" local] ) -(def: #export (variable system variable) +(def: .public (variable system variable) (All [expression] (-> (System expression) Variable expression)) (case variable @@ -78,7 +78,7 @@ (#variable.Foreign register) (..foreign system register))) -(def: #export (reference system archive reference) +(def: .public (reference system archive reference) (All [anchor expression directive] (-> (System expression) Archive Reference (////generation.Operation anchor expression directive expression))) (case reference diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux index 3a80031eb..0c56f55b1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux @@ -59,7 +59,7 @@ (//////phase\map _.return (/function.function statement expression archive abstraction)) )) -(exception: #export cannot_recur_as_an_expression) +(exception: .public cannot_recur_as_an_expression) (def: (expression archive synthesis) Phase @@ -100,6 +100,6 @@ (#////synthesis.Extension extension) (///extension.apply archive expression extension))) -(def: #export generate +(def: .public generate Phase ..expression) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux index 18185171c..0eca3ec0b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux @@ -36,19 +36,19 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export (gensym prefix) +(def: .public (gensym prefix) (-> Text (Operation LVar)) (///////phase\map (|>> %.nat (format prefix) _.local) /////generation.next)) -(def: #export register +(def: .public register (-> Register LVar) (|>> (///reference.local //reference.system) :assume)) -(def: #export capture +(def: .public capture (-> Register LVar) (|>> (///reference.foreign //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -59,7 +59,7 @@ (_.lambda #.None (list (..register register))) (_.apply_lambda/* (list valueO)))))) -(def: #export (let! statement expression archive [valueS register bodyS]) +(def: .public (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -68,7 +68,7 @@ (_.set (list (..register register)) valueO) bodyO)))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -76,7 +76,7 @@ elseO (expression archive elseS)] (in (_.? testO thenO elseO)))) -(def: #export (if! statement expression archive [testS thenS elseS]) +(def: .public (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) (do ///////phase.monad [test! (expression archive testS) @@ -86,7 +86,7 @@ then! else!)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] @@ -340,7 +340,7 @@ pattern_matching!) (_.statement (_.raise (_.string case.pattern_matching_error))))))) -(def: #export (case! in_closure? statement expression archive [valueS pathP]) +(def: .public (case! in_closure? statement expression archive [valueS pathP]) (-> Bit (Generator! [Synthesis Path])) (do ///////phase.monad [stack_init (expression archive valueS) @@ -351,7 +351,7 @@ pattern_matching! )))) -(def: #export (case statement expression archive case) +(def: .public (case statement expression archive case) (-> Phase! (Generator [Synthesis Path])) (|> case (case! true statement expression archive) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index 281ea380a..11199e5b4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -31,14 +31,14 @@ [archive (#+ Archive) ["." artifact]]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] (in (_.apply_lambda/* argsO+ functionO)))) -(def: #export capture +(def: .public capture (-> Register LVar) (|>> (///reference.foreign //reference.system) :assume)) @@ -63,7 +63,7 @@ (def: input (|>> inc //case.register)) -(def: #export (function statement expression archive [environment arity bodyS]) +(def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) (do {! ///////phase.monad} [[[function_module function_artifact] body!] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux index 2cf1506c7..89daa0b5f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux @@ -44,11 +44,11 @@ (def: symbol (_.symbol "lux_continue")) -(def: #export with_scope +(def: .public with_scope (-> Statement Statement) (_.while (_.bool true))) -(def: #export (scope! statement expression archive [start initsS+ bodyS]) +(def: .public (scope! statement expression archive [start initsS+ bodyS]) (Generator! (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop @@ -65,7 +65,7 @@ ..with_scope body!))))) -(def: #export (scope statement expression archive [start initsS+ bodyS]) +(def: .public (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) (case initsS+ ## function/false/non-independent loop @@ -80,7 +80,7 @@ (_.lambda #.None (list)) (_.apply_lambda/* (list))))))) -(def: #export (recur! statement expression archive argsS+) +(def: .public (recur! statement expression archive argsS+) (Generator! (List Synthesis)) (do {! ///////phase.monad} [offset /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux index 0f01d2455..38b35b7a6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux @@ -5,7 +5,7 @@ ["_" ruby (#+ Literal)]]]]) (template [<type> <name> <implementation>] - [(def: #export <name> + [(def: .public <name> (-> <type> Literal) <implementation>)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux index a54e6da57..827cca197 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System Expression) (def: constant _.global) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux index 989fdf220..ed17f4d1d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -40,7 +40,7 @@ ["." artifact (#+ Registry)]]]]]]) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> Register Expression Statement))] [Operation /////generation.Operation] @@ -49,16 +49,16 @@ [Bundle /////generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation Expression))) -(type: #export Phase! +(type: .public Phase! (-> Phase Archive Synthesis (Operation Statement))) -(type: #export (Generator! i) +(type: .public (Generator! i) (-> Phase! Phase Archive i (Operation Statement))) -(def: #export unit +(def: .public unit (_.string /////synthesis.unit)) (def: (flag value) @@ -71,7 +71,7 @@ (-> LVar (-> LVar Statement) Statement) (definition name)) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -99,7 +99,7 @@ (#.Left name) (macro.with_gensyms [g!_] (let [g!name (code.local_identifier name)] - (in (list (` (def: #export (~ g!name) LVar (~ runtime_name))) + (in (list (` (def: .public (~ g!name) LVar (~ runtime_name))) (` (def: (~ (code.local_identifier (format "@" name))) Statement (..feature (~ runtime_name) @@ -112,7 +112,7 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (in (list (` (def: .public ((~ g!name) (~+ inputsC)) (-> (~+ inputs_typesC) Computation) (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) @@ -158,32 +158,32 @@ (_.return (_.array_range right_index (..tuple_size tuple) tuple))) ))))) -(def: #export variant_tag_field "_lux_tag") -(def: #export variant_flag_field "_lux_flag") -(def: #export variant_value_field "_lux_value") +(def: .public variant_tag_field "_lux_tag") +(def: .public variant_flag_field "_lux_flag") +(def: .public variant_value_field "_lux_value") (runtime: (sum//make tag last? value) (_.return (_.hash (list [(_.string ..variant_tag_field) tag] [(_.string ..variant_flag_field) last?] [(_.string ..variant_value_field) value])))) -(def: #export (variant tag last? value) +(def: .public (variant tag last? value) (-> Nat Bit Expression Computation) (sum//make (_.int (.int tag)) (..flag last?) value)) -(def: #export none +(def: .public none Computation (..variant 0 #0 ..unit)) -(def: #export some +(def: .public some (-> Expression Computation) (..variant 1 #1)) -(def: #export left +(def: .public left (-> Expression Computation) (..variant 0 #0)) -(def: #export right +(def: .public right (-> Expression Computation) (..variant 1 #1)) @@ -389,7 +389,7 @@ runtime//array )) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux index eaf6add62..f51cad8bc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux @@ -14,7 +14,7 @@ ["//#" /// #_ ["#." phase ("#\." monad)]]]]) -(def: #export (tuple generate archive elemsS+) +(def: .public (tuple generate archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -28,7 +28,7 @@ (monad.map ///////phase.monad (generate archive)) (///////phase\map _.array)))) -(def: #export (variant generate archive [lefts right? valueS]) +(def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux index 6292d9686..c2a62c407 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux @@ -25,7 +25,7 @@ [reference (#+) [variable (#+)]]]]]]]) -(def: #export (generate archive synthesis) +(def: .public (generate archive synthesis) Phase (case synthesis (^template [<tag> <generator>] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux index 25da6b501..b09071726 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux @@ -36,15 +36,15 @@ [meta [archive (#+ Archive)]]]]]]]) -(def: #export register +(def: .public register (-> Register Var) (|>> (///reference.local //reference.system) :assume)) -(def: #export capture +(def: .public capture (-> Register Var) (|>> (///reference.foreign //reference.system) :assume)) -(def: #export (let expression archive [valueS register bodyS]) +(def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) @@ -52,7 +52,7 @@ (in (_.let (list [(..register register) valueO]) bodyO)))) -(def: #export (if expression archive [testS thenS elseS]) +(def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do ///////phase.monad [testO (expression archive testS) @@ -60,7 +60,7 @@ elseO (expression archive elseS)] (in (_.if testO thenO elseO)))) -(def: #export (get expression archive [pathP valueS]) +(def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] @@ -214,7 +214,7 @@ (try_pm (_.raise/1 (_.string "Invalid expression for pattern-matching."))) (pattern_matching' expression archive pathP))) -(def: #export (case expression archive [valueS pathP]) +(def: .public (case expression archive [valueS pathP]) (Generator [Synthesis Path]) (do {! ///////phase.monad} [valueO (expression archive valueS)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension.lux index 1880d7700..17052fb88 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension.lux @@ -9,6 +9,6 @@ [/ ["." common]]) -(def: #export bundle +(def: .public bundle Bundle common.bundle) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux index 28cf31cc1..89acab685 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux @@ -31,17 +31,17 @@ (syntax: (Vector {size s.nat} elemT) (in (list (` [(~+ (list.repeat size elemT))])))) -(type: #export Nullary (-> (Vector 0 Expression) Computation)) -(type: #export Unary (-> (Vector 1 Expression) Computation)) -(type: #export Binary (-> (Vector 2 Expression) Computation)) -(type: #export Trinary (-> (Vector 3 Expression) Computation)) -(type: #export Variadic (-> (List Expression) Computation)) +(type: .public Nullary (-> (Vector 0 Expression) Computation)) +(type: .public Unary (-> (Vector 1 Expression) Computation)) +(type: .public Binary (-> (Vector 2 Expression) Computation)) +(type: .public Trinary (-> (Vector 3 Expression) Computation)) +(type: .public Variadic (-> (List Expression) Computation)) (syntax: (arity: {name s.local_identifier} {arity s.nat}) (with_gensyms [g!_ g!extension g!name g!phase g!inputs] (do {! macro.monad} [g!input+ (monad.seq ! (list.repeat arity (macro.gensym "input")))] - (in (list (` (def: #export ((~ (code.local_identifier name)) (~ g!extension)) + (in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!extension)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation) Handler) (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!inputs)) @@ -62,7 +62,7 @@ (arity: binary 2) (arity: trinary 3) -(def: #export (variadic extension) +(def: .public (variadic extension) (-> Variadic Handler) (function (_ extension_name) (function (_ phase inputsS) @@ -212,7 +212,7 @@ (bundle.install "exit" (unary _.exit/1)) (bundle.install "current-time" (nullary (function (_ _) (///runtime.io//current_time (_.string //////synthesis.unit)))))))) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "lux") (|> bundle::lux diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux index 7feb087f2..9998edab9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux @@ -29,7 +29,7 @@ [reference [variable (#+ Register Variable)]]]]]]) -(def: #export (apply expression archive [functionS argsS+]) +(def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) (do {! ///////phase.monad} [functionO (expression archive functionS) @@ -60,7 +60,7 @@ (def: input (|>> inc //case.register)) -(def: #export (function expression archive [environment arity bodyS]) +(def: .public (function expression archive [environment arity bodyS]) (Generator (Abstraction Synthesis)) (do {! ///////phase.monad} [[function_name bodyO] (/////generation.with_new_context archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux index 25b0feb46..32da9a0de 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux @@ -36,7 +36,7 @@ (def: @scope (_.var "scope")) -(def: #export (scope expression archive [start initsS+ bodyS]) +(def: .public (scope expression archive [start initsS+ bodyS]) (Generator (Scope Synthesis)) (case initsS+ ## function/false/non-independent loop @@ -56,7 +56,7 @@ bodyO)]) (_.apply/* initsO+ @scope)))))) -(def: #export (recur expression archive argsS+) +(def: .public (recur expression archive argsS+) (Generator (List Synthesis)) (do {! ///////phase.monad} [@scope /////generation.anchor diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux index a7c2b81b6..1cb915b8e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux @@ -5,7 +5,7 @@ ["_" scheme (#+ Expression)]]]]) (template [<name> <type> <code>] - [(def: #export <name> + [(def: .public <name> (-> <type> Expression) <code>)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux index 19d46ba19..b44d3f887 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux @@ -6,7 +6,7 @@ [/// [reference (#+ System)]]) -(implementation: #export system +(implementation: .public system (System Expression) (def: constant _.var) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index 72ec2ef27..5e17c3324 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -43,7 +43,7 @@ 0) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> Var Expression Expression))] [Operation /////generation.Operation] @@ -52,13 +52,13 @@ [Bundle /////generation.Bundle] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation Expression))) -(def: #export unit +(def: .public unit (_.string /////synthesis.unit)) -(syntax: #export (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} +(syntax: .public (with_vars {vars (<code>.tuple (<>.some <code>.local_identifier))} body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.seed))] @@ -82,7 +82,7 @@ (case declaration (#.Left name) (let [g!name (code.local_identifier name)] - (in (list (` (def: #export (~ g!name) + (in (list (` (def: .public (~ g!name) Var (~ runtime_name))) @@ -95,7 +95,7 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (in (list (` (def: .public ((~ g!name) (~+ inputsC)) (-> (~+ inputs_typesC) _.Computation) (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) @@ -147,7 +147,7 @@ (runtime: (sum//make tag last? value) (variant' tag last? value)) -(def: #export (variant [lefts right? value]) +(def: .public (variant [lefts right? value]) (-> (Variant Expression) Computation) (..sum//make (_.int (.int lefts)) (_.bool right?) value)) @@ -181,19 +181,19 @@ @sum//get @sum//make))) -(def: #export none +(def: .public none Computation (|> ..unit [0 #0] variant)) -(def: #export some +(def: .public some (-> Expression Computation) (|>> [1 #1] ..variant)) -(def: #export left +(def: .public left (-> Expression Computation) (|>> [0 #0] ..variant)) -(def: #export right +(def: .public right (-> Expression Computation) (|>> [1 #1] ..variant)) @@ -356,7 +356,7 @@ runtime//array ))) -(def: #export generate +(def: .public generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux index 3cf04831b..ebc933d4c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux @@ -17,7 +17,7 @@ ["//#" /// #_ ["#." phase ("#\." monad)]]]]) -(def: #export (tuple expression archive elemsS+) +(def: .public (tuple expression archive elemsS+) (Generator (Tuple Synthesis)) (case elemsS+ #.End @@ -31,7 +31,7 @@ (monad.map ///////phase.monad (expression archive)) (///////phase\map _.vector/*)))) -(def: #export (variant expression archive [lefts right? valueS]) +(def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? (inc lefts) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux index 306dfc48a..4adb10f57 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux @@ -97,7 +97,7 @@ (phase.run' state)))))) ))) -(def: #export (phase archive analysis) +(def: .public (phase archive analysis) Phase (do phase.monad [synthesis (..optimization archive analysis)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index f6f4d746c..aa9c0a757 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -223,7 +223,7 @@ _ <failure>))))) -(def: #export (synthesize_case synthesize archive input [[headP headA] tailPA+]) +(def: .public (synthesize_case synthesize archive input [[headP headA] tailPA+]) (-> Phase Archive Synthesis Match (Operation Synthesis)) (do {! ///.monad} [headSP (path archive synthesize headP headA) @@ -235,20 +235,20 @@ (#///analysis.Reference (///reference.local <output>))] (list)]) -(def: #export (synthesize_let synthesize archive input @variable body) +(def: .public (synthesize_let synthesize archive input @variable body) (-> Phase Archive Synthesis Register Analysis (Operation Synthesis)) (do ///.monad [body (/.with_new_local (synthesize archive body))] (in (/.branch/let [input @variable body])))) -(def: #export (synthesize_masking synthesize archive input @variable @output) +(def: .public (synthesize_masking synthesize archive input @variable @output) (-> Phase Archive Synthesis Register Register (Operation Synthesis)) (if (n.= @variable @output) (///\in input) (..synthesize_let synthesize archive input @variable (#///analysis.Reference (///reference.local @output))))) -(def: #export (synthesize_if synthesize archive test then else) +(def: .public (synthesize_if synthesize archive test then else) (-> Phase Archive Synthesis Analysis Analysis (Operation Synthesis)) (do ///.monad [then (synthesize archive then) @@ -260,7 +260,7 @@ (#///analysis.Reference (///reference.local <output>))] (.list)]) -(def: #export (synthesize_get synthesize archive input patterns @member) +(def: .public (synthesize_get synthesize archive input patterns @member) (-> Phase Archive Synthesis (///analysis.Tuple ///analysis.Pattern) Register (Operation Synthesis)) (case (..get patterns @member) #.End @@ -274,7 +274,7 @@ _ (///\in (/.branch/get [path input]))))) -(def: #export (synthesize synthesize^ [headB tailB+] archive inputA) +(def: .public (synthesize synthesize^ [headB tailB+] archive inputA) (-> Phase Match Phase) (do {! ///.monad} [inputS (synthesize^ archive inputA)] @@ -303,7 +303,7 @@ match (..synthesize_case synthesize^ archive inputS match)))) -(def: #export (count_pops path) +(def: .public (count_pops path) (-> Path [Nat Path]) (case path (^ (/.path/seq #/.Pop path')) @@ -313,10 +313,10 @@ _ [0 path])) -(def: #export pattern_matching_error +(def: .public pattern_matching_error "Invalid expression for pattern-matching.") -(type: #export Storage +(type: .public Storage {#bindings (Set Register) #dependencies (Set Variable)}) @@ -331,7 +331,7 @@ ## since the variable will exist beforehand, so no closure will need ## to be created for it. ## Apply this trick to JS, Python et al. -(def: #export (storage path) +(def: .public (storage path) (-> Path Storage) (loop for_path [path path diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux index b19403e90..39d934d96 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -27,7 +27,7 @@ ["#/." variable (#+ Register Variable)]] ["." phase ("#\." monad)]]]]) -(exception: #export (cannot_find_foreign_variable_in_environment {foreign Register} {environment (Environment Synthesis)}) +(exception: .public (cannot_find_foreign_variable_in_environment {foreign Register} {environment (Environment Synthesis)}) (exception.report ["Foreign" (%.nat foreign)] ["Environment" (exception.listing /.%synthesis environment)])) @@ -38,14 +38,14 @@ (enum.range n.enum 1) (list\map (|>> /.variable/local)))) -(template: #export (self_reference) +(template: .public (self_reference) (/.variable/local 0)) (def: (expanded_nested_self_reference arity) (-> Arity Synthesis) (/.function/apply [(..self_reference) (arity_arguments arity)])) -(def: #export (apply phase) +(def: .public (apply phase) (-> Phase Phase) (function (_ archive exprA) (let [[funcA argsA] (////analysis.application exprA)] @@ -243,7 +243,7 @@ (#/.Primitive _) (phase\in expression))) -(def: #export (abstraction phase environment archive bodyA) +(def: .public (abstraction phase environment archive bodyA) (-> Phase (Environment Analysis) Phase) (do {! phase.monad} [currying? /.currying? diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 6e83a6a6a..23227e4df 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -18,10 +18,10 @@ ["." reference ["." variable (#+ Register Variable)]]]]) -(type: #export (Transform a) +(type: .public (Transform a) (-> a (Maybe a))) -(def: #export (register_optimization offset) +(def: .public (register_optimization offset) (-> Register (-> Register Register)) (|>> dec (n.+ offset))) @@ -180,7 +180,7 @@ (monad.map maybe.monad (recur false)) (maybe\map (|>> [name] #/.Extension)))))) -(def: #export (optimization true_loop? offset inits functionS) +(def: .public (optimization true_loop? offset inits functionS) (-> Bit Register (List Synthesis) Abstraction (Maybe [Register (List Synthesis) Synthesis])) (|> (get@ #/.body functionS) (body_optimization true_loop? offset (get@ #/.environment functionS) (get@ #/.arity functionS)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index db9cbdc59..7f2f025f7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -209,7 +209,7 @@ (#.Item head tail)]))))) (template [<name>] - [(exception: #export (<name> {register Register}) + [(exception: .public (<name> {register Register}) (exception.report ["Register" (%.nat register)]))] @@ -436,7 +436,7 @@ (in [redundancy (#/.Extension name inputs)]))))) -(def: #export optimization +(def: .public optimization (-> Synthesis (Try Synthesis)) (|>> [..initial] optimization' diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux index be1eead63..af17d9e15 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux @@ -21,18 +21,18 @@ ["." descriptor (#+ Module)] ["." artifact]]]]]) -(type: #export (Program expression directive) +(type: .public (Program expression directive) (-> Context expression directive)) -(def: #export name +(def: .public name Text "") -(exception: #export (cannot_find_program {modules (List Module)}) +(exception: .public (cannot_find_program {modules (List Module)}) (exception.report ["Modules" (exception.listing %.text modules)])) -(def: #export (context archive) +(def: .public (context archive) (-> Archive (Try Context)) (do {! try.monad} [registries (|> archive diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index 4c930475b..212181b2d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -51,8 +51,8 @@ ["." frac]]]]]) (template: (inline: <declaration> <type> <body>) - (for {@.python (def: <declaration> <type> <body>)} - (template: <declaration> <body>))) + [(for {@.python (def: <declaration> <type> <body>)} + (template: <declaration> [<body>]))]) ## TODO: Implement "lux syntax char case!" as a custom extension. ## That way, it should be possible to obtain the char without wrapping @@ -72,7 +72,7 @@ (template [<name> <extension> <diff>] [(template: (<name> value) - (<extension> <diff> value))] + [(<extension> <diff> value)])] [!inc "lux i64 +" 1] [!inc/2 "lux i64 +" 2] @@ -80,11 +80,11 @@ ) (template: (!clip from to text) - ("lux text clip" from (n.- from to) text)) + [("lux text clip" from (n.- from to) text)]) (template [<name> <extension>] [(template: (<name> reference subject) - (<extension> reference subject))] + [(<extension> reference subject)])] [!n/= "lux i64 ="] [!i/< "lux i64 <"] @@ -92,26 +92,26 @@ (template [<name> <extension>] [(template: (<name> param subject) - (<extension> param subject))] + [(<extension> param subject)])] [!n/+ "lux i64 +"] [!n/- "lux i64 -"] ) -(type: #export Aliases +(type: .public Aliases (Dictionary Text Text)) -(def: #export no_aliases +(def: .public no_aliases Aliases (dictionary.empty text.hash)) -(def: #export prelude +(def: .public prelude .prelude_module) -(def: #export text_delimiter text.double_quote) +(def: .public text_delimiter text.double_quote) (template [<char> <definition>] - [(def: #export <definition> <char>)] + [(def: .public <definition> <char>)] ## Form delimiters ["(" open_form] @@ -144,7 +144,7 @@ ["." name_separator] ) -(exception: #export (end_of_file {module Text}) +(exception: .public (end_of_file {module Text}) (exception.report ["Module" (%.text module)])) @@ -155,7 +155,7 @@ (let [end (|> start (!n/+ amount_of_input_shown) (n.min ("lux text size" input)))] (!clip start end input))) -(exception: #export (unrecognized_input {[file line column] Location} {context Text} {input Text} {offset Offset}) +(exception: .public (unrecognized_input {[file line column] Location} {context Text} {input Text} {offset Offset}) (exception.report ["File" file] ["Line" (%.nat line)] @@ -163,44 +163,44 @@ ["Context" (%.text context)] ["Input" (input_at offset input)])) -(exception: #export (text_cannot_contain_new_lines {text Text}) +(exception: .public (text_cannot_contain_new_lines {text Text}) (exception.report ["Text" (%.text text)])) (template: (!failure parser where offset source_code) - (#.Left [[where offset source_code] - (exception.error ..unrecognized_input [where (%.name (name_of parser)) source_code offset])])) + [(#.Left [[where offset source_code] + (exception.error ..unrecognized_input [where (%.name (name_of parser)) source_code offset])])]) (template: (!end_of_file where offset source_code current_module) - (#.Left [[where offset source_code] - (exception.error ..end_of_file current_module)])) + [(#.Left [[where offset source_code] + (exception.error ..end_of_file current_module)])]) (type: (Parser a) (-> Source (Either [Source Text] [Source a]))) (template: (!with_char+ @source_code_size @source_code @offset @char @else @body) - (if (!i/< (:as Int @source_code_size) - (:as Int @offset)) - (let [@char ("lux text char" @offset @source_code)] - @body) - @else)) + [(if (!i/< (:as Int @source_code_size) + (:as Int @offset)) + (let [@char ("lux text char" @offset @source_code)] + @body) + @else)]) (template: (!with_char @source_code @offset @char @else @body) - (!with_char+ ("lux text size" @source_code) @source_code @offset @char @else @body)) + [(!with_char+ ("lux text size" @source_code) @source_code @offset @char @else @body)]) (template: (!letE <binding> <computation> <body>) - (case <computation> - (#.Right <binding>) - <body> + [(case <computation> + (#.Right <binding>) + <body> - ## (#.Left error) - <<otherwise>> - (:assume <<otherwise>>))) + ## (#.Left error) + <<otherwise>> + (:assume <<otherwise>>))]) (template: (!horizontal where offset source_code) - [(update@ #.column inc where) - (!inc offset) - source_code]) + [[(update@ #.column inc where) + (!inc offset) + source_code]]) (inline: (!new_line where) (-> Location Location) @@ -213,9 +213,9 @@ [where::file where::line (!n/+ length where::column)])) (template: (!vertical where offset source_code) - [(!new_line where) - (!inc offset) - source_code]) + [[(!new_line where) + (!inc offset) + source_code]]) (template [<name> <close> <tag>] [(inline: (<name> parse where offset source_code) @@ -257,13 +257,13 @@ (#.Left [source' error]))))) (template: (!guarantee_no_new_lines where offset source_code content body) - (case ("lux text index" 0 (static text.new_line) content) - #.None - body + [(case ("lux text index" 0 (static text.new_line) content) + #.None + body - g!_ - (#.Left [[where offset source_code] - (exception.error ..text_cannot_contain_new_lines content)]))) + g!_ + (#.Left [[where offset source_code] + (exception.error ..text_cannot_contain_new_lines content)]))]) (def: (text_parser where offset source_code) (-> Location Offset Text (Either [Source Text] [Source Code])) @@ -295,55 +295,55 @@ [..sigil]) <digit_separator> (static ..digit_separator)] (template: (!if_digit? @char @then @else) - ("lux syntax char case!" @char - [[<digits>] - @then] + [("lux syntax char case!" @char + [[<digits>] + @then] - ## else - @else)) + ## else + @else)]) (template: (!if_digit?+ @char @then @else_options @else) - (`` ("lux syntax char case!" @char - [[<digits> <digit_separator>] - @then + [(`` ("lux syntax char case!" @char + [[<digits> <digit_separator>] + @then - (~~ (template.spliced @else_options))] + (~~ (template.spliced @else_options))] - ## else - @else))) + ## else + @else))]) (`` (template: (!if_name_char?|tail @char @then @else) - ("lux syntax char case!" @char - [[<non_name_chars>] - @else] + [("lux syntax char case!" @char + [[<non_name_chars>] + @else] - ## else - @then))) + ## else + @then)])) (`` (template: (!if_name_char?|head @char @then @else) - ("lux syntax char case!" @char - [[<non_name_chars> <digits>] - @else] + [("lux syntax char case!" @char + [[<non_name_chars> <digits>] + @else] - ## else - @then))) + ## else + @then)])) ) (template: (!number_output <source_code> <start> <end> <codec> <tag>) - (case (|> <source_code> - (!clip <start> <end>) - (text.replace_all ..digit_separator "") - (\ <codec> decode)) - (#.Right output) - (#.Right [[(let [[where::file where::line where::column] where] - [where::file where::line (!n/+ (!n/- <start> <end>) where::column)]) - <end> - <source_code>] - [where (<tag> output)]]) - - (#.Left error) - (#.Left [[where <start> <source_code>] - error]))) + [(case (|> <source_code> + (!clip <start> <end>) + (text.replace_all ..digit_separator "") + (\ <codec> decode)) + (#.Right output) + (#.Right [[(let [[where::file where::line where::column] where] + [where::file where::line (!n/+ (!n/- <start> <end>) where::column)]) + <end> + <source_code>] + [where (<tag> output)]]) + + (#.Left error) + (#.Left [[where <start> <source_code>] + error]))]) (def: no_exponent Offset @@ -413,11 +413,11 @@ ) (template: (!signed_parser source_code//size offset where source_code @aliases @end) - (<| (let [g!offset/1 (!inc offset)]) - (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end) - (!if_digit? g!char/1 - (signed_parser source_code//size offset where (!inc/2 offset) source_code) - (!full_name_parser offset [where (!inc offset) source_code] where @aliases #.Identifier)))) + [(<| (let [g!offset/1 (!inc offset)]) + (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end) + (!if_digit? g!char/1 + (signed_parser source_code//size offset where (!inc/2 offset) source_code) + (!full_name_parser offset [where (!inc offset) source_code] where @aliases #.Identifier)))]) (with_expansions [<output> (#.Right [[(update@ #.column (|>> (!n/+ (!n/- start end))) where) end @@ -434,10 +434,10 @@ <output>)))))) (template: (!half_name_parser @offset @char @module) - (!if_name_char?|head @char - (!letE [source' name] (..name_part_parser @offset where (!inc @offset) source_code) - (#.Right [source' [@module name]])) - (!failure ..!half_name_parser where @offset source_code))) + [(!if_name_char?|head @char + (!letE [source' name] (..name_part_parser @offset where (!inc @offset) source_code) + (#.Right [source' [@module name]])) + (!failure ..!half_name_parser where @offset source_code))]) (`` (def: (short_name_parser source_code//size current_module [where offset/0 source_code]) (-> Nat Text (Parser Name)) @@ -451,8 +451,8 @@ (!half_name_parser offset/0 char/0 (static ..prelude)))))) (template: (!short_name_parser source_code//size @current_module @source @where @tag) - (!letE [source' name] (..short_name_parser source_code//size @current_module @source) - (#.Right [source' [@where (@tag name)]]))) + [(!letE [source' name] (..short_name_parser source_code//size @current_module @source) + (#.Right [source' [@where (@tag name)]]))]) (with_expansions [<simple> (as_is (#.Right [source' ["" simple]]))] (`` (def: (full_name_parser aliases start source) @@ -474,8 +474,8 @@ <simple>))))) (template: (!full_name_parser @offset @source @where @aliases @tag) - (!letE [source' full_name] (..full_name_parser @aliases @offset @source) - (#.Right [source' [@where (@tag full_name)]]))) + [(!letE [source' full_name] (..full_name_parser @aliases @offset @source) + (#.Right [source' [@where (@tag full_name)]]))]) ## TODO: Grammar macro for specifying syntax. ## (grammar: lux_grammar @@ -488,7 +488,7 @@ <recur> (as_is (parse current_module aliases source_code//size))] (template: (!close closer) - (#.Left [<move_1> closer])) + [(#.Left [<move_1> closer])]) (def: (bit_syntax value [where offset/0 source_code]) (-> Bit (Parser Code)) @@ -497,7 +497,7 @@ source_code] [where (#.Bit value)]])) - (def: #export (parse current_module aliases source_code//size) + (def: .public (parse current_module aliases source_code//size) (-> Text Aliases Nat (Parser Code)) ## The "exec []" is only there to avoid function fusion. ## This is to preserve the loop as much as possible and keep it tight. diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux index d5a1e53a4..3112e5b74 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -34,43 +34,43 @@ ["." reference (#+ Reference) ["." variable (#+ Register Variable)]]]]) -(type: #export Resolver +(type: .public Resolver (Dictionary Variable Variable)) -(type: #export State +(type: .public State {#locals Nat ## https://en.wikipedia.org/wiki/Currying #currying? Bit}) -(def: #export fresh_resolver +(def: .public fresh_resolver Resolver (dictionary.empty variable.hash)) -(def: #export init +(def: .public init State {#locals 0 #currying? false}) -(type: #export Primitive +(type: .public Primitive (#Bit Bit) (#I64 (I64 Any)) (#F64 Frac) (#Text Text)) -(type: #export Side +(type: .public Side (Either Nat Nat)) -(type: #export Member +(type: .public Member (Either Nat Nat)) -(type: #export Access +(type: .public Access (#Side Side) (#Member Member)) -(type: #export (Fork value next) +(type: .public (Fork value next) [[value next] (List [value next])]) -(type: #export (Path' s) +(type: .public (Path' s) #Pop (#Access Access) (#Bind Register) @@ -82,40 +82,40 @@ (#Seq (Path' s) (Path' s)) (#Then s)) -(type: #export (Abstraction' s) +(type: .public (Abstraction' s) {#environment (Environment s) #arity Arity #body s}) -(type: #export (Apply' s) +(type: .public (Apply' s) {#function s #arguments (List s)}) -(type: #export (Branch s) +(type: .public (Branch s) (#Let s Register s) (#If s s s) (#Get (List Member) s) (#Case s (Path' s))) -(type: #export (Scope s) +(type: .public (Scope s) {#start Register #inits (List s) #iteration s}) -(type: #export (Loop s) +(type: .public (Loop s) (#Scope (Scope s)) (#Recur (List s))) -(type: #export (Function s) +(type: .public (Function s) (#Abstraction (Abstraction' s)) (#Apply s (List s))) -(type: #export (Control s) +(type: .public (Control s) (#Branch (Branch s)) (#Loop (Loop s)) (#Function (Function s))) -(type: #export #rec Synthesis +(type: .public #rec Synthesis (#Primitive Primitive) (#Structure (Composite Synthesis)) (#Reference Reference) @@ -123,7 +123,7 @@ (#Extension (Extension Synthesis))) (template [<special> <general>] - [(type: #export <special> + [(type: .public <special> (<general> ..State Analysis Synthesis))] [State+ extension.State] @@ -133,29 +133,29 @@ [Bundle extension.Bundle] ) -(type: #export Path +(type: .public Path (Path' Synthesis)) -(def: #export path/pop +(def: .public path/pop Path #Pop) (template [<name> <kind>] - [(template: #export (<name> content) - (.<| #..Access - <kind> - content))] + [(template: .public (<name> content) + [(.<| #..Access + <kind> + content)])] [path/side #..Side] [path/member #..Member] ) (template [<name> <kind> <side>] - [(template: #export (<name> content) - (.<| #..Access - <kind> - <side> - content))] + [(template: .public (<name> content) + [(.<| #..Access + <kind> + <side> + content)])] [side/left #..Side #.Left] [side/right #..Side #.Right] @@ -164,35 +164,35 @@ ) (template [<name> <tag>] - [(template: #export (<name> content) - (<tag> content))] + [(template: .public (<name> content) + [(<tag> content)])] [path/bind #..Bind] [path/then #..Then] ) (template [<name> <tag>] - [(template: #export (<name> left right) - (<tag> [left right]))] + [(template: .public (<name> left right) + [(<tag> [left right])])] [path/alt #..Alt] [path/seq #..Seq] ) -(type: #export Abstraction +(type: .public Abstraction (Abstraction' Synthesis)) -(type: #export Apply +(type: .public Apply (Apply' Synthesis)) -(def: #export unit Text "") +(def: .public unit Text "") (template [<with> <query> <tag> <type>] - [(def: #export (<with> value) + [(def: .public (<with> value) (-> <type> (All [a] (-> (Operation a) (Operation a)))) (extension.temporary (set@ <tag> value))) - (def: #export <query> + (def: .public <query> (Operation <type>) (extension.read (get@ <tag>)))] @@ -200,15 +200,15 @@ [with_currying? currying? #currying? Bit] ) -(def: #export with_new_local +(def: .public with_new_local (All [a] (-> (Operation a) (Operation a))) (<<| (do phase.monad [locals ..locals]) (..with_locals (inc locals)))) (template [<name> <tag>] - [(template: #export (<name> content) - (#..Primitive (<tag> content)))] + [(template: .public (<name> content) + [(#..Primitive (<tag> content))])] [bit #..Bit] [i64 #..I64] @@ -217,20 +217,20 @@ ) (template [<name> <tag>] - [(template: #export (<name> content) - (<| #..Structure - <tag> - content))] + [(template: .public (<name> content) + [(<| #..Structure + <tag> + content)])] [variant #analysis.Variant] [tuple #analysis.Tuple] ) (template [<name> <tag>] - [(template: #export (<name> content) - (.<| #..Reference - <tag> - content))] + [(template: .public (<name> content) + [(.<| #..Reference + <tag> + content)])] [variable reference.variable] [constant reference.constant] @@ -239,11 +239,11 @@ ) (template [<name> <family> <tag>] - [(template: #export (<name> content) - (.<| #..Control - <family> - <tag> - content))] + [(template: .public (<name> content) + [(.<| #..Control + <family> + <tag> + content)])] [branch/case #..Branch #..Case] [branch/let #..Branch #..Let] @@ -257,7 +257,7 @@ [function/apply #..Function #..Apply] ) -(def: #export (%path' %then value) +(def: .public (%path' %then value) (All [a] (-> (Format a) (Format (Path' a)))) (case value #Pop @@ -316,7 +316,7 @@ (|> (%then then) (text.enclosed ["(! " ")"])))) -(def: #export (%synthesis value) +(def: .public (%synthesis value) (Format Synthesis) (case value (#Primitive primitive) @@ -409,11 +409,11 @@ (format (%.text name) " ") (text.enclosed ["(" ")"])))) -(def: #export %path +(def: .public %path (Format Path) (%path' %synthesis)) -(implementation: #export primitive_equivalence +(implementation: .public primitive_equivalence (Equivalence Primitive) (def: (= reference sample) @@ -457,7 +457,7 @@ (Hash Member) (sum.hash n.hash n.hash)) -(implementation: #export access_equivalence +(implementation: .public access_equivalence (Equivalence Access) (def: (= reference sample) @@ -485,7 +485,7 @@ ([#Side] [#Member]))))) -(implementation: #export (path'_equivalence equivalence) +(implementation: .public (path'_equivalence equivalence) (All [a] (-> (Equivalence a) (Equivalence (Path' a)))) (def: (= reference sample) @@ -740,7 +740,7 @@ [5 #Function ..function_hash]) ))) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Synthesis) (def: (= reference sample) @@ -757,11 +757,11 @@ _ false))) -(def: #export path_equivalence +(def: .public path_equivalence (Equivalence Path) (path'_equivalence equivalence)) -(implementation: #export hash +(implementation: .public hash (Hash Synthesis) (def: &equivalence ..equivalence) @@ -778,17 +778,17 @@ [#Control (..control_hash recur_hash)] [#Extension (extension.hash recur_hash)]))))) -(template: #export (!bind_top register thenP) - ($_ ..path/seq - (#..Bind register) - #..Pop - thenP)) +(template: .public (!bind_top register thenP) + [($_ ..path/seq + (#..Bind register) + #..Pop + thenP)]) -(template: #export (!multi_pop nextP) - ($_ ..path/seq - #..Pop - #..Pop - nextP)) +(template: .public (!multi_pop nextP) + [($_ ..path/seq + #..Pop + #..Pop + nextP)]) ## TODO: There are sister patterns to the simple side checks for tuples. ## These correspond to the situation where tuple members are accessed @@ -798,11 +798,11 @@ ## pattern-optimizations again, since a lot of BINDs will become POPs ## and thus will result in useless code being generated. (template [<name> <side>] - [(template: #export (<name> idx nextP) - ($_ ..path/seq - (<side> idx) - #..Pop - nextP))] + [(template: .public (<name> idx nextP) + [($_ ..path/seq + (<side> idx) + #..Pop + nextP)])] [simple_left_side ..side/left] [simple_right_side ..side/right] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/version.lux b/stdlib/source/library/lux/tool/compiler/language/lux/version.lux index dd3676068..1ad0a00b4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/version.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/version.lux @@ -4,6 +4,6 @@ [//// [version (#+ Version)]]) -(def: #export version +(def: .public version Version 00,06,00) diff --git a/stdlib/source/library/lux/tool/compiler/meta.lux b/stdlib/source/library/lux/tool/compiler/meta.lux index 23cacb4aa..2d61d0c94 100644 --- a/stdlib/source/library/lux/tool/compiler/meta.lux +++ b/stdlib/source/library/lux/tool/compiler/meta.lux @@ -4,6 +4,6 @@ [// [version (#+ Version)]]) -(def: #export version +(def: .public version Version 00,01,00) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index cd6b245ee..8efda7f03 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -38,16 +38,16 @@ [/// [version (#+ Version)]]]) -(type: #export Output +(type: .public Output (Row [artifact.ID (Maybe Text) Binary])) -(exception: #export (unknown_document {module Module} +(exception: .public (unknown_document {module Module} {known_modules (List Module)}) (exception.report ["Module" (%.text module)] ["Known Modules" (exception.listing %.text known_modules)])) -(exception: #export (cannot_replace_document {module Module} +(exception: .public (cannot_replace_document {module Module} {old (Document Any)} {new (Document Any)}) (exception.report @@ -55,26 +55,28 @@ ["Old key" (signature.description (document.signature old))] ["New key" (signature.description (document.signature new))])) -(exception: #export (module_has_already_been_reserved {module Module}) +(exception: .public (module_has_already_been_reserved {module Module}) (exception.report ["Module" (%.text module)])) -(exception: #export (module_must_be_reserved_before_it_can_be_added {module Module}) +(exception: .public (module_must_be_reserved_before_it_can_be_added {module Module}) (exception.report ["Module" (%.text module)])) -(exception: #export (module_is_only_reserved {module Module}) +(exception: .public (module_is_only_reserved {module Module}) (exception.report ["Module" (%.text module)])) -(type: #export ID +(type: .public ID Nat) -(def: #export runtime_module +(def: .public runtime_module Module "") -(abstract: #export Archive +(abstract: .public Archive + {} + {#next ID #resolver (Dictionary Module [ID (Maybe [Descriptor (Document Any) Output])])} @@ -82,12 +84,12 @@ (-> Archive ID) (|>> :representation (get@ #next))) - (def: #export empty + (def: .public empty Archive (:abstraction {#next 0 #resolver (dictionary.empty text.hash)})) - (def: #export (id module archive) + (def: .public (id module archive) (-> Module Archive (Try ID)) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.get module resolver) @@ -98,7 +100,7 @@ (exception.except ..unknown_document [module (dictionary.keys resolver)])))) - (def: #export (reserve module archive) + (def: .public (reserve module archive) (-> Module Archive (Try [ID Archive])) (let [(^slots [#..next #..resolver]) (:representation archive)] (case (dictionary.get module resolver) @@ -113,7 +115,7 @@ (update@ #..next inc) :abstraction)])))) - (def: #export (add module [descriptor document output] archive) + (def: .public (add module [descriptor document output] archive) (-> Module [Descriptor (Document Any) Output] Archive (Try Archive)) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.get module resolver) @@ -132,7 +134,7 @@ #.None (exception.except ..module_must_be_reserved_before_it_can_be_added [module])))) - (def: #export (find module archive) + (def: .public (find module archive) (-> Module Archive (Try [Descriptor (Document Any) Output])) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.get module resolver) @@ -146,7 +148,7 @@ (exception.except ..unknown_document [module (dictionary.keys resolver)])))) - (def: #export (archived? archive module) + (def: .public (archived? archive module) (-> Archive Module Bit) (case (..find module archive) (#try.Success _) @@ -155,7 +157,7 @@ (#try.Failure _) bit.no)) - (def: #export archived + (def: .public archived (-> Archive (List Module)) (|>> :representation (get@ #resolver) @@ -165,7 +167,7 @@ (#.Some _) (#.Some module) #.None #.None))))) - (def: #export (reserved? archive module) + (def: .public (reserved? archive module) (-> Archive Module Bit) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.get module resolver) @@ -175,13 +177,13 @@ #.None bit.no))) - (def: #export reserved + (def: .public reserved (-> Archive (List Module)) (|>> :representation (get@ #resolver) dictionary.keys)) - (def: #export reservations + (def: .public reservations (-> Archive (List [Module ID])) (|>> :representation (get@ #resolver) @@ -189,7 +191,7 @@ (list\map (function (_ [module [id _]]) [module id])))) - (def: #export (merged additions archive) + (def: .public (merged additions archive) (-> Archive Archive Archive) (let [[+next +resolver] (:representation additions)] (|> archive @@ -227,7 +229,7 @@ binary.nat (binary.list (binary.and binary.text binary.nat)))) - (def: #export (export version archive) + (def: .public (export version archive) (-> Version Archive Binary) (let [(^slots [#..next #..resolver]) (:representation archive)] (|> resolver @@ -239,12 +241,12 @@ [version next] (binary.run ..writer)))) - (exception: #export (version_mismatch {expected Version} {actual Version}) + (exception: .public (version_mismatch {expected Version} {actual Version}) (exception.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) - (exception: #export corrupt_data) + (exception: .public corrupt_data) (def: (correct_modules? reservations) (-> (List Reservation) Bit) @@ -267,7 +269,7 @@ (and (correct_modules? reservations) (correct_ids? reservations))) - (def: #export (import expected binary) + (def: .public (import expected binary) (-> Version Binary (Try Archive)) (do try.monad [[actual next reservations] (<binary>.run ..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 cab4eb2d3..11aa363fd 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -21,10 +21,10 @@ [type abstract]]]) -(type: #export ID +(type: .public ID Nat) -(type: #export Category +(type: .public Category #Anonymous (#Definition Text) (#Analyser Text) @@ -33,20 +33,22 @@ (#Directive Text) (#Custom Text)) -(type: #export Artifact +(type: .public Artifact {#id ID #category Category}) -(abstract: #export Registry +(abstract: .public Registry + {} + {#artifacts (Row Artifact) #resolver (Dictionary Text ID)} - (def: #export empty + (def: .public empty Registry (:abstraction {#artifacts row.empty #resolver (dictionary.empty text.hash)})) - (def: #export artifacts + (def: .public artifacts (-> Registry (Row Artifact)) (|>> :representation (get@ #artifacts))) @@ -54,7 +56,7 @@ (-> Registry ID) (|>> ..artifacts row.size)) - (def: #export (resource registry) + (def: .public (resource registry) (-> Registry [ID Registry]) (let [id (..next registry)] [id @@ -65,7 +67,7 @@ :abstraction)])) (template [<tag> <create> <fetch>] - [(def: #export (<create> name registry) + [(def: .public (<create> name registry) (-> Text Registry [ID Registry]) (let [id (..next registry)] [id @@ -76,7 +78,7 @@ (update@ #resolver (dictionary.put name id)) :abstraction)])) - (def: #export (<fetch> registry) + (def: .public (<fetch> registry) (-> Registry (List Text)) (|> registry :representation @@ -94,13 +96,13 @@ [#Custom custom customs] ) - (def: #export (remember name registry) + (def: .public (remember name registry) (-> Text Registry (Maybe ID)) (|> (:representation registry) (get@ #resolver) (dictionary.get name))) - (def: #export writer + (def: .public writer (Writer Registry) (let [category (: (Writer Category) (function (_ value) @@ -121,11 +123,11 @@ (row\map (get@ #category)) artifacts))) - (exception: #export (invalid_category {tag Nat}) + (exception: .public (invalid_category {tag Nat}) (exception.report ["Tag" (%.nat tag)])) - (def: #export parser + (def: .public parser (Parser Registry) (let [category (: (Parser Category) (do {! <>.monad} diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux index 08d1af30f..59f1981bc 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux @@ -15,10 +15,10 @@ [// ["." artifact (#+ Registry)]]) -(type: #export Module +(type: .public Module Text) -(type: #export Descriptor +(type: .public Descriptor {#name Module #file Path #hash Nat @@ -26,7 +26,7 @@ #references (Set Module) #registry Registry}) -(def: #export writer +(def: .public writer (Writer Descriptor) ($_ binary.and binary.text @@ -37,7 +37,7 @@ artifact.writer )) -(def: #export parser +(def: .public parser (Parser Descriptor) ($_ <>.and <b>.text diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux index b8af027c1..d9f12d482 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -20,16 +20,18 @@ ["." key (#+ Key)] [descriptor (#+ Module)]]) -(exception: #export (invalid_signature {expected Signature} {actual Signature}) +(exception: .public (invalid_signature {expected Signature} {actual Signature}) (exception.report ["Expected" (signature.description expected)] ["Actual" (signature.description actual)])) -(abstract: #export (Document d) +(abstract: .public (Document d) + {} + {#signature Signature #content d} - (def: #export (read key document) + (def: .public (read key document) (All [d] (-> (Key d) (Document Any) (Try d))) (let [[document//signature document//content] (:representation document)] (if (\ signature.equivalence = @@ -44,28 +46,28 @@ (exception.except ..invalid_signature [(key.signature key) document//signature])))) - (def: #export (write key content) + (def: .public (write key content) (All [d] (-> (Key d) d (Document d))) (:abstraction {#signature (key.signature key) #content content})) - (def: #export (check key document) + (def: .public (check key document) (All [d] (-> (Key d) (Document Any) (Try (Document d)))) (do try.monad [_ (..read key document)] (in (:assume document)))) - (def: #export signature + (def: .public signature (-> (Document Any) Signature) (|>> :representation (get@ #signature))) - (def: #export (writer content) + (def: .public (writer content) (All [d] (-> (Writer d) (Writer (Document d)))) (let [writer (binary.and signature.writer content)] (|>> :representation writer))) - (def: #export parser + (def: .public parser (All [d] (-> (Parser d) (Parser (Document d)))) (|>> (<>.and signature.parser) (\ <>.monad map (|>> :abstraction)))) 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 ec6439aa7..41de7eba0 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux @@ -6,14 +6,16 @@ [// [signature (#+ Signature)]]) -(abstract: #export (Key k) +(abstract: .public (Key k) + {} + Signature - (def: #export signature + (def: .public signature (-> (Key Any) Signature) (|>> :representation)) - (def: #export (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/signature.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux index e39bb2144..bc413b413 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux @@ -19,24 +19,24 @@ [//// [version (#+ Version)]]) -(type: #export Signature +(type: .public Signature {#name Name #version Version}) -(def: #export equivalence +(def: .public equivalence (Equivalence Signature) (product.equivalence name.equivalence nat.equivalence)) -(def: #export (description signature) +(def: .public (description signature) (-> Signature Text) (format (%.name (get@ #name signature)) " " (%.nat (get@ #version signature)))) -(def: #export writer +(def: .public writer (Writer Signature) (binary.and (binary.and binary.text binary.text) binary.nat)) -(def: #export parser +(def: .public parser (Parser Signature) (<>.and (<>.and <b>.text <b>.text) <b>.nat)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux index ecce5c337..4a9773f6c 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux @@ -29,14 +29,14 @@ Ancestry (set.empty text.hash)) -(type: #export Graph +(type: .public Graph (Dictionary Module Ancestry)) (def: empty Graph (dictionary.empty text.hash)) -(def: #export modules +(def: .public modules (-> Graph (List Module)) dictionary.keys) @@ -44,7 +44,7 @@ {#module Module #imports Ancestry}) -(def: #export graph +(def: .public graph (-> (List Dependency) Graph) (list\fold (function (_ [module imports] graph) (dictionary.put module imports graph)) @@ -79,10 +79,10 @@ (maybe.else ..fresh))] (set.member? target_ancestry source))) -(type: #export Order +(type: .public Order (List [Module [archive.ID [Descriptor (Document .Module) Output]]])) -(def: #export (load_order key archive) +(def: .public (load_order key archive) (-> (Key .Module) Archive (Try Order)) (let [ancestry (..ancestry archive)] (|> ancestry diff --git a/stdlib/source/library/lux/tool/compiler/meta/io.lux b/stdlib/source/library/lux/tool/compiler/meta/io.lux index 8802d00bd..5aa0d7331 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io.lux @@ -6,15 +6,15 @@ [world [file (#+ Path System)]]]]) -(type: #export Context +(type: .public Context Path) -(type: #export Code +(type: .public Code Text) -(def: #export (safe system) +(def: .public (safe system) (All [m] (-> (System m) Text Text)) (text.replace_all "/" (\ system separator))) -(def: #export lux_context +(def: .public lux_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 125360e58..21d657352 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -51,7 +51,7 @@ ["." directive] ["#/." program]]]]]]) -(exception: #export (cannot_prepare {archive file.Path} +(exception: .public (cannot_prepare {archive file.Path} {module_id archive.ID} {error Text}) (exception.report @@ -83,7 +83,7 @@ (\ fs separator) (%.nat module_id))) -(def: #export (artifact fs static module_id artifact_id) +(def: .public (artifact fs static module_id artifact_id) (All [!] (-> (file.System !) Static archive.ID artifact.ID file.Path)) (format (..module fs static module_id) (\ fs separator) @@ -98,7 +98,7 @@ (in (#try.Success [])) (\ fs make_directory path)))) -(def: #export (prepare fs static module_id) +(def: .public (prepare fs static module_id) (-> (file.System Async) Static archive.ID (Async (Try Any))) (do {! async.monad} [.let [module (..module fs static module_id)] @@ -118,11 +118,11 @@ module_id error]))))))))) -(def: #export (write fs static module_id artifact_id content) +(def: .public (write fs static module_id artifact_id content) (-> (file.System Async) Static archive.ID artifact.ID Binary (Async (Try Any))) (\ fs write content (..artifact fs static module_id artifact_id))) -(def: #export (enable fs static) +(def: .public (enable fs static) (-> (file.System Async) Static (Async (Try Any))) (do (try.with async.monad) [_ (..ensure_directory fs (get@ #static.target static))] @@ -134,7 +134,7 @@ (\ fs separator) "general_descriptor")) -(def: #export (freeze fs static archive) +(def: .public (freeze fs static archive) (-> (file.System Async) Static Archive (Async (Try Any))) (\ fs write (archive.export ///.version archive) (..general_descriptor fs static))) @@ -147,7 +147,7 @@ (\ fs separator) ..module_descriptor_file)) -(def: #export (cache fs static module_id content) +(def: .public (cache fs static module_id content) (-> (file.System Async) Static archive.ID Binary (Async (Try Any))) (\ fs write content (..module_descriptor fs static module_id))) @@ -459,7 +459,7 @@ ..empty_bundles loaded_caches)]))))) -(def: #export (thaw host_environment fs static import contexts) +(def: .public (thaw host_environment fs static import contexts) (All [expression directive] (-> (generation.Host expression directive) (file.System Async) Static 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 e049ef8b5..81ac25578 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -29,23 +29,23 @@ [descriptor (#+ Module)]] ["/#" // (#+ Input)]]]) -(exception: #export (cannot_find_module {importer Module} {module Module}) +(exception: .public (cannot_find_module {importer Module} {module Module}) (exception.report ["Module" (%.text module)] ["Importer" (%.text importer)])) -(exception: #export (cannot_read_module {module Module}) +(exception: .public (cannot_read_module {module Module}) (exception.report ["Module" (%.text module)])) -(type: #export Extension +(type: .public Extension Text) (def: lux_extension Extension ".lux") -(def: #export (path fs context module) +(def: .public (path fs context module) (All [m] (-> (file.System m) Context Module file.Path)) (|> module (//.safe fs) @@ -120,7 +120,7 @@ (#try.Failure _) (in (..find_library_source_file importer import partial_host_extension module))))) -(def: #export (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) @@ -135,7 +135,7 @@ (#try.Failure _) (async\in (exception.except ..cannot_read_module [module]))))) -(type: #export Enumeration +(type: .public Enumeration (Dictionary file.Path Binary)) (def: (context_listing fs directory enumeration) @@ -159,7 +159,7 @@ (def: Action (type (All [a] (Async (Try a))))) -(def: #export (listing fs contexts) +(def: .public (listing fs contexts) (-> (file.System Async) (List Context) (Action Enumeration)) (monad.fold (: (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 07ac4be8c..21c15d551 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager.lux @@ -22,16 +22,16 @@ [lux [generation (#+ Context)]]]]]) -(type: #export Packager +(type: .public Packager (-> (Dictionary file.Path Binary) Archive Context (Try Binary))) -(type: #export Order +(type: .public Order (List [archive.ID (List artifact.ID)])) -(def: #export order +(def: .public order (-> dependency.Order Order) (list\map (function (_ [module [module_id [descriptor document]]]) (|> descriptor 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 c138ef6ce..bf5ed12f9 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -242,7 +242,7 @@ duplicates sink)))))))) -(def: #export (package static) +(def: .public (package static) (-> Static Packager) (function (_ host_dependencies archive program) (do {! try.monad} 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 081a43829..ee2dd3415 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -116,7 +116,7 @@ module_file (tar.path (..module_file module_id))] (in (#tar.Normal [module_file now ..mode ..ownership entry_content])))) -(def: #export (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 0f3f33a29..28f8a3f28 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux @@ -54,7 +54,7 @@ (sequence so_far))))) so_far))) -(def: #export (package header code sequence scope) +(def: .public (package header code sequence scope) (All [directive] (-> directive (-> directive Text) diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index cfae348ce..73aef8bcd 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -24,41 +24,41 @@ [meta [archive (#+ Archive)]]]) -(type: #export (Operation s o) +(type: .public (Operation s o) (state.+State Try s o)) -(def: #export monad +(def: .public monad (All [s] (Monad (Operation s))) (state.with try.monad)) -(type: #export (Phase s i o) +(type: .public (Phase s i o) (-> Archive i (Operation s o))) -(def: #export (run' state operation) +(def: .public (run' state operation) (All [s o] (-> s (Operation s o) (Try [s o]))) (operation state)) -(def: #export (run state operation) +(def: .public (run state operation) (All [s o] (-> s (Operation s o) (Try o))) (|> state operation (\ try.monad map product.right))) -(def: #export get_state +(def: .public get_state (All [s o] (Operation s s)) (function (_ state) (#try.Success [state state]))) -(def: #export (set_state state) +(def: .public (set_state state) (All [s o] (-> s (Operation s Any))) (function (_ _) (#try.Success [state []]))) -(def: #export (sub [get set] operation) +(def: .public (sub [get set] operation) (All [s s' o] (-> [(-> s s') (-> s' s s)] (Operation s' o) @@ -68,30 +68,30 @@ [[state' output] (operation (get state))] (in [(set state' state) output])))) -(def: #export failure +(def: .public failure (-> Text Operation) (|>> #try.Failure (state.lift try.monad))) -(def: #export (except exception parameters) +(def: .public (except exception parameters) (All [e] (-> (Exception e) e Operation)) (..failure (ex.error exception parameters))) -(def: #export (lift error) +(def: .public (lift error) (All [s a] (-> (Try a) (Operation s a))) (function (_ state) (try\map (|>> [state]) error))) -(syntax: #export (assertion exception message test) +(syntax: .public (assertion exception message test) (in (list (` (if (~ test) (\ ..monad (~' in) []) (..except (~ exception) (~ message))))))) -(def: #export identity +(def: .public identity (All [s a] (Phase s a a)) (function (_ archive input state) (#try.Success [state input]))) -(def: #export (compose pre post) +(def: .public (compose pre post) (All [s0 s1 i t o] (-> (Phase s0 i t) (Phase s1 t o) @@ -102,7 +102,7 @@ [post/state' output] (post archive temp post/state)] (in [[pre/state' post/state'] output])))) -(def: #export (timed definition description operation) +(def: .public (timed definition description operation) (All [s a] (-> Name Text (Operation s a) (Operation s a))) (do ..monad diff --git a/stdlib/source/library/lux/tool/compiler/reference.lux b/stdlib/source/library/lux/tool/compiler/reference.lux index 8823b29e2..e8714bb2a 100644 --- a/stdlib/source/library/lux/tool/compiler/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/reference.lux @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- local) [abstract [equivalence (#+ Equivalence)] [hash (#+ Hash)]] @@ -16,14 +16,14 @@ ["." / #_ ["#." variable (#+ Variable)]]) -(type: #export Constant +(type: .public Constant Name) -(type: #export Reference +(type: .public Reference (#Variable Variable) (#Constant Constant)) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Reference) (def: (= reference sample) @@ -37,7 +37,7 @@ _ false))) -(implementation: #export hash +(implementation: .public hash (Hash Reference) (def: &equivalence @@ -54,29 +54,29 @@ ))) (template [<name> <family> <tag>] - [(template: #export (<name> content) - (<| <family> - <tag> - content))] + [(template: .public (<name> content) + [(<| <family> + <tag> + content)])] [local #..Variable #/variable.Local] [foreign #..Variable #/variable.Foreign] ) (template [<name> <tag>] - [(template: #export (<name> content) - (<| <tag> - content))] + [(template: .public (<name> content) + [(<| <tag> + content)])] [variable #..Variable] [constant #..Constant] ) -(def: #export self +(def: .public self Reference (..local 0)) -(def: #export format +(def: .public format (Format Reference) (|>> (case> (#Variable variable) (/variable.format variable) diff --git a/stdlib/source/library/lux/tool/compiler/reference/variable.lux b/stdlib/source/library/lux/tool/compiler/reference/variable.lux index a8ce4c049..c45c5239b 100644 --- a/stdlib/source/library/lux/tool/compiler/reference/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/reference/variable.lux @@ -14,14 +14,14 @@ ["n" nat] ["i" int]]]]]) -(type: #export Register +(type: .public Register Nat) -(type: #export Variable +(type: .public Variable (#Local Register) (#Foreign Register)) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Variable) (def: (= reference sample) @@ -34,7 +34,7 @@ _ #0))) -(implementation: #export hash +(implementation: .public hash (Hash Variable) (def: &equivalence @@ -48,10 +48,10 @@ ([2 #Local] [3 #Foreign]))))) -(template: #export (self) - (#..Local 0)) +(template: .public (self) + [(#..Local 0)]) -(def: #export self? +(def: .public self? (-> Variable Bit) (|>> (case> (^ (..self)) true @@ -59,7 +59,7 @@ _ false))) -(def: #export format +(def: .public format (Format Variable) (|>> (case> (#Local local) (%.format "+" (%.nat local)) diff --git a/stdlib/source/library/lux/tool/compiler/version.lux b/stdlib/source/library/lux/tool/compiler/version.lux index 733b86477..4d34cab77 100644 --- a/stdlib/source/library/lux/tool/compiler/version.lux +++ b/stdlib/source/library/lux/tool/compiler/version.lux @@ -8,7 +8,7 @@ [number ["n" nat]]]]]) -(type: #export Version +(type: .public Version Nat) (def: range 100) @@ -23,15 +23,15 @@ (def: next (n./ ..range)) -(def: #export patch +(def: .public patch (-> Version Nat) (|>> ..current ..level)) -(def: #export minor +(def: .public minor (-> Version Nat) (|>> ..next ..level)) -(def: #export major +(def: .public major (-> Version Nat) (|>> ..next ..next ..level)) @@ -43,7 +43,7 @@ (%.format "0" (%.nat value)) (%.nat value))) -(def: #export (format version) +(def: .public (format version) (%.Format Version) (%.format (..padded (..major version)) ..separator diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index f60aaf134..a531ed396 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -29,10 +29,10 @@ ["." console (#+ Console)]]]] ["." /type]) -(exception: #export (error {message Text}) +(exception: .public (error {message Text}) message) -(def: #export module "<INTERPRETER>") +(def: .public module "<INTERPRETER>") (def: fresh_source Source @@ -191,7 +191,7 @@ (set@ #source source')) representation])))) -(def: #export (run Monad<!> Console<!> platform configuration generation_bundle) +(def: .public (run Monad<!> Console<!> platform configuration generation_bundle) (All [! anchor expression directive] (-> (Monad !) (Console !) (Platform ! anchor expression directive) diff --git a/stdlib/source/library/lux/tool/mediator.lux b/stdlib/source/library/lux/tool/mediator.lux index b24309ef1..9357999f4 100644 --- a/stdlib/source/library/lux/tool/mediator.lux +++ b/stdlib/source/library/lux/tool/mediator.lux @@ -10,10 +10,10 @@ ["." archive (#+ Archive) [descriptor (#+ Module)]]]]]) -(type: #export Source File) +(type: .public Source File) -(type: #export (Mediator !) +(type: .public (Mediator !) (-> Archive Module (! Archive))) -(type: #export (Instancer ! d o) +(type: .public (Instancer ! d o) (-> (file.System !) (List Source) (Compiler d o) (Mediator !))) diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index ed808b8e9..ed5964589 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -29,7 +29,7 @@ ["." location]]]]) (template [<name> <tag>] - [(def: #export (<name> type) + [(def: .public (<name> type) (-> Type [Nat Type]) (loop [num_args 0 type type] @@ -44,7 +44,7 @@ [flat_ex_q #.ExQ] ) -(def: #export (flat_function type) +(def: .public (flat_function type) (-> Type [(List Type) Type]) (case type (#.Function in out') @@ -54,7 +54,7 @@ _ [(list) type])) -(def: #export (flat_application type) +(def: .public (flat_application type) (-> Type [Type (List Type)]) (case type (#.Apply arg func') @@ -65,7 +65,7 @@ [type (list)])) (template [<name> <tag>] - [(def: #export (<name> type) + [(def: .public (<name> type) (-> Type (List Type)) (case type (<tag> left right) @@ -78,7 +78,7 @@ [flat_tuple #.Product] ) -(def: #export (format type) +(def: .public (format type) (-> Type Text) (case type (#.Primitive name params) @@ -176,7 +176,7 @@ type )) -(implementation: #export equivalence +(implementation: .public equivalence (Equivalence Type) (def: (= x y) @@ -221,7 +221,7 @@ #0 )))) -(def: #export (applied params func) +(def: .public (applied params func) (-> (List Type) Type (Maybe Type)) (case params #.End @@ -245,7 +245,7 @@ _ #.None))) -(def: #export (code type) +(def: .public (code type) (-> Type Code) (case type (#.Primitive name params) @@ -273,7 +273,7 @@ ([#.UnivQ] [#.ExQ]) )) -(def: #export (de_aliased type) +(def: .public (de_aliased type) (-> Type Type) (case type (#.Named _ (#.Named name type')) @@ -282,7 +282,7 @@ _ type)) -(def: #export (anonymous type) +(def: .public (anonymous type) (-> Type Type) (case type (#.Named name type') @@ -292,7 +292,7 @@ type)) (template [<name> <base> <ctor>] - [(def: #export (<name> types) + [(def: .public (<name> types) (-> (List Type) Type) (case types #.End @@ -308,7 +308,7 @@ [tuple Any #.Product] ) -(def: #export (function inputs output) +(def: .public (function inputs output) (-> (List Type) Type Type) (case inputs #.End @@ -317,7 +317,7 @@ (#.Item input inputs') (#.Function input (function inputs' output)))) -(def: #export (application params quant) +(def: .public (application params quant) (-> (List Type) Type Type) (case params #.End @@ -327,7 +327,7 @@ (application params' (#.Apply param quant)))) (template [<name> <tag>] - [(def: #export (<name> size body) + [(def: .public (<name> size body) (-> Nat Type Type) (case size 0 body @@ -337,7 +337,7 @@ [ex_q #.ExQ] ) -(def: #export (quantified? type) +(def: .public (quantified? type) (-> Type Bit) (case type (#.Named [module name] _type) @@ -354,7 +354,7 @@ _ #0)) -(def: #export (array depth element_type) +(def: .public (array depth element_type) (-> Nat Type Type) (case depth 0 element_type @@ -363,7 +363,7 @@ (list) (#.Primitive array.type_name)))) -(def: #export (flat_array type) +(def: .public (flat_array type) (-> Type [Nat Type]) (case type (^multi (^ (#.Primitive name (list element_type))) @@ -374,7 +374,7 @@ _ [0 type])) -(def: #export array? +(def: .public array? (-> Type Bit) (|>> ..flat_array product.left @@ -387,7 +387,7 @@ (def: secret_marker (`` (name_of (~~ (new_secret_marker))))) -(syntax: #export (:log! {input (<>.or (<>.and <code>.identifier +(syntax: .public (:log! {input (<>.or (<>.and <code>.identifier (<>.maybe (<>.after (<code>.identifier! ..secret_marker) <code>.any))) <code>.any)}) (case input @@ -417,7 +417,7 @@ (Parser (List Text)) (<code>.tuple (<>.some <code>.local_identifier))) -(syntax: #export (:cast {type_vars type_parameters} +(syntax: .public (:cast {type_vars type_parameters} input output {value (<>.maybe <code>.any)}) @@ -440,7 +440,7 @@ (<>.and <code>.any <code>.any)) ## TODO: Make sure the generated code always gets optimized away. -(syntax: #export (:sharing {type_vars ..type_parameters} +(syntax: .public (:sharing {type_vars ..type_parameters} {exemplar ..typed} {computation ..typed}) (macro.with_gensyms [g!_] @@ -451,7 +451,7 @@ (~ (get@ #expression computation)))))] (in (list (` ((~ shareC) (~ (get@ #expression exemplar))))))))) -(syntax: #export (:by_example {type_vars ..type_parameters} +(syntax: .public (:by_example {type_vars ..type_parameters} {exemplar ..typed} {extraction <code>.any}) (in (list (` (:of ((~! :sharing) diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux index 7eb42acb2..2ea87233e 100644 --- a/stdlib/source/library/lux/type/abstract.lux +++ b/stdlib/source/library/lux/type/abstract.lux @@ -17,7 +17,6 @@ [macro ["." code] [syntax (#+ syntax:) - ["|.|" export] ["|.|" annotations]]]]]) (type: Stack List) @@ -34,7 +33,7 @@ (All [a] (-> (Stack a) (Maybe (Stack a)))) list.tail) -(type: #export Frame +(type: .public Frame {#name Text #type_vars (List Code) #abstraction Code @@ -45,15 +44,15 @@ #.End) (template: (!peek <source> <reference> <then>) - (loop [entries <source>] - (case entries - (#.Item [head_name head] tail) - (if (text\= <reference> head_name) - <then> - (recur tail)) + [(loop [entries <source>] + (case entries + (#.Item [head_name head] tail) + (if (text\= <reference> head_name) + <then> + (recur tail)) - #.End - (undefined)))) + #.End + (undefined)))]) (def: (peek_frames_definition reference source) (-> Text (List [Text Global]) (Stack Frame)) @@ -70,7 +69,7 @@ (!peek source reference (peek_frames_definition definition_reference (get@ #.definitions head)))) -(exception: #export no_active_frames) +(exception: .public no_active_frames) (def: (peek! frame) (-> (Maybe Text) (Meta Frame)) @@ -91,26 +90,26 @@ #.None (exception.except ..no_active_frames []))))) -(def: #export current +(def: .public current (Meta Frame) (..peek! #.None)) -(def: #export (specific name) +(def: .public (specific name) (-> Text (Meta Frame)) (..peek! (#.Some name))) (template: (!push <source> <reference> <then>) - (loop [entries <source>] - (case entries - (#.Item [head_name head] tail) - (if (text\= <reference> head_name) - (#.Item [head_name <then>] - tail) - (#.Item [head_name head] - (recur tail))) - - #.End - (undefined)))) + [(loop [entries <source>] + (case entries + (#.Item [head_name head] tail) + (if (text\= <reference> head_name) + (#.Item [head_name <then>] + tail) + (#.Item [head_name head] + (recur tail))) + + #.End + (undefined)))]) (def: (push_frame_definition reference frame source) (-> Text Frame (List [Text Global]) (List [Text Global])) @@ -175,7 +174,7 @@ (<>.and (<>\in #.None) <code>.any))) (template [<name> <from> <to>] - [(syntax: #export (<name> {[frame value] ..cast}) + [(syntax: .public (<name> {[frame value] ..cast}) (do meta.monad [[name type_vars abstraction representation] (peek! frame)] (in (list (` ((~! :cast) [(~+ type_vars)] (~ <from>) (~ <to>) @@ -203,14 +202,25 @@ (<>.either (<code>.form (<>.and <code>.local_identifier (<>.some <code>.local_identifier))) (<>.and <code>.local_identifier (\ <>.monad in (list))))) +(def: abstract + (Parser [Code [Text (List Text)] |annotations|.Annotations Code (List Code)]) + (let [private (: (Parser [[Text (List Text)] |annotations|.Annotations Code (List Code)]) + ($_ <>.and + ..declaration + |annotations|.parser + <code>.any + (<>.some <code>.any) + ))] + ($_ <>.either + (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private) + ))) + ## TODO: Make sure the generated code always gets optimized away. ## (This applies to uses of ":abstraction" and ":representation") -(syntax: #export (abstract: - {export |export|.parser} - {[name type_vars] declaration} - representation_type - {annotations (<>.else |annotations|.empty |annotations|.parser)} - {primitives (<>.some <code>.any)}) +(syntax: .public (abstract: + {[export_policy [name type_vars] annotations representation_type primitives] + ..abstract}) (do meta.monad [current_module meta.current_module_name .let [type_varsC (list\map code.local_identifier type_vars) @@ -221,7 +231,7 @@ type_varsC abstraction_declaration representation_declaration])] - (in (list& (` (type: (~+ (|export|.format export)) (~ abstraction_declaration) + (in (list& (` (type: (~ export_policy) (~ abstraction_declaration) (~ (|annotations|.format annotations)) (primitive (~ (code.text (abstraction_type_name [current_module name]))) [(~+ type_varsC)]))) @@ -240,7 +250,7 @@ (<>.or (<>.and <code>.any parser) parser)) -(syntax: #export (:transmutation {selection (..selection <code>.any)}) +(syntax: .public (:transmutation {selection (..selection <code>.any)}) (case selection (#Specific specific value) (in (list (` (..:abstraction (~ specific) @@ -250,7 +260,7 @@ (#Current value) (in (list (` (..:abstraction (..:representation (~ value)))))))) -(syntax: #export (^:representation {selection (<code>.form (..selection <code>.local_identifier))} +(syntax: .public (^:representation {selection (<code>.form (..selection <code>.local_identifier))} body {branches (<>.some <code>.any)}) (case selection diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index 0b47df0ab..352c5f3df 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -23,42 +23,42 @@ ["." // ("#\." equivalence)]) (template: (!n\= reference subject) - ("lux i64 =" reference subject)) + [("lux i64 =" reference subject)]) (template: (!text\= reference subject) - ("lux text =" reference subject)) + [("lux text =" reference subject)]) -(exception: #export (unknown_type_var {id Nat}) +(exception: .public (unknown_type_var {id Nat}) (exception.report ["ID" (n\encode id)])) -(exception: #export (unbound_type_var {id Nat}) +(exception: .public (unbound_type_var {id Nat}) (exception.report ["ID" (n\encode id)])) -(exception: #export (invalid_type_application {funcT Type} {argT Type}) +(exception: .public (invalid_type_application {funcT Type} {argT Type}) (exception.report ["Type function" (//.format funcT)] ["Type argument" (//.format argT)])) -(exception: #export (cannot_rebind_var {id Nat} {type Type} {bound Type}) +(exception: .public (cannot_rebind_var {id Nat} {type Type} {bound Type}) (exception.report ["Var" (n\encode id)] ["Wanted Type" (//.format type)] ["Current Type" (//.format bound)])) -(exception: #export (type_check_failed {expected Type} {actual Type}) +(exception: .public (type_check_failed {expected Type} {actual Type}) (exception.report ["Expected" (//.format expected)] ["Actual" (//.format actual)])) -(type: #export Var +(type: .public Var Nat) (type: Assumption [Type Type]) -(type: #export (Check a) +(type: .public (Check a) (-> Type_Context (Try [Type_Context a]))) (type: (Checker a) @@ -67,7 +67,7 @@ (type: Type_Vars (List [Var (Maybe Type)])) -(implementation: #export functor +(implementation: .public functor (Functor Check) (def: (map f fa) @@ -79,7 +79,7 @@ (#try.Failure error) (#try.Failure error))))) -(implementation: #export apply +(implementation: .public apply (Apply Check) (def: &functor ..functor) @@ -100,7 +100,7 @@ ))) ) -(implementation: #export monad +(implementation: .public monad (Monad Check) (def: &functor ..functor) @@ -157,7 +157,7 @@ (#.Item [var_id var_type] (var::put id value plist'))))) -(def: #export (run context proc) +(def: .public (run context proc) (All [a] (-> Type_Context (Check a) (Try a))) (case (proc context) (#try.Success [context' output]) @@ -166,23 +166,23 @@ (#try.Failure error) (#try.Failure error))) -(def: #export (failure message) +(def: .public (failure message) (All [a] (-> Text (Check a))) (function (_ context) (#try.Failure message))) -(def: #export (assertion message test) +(def: .public (assertion message test) (-> Text Bit (Check Any)) (function (_ context) (if test (#try.Success [context []]) (#try.Failure message)))) -(def: #export (except exception message) +(def: .public (except exception message) (All [e a] (-> (Exception e) e (Check a))) (..failure (exception.error exception message))) -(def: #export existential +(def: .public existential {#.doc "A producer of existential types."} (Check [Nat Type]) (function (_ context) @@ -191,7 +191,7 @@ [id (#.Ex id)]])))) (template [<name> <outputT> <fail> <succeed>] - [(def: #export (<name> id) + [(def: .public (<name> id) (-> Var (Check <outputT>)) (function (_ context) (case (|> context (get@ #.var_bindings) (var::get id)) @@ -209,7 +209,7 @@ [read (Maybe Type) #.None (#.Some bound)] ) -(def: #export (read! id) +(def: .public (read! id) (-> Var (Check Type)) (do ..monad [?type (read id)] @@ -233,7 +233,7 @@ _ (exception.except ..unknown_type_var id)))) -(def: #export (bind type id) +(def: .public (bind type id) (-> Type Var (Check Any)) (function (_ context) (case (|> context (get@ #.var_bindings) (var::get id)) @@ -258,7 +258,7 @@ _ (exception.except ..unknown_type_var id)))) -(def: #export var +(def: .public var (Check [Var Type]) (function (_ context) (let [id (get@ #.var_counter context)] @@ -323,7 +323,7 @@ #.None (exception.except ..unknown_type_var current))))) -(def: #export fresh_context +(def: .public fresh_context Type_Context {#.var_counter 0 #.ex_counter 0 @@ -664,12 +664,12 @@ _ ..silent_failure!)))) -(def: #export (check expected actual) +(def: .public (check expected actual) {#.doc "Type-check to ensure that the 'expected' type subsumes the 'actual' type."} (-> Type Type (Check Any)) (check' (list) expected actual)) -(def: #export (checks? expected actual) +(def: .public (checks? expected actual) {#.doc "A simple type-checking function that just returns a yes/no answer."} (-> Type Type Bit) (case (..run ..fresh_context (..check' (list) expected actual)) @@ -679,12 +679,12 @@ (#try.Success _) true)) -(def: #export context +(def: .public context (Check Type_Context) (function (_ context) (#try.Success [context context]))) -(def: #export (clean inputT) +(def: .public (clean inputT) (-> Type (Check Type)) (case inputT (#.Primitive name paramsT+) diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux index f9a9d0c53..bfd73455c 100644 --- a/stdlib/source/library/lux/type/dynamic.lux +++ b/stdlib/source/library/lux/type/dynamic.lux @@ -13,27 +13,27 @@ ["." type abstract]]]) -(exception: #export (wrong_type {expected Type} {actual Type}) +(exception: .public (wrong_type {expected Type} {actual Type}) (exception.report ["Expected" (%.type expected)] ["Actual" (%.type actual)])) -(abstract: #export Dynamic - [Type Any] - +(abstract: .public Dynamic {#.doc "A value coupled with its type, so it can be checked later."} + [Type Any] + (def: abstraction (-> [Type Any] Dynamic) (|>> :abstraction)) (def: representation (-> Dynamic [Type Any]) (|>> :representation)) - (syntax: #export (:dynamic value) + (syntax: .public (:dynamic value) {#.doc (doc (: Dynamic (:dynamic 123)))} (with_gensyms [g!value] (in (list (` (let [(~ g!value) (~ value)] ((~! ..abstraction) [(:of (~ g!value)) (~ g!value)]))))))) - (syntax: #export (:check type value) + (syntax: .public (:check type value) {#.doc (doc (: (try.Try Nat) (:check Nat (:dynamic 123))))} (with_gensyms [g!type g!value] @@ -44,7 +44,7 @@ (#try.Success (:as (~ type) (~ g!value))) ((~! exception.except) ..wrong_type [(.type (~ type)) (~ g!type)]))))))))) - (def: #export (format value) + (def: .public (format value) (-> Dynamic (Try Text)) (let [[type value] (:representation value)] (debug.representation type value))) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index a1d7c160c..b6b351262 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -313,7 +313,7 @@ _ (` ((~ (code.identifier constructor)) (~+ (list\map instance$ dependencies)))))) -(syntax: #export (\\ +(syntax: .public (\\ {member <code>.identifier} {args (<>.or (<>.and (<>.some <code>.identifier) <code>.end!) (<>.and (<>.some <code>.any) <code>.end!))}) @@ -380,7 +380,7 @@ (Parser (List Code)) (<code>.tuple (<>.many <code>.any))) -(syntax: #export (with {implementations ..implicits} body) +(syntax: .public (with {implementations ..implicits} body) (do meta.monad [g!implicit+ (implicit_bindings (list.size implementations))] (in (list (` (let [(~+ (|> (list.zipped/2 g!implicit+ implementations) @@ -389,11 +389,11 @@ list\join))] (~ body))))))) -(syntax: #export (implicit: {implementations ..implicits}) +(syntax: .public (implicit: {implementations ..implicits}) (do meta.monad [g!implicit+ (implicit_bindings (list.size implementations))] (in (|> (list.zipped/2 g!implicit+ implementations) (list\map (function (_ [g!implicit implementation]) - (` (def: (~ g!implicit) + (` (def: .private (~ g!implicit) {#.implementation? #1} (~ implementation))))))))) diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux index d4250a02f..5d2c29f2f 100644 --- a/stdlib/source/library/lux/type/quotient.lux +++ b/stdlib/source/library/lux/type/quotient.lux @@ -8,20 +8,24 @@ ["." type abstract]]]) -(abstract: #export (Class t c %) +(abstract: .public (Class t c %) + {} + (-> t c) - (def: #export class + (def: .public class (All [t c] (Ex [%] (-> (-> t c) (Class t c %)))) (|>> :abstraction)) - (abstract: #export (Quotient t c %) + (abstract: .public (Quotient t c %) + {} + {#value t #label c} - (def: #export (quotient class value) + (def: .public (quotient class value) (All [t c %] (-> (Class t c %) t (Quotient t c %))) @@ -29,7 +33,7 @@ #label ((:representation Class class) value)})) (template [<name> <output> <slot>] - [(def: #export <name> + [(def: .public <name> (All [t c %] (-> (Quotient t c %) <output>)) (|>> :representation (get@ <slot>)))] @@ -39,7 +43,7 @@ ) ) -(syntax: #export (type class) +(syntax: .public (type class) (with_gensyms [g!t g!c g!%] (in (list (` ((~! type.:by_example) [(~ g!t) (~ g!c) (~ g!%)] @@ -49,7 +53,7 @@ (..Quotient (~ g!t) (~ g!c) (~ g!%)))))))) -(implementation: #export (equivalence super) +(implementation: .public (equivalence super) (All [t c %] (-> (Equivalence c) (Equivalence (..Quotient t c %)))) (def: (= reference sample) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index 35189a071..a34153800 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -8,16 +8,16 @@ ["." type abstract]]]) -(abstract: #export (Refined t %) +(abstract: .public (Refined t %) + {#.doc "A refined type '%' of base type 't' using a predicate."} + {#value t #predicate (Predicate t)} - {#.doc "A refined type '%' of base type 't' using a predicate."} - - (type: #export (Refiner t %) + (type: .public (Refiner t %) (-> t (Maybe (Refined t %)))) - (def: #export (refinement predicate) + (def: .public (refinement predicate) (All [t] (Ex [%] (-> (Predicate t) (Refiner t %)))) @@ -28,7 +28,7 @@ #.None))) (template [<name> <output> <slot>] - [(def: #export <name> + [(def: .public <name> (All [t %] (-> (Refined t %) <output>)) (|>> :representation (get@ <slot>)))] @@ -36,7 +36,7 @@ [predicate (Predicate t) #predicate] ) - (def: #export (lift transform) + (def: .public (lift transform) (All [t %] (-> (-> t t) (-> (Refined t %) (Maybe (Refined t %))))) @@ -49,7 +49,7 @@ #.None)))) ) -(def: #export (only refiner values) +(def: .public (only refiner values) (All [t %] (-> (Refiner t %) (List t) (List (Refined t %)))) (case values #.End @@ -63,7 +63,7 @@ #.None (only refiner tail)))) -(def: #export (partition refiner values) +(def: .public (partition refiner values) (All [t %] (-> (Refiner t %) (List t) [(List (Refined t %)) (List t)])) (case values #.End @@ -80,7 +80,7 @@ [yes (#.Item head no)])))) -(syntax: #export (type refiner) +(syntax: .public (type refiner) (macro.with_gensyms [g!t g!%] (in (list (` ((~! type.:by_example) [(~ g!t) (~ g!%)] (..Refiner (~ g!t) (~ g!%)) diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index 1ddc43d99..2a568e6fd 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -25,22 +25,22 @@ [type abstract]]]) -(type: #export (Procedure monad input output value) +(type: .public (Procedure monad input output value) (-> input (monad [output value]))) -(type: #export (Linear monad value) +(type: .public (Linear monad value) (All [keys] (Procedure monad keys keys value))) -(type: #export (Affine monad permissions value) +(type: .public (Affine monad permissions value) (All [keys] (Procedure monad keys [permissions keys] value))) -(type: #export (Relevant monad permissions value) +(type: .public (Relevant monad permissions value) (All [keys] (Procedure monad [permissions keys] keys value))) -(implementation: #export (monad monad) +(implementation: .public (monad monad) (All [!] (-> (Monad !) (IxMonad (Procedure !)))) (def: (in value) @@ -53,24 +53,26 @@ [[keysT value] (input keysI)] ((f value) keysT))))) -(def: #export (run monad procedure) +(def: .public (run monad procedure) (All [! v] (-> (Monad !) (Linear ! v) (! v))) (do monad [[_ output] (procedure [])] (in output))) -(def: #export (lifted monad procedure) +(def: .public (lifted monad procedure) (All [! v] (-> (Monad !) (! v) (Linear ! v))) (function (_ keys) (do monad [output procedure] (in [keys output])))) -(abstract: #export Ordered Any) +(abstract: .public Ordered {} Any) -(abstract: #export Commutative Any) +(abstract: .public Commutative {} Any) -(abstract: #export (Key mode key) +(abstract: .public (Key mode key) + {} + Any (template [<name> <mode>] @@ -82,13 +84,13 @@ [commutative_key Commutative] )) -(abstract: #export (Res key value) - value - +(abstract: .public (Res key value) {#.doc "A value locked by a key."} + value + (template [<name> <mode> <key>] - [(def: #export (<name> monad value) + [(def: .public (<name> monad value) (All [! v] (Ex [k] (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v))))) (function (_ keys) (\ monad in [[(<key> []) keys] (:abstraction value)])))] @@ -97,18 +99,18 @@ [commutative Commutative ..commutative_key] ) - (def: #export (read monad resource) + (def: .public (read monad resource) (All [! v k m] (-> (Monad !) (Res k v) (Relevant ! (Key m k) v))) (function (_ [key keys]) (\ monad in [keys (:representation resource)]))) ) -(exception: #export (index_cannot_be_repeated {index Nat}) +(exception: .public (index_cannot_be_repeated {index Nat}) (exception.report ["Index" (%.nat index)])) -(exception: #export amount_cannot_be_zero) +(exception: .public amount_cannot_be_zero) (def: indices (Parser (List Nat)) @@ -129,7 +131,7 @@ (function (_ context) (\ monad in [context []]))) -(syntax: #export (exchange {swaps ..indices}) +(syntax: .public (exchange {swaps ..indices}) (macro.with_gensyms [g!_ g!context g!!] (case swaps #.End @@ -168,7 +170,7 @@ (in raw))) (template [<name> <from> <to>] - [(syntax: #export (<name> {amount ..amount}) + [(syntax: .public (<name> {amount ..amount}) (macro.with_gensyms [g!_ g!context g!!] (do {! meta.monad} [g!keys (|> (macro.gensym "keys") diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux index b04ad62e9..3348ded53 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/type/unit.lux @@ -8,7 +8,7 @@ [order (#+ Order)] [enum (#+ Enum)]] [control - ["<>" parser + ["<>" parser ("#\." monad) ["<.>" code (#+ Parser)]]] [data [text @@ -16,7 +16,6 @@ [macro ["." code] [syntax (#+ syntax:) - ["|.|" export] ["|.|" annotations]]] [math [number @@ -26,7 +25,9 @@ [type abstract]]]) -(abstract: #export (Qty unit) +(abstract: .public (Qty unit) + {} + Int (def: in @@ -38,7 +39,7 @@ (|>> :representation)) (template [<name> <op>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (All [unit] (-> (Qty unit) (Qty unit) (Qty unit))) (:abstraction (<op> (:representation param) (:representation subject))))] @@ -48,7 +49,7 @@ ) (template [<name> <op> <p> <s> <p*s>] - [(def: #export (<name> param subject) + [(def: .public (<name> param subject) (All [p s] (-> (Qty <p>) (Qty <s>) (Qty <p*s>))) (:abstraction (<op> (:representation param) (:representation subject))))] @@ -58,13 +59,13 @@ ) ) -(interface: #export (Unit a) +(interface: .public (Unit a) (: (-> Int (Qty a)) in) (: (-> (Qty a) Int) out)) -(interface: #export (Scale s) +(interface: .public (Scale s) (: (All [u] (-> (Qty u) (Qty (s u)))) scale) (: (All [u] (-> (Qty (s u)) (Qty u))) @@ -72,30 +73,36 @@ (: Ratio ratio)) -(type: #export Pure +(type: .public Pure (Qty Any)) -(def: #export pure +(def: .public pure (-> Int Pure) ..in) -(def: #export number +(def: .public number (-> Pure Int) ..out) -(syntax: #export (unit: - {export |export|.parser} - {type_name <code>.local_identifier} - {unit_name <code>.local_identifier} - {annotations (<>.else |annotations|.empty |annotations|.parser)}) +(def: unitP + (Parser [Code Text Text |annotations|.Annotations]) + (let [private ($_ <>.and + <code>.local_identifier + <code>.local_identifier + (<>.else |annotations|.empty |annotations|.parser))] + (<>.either (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private)))) + +(syntax: .public (unit: + {[export_policy type_name unit_name annotations] ..unitP}) (do meta.monad [@ meta.current_module_name .let [g!type (code.local_identifier type_name)]] - (in (list (` (type: (~+ (|export|.format export)) (~ g!type) + (in (list (` (type: (~ export_policy) (~ g!type) (~ (|annotations|.format annotations)) (primitive (~ (code.text (%.name [@ type_name])))))) - (` (implementation: (~+ (|export|.format export)) (~ (code.local_identifier unit_name)) + (` (implementation: (~ export_policy) (~ (code.local_identifier unit_name)) (..Unit (~ g!type)) (def: (~' in) (~! ..in)) @@ -113,20 +120,27 @@ (n.> 0 denominator))] (in [numerator denominator])))) -(syntax: #export (scale: - {export |export|.parser} - {type_name <code>.local_identifier} - {scale_name <code>.local_identifier} - {(^slots [#ratio.numerator #ratio.denominator]) ..scale} - {annotations (<>.else |annotations|.empty |annotations|.parser)}) +(def: scaleP + (Parser [Code Text Text Ratio |annotations|.Annotations]) + (let [private ($_ <>.and + <code>.local_identifier + <code>.local_identifier + ..scale + (<>.else |annotations|.empty |annotations|.parser))] + (<>.either (<>.and <code>.any private) + (<>.and (<>\in (` .private)) private)))) + +(syntax: .public (scale: + {[export_policy type_name scale_name ratio annotations] ..scaleP}) (do meta.monad - [@ meta.current_module_name + [.let [(^slots [#ratio.numerator #ratio.denominator]) ratio] + @ meta.current_module_name .let [g!scale (code.local_identifier type_name)]] - (in (list (` (type: (~+ (|export|.format export)) ((~ g!scale) (~' u)) + (in (list (` (type: (~ export_policy) ((~ g!scale) (~' u)) (~ (|annotations|.format annotations)) (primitive (~ (code.text (%.name [@ type_name]))) [(~' u)]))) - (` (implementation: (~+ (|export|.format export)) (~ (code.local_identifier scale_name)) + (` (implementation: (~ export_policy) (~ (code.local_identifier scale_name)) (..Scale (~ g!scale)) (def: (~' scale) @@ -143,7 +157,7 @@ [(~ (code.nat numerator)) (~ (code.nat denominator))]))) )))) -(def: #export (re_scaled from to quantity) +(def: .public (re_scaled from to quantity) (All [si so u] (-> (Scale si) (Scale so) (Qty (si u)) (Qty (so u)))) (let [[numerator denominator] (ratio./ (\ from ratio) (\ to ratio))] @@ -153,26 +167,26 @@ (i./ (.int denominator)) in))) -(scale: #export Kilo kilo [1 1,000]) -(scale: #export Mega mega [1 1,000,000]) -(scale: #export Giga giga [1 1,000,000,000]) +(scale: .public Kilo kilo [1 1,000]) +(scale: .public Mega mega [1 1,000,000]) +(scale: .public Giga giga [1 1,000,000,000]) -(scale: #export Milli milli [ 1,000 1]) -(scale: #export Micro micro [ 1,000,000 1]) -(scale: #export Nano nano [1,000,000,000 1]) +(scale: .public Milli milli [ 1,000 1]) +(scale: .public Micro micro [ 1,000,000 1]) +(scale: .public Nano nano [1,000,000,000 1]) -(unit: #export Gram gram) -(unit: #export Meter meter) -(unit: #export Litre litre) -(unit: #export Second second) +(unit: .public Gram gram) +(unit: .public Meter meter) +(unit: .public Litre litre) +(unit: .public Second second) -(implementation: #export equivalence +(implementation: .public equivalence (All [unit] (Equivalence (Qty unit))) (def: (= reference sample) (i.= (..out reference) (..out sample)))) -(implementation: #export order +(implementation: .public order (All [unit] (Order (Qty unit))) (def: &equivalence ..equivalence) @@ -180,7 +194,7 @@ (def: (< reference sample) (i.< (..out reference) (..out sample)))) -(implementation: #export enum +(implementation: .public enum (All [unit] (Enum (Qty unit))) (def: &order ..order) diff --git a/stdlib/source/library/lux/type/variance.lux b/stdlib/source/library/lux/type/variance.lux index 406717046..2a7d65267 100644 --- a/stdlib/source/library/lux/type/variance.lux +++ b/stdlib/source/library/lux/type/variance.lux @@ -2,11 +2,11 @@ [library [lux #*]]) -(type: #export (Co t) +(type: .public (Co t) (-> Any t)) -(type: #export (Contra t) +(type: .public (Contra t) (-> t Any)) -(type: #export (In t) +(type: .public (In t) (-> t t)) diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index e57fcd3e7..fead037c2 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -16,7 +16,7 @@ ["." text (#+ Char) ["%" format (#+ format)]]]]]) -(interface: #export (Console !) +(interface: .public (Console !) (: (-> [] (! (Try Char))) read) (: (-> [] (! (Try Text))) @@ -26,7 +26,7 @@ (: (-> [] (! (Try Any))) close)) -(def: #export (async console) +(def: .public (async console) (-> (Console IO) (Console Async)) (`` (implementation (~~ (template [<capability>] @@ -59,14 +59,14 @@ (#static out java/io/PrintStream)]) (template [<name>] - [(exception: #export (<name>) + [(exception: .public (<name>) "")] [cannot_open] [cannot_close] ) - (def: #export default + (def: .public default (IO (Try (Console IO))) (do io.monad [?jvm_console (java/lang/System::console)] @@ -98,11 +98,11 @@ @.jvm (as_is <jvm>)} (as_is))) -(def: #export (write_line message console) +(def: .public (write_line message console) (All [!] (-> Text (Console !) (! (Try Any)))) (\ console write (format message text.new_line))) -(interface: #export (Mock s) +(interface: .public (Mock s) (: (-> s (Try [s Char])) on_read) (: (-> s (Try [s Text])) @@ -112,7 +112,7 @@ (: (-> s (Try s)) on_close)) -(def: #export (mock mock init) +(def: .public (mock mock init) (All [s] (-> (Mock s) s (Console IO))) (let [state (atom.atom init)] (`` (implementation diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux index 0d1112282..5ee34d9f7 100644 --- a/stdlib/source/library/lux/world/db/jdbc.lux +++ b/stdlib/source/library/lux/world/db/jdbc.lux @@ -50,33 +50,33 @@ (import: java/sql/DriverManager (#static getConnection [java/lang/String java/lang/String java/lang/String] #io #try java/sql/Connection)) -(type: #export Credentials +(type: .public Credentials {#url URL #user Text #password Text}) -(type: #export ID Int) +(type: .public ID Int) -(type: #export (Statement input) +(type: .public (Statement input) {#sql sql.Statement #input (Input input) #value input}) (template [<name> <forge> <output>] - [(capability: #export (<name> ! i) + [(capability: .public (<name> ! i) (<forge> (Statement i) (! (Try <output>))))] [Can_Execute can_execute Nat] [Can_Insert can_insert (List ID)] ) -(capability: #export (Can_Query ! i o) +(capability: .public (Can_Query ! i o) (can_query [(Statement i) (Output o)] (! (Try (List o))))) -(capability: #export (Can_Close !) +(capability: .public (Can_Close !) (can_close Any (! (Try Any)))) -(interface: #export (DB !) +(interface: .public (DB !) (: (Can_Execute !) execute) (: (Can_Insert !) @@ -100,7 +100,7 @@ _ (java/sql/Statement::close prepared)] (in result))) -(def: #export (async db) +(def: .public (async db) (-> (DB IO) (DB Async)) (`` (implementation (~~ (template [<name> <forge>] @@ -111,7 +111,7 @@ [close can_close] [query can_query]))))) -(def: #export (connect creds) +(def: .public (connect creds) (-> Credentials (IO (Try (DB IO)))) (do (try.with io.monad) [connection (java/sql/DriverManager::getConnection (get@ #url creds) @@ -153,7 +153,7 @@ (/output.rows output result_set))))))) ))))) -(def: #export (with_db creds action) +(def: .public (with_db creds action) (All [a] (-> Credentials (-> (DB IO) (IO (Try a))) @@ -164,7 +164,7 @@ _ (!.use (\ db close) [])] (in result))) -(def: #export (with_async_db creds action) +(def: .public (with_async_db creds action) (All [a] (-> Credentials (-> (DB Async) (Async (Try a))) diff --git a/stdlib/source/library/lux/world/db/jdbc/input.lux b/stdlib/source/library/lux/world/db/jdbc/input.lux index 6033224eb..fe510ea66 100644 --- a/stdlib/source/library/lux/world/db/jdbc/input.lux +++ b/stdlib/source/library/lux/world/db/jdbc/input.lux @@ -43,34 +43,34 @@ [setTimestamp java/sql/Timestamp] )))) -(type: #export (Input a) +(type: .public (Input a) (-> a [Nat java/sql/PreparedStatement] (Try [Nat java/sql/PreparedStatement]))) -(implementation: #export contravariant (Contravariant Input) +(implementation: .public contravariant (Contravariant Input) (def: (map-1 f fb) (function (fa value circumstance) (fb (f value) circumstance)))) -(def: #export (and pre post) +(def: .public (and pre post) (All [l r] (-> (Input l) (Input r) (Input [l r]))) (function (_ [left right] context) (do try.monad [context (pre left context)] (post right context)))) -(def: #export (fail error) +(def: .public (fail error) (All [a] (-> Text (Input a))) (function (_ value [idx context]) (#try.Failure error))) -(def: #export empty +(def: .public empty (Input Any) (function (_ value context) (#try.Success context))) (template [<function> <type> <setter>] - [(def: #export <function> + [(def: .public <function> (Input <type>) (function (_ value [idx statement]) (do try.monad @@ -92,7 +92,7 @@ ) (template [<function> <setter> <constructor>] - [(def: #export <function> + [(def: .public <function> (Input Instant) (function (_ value [idx statement]) (do try.monad diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux index 29f1d86a5..7fbcc2b3e 100644 --- a/stdlib/source/library/lux/world/db/jdbc/output.lux +++ b/stdlib/source/library/lux/world/db/jdbc/output.lux @@ -47,10 +47,10 @@ (next [] #try boolean) (close [] #io #try void))) -(type: #export (Output a) +(type: .public (Output a) (-> [Nat java/sql/ResultSet] (Try [Nat a]))) -(implementation: #export functor +(implementation: .public functor (Functor Output) (def: (map f fa) @@ -62,7 +62,7 @@ (#try.Success [idx' value]) (#try.Success [idx' (f value)]))))) -(implementation: #export apply +(implementation: .public apply (Apply Output) (def: &functor ..functor) @@ -81,7 +81,7 @@ (#try.Failure msg) (#try.Failure msg))))) -(implementation: #export monad +(implementation: .public monad (Monad Output) (def: &functor ..functor) @@ -99,12 +99,12 @@ (#try.Success [idx' ma]) (ma [idx' rs]))))) -(def: #export (fail error) +(def: .public (fail error) (All [a] (-> Text (Output a))) (function (_ [idx result_set]) (#try.Failure error))) -(def: #export (and left right) +(def: .public (and left right) (All [a b] (-> (Output a) (Output b) (Output [a b]))) (do ..monad @@ -113,7 +113,7 @@ (in [=left =right]))) (template [<func_name> <method_name> <type>] - [(def: #export <func_name> + [(def: .public <func_name> (Output <type>) (function (_ [idx result_set]) (case (<method_name> [(.int idx)] result_set) @@ -138,7 +138,7 @@ ) (template [<func_name> <method_name>] - [(def: #export <func_name> + [(def: .public <func_name> (Output Instant) (function (_ [idx result_set]) (case (<method_name> [(.int idx)] result_set) @@ -154,7 +154,7 @@ [time_stamp java/sql/ResultSet::getTimestamp] ) -(def: #export (rows output results) +(def: .public (rows output results) (All [a] (-> (Output a) java/sql/ResultSet (IO (Try (List a))))) (case (java/sql/ResultSet::next results) (#try.Success has_next?) diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index 4d29ad803..e8d053c44 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -19,7 +19,7 @@ ## Kind (template [<declaration>] - [(abstract: #export <declaration> Any)] + [(abstract: .public <declaration> Any)] [Literal'] [Column'] @@ -55,16 +55,16 @@ [(Statement' kind)] ) -(type: #export Alias Text) +(type: .public Alias Text) -(def: #export no_alias Alias "") +(def: .public no_alias Alias "") -(abstract: #export (SQL kind) +(abstract: .public (SQL kind) Text ## SQL (template [<declaration> <kind>] - [(type: #export <declaration> (SQL <kind>))] + [(type: .public <declaration> (SQL <kind>))] [Literal (Value' Literal')] [Column (Value' Column')] @@ -96,13 +96,13 @@ (def: Base_Query (.type (Query No_Where No_Having No_Order No_Group No_Limit No_Offset))) (def: Any_Query (.type (Query Any Any Any Any Any Any))) - (def: #export read + (def: .public read {#.doc (doc "Only use this function for debugging purposes." "Do not use this function to actually execute SQL code.")} (-> (SQL Any) Text) (|>> :representation)) - (def: #export (sql action) + (def: .public (sql action) (-> Statement Text) (format (:representation action) ";")) @@ -112,32 +112,32 @@ (text.join_with ", "))) ## Value - (def: #export ? Placeholder (:abstraction "?")) + (def: .public ? Placeholder (:abstraction "?")) (def: literal (-> Text Literal) (|>> :abstraction)) - (def: #export null Literal (..literal "NULL")) + (def: .public null Literal (..literal "NULL")) - (def: #export (int value) + (def: .public (int value) (-> Int Literal) (..literal (if (i.< +0 value) (%.int value) (%.nat (.nat value))))) - (def: #export function + (def: .public function (-> Text Function) (|>> :abstraction)) - (def: #export (call function parameters) + (def: .public (call function parameters) (-> Function (List Value) Value) (:abstraction (format (:representation function) (..parenthesize (..listing parameters))))) ## Condition (template [<name> <sql_op>] - [(def: #export (<name> reference sample) + [(def: .public (<name> reference sample) (-> Value Value Condition) (:abstraction (..parenthesize @@ -156,7 +156,7 @@ [ilike? "ILIKE"] ) - (def: #export (between from to sample) + (def: .public (between from to sample) (-> Value Value Value Condition) (:abstraction (..parenthesize @@ -164,7 +164,7 @@ " BETWEEN " (:representation from) " AND " (:representation to))))) - (def: #export (in options value) + (def: .public (in options value) (-> (List Value) Value Condition) (:abstraction (format (:representation value) @@ -172,7 +172,7 @@ (..parenthesize (listing options))))) (template [<func_name> <sql_op>] - [(def: #export (<func_name> left right) + [(def: .public (<func_name> left right) (-> Condition Condition Condition) (:abstraction (format (..parenthesize (:representation left)) @@ -184,7 +184,7 @@ ) (template [<name> <type> <sql>] - [(def: #export <name> + [(def: .public <name> (-> <type> Condition) (|>> :representation ..parenthesize (format <sql> " ") :abstraction))] @@ -194,7 +194,7 @@ ## Query (template [<name> <type> <decoration>] - [(def: #export <name> + [(def: .public <name> (-> <type> Source) (|>> :representation <decoration> :abstraction))] @@ -204,7 +204,7 @@ ) (template [<func_name> <op>] - [(def: #export (<func_name> columns source) + [(def: .public (<func_name> columns source) (-> (List [Column Alias]) Source Base_Query) (:abstraction (format <op> @@ -228,7 +228,7 @@ ) (template [<name> <join_text>] - [(def: #export (<name> table condition prev) + [(def: .public (<name> table condition prev) (-> Table Condition Base_Query Base_Query) (:abstraction (format (:representation prev) @@ -243,7 +243,7 @@ ) (template [<function> <sql_op>] - [(def: #export (<function> left right) + [(def: .public (<function> left right) (-> Any_Query Any_Query (Query Without_Where Without_Having No_Order No_Group No_Limit No_Offset)) (:abstraction (format (:representation left) @@ -256,7 +256,7 @@ ) (template [<name> <sql> <variables> <input> <output>] - [(def: #export (<name> value query) + [(def: .public (<name> value query) (All <variables> (-> Nat <input> <output>)) (:abstraction @@ -274,7 +274,7 @@ ) (template [<name> <sql>] - [(def: #export <name> + [(def: .public <name> Order (:abstraction <sql>))] @@ -282,7 +282,7 @@ [descending "DESC"] ) - (def: #export (order_by pairs query) + (def: .public (order_by pairs query) (All [where having group limit offset] (-> (List [Value Order]) (Query where having No_Order group limit offset) @@ -300,7 +300,7 @@ (format (:representation value) " " (:representation order)))) (text.join_with ", ")))))) - (def: #export (group_by pairs query) + (def: .public (group_by pairs query) (All [where having order limit offset] (-> (List Value) (Query where having order No_Group limit offset) @@ -316,7 +316,7 @@ (..listing pairs))))) ## Command - (def: #export (insert table columns rows) + (def: .public (insert table columns rows) (-> Table (List Column) (List (List Value)) (Command Without_Where Without_Having)) (:abstraction (format "INSERT INTO " (:representation table) " " @@ -327,7 +327,7 @@ (text.join_with ", ")) ))) - (def: #export (update table pairs) + (def: .public (update table pairs) (-> Table (List [Column Value]) (Command No_Where No_Having)) (:abstraction (format "UPDATE " (:representation table) (case pairs @@ -340,12 +340,12 @@ (format (:representation column) "=" (:representation value)))) (text.join_with ", "))))))) - (def: #export delete + (def: .public delete (-> Table (Command No_Where No_Having)) (|>> :representation (format "DELETE FROM ") :abstraction)) ## Action - (def: #export (where condition prev) + (def: .public (where condition prev) (All [kind having] (-> Condition (Action No_Where having kind) (Action With_Where having kind))) (:abstraction @@ -353,7 +353,7 @@ " WHERE " (:representation condition)))) - (def: #export (having condition prev) + (def: .public (having condition prev) (All [where kind] (-> Condition (Action where No_Having kind) (Action where With_Having kind))) (:abstraction @@ -362,12 +362,12 @@ (:representation condition)))) ## Schema - (def: #export type + (def: .public type (-> Text (Schema Value)) (|>> :abstraction)) (template [<name> <attr>] - [(def: #export (<name> attr) + [(def: .public (<name> attr) (-> (Schema Value) (Schema Value)) (:abstraction (format (:representation attr) " " <attr>)))] @@ -377,22 +377,22 @@ [stored "STORED"] ) - (def: #export (default value attr) + (def: .public (default value attr) (-> Value (Schema Value) (Schema Value)) (:abstraction (format (:representation attr) " DEFAULT " (:representation value)))) - (def: #export (define_column name type) + (def: .public (define_column name type) (-> Column (Schema Value) (Schema Column)) (:abstraction (format (:representation name) " " (:representation type)))) - (def: #export (auto_increment offset column) + (def: .public (auto_increment offset column) (-> Int (Schema Column) (Schema Column)) (:abstraction (format (:representation column) " AUTO_INCREMENT=" (:representation (..int offset))))) - (def: #export (create_table or_replace? table columns) + (def: .public (create_table or_replace? table columns) (-> Bit Table (List (Schema Column)) Definition) (let [command (if or_replace? "CREATE OR REPLACE TABLE" @@ -401,13 +401,13 @@ (format command " " (:representation table) (..parenthesize (..listing columns)))))) - (def: #export (create_table_as table query) + (def: .public (create_table_as table query) (-> Table Any_Query Definition) (:abstraction (format "CREATE TABLE " (:representation table) " AS " (:representation query)))) (template [<name> <sql>] - [(def: #export (<name> table) + [(def: .public (<name> table) (-> Table Definition) (:abstraction (format <sql> " TABLE " (:representation table))))] @@ -416,18 +416,18 @@ [truncate "TRUNCATE"] ) - (def: #export (add_column table column) + (def: .public (add_column table column) (-> Table (Schema Column) Definition) (:abstraction (format "ALTER TABLE " (:representation table) " ADD " (:representation column)))) - (def: #export (drop_column table column) + (def: .public (drop_column table column) (-> Table Column Definition) (:abstraction (format "ALTER TABLE " (:representation table) " DROP COLUMN " (:representation column)))) (template [<name> <type>] - [(def: #export (<name> name) + [(def: .public (<name> name) (-> Text <type>) (:abstraction name))] @@ -439,7 +439,7 @@ ) (template [<name> <type> <sql>] - [(def: #export <name> + [(def: .public <name> (-> <type> Definition) (|>> :representation (format <sql> " ") :abstraction))] @@ -449,7 +449,7 @@ ) (template [<name> <sql>] - [(def: #export (<name> view query) + [(def: .public (<name> view query) (-> View Any_Query Definition) (:abstraction (format <sql> " " (:representation view) " AS " (:representation query))))] @@ -458,13 +458,13 @@ [create_or_replace_view "CREATE OR REPLACE VIEW"] ) - (def: #export (create_index index table unique? columns) + (def: .public (create_index index table unique? columns) (-> Index Table Bit (List Column) Definition) (:abstraction (format "CREATE " (if unique? "UNIQUE" "") " INDEX " (:representation index) " ON " (:representation table) " " (..parenthesize (..listing columns))))) - (def: #export (with alias query body) + (def: .public (with alias query body) (All [where having order group limit offset] (-> Table Any_Query (Query where having order group limit offset) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 2d09acf8a..62c4404e8 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -35,10 +35,10 @@ ["." instant (#+ Instant)] ["." duration]]]]) -(type: #export Path +(type: .public Path Text) -(`` (interface: #export (System !) +(`` (interface: .public (System !) (: Text separator) @@ -89,20 +89,20 @@ [_ child] (text.split (text.size /) temp)] (in [parent child]))))) -(def: #export (parent fs path) +(def: .public (parent fs path) (All [!] (-> (System !) Path (Maybe Path))) (|> path (..un_rooted fs) (maybe\map product.left))) -(def: #export (name fs path) +(def: .public (name fs path) (All [!] (-> (System !) Path Text)) (|> path (..un_rooted fs) (maybe\map product.right) (maybe.else path))) -(def: #export (async fs) +(def: .public (async fs) (-> (System IO) (System Async)) (`` (implementation (def: separator @@ -136,12 +136,12 @@ [move])) ))) -(def: #export (rooted fs parent child) +(def: .public (rooted fs parent child) (All [!] (-> (System !) Path Text Path)) (format parent (\ fs separator) child)) (template [<name>] - [(exception: #export (<name> {file Path}) + [(exception: .public (<name> {file Path}) (exception.report ["Path" file]))] @@ -155,7 +155,7 @@ [cannot_read_all_data] ) -(with_expansions [<for_jvm> (as_is (exception: #export (cannot_modify_file {instant Instant} {file Path}) +(with_expansions [<for_jvm> (as_is (exception: .public (cannot_modify_file {instant Instant} {file Path}) (exception.report ["Instant" (%.instant instant)] ["Path" file])) @@ -202,7 +202,7 @@ ["#::." (new [java/io/File] #io #try)]) - (`` (implementation: #export default + (`` (implementation: .public default (System IO) (def: separator @@ -324,12 +324,12 @@ (toString [] ffi.String)]) (template: (with_async <write> <type> <body>) - (template.with_locals [<read>] - (let [[<read> <write>] (: [(Async <type>) (async.Resolver <type>)] - (async.async []))] - (exec - <body> - <read>)))) + [(template.with_locals [<read>] + (let [[<read> <write>] (: [(Async <type>) (async.Resolver <type>)] + (async.async []))] + (exec + <body> + <read>)))]) (ffi.import: Fs ["#::." @@ -403,7 +403,7 @@ (JsPath::sep (..node_path [])) "/")) - (`` (implementation: #export default + (`` (implementation: .public default (System Async) (def: separator @@ -573,7 +573,7 @@ (def: python_separator (os/path::sep)) - (`` (implementation: #export default + (`` (implementation: .public default (System IO) (def: separator @@ -699,7 +699,7 @@ Text (..RubyFile::SEPARATOR)) - (`` (implementation: #export default + (`` (implementation: .public default (System IO) (def: separator @@ -836,7 +836,7 @@ ## (def: default_separator (..DIRECTORY_SEPARATOR)) ## (template [<name>] - ## [(exception: #export (<name> {file Path}) + ## [(exception: .public (<name> {file Path}) ## (exception.report ## ["Path" file]))] @@ -945,7 +945,7 @@ ## (in [])))) ## )) - ## (`` (implementation: #export default + ## (`` (implementation: .public default ## (System IO) ## (~~ (template [<name> <test> <constructor> <exception>] @@ -984,7 +984,7 @@ } (as_is))) -(def: #export (exists? monad fs path) +(def: .public (exists? monad fs path) (All [!] (-> (Monad !) (System !) Path (! Bit))) (do monad [verdict (\ fs file? path)] @@ -1169,7 +1169,7 @@ (#.Item _) (recur sub_directory tail))))))) -(def: #export (mock separator) +(def: .public (mock separator) (-> Text (System Async)) (let [store (stm.var ..empty_mock)] (`` (implementation @@ -1317,7 +1317,7 @@ (in (#try.Success [])) (\ fs make_directory path)))) -(def: #export (make_directories monad fs path) +(def: .public (make_directories monad fs path) (All [!] (-> (Monad !) (System !) Path (! (Try Any)))) (let [rooted? (text.starts_with? (\ fs separator) path) segments (text.split_all_with (\ fs separator) path)] @@ -1349,7 +1349,7 @@ (#try.Failure error) (in (#try.Failure error))))))))) -(def: #export (make_file monad fs content path) +(def: .public (make_file monad fs content path) (All [!] (-> (Monad !) (System !) Binary Path (! (Try Any)))) (do monad [? (\ fs file? path)] diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index 5800e68e1..1958e1403 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -32,7 +32,9 @@ [abstract (#+ abstract: :representation :abstraction)]]]] ["." //]) -(abstract: #export Concern +(abstract: .public Concern + {} + {#create Bit #modify Bit #delete Bit} @@ -45,14 +47,14 @@ #delete false})) (template [<concern> <predicate> <event> <create> <modify> <delete>] - [(def: #export <concern> + [(def: .public <concern> Concern (:abstraction {#create <create> #modify <modify> #delete <delete>})) - (def: #export <predicate> + (def: .public <predicate> (Predicate Concern) (|>> :representation (get@ <event>)))] @@ -64,14 +66,14 @@ false false true] ) - (def: #export (also left right) + (def: .public (also left right) (-> Concern Concern Concern) (:abstraction {#create (or (..creation? left) (..creation? right)) #modify (or (..modification? left) (..modification? right)) #delete (or (..deletion? left) (..deletion? right))})) - (def: #export all + (def: .public all Concern ($_ ..also ..creation @@ -80,7 +82,7 @@ )) ) -(interface: #export (Watcher !) +(interface: .public (Watcher !) (: (-> Concern //.Path (! (Try Any))) start) (: (-> //.Path (! (Try Concern))) @@ -91,7 +93,7 @@ poll)) (template [<name>] - [(exception: #export (<name> {path //.Path}) + [(exception: .public (<name> {path //.Path}) (exception.report ["Path" (%.text path)]))] @@ -182,7 +184,7 @@ modifications deletions]]))) -(def: #export (polling fs) +(def: .public (polling fs) (-> (//.System Async) (Watcher Async)) (let [tracker (: (Var Directory_Tracker) (stm.var (dictionary.empty text.hash)))] @@ -254,7 +256,7 @@ ))))) ))) -(def: #export (mock separator) +(def: .public (mock separator) (-> Text [(//.System Async) (Watcher Async)]) (let [fs (//.mock separator)] [fs @@ -405,7 +407,7 @@ (list)) )) - (def: #export default + (def: .public default (IO (Try (Watcher Async))) (do (try.with io.monad) [watcher (java/nio/file/FileSystem::newWatchService diff --git a/stdlib/source/library/lux/world/input/keyboard.lux b/stdlib/source/library/lux/world/input/keyboard.lux index 8c65fe493..38e93e56c 100644 --- a/stdlib/source/library/lux/world/input/keyboard.lux +++ b/stdlib/source/library/lux/world/input/keyboard.lux @@ -2,11 +2,11 @@ [library [lux #*]]) -(type: #export Key +(type: .public Key Nat) (template [<code> <name>] - [(def: #export <name> Key <code>)] + [(def: .public <name> Key <code>)] [00008 back_space] [00010 enter] @@ -97,12 +97,12 @@ [61451 f24] ) -(type: #export Press +(type: .public Press {#pressed? Bit #input Key}) (template [<bit> <name>] - [(def: #export (<name> key) + [(def: .public (<name> key) (-> Key Press) {#pressed? <bit> #input key})] diff --git a/stdlib/source/library/lux/world/net.lux b/stdlib/source/library/lux/world/net.lux index cea1b4a7d..76b85d499 100644 --- a/stdlib/source/library/lux/world/net.lux +++ b/stdlib/source/library/lux/world/net.lux @@ -2,12 +2,12 @@ [library [lux (#- Location)]]) -(type: #export Address Text) +(type: .public Address Text) -(type: #export Port Nat) +(type: .public Port Nat) -(type: #export URL Text) +(type: .public URL Text) -(type: #export Location +(type: .public Location {#address Address #port Port}) diff --git a/stdlib/source/library/lux/world/net/http.lux b/stdlib/source/library/lux/world/net/http.lux index c526e6c97..2c0877351 100644 --- a/stdlib/source/library/lux/world/net/http.lux +++ b/stdlib/source/library/lux/world/net/http.lux @@ -12,10 +12,10 @@ [// (#+ URL) [uri (#+ URI)]]) -(type: #export Version +(type: .public Version Text) -(type: #export Method +(type: .public Method #Post #Get #Put @@ -26,54 +26,54 @@ #Options #Trace) -(type: #export Port +(type: .public Port Nat) -(type: #export Status +(type: .public Status Nat) -(type: #export Headers +(type: .public Headers Environment) -(def: #export empty +(def: .public empty Headers environment.empty) -(type: #export Header +(type: .public Header (-> Headers Headers)) -(type: #export (Body !) +(type: .public (Body !) (-> (Maybe Nat) (! (Try [Nat Binary])))) -(type: #export Scheme +(type: .public Scheme #HTTP #HTTPS) -(type: #export Address +(type: .public Address {#port Port #host Text}) -(type: #export Identification +(type: .public Identification {#local Address #remote Address}) -(type: #export Protocol +(type: .public Protocol {#version Version #scheme Scheme}) -(type: #export Resource +(type: .public Resource {#method Method #uri URI}) -(type: #export (Message !) +(type: .public (Message !) {#headers Headers #body (Body !)}) -(type: #export (Request !) +(type: .public (Request !) [Identification Protocol Resource (Message !)]) -(type: #export (Response !) +(type: .public (Response !) [Status (Message !)]) -(type: #export (Server !) +(type: .public (Server !) (-> (Request !) (! (Response !)))) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index fd79fc81b..8055dce6e 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -24,13 +24,13 @@ ["." // [// (#+ URL)]]) -(interface: #export (Client !) +(interface: .public (Client !) (: (-> //.Method URL //.Headers (Maybe Binary) (! (Try (//.Response !)))) request)) (template [<name> <method>] - [(def: #export (<name> url headers data client) + [(def: .public (<name> url headers data client) (All [!] (-> URL //.Headers (Maybe Binary) (Client !) (! (Try (//.Response !))))) @@ -170,7 +170,7 @@ #.None (in headers))))) - (implementation: #export default + (implementation: .public default (Client IO) (def: (request method url headers data) @@ -206,7 +206,7 @@ @.jvm (as_is <jvm>)} (as_is))) -(implementation: #export (async client) +(implementation: .public (async client) (-> (Client IO) (Client Async)) (def: (request method url headers data) @@ -222,6 +222,6 @@ (#try.Failure error) (#try.Failure error))))))) -(def: #export headers +(def: .public headers (-> (List [Text Text]) //.Headers) (dictionary.of_list text.hash)) diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux index 2c5965338..1e4623761 100644 --- a/stdlib/source/library/lux/world/net/http/cookie.lux +++ b/stdlib/source/library/lux/world/net/http/cookie.lux @@ -20,7 +20,7 @@ ["." // (#+ Header) ["." header]]) -(type: #export Directive +(type: .public Directive (-> Text Text)) (def: (directive extension) @@ -28,11 +28,11 @@ (function (_ so_far) (format so_far "; " extension))) -(def: #export (set name value) +(def: .public (set name value) (-> Text Text Header) (header.add "Set-Cookie" (format name "=" value))) -(def: #export (max_age duration) +(def: .public (max_age duration) (-> Duration Directive) (let [seconds (duration.query duration.second duration)] (..directive (format "Max-Age=" (if (i.< +0 seconds) @@ -40,7 +40,7 @@ (%.nat (.nat seconds))))))) (template [<name> <prefix>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> Text Directive) (..directive (format <prefix> "=" value)))] @@ -49,7 +49,7 @@ ) (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> Directive (..directive <tag>))] @@ -57,11 +57,11 @@ [http_only "HttpOnly"] ) -(type: #export CSRF_Policy +(type: .public CSRF_Policy #Strict #Lax) -(def: #export (same_site policy) +(def: .public (same_site policy) (-> CSRF_Policy Directive) (..directive (format "SameSite=" (case policy #Strict "Strict" @@ -84,6 +84,6 @@ (cookies context')) (p\in context))) -(def: #export (get header) +(def: .public (get header) (-> Text (Try Context)) (l.run header (..cookies context.empty))) diff --git a/stdlib/source/library/lux/world/net/http/header.lux b/stdlib/source/library/lux/world/net/http/header.lux index 1d84b3318..6f8d92cc2 100644 --- a/stdlib/source/library/lux/world/net/http/header.lux +++ b/stdlib/source/library/lux/world/net/http/header.lux @@ -12,7 +12,7 @@ ["." mime (#+ MIME)] [// (#+ URL)]]) -(def: #export (add name value) +(def: .public (add name value) (-> Text Text Header) (dictionary.upsert name "" (|>> (case> @@ -22,14 +22,14 @@ previous (format previous "," value))))) -(def: #export content_length +(def: .public content_length (-> Nat Header) (|>> %.nat (..add "Content-Length"))) -(def: #export content_type +(def: .public content_type (-> MIME Header) (|>> mime.name (..add "Content-Type"))) -(def: #export location +(def: .public location (-> URL Header) (..add "Location")) diff --git a/stdlib/source/library/lux/world/net/http/mime.lux b/stdlib/source/library/lux/world/net/http/mime.lux index 445796038..1592b3d25 100644 --- a/stdlib/source/library/lux/world/net/http/mime.lux +++ b/stdlib/source/library/lux/world/net/http/mime.lux @@ -8,23 +8,23 @@ [type abstract]]]) -(abstract: #export MIME +(abstract: .public MIME Text {#doc "Multipurpose Internet Mail Extensions"} - (def: #export mime + (def: .public mime (-> Text MIME) (|>> :abstraction)) - (def: #export name + (def: .public name (-> MIME Text) (|>> :representation)) ) ## https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types (template [<name> <type>] - [(def: #export <name> MIME (..mime <type>))] + [(def: .public <name> MIME (..mime <type>))] [aac_audio "audio/aac"] [abiword "application/x-abiword"] @@ -93,10 +93,10 @@ [!7z "application/x-7z-compressed"] ) -(def: #export (text encoding) +(def: .public (text encoding) (-> Encoding MIME) (..mime (format "text/plain; charset=" text.double_quote (encoding.name encoding) text.double_quote))) -(def: #export utf_8 +(def: .public utf_8 MIME (..text encoding.utf_8)) diff --git a/stdlib/source/library/lux/world/net/http/query.lux b/stdlib/source/library/lux/world/net/http/query.lux index 0f78ba5e3..d0be7dfc3 100644 --- a/stdlib/source/library/lux/world/net/http/query.lux +++ b/stdlib/source/library/lux/world/net/http/query.lux @@ -60,6 +60,6 @@ ## if invalid form data, just stop parsing... (\ p.monad in context))) -(def: #export (parameters raw) +(def: .public (parameters raw) (-> Text (Try Context)) (l.run raw (..form context.empty))) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index 7ef59466b..8ab9265cb 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -52,7 +52,7 @@ (def: failure (//response.bad_request "")) -(def: #export (json reader server) +(def: .public (json reader server) (All [a] (-> (<json>.Reader a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad @@ -67,7 +67,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (text server) +(def: .public (text server) (-> (-> Text Server) Server) (function (_ (^@ request [identification protocol resource message])) (do async.monad @@ -79,7 +79,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (query property server) +(def: .public (query property server) (All [a] (-> (Property a) (-> a Server) Server)) (function (_ [identification protocol resource message]) (let [full (get@ #//.uri resource) @@ -97,7 +97,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (form property server) +(def: .public (form property server) (All [a] (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad @@ -112,7 +112,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (cookies property server) +(def: .public (cookies property server) (All [a] (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (case (do try.monad diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux index c32094707..9d74ced0c 100644 --- a/stdlib/source/library/lux/world/net/http/response.lux +++ b/stdlib/source/library/lux/world/net/http/response.lux @@ -22,12 +22,12 @@ ["." header] [// (#+ URL)]]) -(def: #export (static response) +(def: .public (static response) (-> Response Server) (function (_ request) (async.resolved response))) -(def: #export empty +(def: .public empty (-> Status Response) (let [body (frp\in (\ encoding.utf8 encode ""))] (function (_ status) @@ -37,16 +37,16 @@ (header.content_type mime.utf_8)) #//.body body}]))) -(def: #export (temporary_redirect to) +(def: .public (temporary_redirect to) (-> URL Response) (let [[status message] (..empty status.temporary_redirect)] [status (update@ #//.headers (header.location to) message)])) -(def: #export not_found +(def: .public not_found Response (..empty status.not_found)) -(def: #export (content status type data) +(def: .public (content status type data) (-> Status MIME Binary Response) [status {#//.headers (|> context.empty @@ -54,16 +54,16 @@ (header.content_type type)) #//.body (frp\in data)}]) -(def: #export bad_request +(def: .public bad_request (-> Text Response) (|>> (\ encoding.utf8 encode) (content status.bad_request mime.utf_8))) -(def: #export ok +(def: .public ok (-> MIME Binary Response) (content status.ok)) (template [<name> <type> <mime> <pre>] - [(def: #export <name> + [(def: .public <name> (-> <type> Response) (|>> <pre> (\ encoding.utf8 encode) (..ok <mime>)))] diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux index 0dd3f6c5b..15f89bb99 100644 --- a/stdlib/source/library/lux/world/net/http/route.lux +++ b/stdlib/source/library/lux/world/net/http/route.lux @@ -15,7 +15,7 @@ ["#." response]]) (template [<scheme> <name>] - [(def: #export (<name> server) + [(def: .public (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) (case (get@ #//.scheme protocol) @@ -30,7 +30,7 @@ ) (template [<method> <name>] - [(def: #export (<name> server) + [(def: .public (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) (case (get@ #//.method resource) @@ -51,7 +51,7 @@ [#//.Trace trace] ) -(def: #export (uri path server) +(def: .public (uri path server) (-> URI Server Server) (function (_ [identification protocol resource message]) (if (text.starts_with? path (get@ #//.uri resource)) @@ -63,7 +63,7 @@ message]) (async.resolved //response.not_found)))) -(def: #export (or primary alternative) +(def: .public (or primary alternative) (-> Server Server Server) (function (_ request) (do async.monad diff --git a/stdlib/source/library/lux/world/net/http/status.lux b/stdlib/source/library/lux/world/net/http/status.lux index fe3f7d90d..0d7d45fd5 100644 --- a/stdlib/source/library/lux/world/net/http/status.lux +++ b/stdlib/source/library/lux/world/net/http/status.lux @@ -5,7 +5,7 @@ ## https://en.wikipedia.org/wiki/List_of_HTTP_status_codes (template [<status> <name>] - [(def: #export <name> + [(def: .public <name> Status <status>)] diff --git a/stdlib/source/library/lux/world/net/http/version.lux b/stdlib/source/library/lux/world/net/http/version.lux index 2443fda12..535d4736a 100644 --- a/stdlib/source/library/lux/world/net/http/version.lux +++ b/stdlib/source/library/lux/world/net/http/version.lux @@ -4,7 +4,7 @@ [// (#+ Version)]) (template [<name> <version>] - [(def: #export <name> Version <version>)] + [(def: .public <name> Version <version>)] [v0_9 "0.9"] [v1_0 "1.0"] diff --git a/stdlib/source/library/lux/world/net/uri.lux b/stdlib/source/library/lux/world/net/uri.lux index 2c43cbbd3..275c1539d 100644 --- a/stdlib/source/library/lux/world/net/uri.lux +++ b/stdlib/source/library/lux/world/net/uri.lux @@ -2,8 +2,8 @@ [library [lux #*]]) -(type: #export URI +(type: .public URI Text) -(def: #export separator +(def: .public separator "/") diff --git a/stdlib/source/library/lux/world/output/video/resolution.lux b/stdlib/source/library/lux/world/output/video/resolution.lux index 8822c268c..b48cc44bb 100644 --- a/stdlib/source/library/lux/world/output/video/resolution.lux +++ b/stdlib/source/library/lux/world/output/video/resolution.lux @@ -10,21 +10,21 @@ [number ["." nat]]]]]) -(type: #export Resolution +(type: .public Resolution {#width Nat #height Nat}) -(def: #export hash +(def: .public hash (Hash Resolution) (product.hash nat.hash nat.hash)) -(def: #export equivalence +(def: .public equivalence (Equivalence Resolution) (\ ..hash &equivalence)) ## https://en.wikipedia.org/wiki/Display_resolution#Common_display_resolutions (template [<name> <width> <height>] - [(def: #export <name> + [(def: .public <name> Resolution {#width <width> #height <height>})] diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 460acdc66..c846f1b7d 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -35,11 +35,11 @@ [file (#+ Path)] [shell (#+ Exit)]]) -(exception: #export (unknown_environment_variable {name Text}) +(exception: .public (unknown_environment_variable {name Text}) (exception.report ["Name" (%.text name)])) -(interface: #export (Program !) +(interface: .public (Program !) (: (-> Any (! (List Text))) available_variables) (: (-> Text (! (Try Text))) @@ -51,7 +51,7 @@ (: (-> Exit (! Nothing)) exit)) -(def: #export (environment monad program) +(def: .public (environment monad program) (All [!] (-> (Monad !) (Program !) (! Environment))) (do {! monad} [variables (\ program available_variables []) @@ -68,7 +68,7 @@ #.None))) (dictionary.of_list text.hash))))) -(`` (implementation: #export (async program) +(`` (implementation: .public (async program) (-> (Program IO) (Program Async)) (~~ (template [<method>] @@ -88,7 +88,7 @@ [exit] )))) -(def: #export (mock environment home directory) +(def: .public (mock environment home directory) (-> Environment Path Path (Program IO)) (let [@dead? (atom.atom false)] (implementation @@ -301,7 +301,7 @@ } (as_is))) -(implementation: #export default +(implementation: .public default (Program IO) (def: (available_variables _) diff --git a/stdlib/source/library/lux/world/service/authentication.lux b/stdlib/source/library/lux/world/service/authentication.lux index 7cce79b8e..092d26454 100644 --- a/stdlib/source/library/lux/world/service/authentication.lux +++ b/stdlib/source/library/lux/world/service/authentication.lux @@ -6,19 +6,19 @@ [security [capability (#+ Capability)]]]]]) -(type: #export (Can_Register ! account secret value) +(type: .public (Can_Register ! account secret value) (Capability [account secret value] (! (Try Any)))) -(type: #export (Can_Authenticate ! account secret value) +(type: .public (Can_Authenticate ! account secret value) (Capability [account secret] (! (Try value)))) -(type: #export (Can_Reset ! account secret) +(type: .public (Can_Reset ! account secret) (Capability [account secret] (! (Try Any)))) -(type: #export (Can_Forget ! account) +(type: .public (Can_Forget ! account) (Capability [account] (! (Try Any)))) -(type: #export (Service ! account secret value) +(type: .public (Service ! account secret value) {#can_register (Can_Register ! account secret value) #can_authenticate (Can_Authenticate ! account secret value) #can_reset (Can_Reset ! account secret) diff --git a/stdlib/source/library/lux/world/service/crud.lux b/stdlib/source/library/lux/world/service/crud.lux index 00eb870c5..056628491 100644 --- a/stdlib/source/library/lux/world/service/crud.lux +++ b/stdlib/source/library/lux/world/service/crud.lux @@ -8,25 +8,25 @@ [time ["." instant (#+ Instant)]]]]) -(type: #export ID Nat) +(type: .public ID Nat) -(type: #export Time +(type: .public Time {#created Instant #updated Instant}) -(capability: #export (Can_Create ! entity) +(capability: .public (Can_Create ! entity) (can_create [Instant entity] (! (Try ID)))) -(capability: #export (Can_Retrieve ! entity) +(capability: .public (Can_Retrieve ! entity) (can_retrieve ID (! (Try [Time entity])))) -(capability: #export (Can_Update ! entity) +(capability: .public (Can_Update ! entity) (can_update [ID Instant entity] (! (Try Any)))) -(capability: #export (Can_Delete ! entity) +(capability: .public (Can_Delete ! entity) (can_delete ID (! (Try Any)))) -(type: #export (CRUD ! entity) +(type: .public (CRUD ! entity) {#can_create (Can_Create ! entity) #can_retrieve (Can_Retrieve ! entity) #can_update (Can_Update ! entity) diff --git a/stdlib/source/library/lux/world/service/inventory.lux b/stdlib/source/library/lux/world/service/inventory.lux index f5b0dc807..38c69557e 100644 --- a/stdlib/source/library/lux/world/service/inventory.lux +++ b/stdlib/source/library/lux/world/service/inventory.lux @@ -6,25 +6,25 @@ [security ["!" capability (#+ capability:)]]]]]) -(type: #export ID Nat) +(type: .public ID Nat) -(type: #export Ownership +(type: .public Ownership {#owner ID #property ID}) -(capability: #export (Can_Own !) +(capability: .public (Can_Own !) (can_own Ownership (! (Try Any)))) -(capability: #export (Can_Disown !) +(capability: .public (Can_Disown !) (can_disown Ownership (! (Try Any)))) -(capability: #export (Can_Check !) +(capability: .public (Can_Check !) (can_check Ownership (! (Try Bit)))) -(capability: #export (Can_List_Property !) +(capability: .public (Can_List_Property !) (can_list_property ID (! (Try (List ID))))) -(type: #export (Inventory !) +(type: .public (Inventory !) {#can_own (Can_Own !) #can_disown (Can_Disown !) #can_check (Can_Check !) diff --git a/stdlib/source/library/lux/world/service/journal.lux b/stdlib/source/library/lux/world/service/journal.lux index b82fdd83a..424288cb5 100644 --- a/stdlib/source/library/lux/world/service/journal.lux +++ b/stdlib/source/library/lux/world/service/journal.lux @@ -12,7 +12,7 @@ [time ["." instant (#+ Instant) ("#\." equivalence)]]]]) -(type: #export (Entry a) +(type: .public (Entry a) {#what a #why Text #how Text @@ -20,17 +20,17 @@ #where Text #when Instant}) -(type: #export Range +(type: .public Range (Interval Instant)) -(def: #export (range start end) +(def: .public (range start end) (-> Instant Instant Range) (implementation (def: &enum instant.enum) (def: bottom start) (def: top end))) -(implementation: #export (equivalence (^open "_\.")) +(implementation: .public (equivalence (^open "_\.")) (All [a] (-> (Equivalence a) (Equivalence (Entry a)))) (def: (= reference sample) (and (_\= (get@ #what reference) (get@ #what sample)) @@ -40,12 +40,12 @@ (text\= (get@ #where reference) (get@ #where sample)) (instant\= (get@ #when reference) (get@ #when sample))))) -(capability: #export (Can_Write ! a) +(capability: .public (Can_Write ! a) (can_write (Entry a) (! (Try Any)))) -(capability: #export (Can_Read ! a) +(capability: .public (Can_Read ! a) (can_read Range (! (Try (List (Entry a)))))) -(type: #export (Journal ! a) +(type: .public (Journal ! a) {#can_write (Can_Write ! a) #can_read (Can_Read ! a)}) diff --git a/stdlib/source/library/lux/world/service/mail.lux b/stdlib/source/library/lux/world/service/mail.lux index 8a5921e83..063972b22 100644 --- a/stdlib/source/library/lux/world/service/mail.lux +++ b/stdlib/source/library/lux/world/service/mail.lux @@ -8,12 +8,12 @@ [security ["!" capability (#+ capability:)]]]]]) -(capability: #export (Can_Send ! address message) +(capability: .public (Can_Send ! address message) (can_send [address message] (! (Try Any)))) -(capability: #export (Can_Subscribe ! address message) +(capability: .public (Can_Subscribe ! address message) (can_subscribe [address] (! (Try (Channel message))))) -(type: #export (Service ! address message) +(type: .public (Service ! address message) {#can_send (Can_Send ! address message) #can_subscribe (Can_Subscribe ! address message)}) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index 696a0a730..b8fae1871 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -33,11 +33,11 @@ [// [file (#+ Path)]]) -(type: #export Exit +(type: .public Exit Int) (template [<code> <name>] - [(def: #export <name> + [(def: .public <name> Exit <code>)] @@ -45,7 +45,7 @@ [+1 error] ) -(interface: #export (Process !) +(interface: .public (Process !) (: (-> [] (! (Try Text))) read) (: (-> [] (! (Try Text))) @@ -72,17 +72,17 @@ [await] ))))) -(type: #export Command +(type: .public Command Text) -(type: #export Argument +(type: .public Argument Text) -(interface: #export (Shell !) +(interface: .public (Shell !) (: (-> [Environment Path Command (List Argument)] (! (Try (Process !)))) execute)) -(def: #export (async shell) +(def: .public (async shell) (-> (Shell IO) (Shell Async)) (implementation (def: (execute input) @@ -224,7 +224,7 @@ (destroy [] #io #try void) (waitFor [] #io #try int)]) - (exception: #export no_more_output) + (exception: .public no_more_output) (def: (default_process process) (-> java/lang/Process (IO (Try (Process IO)))) @@ -286,7 +286,7 @@ (|>> java/lang/String::toLowerCase (text.starts_with? "windows")) (java/lang/System::getProperty "os.name"))) - (implementation: #export default + (implementation: .public default (Shell IO) (def: (execute [environment working_directory command arguments]) @@ -306,7 +306,7 @@ @.jvm (as_is <jvm>)} (as_is))) -(interface: #export (Mock s) +(interface: .public (Mock s) (: (-> s (Try [s Text])) on_read) (: (-> s (Try [s Text])) @@ -361,7 +361,7 @@ (#try.Failure error) (in (#try.Failure error))))))) -(implementation: #export (mock mock init) +(implementation: .public (mock mock init) (All [s] (-> (-> [Environment Path Command (List Argument)] (Try (Mock s))) diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux index 1c8aa70e1..4c33de0f3 100644 --- a/stdlib/source/poly/lux/abstract/equivalence.lux +++ b/stdlib/source/poly/lux/abstract/equivalence.lux @@ -41,7 +41,7 @@ [\\library ["." /]]) -(poly: #export equivalence +(poly: .public equivalence (`` (do {! <>.monad} [.let [g!_ (code.local_identifier "_____________")] *env* <type>.env diff --git a/stdlib/source/poly/lux/abstract/functor.lux b/stdlib/source/poly/lux/abstract/functor.lux index ff797b29c..bb9ef4a88 100644 --- a/stdlib/source/poly/lux/abstract/functor.lux +++ b/stdlib/source/poly/lux/abstract/functor.lux @@ -24,7 +24,7 @@ [\\library ["." /]]) -(poly: #export functor +(poly: .public functor (do {! p.monad} [.let [type_funcC (code.local_identifier "____________type_funcC") funcC (code.local_identifier "____________funcC") diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index c4cae2881..847e3a160 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -321,7 +321,7 @@ (<>.failure (format "Cannot create JSON decoder for: " (type.format inputT))) )))) -(syntax: #export (codec inputT) +(syntax: .public (codec inputT) {#.doc (doc "A macro for automatically producing JSON codecs." (type: Variant (#Bit Bit) diff --git a/stdlib/source/program/aedifex/action.lux b/stdlib/source/program/aedifex/action.lux index 2da97fde2..55994c67b 100644 --- a/stdlib/source/program/aedifex/action.lux +++ b/stdlib/source/program/aedifex/action.lux @@ -8,9 +8,9 @@ [concurrency ["." async (#+ Async)]]]]]) -(type: #export (Action a) +(type: .public (Action a) (Async (Try a))) -(def: #export monad +(def: .public monad (Monad Action) (:assume (try.with async.monad))) diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux index 631de6ebe..ec955d4dd 100644 --- a/stdlib/source/program/aedifex/artifact.lux +++ b/stdlib/source/program/aedifex/artifact.lux @@ -16,21 +16,21 @@ [net ["." uri (#+ URI)]]]]]) -(type: #export Group +(type: .public Group Text) -(type: #export Name +(type: .public Name Text) -(type: #export Version +(type: .public Version Text) -(type: #export Artifact +(type: .public Artifact {#group Group #name Name #version Version}) -(def: #export hash +(def: .public hash (Hash Artifact) ($_ product.hash text.hash @@ -38,11 +38,11 @@ text.hash )) -(def: #export equivalence +(def: .public equivalence (Equivalence Artifact) (\ ..hash &equivalence)) -(implementation: #export order +(implementation: .public order (Order Artifact) (def: &equivalence @@ -72,25 +72,25 @@ [":" identity_separator] ) -(def: #export (identity artifact) +(def: .public (identity artifact) (-> Artifact Text) (%.format (get@ #name artifact) ..version_separator (get@ #version artifact))) -(def: #export (format value) +(def: .public (format value) (Format Artifact) (%.format (get@ #group value) ..identity_separator (..identity value))) -(def: #export (directory separator group) +(def: .public (directory separator group) (-> Text Group Text) (|> group (text.split_all_with ..group_separator) (text.join_with separator))) -(def: #export (uri version artifact) +(def: .public (uri version artifact) (-> Version Artifact URI) (let [/ uri.separator group (..directory / (get@ #group artifact)) @@ -99,7 +99,7 @@ identity (..identity artifact)] (%.format group / name / version / identity))) -(def: #export (local artifact) +(def: .public (local artifact) (-> Artifact (List Text)) (list\compose (|> artifact (get@ #group) diff --git a/stdlib/source/program/aedifex/artifact/extension.lux b/stdlib/source/program/aedifex/artifact/extension.lux index d1102437d..11a94bb7e 100644 --- a/stdlib/source/program/aedifex/artifact/extension.lux +++ b/stdlib/source/program/aedifex/artifact/extension.lux @@ -9,22 +9,22 @@ ["." // #_ ["#" type]]) -(type: #export Extension +(type: .public Extension Text) (def: separator ".") -(def: #export extension +(def: .public extension (-> //.Type Extension) (|>> (format ..separator))) -(def: #export type +(def: .public type (-> Extension //.Type) (text.replace_all ..separator "")) (template [<name>] - [(def: #export <name> + [(def: .public <name> Extension (..extension (template.identifier [//._] [<name>])))] diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux index 6a5849f43..133b6c4cc 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot.lux @@ -15,7 +15,7 @@ ["." / #_ ["#." stamp (#+ Stamp)]]) -(type: #export Snapshot +(type: .public Snapshot #Local (#Remote Stamp)) @@ -25,7 +25,7 @@ (def: (= _ _) true)) -(def: #export equivalence +(def: .public equivalence (Equivalence Snapshot) ($_ sum.equivalence ..any_equivalence @@ -54,7 +54,7 @@ (<text>.then (<text>.this ..local_copy_value)) <xml>.text)) -(def: #export (format snapshot) +(def: .public (format snapshot) (-> Snapshot XML) (<| (#xml.Node ..<snapshot> xml.attributes) (case snapshot @@ -64,7 +64,7 @@ (#Remote stamp) (/stamp.format stamp)))) -(def: #export parser +(def: .public parser (Parser Snapshot) (<| (<xml>.node <snapshot>) (<>.or ..local_copy_parser diff --git a/stdlib/source/program/aedifex/artifact/snapshot/build.lux b/stdlib/source/program/aedifex/artifact/snapshot/build.lux index 37bb3ca2d..15d0c91dd 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/build.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/build.lux @@ -17,10 +17,10 @@ [number ["." nat]]]]]) -(type: #export Build +(type: .public Build Nat) -(def: #export equivalence +(def: .public equivalence (Equivalence Build) nat.equivalence) @@ -28,14 +28,14 @@ xml.Tag ["" "buildNumber"]) -(def: #export format +(def: .public format (-> Build XML) (|>> %.nat #xml.Text list (#xml.Node ..tag xml.attributes))) -(def: #export parser +(def: .public parser (Parser Build) (<| (<xml>.node ..tag) (<text>.then (<>.codec nat.decimal (<text>.many <text>.decimal))) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux index 0e9cba494..609de1013 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux @@ -16,11 +16,11 @@ ["#." time (#+ Time)] ["#." build (#+ Build)]]) -(type: #export Stamp +(type: .public Stamp {#time Time #build Build}) -(def: #export equivalence +(def: .public equivalence (Equivalence Stamp) ($_ product.equivalence //time.equivalence @@ -38,7 +38,7 @@ list (#xml.Node ..<timestamp> xml.attributes))) -(def: #export (format (^slots [#time #build])) +(def: .public (format (^slots [#time #build])) (-> Stamp (List XML)) (list (..time_format time) (//build.format build))) @@ -49,7 +49,7 @@ (<text>.then //time.parser) <xml>.text)) -(def: #export parser +(def: .public parser (Parser Stamp) (<>.and (<xml>.somewhere ..time_parser) (<xml>.somewhere //build.parser))) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/time.lux b/stdlib/source/program/aedifex/artifact/snapshot/time.lux index 08f8b8035..703354eb8 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/time.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/time.lux @@ -21,23 +21,23 @@ ["#/." date] ["#/." time]]]) -(type: #export Time +(type: .public Time ///time.Time) -(def: #export equivalence +(def: .public equivalence (Equivalence Time) ///time.equivalence) (def: separator ".") -(def: #export (format [date time]) +(def: .public (format [date time]) (%.Format Time) (%.format (///time/date.format date) ..separator (///time/time.format time))) -(def: #export parser +(def: .public parser (<text>.Parser Time) (do <>.monad [date ///time/date.parser diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux index c1341cf98..13f2b5692 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux @@ -17,12 +17,12 @@ ["#." type (#+ Type)] ["#." time (#+ Time)]]) -(type: #export Version +(type: .public Version {#extension Type #value Text #updated Time}) -(def: #export equivalence +(def: .public equivalence (Equivalence Version) ($_ product.equivalence text.equivalence @@ -44,7 +44,7 @@ (-> xml.Tag Text XML) (|> value #xml.Text list (#xml.Node tag xml.attributes))) -(def: #export (format (^slots [#extension #value #updated])) +(def: .public (format (^slots [#extension #value #updated])) (-> Version XML) (<| (#xml.Node ..<snapshot_version> xml.attributes) (list (..text_format ..<extension> extension) @@ -56,7 +56,7 @@ (<| (<xml>.node tag) <xml>.text)) -(def: #export parser +(def: .public parser (Parser Version) (<| (<xml>.node ..<snapshot_version>) ($_ <>.and diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux index ce9a09f1a..55ece62c7 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux @@ -11,11 +11,11 @@ ["#." time] ["#." stamp]]) -(type: #export Value +(type: .public Value {#version Text #snapshot Snapshot}) -(def: #export equivalence +(def: .public equivalence (Equivalence Value) ($_ product.equivalence text.equivalence @@ -25,10 +25,10 @@ (def: separator "-") -(def: #export snapshot +(def: .public snapshot "SNAPSHOT") -(def: #export (format (^slots [#version #snapshot])) +(def: .public (format (^slots [#version #snapshot])) (%.Format Value) (case snapshot #///.Local diff --git a/stdlib/source/program/aedifex/artifact/time.lux b/stdlib/source/program/aedifex/artifact/time.lux index c8452a477..4a0a20ea3 100644 --- a/stdlib/source/program/aedifex/artifact/time.lux +++ b/stdlib/source/program/aedifex/artifact/time.lux @@ -19,37 +19,37 @@ ["#." date] ["#." time]]) -(type: #export Time +(type: .public Time [/date.Date /time.Time]) -(def: #export epoch +(def: .public epoch Time [/date.epoch time.midnight]) -(def: #export (instant time) +(def: .public (instant time) (-> Time Instant) (let [[date time] time] (instant.of_date_time (/date.value date) time))) -(def: #export (of_instant instant) +(def: .public (of_instant instant) (-> Instant (Try Time)) (do try.monad [date (/date.date (instant.date instant))] (in [date (instant.time instant)]))) -(def: #export equivalence +(def: .public equivalence (Equivalence Time) (product.equivalence /date.equivalence time.equivalence)) -(def: #export (format [date time]) +(def: .public (format [date time]) (Format Time) (%.format (/date.format date) (/time.format time))) -(def: #export parser +(def: .public parser (Parser Time) (do <>.monad [date /date.parser diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index b392a5569..6e84811e6 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -23,7 +23,7 @@ [type abstract]]]) -(def: #export (pad value) +(def: .public (pad value) (-> Nat Text) (if (n.< 10 value) (%.format "0" (%.nat value)) @@ -32,20 +32,22 @@ (def: min_year +1,000) (def: max_year +9,999) -(exception: #export (year_is_out_of_range {year year.Year}) +(exception: .public (year_is_out_of_range {year year.Year}) (exception.report ["Minimum" (%.int ..min_year)] ["Maximum" (%.int ..max_year)] ["Year" (%.int (year.value year))])) -(abstract: #export Date +(abstract: .public Date + {} + date.Date - (def: #export epoch + (def: .public epoch Date (:abstraction date.epoch)) - (def: #export (date raw) + (def: .public (date raw) (-> date.Date (Try Date)) (let [year (|> raw date.year year.value)] (if (and (i.>= ..min_year year) @@ -53,24 +55,24 @@ (#try.Success (:abstraction raw)) (exception.except ..year_is_out_of_range [(date.year raw)])))) - (def: #export value + (def: .public value (-> Date date.Date) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Date) (def: (= reference subject) (date\= (:representation reference) (:representation subject)))) - (def: #export (format value) + (def: .public (format value) (%.Format Date) (%.format (|> value :representation date.year year.value .nat %.nat) (|> value :representation date.month month.number ..pad) (|> value :representation date.day_of_month ..pad))) - (def: #export parser + (def: .public parser (Parser Date) (do <>.monad [year (<>.codec n.decimal (<text>.exactly 4 <text>.decimal)) diff --git a/stdlib/source/program/aedifex/artifact/time/time.lux b/stdlib/source/program/aedifex/artifact/time/time.lux index 78b85f8cd..8b33d5732 100644 --- a/stdlib/source/program/aedifex/artifact/time/time.lux +++ b/stdlib/source/program/aedifex/artifact/time/time.lux @@ -16,17 +16,17 @@ ["." // #_ ["#" date]]) -(type: #export Time +(type: .public Time time.Time) -(def: #export (format value) +(def: .public (format value) (%.Format Time) (let [(^slots [#time.hour #time.minute #time.second]) (time.clock value)] (%.format (//.pad hour) (//.pad minute) (//.pad second)))) -(def: #export parser +(def: .public parser (<text>.Parser Time) (do <>.monad [hour (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) diff --git a/stdlib/source/program/aedifex/artifact/type.lux b/stdlib/source/program/aedifex/artifact/type.lux index 22cbd8253..dde76fc0c 100644 --- a/stdlib/source/program/aedifex/artifact/type.lux +++ b/stdlib/source/program/aedifex/artifact/type.lux @@ -3,11 +3,11 @@ [lux (#- Type)]]) ## https://maven.apache.org/ref/3.6.3/maven-core/artifact-handlers.html -(type: #export Type +(type: .public Type Text) (template [<type> <name>] - [(def: #export <name> + [(def: .public <name> Type <type>)] diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux index 44973b54e..9e6ff8244 100644 --- a/stdlib/source/program/aedifex/artifact/versioning.lux +++ b/stdlib/source/program/aedifex/artifact/versioning.lux @@ -30,17 +30,17 @@ ["#." snapshot (#+ Snapshot) ["#/." version (#+ Version)]]]) -(type: #export Versioning +(type: .public Versioning {#snapshot Snapshot #last_updated //time.Time #versions (List Version)}) -(def: #export init +(def: .public init {#snapshot #//snapshot.Local #last_updated //time.epoch #versions (list)}) -(def: #export equivalence +(def: .public equivalence (Equivalence Versioning) ($_ product.equivalence //snapshot.equivalence @@ -61,7 +61,7 @@ (-> //time.Time XML) (|>> //time.format #xml.Text list (#xml.Node ..<last_updated> xml.attributes))) -(def: #export (format (^slots [#snapshot #last_updated #versions])) +(def: .public (format (^slots [#snapshot #last_updated #versions])) (-> Versioning XML) (<| (#xml.Node ..<versioning> xml.attributes) (list (//snapshot.format snapshot) @@ -80,7 +80,7 @@ (<| (<text>.then //time.parser) (..text ..<last_updated>))) -(def: #export parser +(def: .public parser (Parser Versioning) (<| (<xml>.node ..<versioning>) ($_ <>.and diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index c763d572e..8e97e02d3 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -15,7 +15,7 @@ [identity (#+ Identity)]] ["/" profile (#+ Name)]]) -(type: #export Compilation +(type: .public Compilation #Build #Test) @@ -35,7 +35,7 @@ (<>.or (cli.this "build") (cli.this "test"))) -(type: #export Command +(type: .public Command #Version #Clean #POM @@ -45,7 +45,7 @@ (#Compilation Compilation) (#Auto Compilation)) -(def: #export equivalence +(def: .public equivalence (Equivalence Command) ($_ sum.equivalence ## #Version @@ -85,7 +85,7 @@ ..compilation) )) -(def: #export command +(def: .public command (Parser [Name Command]) ($_ <>.either (<>.after (cli.this "with") diff --git a/stdlib/source/program/aedifex/command.lux b/stdlib/source/program/aedifex/command.lux index c8f8106b4..f918733c1 100644 --- a/stdlib/source/program/aedifex/command.lux +++ b/stdlib/source/program/aedifex/command.lux @@ -5,5 +5,5 @@ ["#" profile] ["#." action (#+ Action)]]) -(type: #export (Command a) +(type: .public (Command a) (-> //.Profile (Action a))) diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index f4e2ab18f..2c4c8ac19 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -35,7 +35,7 @@ (\ ! join) (\ ! map (|>> list.concat (list& path)))))) -(def: #export delay +(def: .public delay Nat 1,000) @@ -43,7 +43,7 @@ (-> Nat (Async (Try Any))) (async.delay delay (#try.Success []))) -(def: #export (do! delay watcher command) +(def: .public (do! delay watcher command) (All [a] (-> Nat (Watcher Async) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 23429f123..ff7825678 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -55,12 +55,12 @@ (#.Some dependency) #.None))))) -(def: #export lux_group +(def: .public lux_group Group "com.github.luxlang") (template [<dependency> <definition>] - [(def: #export <definition> + [(def: .public <definition> Name <dependency>)] @@ -71,10 +71,10 @@ ["lux-ruby" ruby_compiler_name] ) -(exception: #export no_available_compiler) -(exception: #export no_specified_program) +(exception: .public no_available_compiler) +(exception: .public no_specified_program) -(type: #export Compiler +(type: .public Compiler (#JVM Dependency) (#JS Dependency) (#Python Dependency) @@ -154,7 +154,7 @@ [#.End #.End] false)))) -(def: #export (host_dependencies fs home) +(def: .public (host_dependencies fs home) (All [!] (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys (list.only (|>> (get@ #///dependency.type) @@ -186,12 +186,12 @@ (-> Text (List Text) (List Text)) (|>> (list\map (|>> (list name))) list.concat)) -(def: #export start "[BUILD STARTED]") -(def: #export success "[BUILD ENDED]") -(def: #export failure "[BUILD FAILED]") +(def: .public start "[BUILD STARTED]") +(def: .public success "[BUILD ENDED]") +(def: .public failure "[BUILD FAILED]") (template [<name> <capability>] - [(def: #export (<name> console process) + [(def: .public (<name> console process) (-> (Console Async) (Process Async) (Async (Try Any))) ## This is a very odd way of implementing this function. ## But it's written this way because the more straightforward way (i.e. by using (try.with async.monad)) @@ -249,7 +249,7 @@ (text.join_with ..jvm_class_path_separator) %.text)) -(def: #export (with_jvm_class_path host_dependencies runtime) +(def: .public (with_jvm_class_path host_dependencies runtime) (-> (List Path) ///runtime.Runtime ///runtime.Runtime) (case host_dependencies #.End @@ -260,7 +260,7 @@ (|>> (list& "-classpath" (..jvm_class_path host_dependencies))) runtime))) -(def: #export (do! console program fs shell resolution) +(def: .public (do! console program fs shell resolution) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Compiler Path])) (function (_ profile) (let [target (get@ #///.target profile)] diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux index c03a09b49..67d539db7 100644 --- a/stdlib/source/program/aedifex/command/clean.lux +++ b/stdlib/source/program/aedifex/command/clean.lux @@ -26,11 +26,11 @@ (\ ! map (monad.map ! (\ fs delete))) (\ ! join)))) -(def: #export success +(def: .public success (-> ///.Target Text) (|>> (format "Successfully cleaned target directory: "))) -(def: #export (do! console fs profile) +(def: .public (do! console fs profile) (-> (Console Async) (file.System Async) (Command Any)) (do {! async.monad} [.let [target (get@ #///.target profile)] diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index b7b08f517..2ff5ca8fb 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -53,10 +53,10 @@ ["#/." extension (#+ Extension)] ["#/." type]]]]) -(def: #export success +(def: .public success "Successfully deployed the project.") -(def: #export (do! console repository fs artifact profile) +(def: .public (do! console repository fs artifact profile) (-> (Console Async) (Repository Async) (file.System Async) Artifact (Command Any)) (do {! ///action.monad} [library (|> profile diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index 342c9c0bc..9dbabbfca 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -37,7 +37,7 @@ ///artifact.format %.text)) -(def: #export (do! console local remotes new_repository profile) +(def: .public (do! console local remotes new_repository profile) (-> (Console Async) (Repository Async) (List (Repository Async)) (-> URL (Repository Async)) (Command Resolution)) (do async.monad [.let [dependencies (|> (get@ #///.dependencies profile) diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index b39b30f85..c86400b6a 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -43,13 +43,13 @@ ["#." artifact (#+ Artifact) ["#/." type]]]]) -(def: #export success +(def: .public success "Successfully installed the project locally.") -(def: #export failure +(def: .public failure "Failure: No 'identity' defined for the project.") -(def: #export (do! console fs repository profile) +(def: .public (do! console fs repository profile) (-> (Console Async) (file.System Async) (Repository Async) (Command Any)) (case (get@ #/.identity profile) (#.Some identity) diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux index 3b6412070..163fa87fa 100644 --- a/stdlib/source/program/aedifex/command/pom.lux +++ b/stdlib/source/program/aedifex/command/pom.lux @@ -22,10 +22,10 @@ ["#." action] ["#." pom]]) -(def: #export success +(def: .public success (format "Successfully created POM file: " ///pom.file)) -(def: #export (do! console fs profile) +(def: .public (do! console fs profile) (-> (Console Async) (file.System Async) (Command Any)) (do ///action.monad [content (|> (///pom.write profile) diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 78859819d..a7279c5ec 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -24,11 +24,11 @@ [dependency [resolution (#+ Resolution)]]]]) -(def: #export start "[TEST STARTED]") -(def: #export success "[TEST ENDED]") -(def: #export failure "[TEST FAILED]") +(def: .public start "[TEST STARTED]") +(def: .public success "[TEST ENDED]") +(def: .public failure "[TEST FAILED]") -(def: #export (do! console program fs shell resolution profile) +(def: .public (do! console program fs shell resolution profile) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])) (do async.monad [environment (program.environment async.monad program) diff --git a/stdlib/source/program/aedifex/command/version.lux b/stdlib/source/program/aedifex/command/version.lux index 0c5c944b5..d66738f11 100644 --- a/stdlib/source/program/aedifex/command/version.lux +++ b/stdlib/source/program/aedifex/command/version.lux @@ -15,7 +15,7 @@ [/// [command (#+ Command)]]) -(def: #export (do! console profile) +(def: .public (do! console profile) (-> (Console Async) (Command Any)) (console.write_line (version.format language/lux.version) console)) diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux index 1ac750d62..f31f0ca44 100644 --- a/stdlib/source/program/aedifex/dependency.lux +++ b/stdlib/source/program/aedifex/dependency.lux @@ -13,22 +13,22 @@ ["#" artifact (#+ Artifact) ("#\." order) [type (#+ Type)]]]) -(type: #export Dependency +(type: .public Dependency {#artifact Artifact #type Type}) -(def: #export hash +(def: .public hash (Hash Dependency) ($_ product.hash //.hash text.hash )) -(def: #export equivalence +(def: .public equivalence (Equivalence Dependency) (\ hash &equivalence)) -(implementation: #export order +(implementation: .public order (Order Dependency) (def: &equivalence diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index 2b39403a9..6ff052a5a 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -115,7 +115,7 @@ ## (..artifacts ///artifact/type.pom (product.right (get@ #///package.pom package))))) )))) -(def: #export (one repository [artifact type] package) +(def: .public (one repository [artifact type] package) (-> (Repository Async) Dependency Package (Async (Try Artifact))) (do {! async.monad} [now (async.future instant.now) @@ -140,7 +140,7 @@ (///metadata/artifact.write repository artifact))] (in artifact)))) -(def: #export (all repository resolution) +(def: .public (all repository resolution) (-> (Repository Async) Resolution (Async (Try (Set Artifact)))) (let [! (try.with async.monad)] (|> (dictionary.entries resolution) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index c286c92c2..c34d88494 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -58,7 +58,7 @@ ["#/." snapshot]]]]) (template [<name>] - [(exception: #export (<name> {artifact Artifact} {extension Extension} {hash Text}) + [(exception: .public (<name> {artifact Artifact} {extension Extension} {hash Text}) (exception.report ["Artifact" (///artifact.format artifact)] ["Extension" (%.text extension)] @@ -122,7 +122,7 @@ [#.None #.None] #//status.Unverified)]))) -(def: #export (one repository dependency) +(def: .public (one repository dependency) (-> (Repository Async) Dependency (Async (Try Package))) (let [[artifact type] dependency extension (///artifact/extension.extension type)] @@ -143,18 +143,18 @@ #///package.library library_&_status #///package.pom [pom pom_data pom_status]})))))) -(type: #export Resolution +(type: .public Resolution (Dictionary Dependency Package)) -(def: #export empty +(def: .public empty Resolution (dictionary.empty //.hash)) -(def: #export equivalence +(def: .public equivalence (Equivalence Resolution) (dictionary.equivalence ///package.equivalence)) -(exception: #export (cannot_resolve {dependency Dependency}) +(exception: .public (cannot_resolve {dependency Dependency}) (exception.report ["Artifact" (%.text (///artifact.format (get@ #//.artifact dependency)))] ["Type" (%.text (get@ #//.type dependency))])) @@ -174,7 +174,7 @@ ["X" announce_failure "Missed" "from"] ) -(def: #export (any console repositories dependency) +(def: .public (any console repositories dependency) (-> (Console Async) (List (Repository Async)) Dependency (Async (Try Package))) (case repositories #.End @@ -197,7 +197,7 @@ [_ (..announce_failure console repository (get@ #//.artifact dependency))] (any console alternatives dependency)))))) -(def: #export (all console repositories new_repository dependencies resolution) +(def: .public (all console repositories new_repository dependencies resolution) (-> (Console Async) (List (Repository Async)) (-> URL (Repository Async)) (List Dependency) Resolution (Async [(List Dependency) (List Dependency) diff --git a/stdlib/source/program/aedifex/dependency/status.lux b/stdlib/source/program/aedifex/dependency/status.lux index db97f59b0..2c2e13fd8 100644 --- a/stdlib/source/program/aedifex/dependency/status.lux +++ b/stdlib/source/program/aedifex/dependency/status.lux @@ -10,7 +10,7 @@ ["." /// #_ ["#." hash (#+ Hash SHA-1 MD5)]]) -(type: #export Status +(type: .public Status #Unverified (#Partial (Either (Hash SHA-1) (Hash MD5))) @@ -22,7 +22,7 @@ (def: (= _ _) true)) -(def: #export equivalence +(def: .public equivalence (Equivalence Status) ($_ sum.equivalence ..any_equivalence @@ -34,7 +34,7 @@ ///hash.equivalence) )) -(def: #export (verified payload) +(def: .public (verified payload) (-> Binary Status) (#Verified (///hash.sha-1 payload) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index c7adaa33e..c0c9db2d1 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -18,7 +18,7 @@ ["#." artifact (#+ Artifact) ["#/." type]]]) -(type: #export (Format a) +(type: .public (Format a) (-> a Code)) (def: (license [name url type]) @@ -139,7 +139,7 @@ (` [(~ (code.text program)) (~+ (list\map code.text parameters))])) -(def: #export (profile value) +(def: .public (profile value) (Format /.Profile) (`` (|> ..empty (..on_list "parents" (get@ #/.parents value) code.text) @@ -163,7 +163,7 @@ [#/.ruby])) ..aggregate))) -(def: #export project +(def: .public project (Format Project) (|>> dictionary.entries (list\map (function (_ [key value]) diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 4e83b8f07..95247c471 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -31,18 +31,18 @@ (#static getInstance [java/lang/String] java/security/MessageDigest) (digest [[byte]] [byte])]) -(abstract: #export SHA-1 Any) -(abstract: #export MD5 Any) +(abstract: .public SHA-1 Any) +(abstract: .public MD5 Any) -(abstract: #export (Hash h) +(abstract: .public (Hash h) Binary - (def: #export data + (def: .public data (All [h] (-> (Hash h) Binary)) (|>> :representation)) (template [<name> <kind> <algorithm>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> Binary (Hash <kind>)) (|> (java/security/MessageDigest::getInstance [<algorithm>]) (java/security/MessageDigest::digest [value]) @@ -77,14 +77,14 @@ (def: hex_per_chunk (n.* hex_per_byte i64.bytes_per_i64)) - (exception: #export (not_a_hash {size Nat} {value Text}) + (exception: .public (not_a_hash {size Nat} {value Text}) (exception.report ["Pseudo hash" (%.text value)] ["Expected size" (%.nat size)] ["Actual size" (%.nat (text.size value))])) (template [<name> <size>] - [(exception: #export (<name> {data Binary}) + [(exception: .public (<name> {data Binary}) (exception.report ["Pseudo hash" (%.text (..encode data))] ["Expected size" (%.nat <size>)] @@ -95,7 +95,7 @@ ) (template [<name> <kind> <size> <exception>] - [(def: #export (<name> data) + [(def: .public (<name> data) (-> Binary (Try (Hash <kind>))) (if (n.= <size> (binary.size data)) (#try.Success (:abstraction data)) @@ -146,7 +146,7 @@ (exception.except ..not_a_hash [(..encoding_size size) encoded])))) (template [<codec> <hash> <nat> <constructor>] - [(implementation: #export <codec> + [(implementation: .public <codec> (Codec Text (Hash <hash>)) (def: encode (|>> :representation ..encode)) @@ -156,7 +156,7 @@ [md5_codec MD5 ..md5::size ..as_md5] ) - (implementation: #export equivalence + (implementation: .public equivalence (All [h] (Equivalence (Hash h))) (def: (= reference subject) diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index 73b3c383b..6a635589e 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -46,7 +46,7 @@ [..lux_parser] [(list) (<code>.run //parser.project)]))) -(def: #export (read monad fs profile) +(def: .public (read monad fs profile) (All [!] (-> (Monad !) (file.System !) Text (! (Try Profile)))) (|> //project.file (\ fs read) diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux index b3a358484..021ce9ca7 100644 --- a/stdlib/source/program/aedifex/local.lux +++ b/stdlib/source/program/aedifex/local.lux @@ -12,10 +12,10 @@ (def: / uri.separator) -(def: #export repository +(def: .public repository URI (format ".m2" / "repository")) -(def: #export (uri version artifact) +(def: .public (uri version artifact) (-> Version Artifact URI) (format ..repository / (//artifact.uri version artifact))) diff --git a/stdlib/source/program/aedifex/metadata.lux b/stdlib/source/program/aedifex/metadata.lux index 40a7bd612..7b883e4f8 100644 --- a/stdlib/source/program/aedifex/metadata.lux +++ b/stdlib/source/program/aedifex/metadata.lux @@ -15,7 +15,7 @@ Path "maven-metadata.xml") -(def: #export (remote_artifact_uri artifact) +(def: .public (remote_artifact_uri artifact) (-> Artifact URI) (let [/ uri.separator] (format (//artifact.directory / (get@ #//artifact.group artifact)) @@ -23,7 +23,7 @@ / (get@ #//artifact.version artifact) / ..remote_file))) -(def: #export (remote_project_uri artifact) +(def: .public (remote_project_uri artifact) (-> Artifact URI) (let [/ uri.separator] (format (//artifact.directory / (get@ #//artifact.group artifact)) @@ -34,10 +34,10 @@ Path "maven-metadata-local.xml") -(def: #export (local_uri remote_uri) +(def: .public (local_uri remote_uri) (-> URI URI) (text.replace_once ..remote_file ..local_file remote_uri)) -(def: #export (remote_uri local_uri) +(def: .public (remote_uri local_uri) (-> URI URI) (text.replace_once ..local_file ..remote_file local_uri)) diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index 777c7df1b..0bd6d4a12 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -38,7 +38,7 @@ [repository (#+ Repository)] ["#." artifact (#+ Group Name Version Artifact)]]]) -(type: #export Metadata +(type: .public Metadata {#group Group #name Name #versions (List Version) @@ -95,7 +95,7 @@ (-> (List Version) XML) (|>> (list\map ..version_format) (#xml.Node ..<versions> xml.attributes))) -(def: #export (format value) +(def: .public (format value) (-> Metadata XML) (#xml.Node ..<metadata> xml.attributes @@ -141,7 +141,7 @@ (in (instant.of_date_time date time))) (..text ..<last_updated>))) -(def: #export parser +(def: .public parser (Parser Metadata) (<| (<xml>.node ..<metadata>) ($_ <>.and @@ -155,7 +155,7 @@ (<xml>.somewhere ..last_updated_parser) ))))) -(def: #export equivalence +(def: .public equivalence (Equivalence Metadata) ($_ product.equivalence text.equivalence @@ -164,7 +164,7 @@ instant.equivalence )) -(def: #export uri +(def: .public uri (-> Artifact URI) //.remote_project_uri) @@ -172,7 +172,7 @@ Instant (instant.of_millis +0)) -(def: #export (read repository artifact) +(def: .public (read repository artifact) (-> (Repository Async) Artifact (Async (Try Metadata))) (do async.monad [project (\ repository download (..uri artifact))] @@ -192,7 +192,7 @@ #versions (list) #last_updated ..epoch})))))) -(def: #export (write repository artifact metadata) +(def: .public (write repository artifact metadata) (-> (Repository Async) Artifact Metadata (Async (Try Any))) (|> metadata ..format diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index 6a9d812c9..69e3432fa 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -45,7 +45,7 @@ ["#/." version] ["#/." stamp]]]]]) -(type: #export Metadata +(type: .public Metadata {#artifact Artifact #versioning Versioning}) @@ -68,7 +68,7 @@ [version_format Version ..<version> (|>)] ) -(def: #export (format (^slots [#artifact #versioning])) +(def: .public (format (^slots [#artifact #versioning])) (-> Metadata XML) (let [(^slots [#///artifact.group #///artifact.name #///artifact.version]) artifact] (#xml.Node ..<metadata> @@ -83,7 +83,7 @@ (<| (<xml>.node tag) <xml>.text)) -(def: #export parser +(def: .public parser (Parser Metadata) (<| (<xml>.node ..<metadata>) (do {! <>.monad} @@ -111,18 +111,18 @@ #///artifact.version version} #versioning versioning})))) -(def: #export equivalence +(def: .public equivalence (Equivalence Metadata) ($_ product.equivalence ///artifact.equivalence ///artifact/versioning.equivalence )) -(def: #export uri +(def: .public uri (-> Artifact URI) //.remote_artifact_uri) -(def: #export (read repository artifact) +(def: .public (read repository artifact) (-> (Repository Async) Artifact (Async (Try Metadata))) (do async.monad [project (\ repository download (..uri artifact))] @@ -139,7 +139,7 @@ {#artifact artifact #versioning ///artifact/versioning.init}))))) -(def: #export (write repository artifact metadata) +(def: .public (write repository artifact metadata) (-> (Repository Async) Artifact Metadata (Async (Try Any))) (|> metadata ..format diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux index 1144e8f4a..ea9c2a6d8 100644 --- a/stdlib/source/program/aedifex/package.lux +++ b/stdlib/source/program/aedifex/package.lux @@ -28,13 +28,13 @@ [remote (#+ Address)] ["#." origin (#+ Origin)]]]) -(type: #export Package +(type: .public Package {#origin Origin #library [Binary Status] #pom [XML Binary Status]}) (template [<name> <tag>] - [(def: #export (<name> package) + [(def: .public (<name> package) (-> Package Bit) (case (get@ #origin package) (<tag> _) @@ -47,7 +47,7 @@ [remote? #//origin.Remote] ) -(def: #export (local pom library) +(def: .public (local pom library) (-> XML Binary Package) {#origin (#//origin.Local "") #library [library @@ -59,7 +59,7 @@ (#//status.Verified (//hash.sha-1 binary_pom) (//hash.md5 binary_pom))])}) -(def: #export dependencies +(def: .public dependencies (-> Package (Try (Set Dependency))) (|>> (get@ #pom) product.left @@ -67,7 +67,7 @@ (<xml>.run //pom.parser) (try\map (get@ #/.dependencies)))) -(def: #export repositories +(def: .public repositories (-> Package (Try (Set Address))) (|>> (get@ #pom) product.left @@ -75,7 +75,7 @@ (<xml>.run //pom.parser) (try\map (get@ #/.repositories)))) -(def: #export equivalence +(def: .public equivalence (Equivalence Package) ($_ product.equivalence //origin.equivalence diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 7405deebc..9eaba0b92 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -258,7 +258,7 @@ ^ruby ))) -(def: #export project +(def: .public project (Parser Project) (let [default_profile (: (Parser Project) (\ <>.monad map diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index e1f242b69..13900d276 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -41,7 +41,7 @@ (def: artifact_tag "artifactId") (def: version_tag "version") -(def: #export file +(def: .public file file.Path "pom.xml") @@ -138,7 +138,7 @@ )) ) -(def: #export (write value) +(def: .public (write value) (-> /.Profile (Try XML)) (case (get@ #/.identity value) (#.Some identity) @@ -210,7 +210,7 @@ (<| (<xml>.node ["" "parent"]) ..own_version)) -(def: #export parser +(def: .public parser (Parser /.Profile) (do {! <>.monad} [own_version (<>.else "" (<xml>.somewhere ..own_version)) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index fc9ae2d42..93eeec473 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -32,12 +32,12 @@ [repository [remote (#+ Address)]]]) -(def: #export default_compiler +(def: .public default_compiler Dependency {#dependency.artifact ["com.github.luxlang" "lux-jvm" "0.6.0-SNAPSHOT"] #dependency.type type.jvm_library}) -(type: #export Distribution +(type: .public Distribution #Repo #Manual) @@ -55,7 +55,7 @@ _ false))) -(type: #export License +(type: .public License [Text URL Distribution]) @@ -67,10 +67,10 @@ text.equivalence ..distribution_equivalence)) -(type: #export SCM +(type: .public SCM URL) -(type: #export Organization +(type: .public Organization [Text URL]) @@ -80,10 +80,10 @@ text.equivalence text.equivalence)) -(type: #export Email +(type: .public Email Text) -(type: #export Developer +(type: .public Developer [Text Email (Maybe Organization)]) @@ -95,10 +95,10 @@ text.equivalence (maybe.equivalence ..organization_equivalence))) -(type: #export Contributor +(type: .public Contributor Developer) -(type: #export Info +(type: .public Info {#url (Maybe URL) #scm (Maybe SCM) #description (Maybe Text) @@ -118,7 +118,7 @@ (list.equivalence ..developer_equivalence) (list.equivalence ..developer_equivalence))) -(def: #export default_info +(def: .public default_info Info {#url #.None #scm #.None @@ -128,32 +128,32 @@ #developers (list) #contributors (list)}) -(type: #export Source +(type: .public Source Path) -(def: #export default_source +(def: .public default_source Source "source") -(type: #export Target +(type: .public Target Path) -(def: #export default_target +(def: .public default_target Target "target") -(def: #export default_repository +(def: .public default_repository Address "https://repo1.maven.org/maven2/") -(type: #export Name +(type: .public Name Text) -(def: #export default +(def: .public default Name "") -(type: #export Profile +(type: .public Profile {#parents (List Name) #identity (Maybe Artifact) #info (Maybe Info) @@ -171,7 +171,7 @@ #lua Runtime #ruby Runtime}) -(def: #export equivalence +(def: .public equivalence (Equivalence Profile) ($_ product.equivalence ## #parents @@ -207,7 +207,7 @@ ## #ruby runtime.equivalence)) -(implementation: #export monoid +(implementation: .public monoid (Monoid Profile) (def: identity @@ -254,4 +254,4 @@ #lua (!runtime #lua runtime.default_lua) #ruby (!runtime #ruby runtime.default_ruby)}))) -(exception: #export no_identity) +(exception: .public no_identity) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index f8fb0334d..30c4d9538 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -18,21 +18,21 @@ ["." // #_ ["#" profile (#+ Name Profile)]]) -(def: #export file +(def: .public file "project.lux") -(type: #export Project +(type: .public Project (Dictionary Name Profile)) -(def: #export (project name profile) +(def: .public (project name profile) (-> Name Profile Project) (dictionary.of_list text.hash (list [name profile]))) -(def: #export equivalence +(def: .public equivalence (Equivalence Project) (dictionary.equivalence //.equivalence)) -(implementation: #export monoid +(implementation: .public monoid (Monoid Project) (def: identity @@ -41,11 +41,11 @@ (def: compose (dictionary.merged_with (\ //.monoid compose)))) -(exception: #export (unknown_profile {name Name}) +(exception: .public (unknown_profile {name Name}) (exception.report ["Name" (%.text name)])) -(exception: #export (circular_dependency {dependee Name} {dependent Name}) +(exception: .public (circular_dependency {dependee Name} {dependent Name}) (exception.report ["Dependent" (%.text dependent)] ["Dependee" (%.text dependee)])) @@ -71,6 +71,6 @@ #.None (exception.except ..unknown_profile [name]))) -(def: #export (profile name project) +(def: .public (profile name project) (-> Name Project (Try Profile)) (..profile' (set.empty text.hash) project name)) diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index 1ab1e0602..8d6d63b3a 100644 --- a/stdlib/source/program/aedifex/repository.lux +++ b/stdlib/source/program/aedifex/repository.lux @@ -15,7 +15,7 @@ [net [uri (#+ URI)]]]]]) -(interface: #export (Repository !) +(interface: .public (Repository !) (: Text description) (: (-> URI (! (Try Binary))) @@ -23,7 +23,7 @@ (: (-> URI Binary (! (Try Any))) upload)) -(def: #export (async repository) +(def: .public (async repository) (-> (Repository IO) (Repository Async)) (implementation (def: description @@ -35,7 +35,7 @@ (async.future (\ repository upload uri content))) )) -(interface: #export (Mock s) +(interface: .public (Mock s) (: Text the_description) (: (-> URI s (Try [s Binary])) @@ -43,7 +43,7 @@ (: (-> URI Binary s (Try s)) on_upload)) -(def: #export (mock mock init) +(def: .public (mock mock init) (All [s] (-> (Mock s) s (Repository Async))) (let [state (stm.var init)] (implementation diff --git a/stdlib/source/program/aedifex/repository/identity.lux b/stdlib/source/program/aedifex/repository/identity.lux index dccecf291..742c1aef2 100644 --- a/stdlib/source/program/aedifex/repository/identity.lux +++ b/stdlib/source/program/aedifex/repository/identity.lux @@ -11,17 +11,17 @@ [encoding ["." utf8]]]]]]) -(type: #export User +(type: .public User Text) -(type: #export Password +(type: .public Password Text) -(type: #export Identity +(type: .public Identity {#user User #password Password}) -(def: #export equivalence +(def: .public equivalence (Equivalence Identity) ($_ product.equivalence text.equivalence @@ -36,7 +36,7 @@ ["#::." (#static getEncoder [] java/util/Base64$Encoder)]) -(def: #export (basic_auth user password) +(def: .public (basic_auth user password) (-> User Password Text) (let [credentials (\ utf8.codec encode (format user ":" password))] (|> (java/util/Base64::getEncoder) diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index 6cfdd0f0b..f59a04b85 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -36,7 +36,7 @@ (..path /) (format (..root program /) /))) -(implementation: #export (repository program fs) +(implementation: .public (repository program fs) (-> (Program Async) (file.System Async) (//.Repository Async)) (def: description diff --git a/stdlib/source/program/aedifex/repository/origin.lux b/stdlib/source/program/aedifex/repository/origin.lux index be7d24a6e..b850bf21f 100644 --- a/stdlib/source/program/aedifex/repository/origin.lux +++ b/stdlib/source/program/aedifex/repository/origin.lux @@ -10,11 +10,11 @@ [file (#+ Path)] [net (#+ URL)]]]]) -(type: #export Origin +(type: .public Origin (#Local Path) (#Remote URL)) -(def: #export equivalence +(def: .public equivalence (Equivalence Origin) ($_ sum.equivalence text.equivalence diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index 76363c94f..feaf3201f 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -30,11 +30,11 @@ ["#." artifact (#+ Version Artifact) [extension (#+ Extension)]]]]) -(type: #export Address +(type: .public Address URL) (template [<name>] - [(exception: #export (<name> {url URL} {status Nat}) + [(exception: .public (<name> {url URL} {status Nat}) (exception.report ["URL" (%.text url)] ["Status Code" (%.nat status)]))] @@ -43,18 +43,18 @@ [upload_failure] ) -(def: #export (uri version_template artifact extension) +(def: .public (uri version_template artifact extension) (-> Version Artifact Extension URI) (format (///artifact.uri version_template artifact) extension)) -(def: #export user_agent +(def: .public user_agent (format "LuxAedifex/" (version.format language/lux.version))) (def: base_headers (List [Text Text]) (list ["User-Agent" ..user_agent])) -(implementation: #export (repository http identity address) +(implementation: .public (repository http identity address) (All [s] (-> (http.Client IO) (Maybe Identity) Address (//.Repository IO))) (def: description diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index ea34fc0fe..842708e44 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -14,18 +14,18 @@ [world ["." file]]]]) -(type: #export Runtime +(type: .public Runtime {#program Text #parameters (List Text)}) -(def: #export equivalence +(def: .public equivalence (Equivalence Runtime) (product.equivalence text.equivalence (list.equivalence text.equivalence))) (template [<name> <command> <parameters>] - [(def: #export <name> + [(def: .public <name> Runtime {#program <command> #parameters (`` (list (~~ (template.spliced <parameters>))))})] @@ -38,7 +38,7 @@ [default_ruby "ruby" []] ) -(def: #export (for runtime path) +(def: .public (for runtime path) (-> Runtime file.Path Runtime) (update@ #parameters (function (_ parameters) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 543fdfdf9..88ceec96c 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -111,7 +111,7 @@ (dictionary.put head content output))))))) (with_expansions [<parameters> (as_is anchor expression artifact)] - (def: #export (compiler static + (def: .public (compiler static expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender service packager,package) diff --git a/stdlib/source/program/compositor/cli.lux b/stdlib/source/program/compositor/cli.lux index f0fdb80be..394869517 100644 --- a/stdlib/source/program/compositor/cli.lux +++ b/stdlib/source/program/compositor/cli.lux @@ -13,25 +13,25 @@ [world [file (#+ Path)]]]]) -(type: #export Source +(type: .public Source Path) -(type: #export Host_Dependency +(type: .public Host_Dependency Path) -(type: #export Library +(type: .public Library Path) -(type: #export Target +(type: .public Target Path) -(type: #export Compilation +(type: .public Compilation [(List Source) (List Host_Dependency) (List Library) Target Module]) -(type: #export Export +(type: .public Export [(List Source) Target]) -(type: #export Service +(type: .public Service (#Compilation Compilation) (#Interpretation Compilation) (#Export Export)) @@ -48,7 +48,7 @@ [module_parser "--module" Module] ) -(def: #export service +(def: .public service (Parser Service) ($_ <>.or (<>.after (cli.this "build") @@ -71,7 +71,7 @@ ..target_parser)) )) -(def: #export target +(def: .public target (-> Service Target) (|>> (case> (^or (#Compilation [sources host_dependencies libraries target module]) (#Interpretation [sources host_dependencies libraries target module]) diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux index 239341e5d..ade242f57 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -39,7 +39,7 @@ {#tar.user commons #tar.group commons})) -(def: #export (library fs sources) +(def: .public (library fs sources) (-> (file.System Async) (List Source) (Async (Try tar.Tar))) (do (try.with async.monad) [files (io.listing fs sources)] @@ -62,7 +62,7 @@ (\ try.monad map row.of_list) (\ async.monad in)))) -(def: #export (export fs [sources target]) +(def: .public (export fs [sources target]) (-> (file.System Async) Export (Async (Try Any))) (do {! (try.with async.monad)} [tar (\ ! map (binary.run tar.writer) diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux index b8e27ebc4..a96f722d9 100644 --- a/stdlib/source/program/compositor/import.lux +++ b/stdlib/source/program/compositor/import.lux @@ -32,14 +32,14 @@ (def: Action (type (All [a] (Async (Try a))))) -(exception: #export useless_tar_entry) +(exception: .public useless_tar_entry) -(exception: #export (duplicate {library Library} {module Module}) +(exception: .public (duplicate {library Library} {module Module}) (exception.report ["Module" (%.text module)] ["Library" (%.text library)])) -(type: #export Import +(type: .public Import (Dictionary file.Path Binary)) (def: (import_library system library import) @@ -67,7 +67,7 @@ import))) (\ ! join))))))) -(def: #export (import system libraries) +(def: .public (import system libraries) (-> (file.System Async) (List Library) (Action Import)) (monad.fold (: (Monad Action) (try.with async.monad)) diff --git a/stdlib/source/program/compositor/static.lux b/stdlib/source/program/compositor/static.lux index ee65f9f72..1208687b3 100644 --- a/stdlib/source/program/compositor/static.lux +++ b/stdlib/source/program/compositor/static.lux @@ -5,7 +5,7 @@ [world [file (#+ Path)]]]]) -(type: #export Static +(type: .public Static {#host Target #host_module_extension Text #target Path diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index ba35a2169..c9b27a305 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -344,7 +344,7 @@ _ type)) -(exception: #export (anonymous_type_definition {type Type}) +(exception: .public (anonymous_type_definition {type Type}) (exception.report ["Type" (%.type type)])) @@ -486,7 +486,7 @@ description documentation)]))) -(exception: #export (io_error {error Text}) +(exception: .public (io_error {error Text}) error) (def: (save_documentation! [module_name documentation]) diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux index 059a467e4..9f29b2b4c 100644 --- a/stdlib/source/specification/aedifex/repository.lux +++ b/stdlib/source/specification/aedifex/repository.lux @@ -23,7 +23,7 @@ ["_." // #_ ["#." artifact]]]) -(def: #export (spec valid_artifact invalid_artifact subject) +(def: .public (spec valid_artifact invalid_artifact subject) (-> Artifact Artifact (/.Repository Async) Test) (do random.monad [expected (_binary.random 100)] diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux index 8cc92ff33..7c7d620f1 100644 --- a/stdlib/source/specification/compositor.lux +++ b/stdlib/source/specification/compositor.lux @@ -41,7 +41,7 @@ (/generation/common.spec runner) )) -(def: #export (spec platform bundle expander program) +(def: .public (spec platform bundle expander program) (All [anchor expression directive] (-> (IO (Platform IO anchor expression directive)) (Bundle anchor expression directive) diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux index 5a34eae36..6e3c4dba7 100644 --- a/stdlib/source/specification/compositor/analysis/type.lux +++ b/stdlib/source/specification/compositor/analysis/type.lux @@ -50,7 +50,7 @@ [(r.ascii/upper_alpha 5) (0 #0 "#Text" (0 #0)) code.text] ))))) -(def: #export (spec expander state) +(def: .public (spec expander state) (-> Expander State+ Test) (do r.monad [[typeC exprT exprC] ..check diff --git a/stdlib/source/specification/compositor/common.lux b/stdlib/source/specification/compositor/common.lux index fdd930ec8..2c83cbd9e 100644 --- a/stdlib/source/specification/compositor/common.lux +++ b/stdlib/source/specification/compositor/common.lux @@ -19,13 +19,13 @@ [default ["." platform (#+ Platform)]]]]]) -(type: #export Runner +(type: .public Runner (-> Text Synthesis (Try Any))) -(type: #export Definer +(type: .public Definer (-> Name Synthesis (Try Any))) -(type: #export (Instancer what) +(type: .public (Instancer what) (All [anchor expression directive] (-> (Platform IO anchor expression directive) (generation.State+ anchor expression directive) @@ -57,7 +57,7 @@ (phase (synthesis.constant lux_name))))] (\ host evaluate! "definer" definitionG)))) -(def: #export (executors target expander platform +(def: .public (executors target expander platform analysis_bundle generation_bundle directive_bundle program extender) (All [anchor expression directive] diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 0ef6fc025..c3dbd1835 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -38,7 +38,7 @@ (-> Nat Nat Bit) (n.= (dec size) idx)) -(def: #export (verify expected) +(def: .public (verify expected) (-> Frac (Try Any) Bit) (|>> (case> (#try.Success actual) (f.= expected (:as Frac actual)) @@ -278,7 +278,7 @@ false))) )) -(def: #export (spec run) +(def: .public (spec run) (-> Runner Test) ($_ _.and (..special_spec run) diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index e17692b30..1e3d6bb9e 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -332,7 +332,7 @@ false))) ))) -(def: #export (spec runner) +(def: .public (spec runner) (-> Runner Test) ($_ _.and (..bit runner) diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index 3589cdf28..a9845081b 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -47,7 +47,7 @@ #synthesis.arity arity #synthesis.body (synthesis.variable/local local)})]))) -(def: #export (spec run) +(def: .public (spec run) (-> Runner Test) (do {! r.monad} [[arity local functionS] ..function diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index 2ddb9a02e..ec00f935f 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -26,7 +26,7 @@ (and (f.not_a_number? reference) (f.not_a_number? subject)))) -(def: #export (spec run) +(def: .public (spec run) (-> Runner Test) (`` ($_ _.and (~~ (template [<evaluation_name> <synthesis> <gen> <test>] diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index d5c3cfd34..02338e915 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -53,7 +53,7 @@ (#try.Failure _) false))))) -(def: #export (spec runner definer) +(def: .public (spec runner definer) (-> Runner Definer Test) ($_ _.and (..definition definer) diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index 46c25c8a3..4feea793f 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -81,7 +81,7 @@ (#try.Failure _) false))))) -(def: #export (spec runner) +(def: .public (spec runner) (-> Runner Test) ($_ _.and (..variant runner) diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux index 691e8c01c..9aaa00eac 100644 --- a/stdlib/source/specification/lux/abstract/apply.lux +++ b/stdlib/source/specification/lux/abstract/apply.lux @@ -62,7 +62,7 @@ (injection decrease) (injection sample)))))) -(def: #export (spec injection comparison apply) +(def: .public (spec injection comparison apply) (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) (_.for [/.Apply] ($_ _.and diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux index f58f6ce91..3cbb712d2 100644 --- a/stdlib/source/specification/lux/abstract/codec.lux +++ b/stdlib/source/specification/lux/abstract/codec.lux @@ -13,7 +13,7 @@ [// [equivalence (#+ Equivalence)]]]]) -(def: #export (spec (^open "@//.") (^open "@//.") generator) +(def: .public (spec (^open "@//.") (^open "@//.") generator) (All [m a] (-> (Equivalence a) (/.Codec m a) (Random a) Test)) (do random.monad [expected generator] diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux index 0f5f18965..b1fca7ab7 100644 --- a/stdlib/source/specification/lux/abstract/comonad.lux +++ b/stdlib/source/specification/lux/abstract/comonad.lux @@ -51,7 +51,7 @@ (== (|> start _//split (_//map (|>> _//split (_//map increase) decrease))) (|> start _//split (_//map increase) _//split (_//map decrease)))))) -(def: #export (spec injection comparison subject) +(def: .public (spec injection comparison subject) (All [f] (-> (Injection f) (Comparison f) (CoMonad f) Test)) (<| (_.for [/.CoMonad]) ($_ _.and diff --git a/stdlib/source/specification/lux/abstract/enum.lux b/stdlib/source/specification/lux/abstract/enum.lux index 6375b4829..f68ba1203 100644 --- a/stdlib/source/specification/lux/abstract/enum.lux +++ b/stdlib/source/specification/lux/abstract/enum.lux @@ -9,7 +9,7 @@ [\\library ["." /]]) -(def: #export (spec (^open "\.") gen_sample) +(def: .public (spec (^open "\.") gen_sample) (All [a] (-> (/.Enum a) (Random a) Test)) (do random.monad [sample gen_sample] diff --git a/stdlib/source/specification/lux/abstract/equivalence.lux b/stdlib/source/specification/lux/abstract/equivalence.lux index 4d6d0900a..e6ef85b11 100644 --- a/stdlib/source/specification/lux/abstract/equivalence.lux +++ b/stdlib/source/specification/lux/abstract/equivalence.lux @@ -9,7 +9,7 @@ [\\library ["." / (#+ Equivalence)]]) -(def: #export (spec (^open "_//.") random) +(def: .public (spec (^open "_//.") random) (All [a] (-> (Equivalence a) (Random a) Test)) (do random.monad [left random diff --git a/stdlib/source/specification/lux/abstract/fold.lux b/stdlib/source/specification/lux/abstract/fold.lux index 2b4a7617f..6d3ad1f7e 100644 --- a/stdlib/source/specification/lux/abstract/fold.lux +++ b/stdlib/source/specification/lux/abstract/fold.lux @@ -13,7 +13,7 @@ [\\library ["." /]]) -(def: #export (spec injection comparison (^open "@//.")) +(def: .public (spec injection comparison (^open "@//.")) (All [f] (-> (Injection f) (Comparison f) (/.Fold f) Test)) (do random.monad [subject random.nat diff --git a/stdlib/source/specification/lux/abstract/functor.lux b/stdlib/source/specification/lux/abstract/functor.lux index cfa6cc2ff..d60555ae0 100644 --- a/stdlib/source/specification/lux/abstract/functor.lux +++ b/stdlib/source/specification/lux/abstract/functor.lux @@ -14,10 +14,10 @@ [\\library ["." / (#+ Functor)]]) -(type: #export (Injection f) +(type: .public (Injection f) (All [a] (-> a (f a)))) -(type: #export (Comparison f) +(type: .public (Comparison f) (All [a] (-> (Equivalence a) (Equivalence (f a))))) @@ -52,7 +52,7 @@ (|> sample (@//map increase) (@//map decrease)) (|> sample (@//map (|>> increase decrease))))))) -(def: #export (spec injection comparison functor) +(def: .public (spec injection comparison functor) (All [f] (-> (Injection f) (Comparison f) (Functor f) Test)) (<| (_.for [/.Functor]) ($_ _.and diff --git a/stdlib/source/specification/lux/abstract/functor/contravariant.lux b/stdlib/source/specification/lux/abstract/functor/contravariant.lux index cba839e94..719398e71 100644 --- a/stdlib/source/specification/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/specification/lux/abstract/functor/contravariant.lux @@ -21,7 +21,7 @@ (@//map function.identity value) value))) -(def: #export (spec equivalence value functor) +(def: .public (spec equivalence value functor) (All [f a] (-> (Equivalence (f a)) (f a) (Functor f) Test)) (do random.monad [sample random.nat] diff --git a/stdlib/source/specification/lux/abstract/hash.lux b/stdlib/source/specification/lux/abstract/hash.lux index e55c8b549..4437a42a5 100644 --- a/stdlib/source/specification/lux/abstract/hash.lux +++ b/stdlib/source/specification/lux/abstract/hash.lux @@ -11,7 +11,7 @@ [\\library ["." /]]) -(def: #export (spec (^open "\.") random) +(def: .public (spec (^open "\.") random) (All [a] (-> (/.Hash a) (Random a) Test)) (do random.monad [parameter random diff --git a/stdlib/source/specification/lux/abstract/interval.lux b/stdlib/source/specification/lux/abstract/interval.lux index c5d89aab3..68b2204b0 100644 --- a/stdlib/source/specification/lux/abstract/interval.lux +++ b/stdlib/source/specification/lux/abstract/interval.lux @@ -10,7 +10,7 @@ [\\library ["." /]]) -(def: #export (spec (^open "@//.") gen_sample) +(def: .public (spec (^open "@//.") gen_sample) (All [a] (-> (/.Interval a) (Random a) Test)) (<| (_.for [/.Interval]) (do random.monad diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux index 1a602b292..01395330f 100644 --- a/stdlib/source/specification/lux/abstract/monad.lux +++ b/stdlib/source/specification/lux/abstract/monad.lux @@ -47,7 +47,7 @@ (|> (injection sample) (_//map increase) _//join (_//map decrease) _//join) (|> (injection sample) (_//map (|>> increase (_//map decrease) _//join)) _//join))))) -(def: #export (spec injection comparison monad) +(def: .public (spec injection comparison monad) (All [f] (-> (Injection f) (Comparison f) (/.Monad f) Test)) (<| (_.for [/.Monad]) ($_ _.and diff --git a/stdlib/source/specification/lux/abstract/monoid.lux b/stdlib/source/specification/lux/abstract/monoid.lux index 592b98bb4..c8e4e4e6e 100644 --- a/stdlib/source/specification/lux/abstract/monoid.lux +++ b/stdlib/source/specification/lux/abstract/monoid.lux @@ -11,7 +11,7 @@ [// [equivalence (#+ Equivalence)]]]]) -(def: #export (spec (^open "\.") (^open "\.") gen_sample) +(def: .public (spec (^open "\.") (^open "\.") gen_sample) (All [a] (-> (Equivalence a) (/.Monoid a) (Random a) Test)) (do random.monad [sample gen_sample diff --git a/stdlib/source/specification/lux/abstract/order.lux b/stdlib/source/specification/lux/abstract/order.lux index 8d4844b2a..e8a022686 100644 --- a/stdlib/source/specification/lux/abstract/order.lux +++ b/stdlib/source/specification/lux/abstract/order.lux @@ -9,7 +9,7 @@ [\\library ["." /]]) -(def: #export (spec (^open "@//.") generator) +(def: .public (spec (^open "@//.") generator) (All [a] (-> (/.Order a) (Random a) Test)) (<| (_.for [/.Order]) ($_ _.and diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux index 154f8faca..ee4e47db6 100644 --- a/stdlib/source/specification/lux/world/console.lux +++ b/stdlib/source/specification/lux/world/console.lux @@ -17,7 +17,7 @@ [\\library ["." /]]) -(def: #export (spec console) +(def: .public (spec console) (-> (IO (/.Console Async)) Test) (do random.monad [message (random.ascii/alpha 10)] diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index 83bfc2465..b74a83fd6 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -323,7 +323,7 @@ post_dir/0 post_dir/1)))) -(def: #export (spec fs) +(def: .public (spec fs) (-> (IO (/.System Async)) Test) ($_ _.and (..for_path fs) diff --git a/stdlib/source/specification/lux/world/program.lux b/stdlib/source/specification/lux/world/program.lux index 091f41c2c..db3ffc36f 100644 --- a/stdlib/source/specification/lux/world/program.lux +++ b/stdlib/source/specification/lux/world/program.lux @@ -18,7 +18,7 @@ [\\library ["." /]]) -(def: #export (spec subject) +(def: .public (spec subject) (-> (/.Program Async) Test) (do random.monad [exit random.int] diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux index 16e0b6db8..6817d14be 100644 --- a/stdlib/source/specification/lux/world/shell.lux +++ b/stdlib/source/specification/lux/world/shell.lux @@ -66,7 +66,7 @@ true))))) (with_expansions [<shell_coverage> (as_is [/.Command /.Argument])] - (def: #export (spec shell) + (def: .public (spec shell) (-> (/.Shell Async) Test) (<| (_.for [/.Shell /.Process]) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index 9a55ccb59..da1941245 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -26,7 +26,7 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Artifact) (let [size 4] ($_ random.and @@ -34,7 +34,7 @@ (random.ascii/lower size) (random.ascii/lower size)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux index 132293d4f..93355ea60 100644 --- a/stdlib/source/test/aedifex/artifact/extension.lux +++ b/stdlib/source/test/aedifex/artifact/extension.lux @@ -18,7 +18,7 @@ ["/#" // #_ ["#" type]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Extension] diff --git a/stdlib/source/test/aedifex/artifact/snapshot.lux b/stdlib/source/test/aedifex/artifact/snapshot.lux index d8ececcd4..f196586ac 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot.lux @@ -20,12 +20,12 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Snapshot) (random.or (random\in []) $/stamp.random)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Snapshot] diff --git a/stdlib/source/test/aedifex/artifact/snapshot/build.lux b/stdlib/source/test/aedifex/artifact/snapshot/build.lux index 55bdc0a42..e613c2f92 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/build.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/build.lux @@ -15,11 +15,11 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Build) random.nat) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Build] diff --git a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux index deea0e954..2a2c19e4f 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux @@ -20,14 +20,14 @@ ["#." time] ["#." build]]) -(def: #export random +(def: .public random (Random /.Stamp) ($_ random.and $//time.random $//build.random )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Stamp]) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/time.lux b/stdlib/source/test/aedifex/artifact/snapshot/time.lux index 05e575e64..a658d3e29 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/time.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/time.lux @@ -17,11 +17,11 @@ ["$." /// #_ ["#." time]]) -(def: #export random +(def: .public random (Random /.Time) $///time.random) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Time]) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version.lux b/stdlib/source/test/aedifex/artifact/snapshot/version.lux index c63dc4f51..c5ec63398 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version.lux @@ -20,7 +20,7 @@ ["#." type] ["#." time]]) -(def: #export random +(def: .public random (Random /.Version) ($_ random.and $///type.random @@ -28,7 +28,7 @@ $///time.random )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Version]) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux index cfd8a7f17..ada815059 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux @@ -28,7 +28,7 @@ ["#." stamp] ["#." time]]]]) -(def: #export random +(def: .public random (Random /.Value) ($_ random.and (random.ascii/alpha 5) @@ -36,7 +36,7 @@ $///stamp.random) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Value]) diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux index 982d2b0f7..ed60f6389 100644 --- a/stdlib/source/test/aedifex/artifact/time.lux +++ b/stdlib/source/test/aedifex/artifact/time.lux @@ -22,14 +22,14 @@ ["#." date] ["#." time]]) -(def: #export random +(def: .public random (Random /.Time) (do random.monad [date /date.random time /time.random] (in [date time]))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Time]) diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index 5dd7156fc..e58ed00f9 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -22,7 +22,7 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Date) (random.one (function (_ raw) (try.maybe @@ -34,7 +34,7 @@ (/.date raw)))) random.date)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Date]) diff --git a/stdlib/source/test/aedifex/artifact/time/time.lux b/stdlib/source/test/aedifex/artifact/time/time.lux index 904e34aec..9358e7bab 100644 --- a/stdlib/source/test/aedifex/artifact/time/time.lux +++ b/stdlib/source/test/aedifex/artifact/time/time.lux @@ -17,12 +17,12 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Time) (random.one (|>> time.clock (set@ #time.milli_second 0) time.time) random.time)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Time]) diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux index b34db299c..be1fdfc80 100644 --- a/stdlib/source/test/aedifex/artifact/type.lux +++ b/stdlib/source/test/aedifex/artifact/type.lux @@ -16,7 +16,7 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Type) ($_ random.either ($_ random.either @@ -28,7 +28,7 @@ (random\in /.sha-1)) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Type] diff --git a/stdlib/source/test/aedifex/artifact/versioning.lux b/stdlib/source/test/aedifex/artifact/versioning.lux index 79d063123..5a0b2df20 100644 --- a/stdlib/source/test/aedifex/artifact/versioning.lux +++ b/stdlib/source/test/aedifex/artifact/versioning.lux @@ -19,7 +19,7 @@ ["#." snapshot ["#/." version]]]) -(def: #export random +(def: .public random (Random /.Versioning) ($_ random.and $//snapshot.random @@ -27,7 +27,7 @@ (random.list 5 $//snapshot/version.random) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Versioning]) diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 07d39f00f..44641af70 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -142,7 +142,7 @@ expected) actual))))))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 6c251b0a4..f59cf6619 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -98,7 +98,7 @@ (#try.Failure error) false))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Compilation /.Command] diff --git a/stdlib/source/test/aedifex/command.lux b/stdlib/source/test/aedifex/command.lux index fe760258b..8fbca7e56 100644 --- a/stdlib/source/test/aedifex/command.lux +++ b/stdlib/source/test/aedifex/command.lux @@ -18,7 +18,7 @@ [\\program ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Command]) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index a5b598b11..6a7ef98ab 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -63,7 +63,7 @@ dummy_file)] (in [shell.normal []])))))])) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index be7c8b55e..b5e796c2d 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -37,7 +37,7 @@ ["#." dependency (#+ Dependency) ["#/." resolution (#+ Resolution)]]]]]) -(def: #export good_shell +(def: .public good_shell (-> Any (Shell IO)) (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) @@ -55,7 +55,7 @@ (def: (on_await state) (#try.Success [state shell.normal])))))))) -(def: #export bad_shell +(def: .public bad_shell (-> Any (Shell IO)) (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) @@ -73,7 +73,7 @@ (def: (on_await state) (#try.Success [state shell.error])))))))) -(def: #export (reader_shell error?) +(def: .public (reader_shell error?) (-> Bit (-> (List Text) (Shell IO))) (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) @@ -127,7 +127,7 @@ [/.ruby_compiler_name] )))))) -(def: #export resolution +(def: .public resolution (Random [Dependency Resolution]) (do random.monad [dependency ..compiler @@ -136,7 +136,7 @@ (|> ///dependency/resolution.empty (dictionary.put dependency package))]))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 523cf6ccc..fffef3033 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -80,7 +80,7 @@ (in (and directory_exists? (list.every? (|>>) files_exist?))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index d315c646c..4bdbafd59 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -59,7 +59,7 @@ _ (/.do! console repository fs artifact profile)] (\ console read_line []))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 0d816ec02..0698899da 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -52,7 +52,7 @@ ["#/." origin] ["#/." local]]]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index ed0a3a7d3..0ca484196 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -39,7 +39,7 @@ ["#." repository #_ ["#/." local]]]]]]) -(def: #export (make_sources! fs sources) +(def: .public (make_sources! fs sources) (-> (file.System Async) (Set file.Path) (Action (List Any))) (let [/ (\ fs separator) ! ///action.monad] @@ -60,7 +60,7 @@ _ (/.do! console fs (///repository/local.repository program fs) sample)] (\ console read_line []))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 54a365468..9577842c1 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -30,7 +30,7 @@ ["#." action] ["#." pom]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index 52c167ee9..f2117fad4 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -39,7 +39,7 @@ ["#." dependency ["#/." resolution]]]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index aaf320c60..f1c424289 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -28,7 +28,7 @@ [\\program ["." /]]) -(exception: #export console_is_closed!) +(exception: .public console_is_closed!) (implementation: mock (Mock [Bit Text]) @@ -57,13 +57,13 @@ (#try.Success [false buffer]) (exception.except ..console_is_closed! [])))) -(def: #export echo +(def: .public echo (-> Text (Console Async)) (|>> [true] (console.mock ..mock) console.async)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/aedifex/dependency.lux b/stdlib/source/test/aedifex/dependency.lux index 733e15710..86d951f99 100644 --- a/stdlib/source/test/aedifex/dependency.lux +++ b/stdlib/source/test/aedifex/dependency.lux @@ -15,13 +15,13 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Dependency) ($_ random.and @artifact.random (random.ascii/alpha 1))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Dependency] diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 8c1e2e61a..ec2ecad3d 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -143,7 +143,7 @@ artifact/type.lux_library])]] (in [dependency artifact package]))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 89e16691d..01b57eb62 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -86,7 +86,7 @@ (\ ///hash.md5_codec encode) (\ utf8.codec encode))) -(def: #export nope +(def: .public nope (Mock Any) (implementation (def: the_description @@ -96,7 +96,7 @@ (def: (on_upload uri binary state) (#try.Failure "NOPE")))) -(def: #export (single artifact package) +(def: .public (single artifact package) (-> Artifact Package (Mock Any)) (let [expected (///artifact.uri (get@ #///artifact.version artifact) artifact)] (implementation @@ -427,7 +427,7 @@ (not (dictionary.key? resolution ignored)))))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Resolution]) diff --git a/stdlib/source/test/aedifex/dependency/status.lux b/stdlib/source/test/aedifex/dependency/status.lux index 5b446d643..aad21027d 100644 --- a/stdlib/source/test/aedifex/dependency/status.lux +++ b/stdlib/source/test/aedifex/dependency/status.lux @@ -18,7 +18,7 @@ ["//#" /// #_ ["#." hash]]]]) -(def: #export random +(def: .public random (Random /.Status) ($_ random.or (random\in []) @@ -28,7 +28,7 @@ ($///hash.random ///hash.md5)) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Status] diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux index 524110c35..dc5633040 100644 --- a/stdlib/source/test/aedifex/hash.lux +++ b/stdlib/source/test/aedifex/hash.lux @@ -25,7 +25,7 @@ [data ["_." binary]]]]) -(def: #export (random hash) +(def: .public (random hash) (All [h] (-> (-> Binary (/.Hash h)) (Random (/.Hash h)))) @@ -33,7 +33,7 @@ [size (\ ! map (n.% 100) random.nat)] (\ ! map hash (_binary.random size)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Hash /.SHA-1 /.MD5]) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index 4b2ee9ea2..168d378d4 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -41,7 +41,7 @@ (-> (Set Address) (Set Address)) (set.add //.default_repository)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/local.lux b/stdlib/source/test/aedifex/local.lux index bd78c3464..a797f2a97 100644 --- a/stdlib/source/test/aedifex/local.lux +++ b/stdlib/source/test/aedifex/local.lux @@ -15,7 +15,7 @@ ["/#" // #_ ["#." artifact]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/metadata.lux b/stdlib/source/test/aedifex/metadata.lux index d4e6e816c..a19f6dfa7 100644 --- a/stdlib/source/test/aedifex/metadata.lux +++ b/stdlib/source/test/aedifex/metadata.lux @@ -16,7 +16,7 @@ [\\program ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 95897c212..2e6a8e10f 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -41,7 +41,7 @@ ["#." repository #_ ["#/." local]]]]]]) -(def: #export random +(def: .public random (Random /.Metadata) ($_ random.and (random.ascii/alpha 5) @@ -66,7 +66,7 @@ #time.milli_second 0})] (in (instant.of_date_time date time)))))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Metadata]) diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 4dd751639..7b375d42c 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -78,14 +78,14 @@ (random.list 5 $///artifact/snapshot/version.random) )) -(def: #export random +(def: .public random (Random /.Metadata) ($_ random.and $///artifact.random ..random_versioning )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Metadata]) diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index 9c6adfcf2..e05dc712f 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -40,7 +40,7 @@ [repository ["#." origin]]]]]) -(def: #export random +(def: .public random (Random [//.Profile /.Package]) (do {! random.monad} [content_size (\ ! map (n.% 100) random.nat) @@ -53,7 +53,7 @@ $profile.random)] (in [profile (/.local pom content)]))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Package]) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 360c30a4a..4c882ea4a 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -114,7 +114,7 @@ (#try.Failure error) false))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.covering //format._) diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux index 01b90c33e..657c6192d 100644 --- a/stdlib/source/test/aedifex/pom.lux +++ b/stdlib/source/test/aedifex/pom.lux @@ -22,7 +22,7 @@ ["/#" // #_ ["#" profile]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 755c0e13a..857aaf6e1 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -117,7 +117,7 @@ (Random /.Target) (random.ascii/alpha 1)) -(def: #export random +(def: .public random (Random /.Profile) ($_ random.and (..list_of ..name) @@ -138,7 +138,7 @@ (random\in //runtime.default_ruby) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Distribution /.License /.SCM /.Organization diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 809bea253..3d027eec7 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -30,13 +30,13 @@ (random\map (set@ #//.parents (list))) (random.and (random.ascii/alpha 1)))) -(def: #export random +(def: .public random (Random /.Project) (do random.monad [[name profile] ..profile] (in (/.project name profile)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Project /.project] diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index 88efb42fe..eead05e89 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -53,7 +53,7 @@ (type: Store (Dictionary URI Binary)) -(def: #export empty +(def: .public empty Store (dictionary.empty text.hash)) @@ -65,7 +65,7 @@ Version "4.5.6-NO") -(implementation: #export mock +(implementation: .public mock (/.Mock Store) (def: the_description @@ -84,7 +84,7 @@ (exception.except ..cannot_upload [uri]) (exception.return (dictionary.put uri content state))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/aedifex/repository/identity.lux b/stdlib/source/test/aedifex/repository/identity.lux index e19acde36..6158d2397 100644 --- a/stdlib/source/test/aedifex/repository/identity.lux +++ b/stdlib/source/test/aedifex/repository/identity.lux @@ -10,14 +10,14 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Identity) ($_ random.and (random.ascii/alpha 10) (random.ascii/alpha 10) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.User /.Password /.Identity] diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index a63f4c256..b2352bdd2 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -23,7 +23,7 @@ [\\program ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/repository/origin.lux b/stdlib/source/test/aedifex/repository/origin.lux index daf8e8667..80c2946bc 100644 --- a/stdlib/source/test/aedifex/repository/origin.lux +++ b/stdlib/source/test/aedifex/repository/origin.lux @@ -10,14 +10,14 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Origin) ($_ random.or (random.ascii/alpha 10) (random.ascii/alpha 10) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Origin] diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux index cad0fe873..0ff764bdd 100644 --- a/stdlib/source/test/aedifex/repository/remote.lux +++ b/stdlib/source/test/aedifex/repository/remote.lux @@ -80,7 +80,7 @@ {#@http.headers (http.headers (list)) #@http.body (..url_body "")}])))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux index bd87377bc..7508239ad 100644 --- a/stdlib/source/test/aedifex/runtime.lux +++ b/stdlib/source/test/aedifex/runtime.lux @@ -19,7 +19,7 @@ [\\program ["." /]]) -(def: #export random +(def: .public random (Random /.Runtime) ($_ random.either (random\in /.default_java) @@ -29,7 +29,7 @@ (random\in /.default_ruby) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Runtime]) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 9d5f719ed..925894d7b 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -59,10 +59,10 @@ ## TODO: Get rid of this ASAP (template: (!bundle body) - (: Test - (do random.monad - [_ (in [])] - body))) + [(: Test + (do random.monad + [_ (in [])] + body))]) (def: sub_tests Test @@ -580,7 +580,7 @@ (actual [expected_left expected_right]))))))) (/.template: (!n/+ <left> <right>) - (n.+ <left> <right>)) + [(n.+ <left> <right>)]) (def: for_template Test @@ -1091,6 +1091,16 @@ (for_meta|Module_State)) )) +(def: for_export + Test + ($_ _.and + (_.cover [/.public /.private] + (and /.public (not /.private))) + (_.cover [/.global /.local] + (and (bit\= /.public /.global) + (bit\= /.private /.local))) + )) + (def: test Test (<| (_.covering /._) @@ -1117,6 +1127,7 @@ ..for_def: ..for_import ..for_meta + ..for_export ..sub_tests ))) diff --git a/stdlib/source/test/lux/abstract.lux b/stdlib/source/test/lux/abstract.lux index e8368434b..cb41844eb 100644 --- a/stdlib/source/test/lux/abstract.lux +++ b/stdlib/source/test/lux/abstract.lux @@ -41,7 +41,7 @@ /comonad/cofree.test )) -(def: #export test +(def: .public test Test ($_ _.and /apply.test diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux index 01fe8375f..7a940adb3 100644 --- a/stdlib/source/test/lux/abstract/apply.lux +++ b/stdlib/source/test/lux/abstract/apply.lux @@ -15,7 +15,7 @@ [\\library ["." / (#+ Apply)]]) -(def: #export test +(def: .public test Test (do random.monad [left random.nat diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux index 00452c205..debc5c17c 100644 --- a/stdlib/source/test/lux/abstract/codec.lux +++ b/stdlib/source/test/lux/abstract/codec.lux @@ -33,7 +33,7 @@ (Codec Text Bit) (/.compose json.codec ..json)) -(def: #export test +(def: .public test Test (do random.monad [expected random.bit] diff --git a/stdlib/source/test/lux/abstract/comonad.lux b/stdlib/source/test/lux/abstract/comonad.lux index eb50c0f53..431272d9f 100644 --- a/stdlib/source/test/lux/abstract/comonad.lux +++ b/stdlib/source/test/lux/abstract/comonad.lux @@ -13,7 +13,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (do random.monad [sample random.nat] diff --git a/stdlib/source/test/lux/abstract/comonad/cofree.lux b/stdlib/source/test/lux/abstract/comonad/cofree.lux index ecb90c77c..531510a04 100644 --- a/stdlib/source/test/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/test/lux/abstract/comonad/cofree.lux @@ -37,7 +37,7 @@ (sequence.take 100 (..interpret left)) (sequence.take 100 (..interpret right))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.CoFree]) diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 7eb4149a1..8de8d659f 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -16,7 +16,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (let [limit (: (Random Nat) (\ random.monad map (n.% 20) random.nat))] diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index bdf24150d..89fa542a1 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -17,7 +17,7 @@ [\\library ["." / (#+ Equivalence)]]) -(def: #export test +(def: .public test Test (do random.monad [leftN random.nat diff --git a/stdlib/source/test/lux/abstract/fold.lux b/stdlib/source/test/lux/abstract/fold.lux index a07a19870..1dbf9eec8 100644 --- a/stdlib/source/test/lux/abstract/fold.lux +++ b/stdlib/source/test/lux/abstract/fold.lux @@ -14,7 +14,7 @@ [\\library ["." / (#+ Fold)]]) -(def: #export test +(def: .public test Test (do random.monad [samples (random.list 10 random.nat)] diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux index 63b0ad2d7..178f33273 100644 --- a/stdlib/source/test/lux/abstract/functor.lux +++ b/stdlib/source/test/lux/abstract/functor.lux @@ -15,7 +15,7 @@ [\\library ["." / (#+ Functor)]]) -(def: #export test +(def: .public test Test (do random.monad [left random.nat diff --git a/stdlib/source/test/lux/abstract/functor/contravariant.lux b/stdlib/source/test/lux/abstract/functor/contravariant.lux index 6a07cb0c5..26d7032a2 100644 --- a/stdlib/source/test/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/test/lux/abstract/functor/contravariant.lux @@ -5,7 +5,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.in_parallel (list)))) diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux index eecb43227..4d5fa9eaf 100644 --- a/stdlib/source/test/lux/abstract/hash.lux +++ b/stdlib/source/test/lux/abstract/hash.lux @@ -18,7 +18,7 @@ [// [equivalence (#+ Equivalence)]]]]) -(def: #export test +(def: .public test Test (do random.monad [leftN random.nat diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 40c78df27..2b588f309 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -21,7 +21,7 @@ ["." / (#+ Interval) ("\." equivalence)]]) (template [<name> <cmp>] - [(def: #export <name> + [(def: .public <name> (Random (Interval Nat)) (do random.monad [bottom random.nat @@ -35,13 +35,13 @@ [outer n.>] ) -(def: #export singleton +(def: .public singleton (Random (Interval Nat)) (do random.monad [point random.nat] (in (/.singleton n.enum point)))) -(def: #export interval +(def: .public interval (Random (Interval Nat)) ($_ random.either ..inner @@ -244,7 +244,7 @@ (/.overlaps? outer right_inner)))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index 02264e013..0fc605a0c 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -13,7 +13,7 @@ [\\library ["." / (#+ Monad do)]]) -(def: #export test +(def: .public test Test (do random.monad [mono random.nat diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index 2a5a562f2..ee696a14b 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -40,7 +40,7 @@ (..interpret left) (..interpret right)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Free]) diff --git a/stdlib/source/test/lux/abstract/monoid.lux b/stdlib/source/test/lux/abstract/monoid.lux index 876ac1f46..98c33068a 100644 --- a/stdlib/source/test/lux/abstract/monoid.lux +++ b/stdlib/source/test/lux/abstract/monoid.lux @@ -14,7 +14,7 @@ [// [equivalence (#+ Equivalence)]]]]) -(def: #export test +(def: .public test Test (do random.monad [natL random.nat diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index 1f84914f3..564b731e8 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -18,7 +18,7 @@ [// [equivalence (#+ Equivalence)]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index f0c7ffbbd..b3521ca3c 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -28,7 +28,7 @@ 0 (function.constant false) _ (|>> (n.% factor) (n.= 0)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control.lux b/stdlib/source/test/lux/control.lux index a4bb2c5f2..4ac09ca39 100644 --- a/stdlib/source/test/lux/control.lux +++ b/stdlib/source/test/lux/control.lux @@ -48,7 +48,7 @@ /capability.test )) -(def: #export test +(def: .public test Test ($_ _.and /concatenative.test diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 4f2774e2b..deb5601a7 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -93,30 +93,30 @@ )))) (template: (!numerical <=> <generator> <only> <arithmetic> <order>) - (: Test - (with_expansions [<arithmetic>' (template.spliced <arithmetic>) - <order>' (template.spliced <order>)] - (do random.monad - [parameter (|> <generator> (random.only <only>)) - subject <generator>] - (`` ($_ _.and - (~~ (template [<concatenative> <functional>] - [(_.cover [<concatenative>] - (<=> (<functional> parameter subject) - (||> (/.push subject) - (/.push parameter) - <concatenative>)))] + [(: Test + (with_expansions [<arithmetic>' (template.spliced <arithmetic>) + <order>' (template.spliced <order>)] + (do random.monad + [parameter (|> <generator> (random.only <only>)) + subject <generator>] + (`` ($_ _.and + (~~ (template [<concatenative> <functional>] + [(_.cover [<concatenative>] + (<=> (<functional> parameter subject) + (||> (/.push subject) + (/.push parameter) + <concatenative>)))] - <arithmetic>')) - (~~ (template [<concatenative> <functional>] - [(_.cover [<concatenative>] - (bit\= (<functional> parameter subject) - (||> (/.push subject) - (/.push parameter) - <concatenative>)))] + <arithmetic>')) + (~~ (template [<concatenative> <functional>] + [(_.cover [<concatenative>] + (bit\= (<functional> parameter subject) + (||> (/.push subject) + (/.push parameter) + <concatenative>)))] - <order>')) - )))))) + <order>')) + )))))]) (def: numerical Test @@ -306,7 +306,7 @@ (||> (/.push sample) ..square))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 95566db38..618271a6e 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -28,6 +28,8 @@ (exception: got_wrecked) (actor: counter + {} + Nat ((on_mail message state self) @@ -45,7 +47,7 @@ (#try.Success _) true (#try.Failure _) false)) -(def: #export test +(def: .public test Test (do {! random.monad} [initial_state random.nat diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 063d3a9e0..b16aa0bf2 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -50,7 +50,7 @@ (i64.left_shifted 4 1)} (i64.left_shifted 3 1))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux index 49947d2d6..aec2d56d9 100644 --- a/stdlib/source/test/lux/control/concurrency/atom.lux +++ b/stdlib/source/test/lux/control/concurrency/atom.lux @@ -13,7 +13,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index f4705f140..ecb6d7c93 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -62,7 +62,7 @@ (\ ! map (|>> (#.Item head)) (take_amount (dec amount_of_polls) [channel sink])))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (let [(^open "list\.") (list.equivalence n.equivalence)] diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 60bd31050..33c5e1da1 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -177,7 +177,7 @@ expected_ids)))))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 62d912f66..79880064e 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -35,7 +35,7 @@ (== (product.right (left (list))) (product.right (right (list)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux index 28d751292..182a05908 100644 --- a/stdlib/source/test/lux/control/concurrency/thread.lux +++ b/stdlib/source/test/lux/control/concurrency/thread.lux @@ -20,7 +20,7 @@ ["." atom (#+ Atom)] ["." async]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index 1e960d947..6635d84b6 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -27,7 +27,7 @@ (function (_ == left right) (== (/.run left) (/.run right)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index b0a957c21..13bde092b 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -23,7 +23,7 @@ (exception: (custom_exception {value Nat}) (/.report [label (%.nat value)])) -(def: #export test +(def: .public test Test (do {! random.monad} [expected random.nat diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux index def4945cb..b65995923 100644 --- a/stdlib/source/test/lux/control/function.lux +++ b/stdlib/source/test/lux/control/function.lux @@ -21,7 +21,7 @@ ["#." mixin] ["#." mutual]]) -(def: #export test +(def: .public test Test (do {! random.monad} [expected random.nat diff --git a/stdlib/source/test/lux/control/function/contract.lux b/stdlib/source/test/lux/control/function/contract.lux index 81840fd08..436ba2282 100644 --- a/stdlib/source/test/lux/control/function/contract.lux +++ b/stdlib/source/test/lux/control/function/contract.lux @@ -13,7 +13,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index d6765a1f1..11e1b876c 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -54,7 +54,7 @@ Nat (i64.left_shifted 4 1)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 3d8299929..5cd283eaa 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -21,7 +21,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/function/mutual.lux b/stdlib/source/test/lux/control/function/mutual.lux index 71248a1ee..5aeb9be71 100644 --- a/stdlib/source/test/lux/control/function/mutual.lux +++ b/stdlib/source/test/lux/control/function/mutual.lux @@ -57,7 +57,7 @@ (and (bit\= expected (..even? sample)) (bit\= (not expected) (..odd? sample)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/control/io.lux b/stdlib/source/test/lux/control/io.lux index 05642a19f..43d891a61 100644 --- a/stdlib/source/test/lux/control/io.lux +++ b/stdlib/source/test/lux/control/io.lux @@ -26,7 +26,7 @@ (function (_ == left right) (== (/.run left) (/.run right)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.IO]) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index c222cee77..7b183db51 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -343,7 +343,7 @@ _ false))) -(def: #export test +(def: .public test Test (do random.monad [expected random.nat diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux index b16045572..8b7f6405f 100644 --- a/stdlib/source/test/lux/control/parser/analysis.lux +++ b/stdlib/source/test/lux/control/parser/analysis.lux @@ -33,19 +33,19 @@ ["." /]]) (template: (!expect <expectation> <computation>) - (case <computation> - <expectation> - true + [(case <computation> + <expectation> + true - _ - false)) + _ + false)]) (def: constant (Random Constant) (random.and (random.unicode 10) (random.unicode 10))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index c494562bc..bbba888a7 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -42,12 +42,12 @@ ["." /]]) (template: (!expect <expectation> <computation>) - (case <computation> - <expectation> - true + [(case <computation> + <expectation> + true - _ - false)) + _ + false)]) (def: segment_size 10) @@ -318,7 +318,7 @@ actual)))))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index 4f8d6d08f..33476e15a 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -19,14 +19,14 @@ ["." /]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index a9adeb507..d2168122a 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -27,19 +27,19 @@ ["." /]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) (def: random_name (Random Name) (random.and (random.unicode 1) (random.unicode 1))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/environment.lux b/stdlib/source/test/lux/control/parser/environment.lux index 756fa38be..215213e59 100644 --- a/stdlib/source/test/lux/control/parser/environment.lux +++ b/stdlib/source/test/lux/control/parser/environment.lux @@ -19,7 +19,7 @@ ["." / ["/#" // ("#\." monad)]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Environment /.Parser]) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index e3a7189df..3a77b3c3e 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -29,18 +29,18 @@ ["." /]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) (def: safe_frac (Random Frac) (random.only (|>> frac.not_a_number? not) random.frac)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index cd617ff8d..753091e27 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -33,12 +33,12 @@ ["." /]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) (def: random_constant (Random Name) @@ -158,7 +158,7 @@ (exception.match? /.cannot_parse error))))))) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 97c76f0f5..878b82fa9 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -32,12 +32,12 @@ ["<c>" code]]]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) (def: (should_fail' sample parser exception) (All [a e] (-> Text (/.Parser a) (Exception e) Bit)) @@ -291,7 +291,7 @@ (..should_fail (format first) (/.between! 2 1 octal!))))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux index 25f6c350c..0d1cc090e 100644 --- a/stdlib/source/test/lux/control/parser/tree.lux +++ b/stdlib/source/test/lux/control/parser/tree.lux @@ -20,36 +20,36 @@ ["/#" //]]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) (template: (!cover <coverage> <parser> <sample>) - (do {! random.monad} - [dummy random.nat - expected (|> random.nat (random.only (|>> (n.= dummy) not)))] - (_.cover <coverage> - (|> (/.run <parser> - <sample>) - (!expect (^multi (#try.Success actual) - (n.= expected actual))))))) + [(do {! random.monad} + [dummy random.nat + expected (|> random.nat (random.only (|>> (n.= dummy) not)))] + (_.cover <coverage> + (|> (/.run <parser> + <sample>) + (!expect (^multi (#try.Success actual) + (n.= expected actual))))))]) (template: (!cover/2 <coverage> <parser> <sample0> <sample1>) - (do {! random.monad} - [dummy random.nat - expected (|> random.nat (random.only (|>> (n.= dummy) not)))] - (_.cover <coverage> - (and (|> (/.run <parser> <sample0>) - (!expect (^multi (#try.Success actual) - (n.= expected actual)))) - (|> (/.run <parser> <sample1>) - (!expect (^multi (#try.Success actual) - (n.= expected actual)))))))) + [(do {! random.monad} + [dummy random.nat + expected (|> random.nat (random.only (|>> (n.= dummy) not)))] + (_.cover <coverage> + (and (|> (/.run <parser> <sample0>) + (!expect (^multi (#try.Success actual) + (n.= expected actual)))) + (|> (/.run <parser> <sample1>) + (!expect (^multi (#try.Success actual) + (n.= expected actual)))))))]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index c4c1ed0fa..971ccd5db 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -21,12 +21,12 @@ ["/#" //]]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) (def: primitive (Random Type) @@ -185,7 +185,7 @@ (is? not_polymorphic bodyT)))))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index ac3432fee..6269cafd5 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -27,24 +27,24 @@ ["/#" // ("#\." monad)]]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> - true - - _ - false)) + [(case <value> + <pattern> + true + + _ + false)]) (template: (!failure <exception> <cases>) - (with_expansions [<<cases>> (template.spliced <cases>)] - (do {! random.monad} - [expected (random.ascii/alpha 1)] - (_.cover [<exception>] - (`` (and (~~ (template [<parser> <input>] - [(|> (/.run <parser> (list <input>)) - (!expect (^multi (#try.Failure error) - (exception.match? <exception> error))))] + [(with_expansions [<<cases>> (template.spliced <cases>)] + (do {! random.monad} + [expected (random.ascii/alpha 1)] + (_.cover [<exception>] + (`` (and (~~ (template [<parser> <input>] + [(|> (/.run <parser> (list <input>)) + (!expect (^multi (#try.Failure error) + (exception.match? <exception> error))))] - <<cases>>)))))))) + <<cases>>)))))))]) (def: random_label (Random Name) @@ -54,7 +54,7 @@ (def: random_tag ..random_label) (def: random_attribute ..random_label) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Parser]) diff --git a/stdlib/source/test/lux/control/pipe.lux b/stdlib/source/test/lux/control/pipe.lux index e38fafba4..27e92a7e0 100644 --- a/stdlib/source/test/lux/control/pipe.lux +++ b/stdlib/source/test/lux/control/pipe.lux @@ -16,7 +16,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index 833399ba7..08d5d82b2 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -27,7 +27,7 @@ (function (_ == left right) (== (/.run [] left) (/.run [] right)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Reader]) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 3e2bc2610..477f42a47 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -76,7 +76,7 @@ _ false))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Region]) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 098ecaa28..24e483420 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -104,7 +104,7 @@ false) ))))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux index 6e2e5cd77..8c0a42952 100644 --- a/stdlib/source/test/lux/control/security/capability.lux +++ b/stdlib/source/test/lux/control/security/capability.lux @@ -21,7 +21,7 @@ (/.capability: Can_IO (can_io [] (IO Nat))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index e1cae710a..5c2f1bf67 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -66,7 +66,7 @@ (def: privilege privilege)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Policy diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index 6c4bf6dc7..d7555e7aa 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -121,7 +121,7 @@ (n.= (n.+ left right) output'))))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/control/thread.lux b/stdlib/source/test/lux/control/thread.lux index b7af2183f..e396a613f 100644 --- a/stdlib/source/test/lux/control/thread.lux +++ b/stdlib/source/test/lux/control/thread.lux @@ -26,7 +26,7 @@ (function (_ == left right) (== (/.run left) (/.run right)))) -(def: #export test +(def: .public test Test (do random.monad [sample random.nat diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 7715dc434..0e2fa479e 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -30,13 +30,13 @@ (function (_ ==) (\ (/.equivalence ==) =))) -(def: #export (attempt element) +(def: .public (attempt element) (All [a] (-> (Random a) (Random (Try a)))) ($_ random.or (random.unicode 1) element)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Try]) diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux index ddf6ecc00..de65f2d47 100644 --- a/stdlib/source/test/lux/control/writer.lux +++ b/stdlib/source/test/lux/control/writer.lux @@ -31,7 +31,7 @@ (function (_ == [_ left] [_ right]) (== left right))) -(def: #export test +(def: .public test Test (do random.monad [log (random.ascii 1) diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index 8f07c3ad5..d350cabf9 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -27,10 +27,10 @@ ## TODO: Get rid of this ASAP (template: (!bundle body) - (: Test - (do random.monad - [_ (in [])] - body))) + [(: Test + (do random.monad + [_ (in [])] + body))]) (def: format Test @@ -64,7 +64,7 @@ /sum.test /text.test)) -(def: #export test +(def: .public test Test ## TODO: Inline ASAP ($_ _.and diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 7b5f5fab0..3326d0055 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -31,7 +31,7 @@ (#try.Success output) output)) -(def: #export (random size) +(def: .public (random size) (-> Nat (Random Binary)) (let [output (/.create size)] (loop [idx 0] @@ -75,7 +75,7 @@ (#.Item head tail)) (list))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/data/bit.lux b/stdlib/source/test/lux/data/bit.lux index bffa5b808..58fe69ca7 100644 --- a/stdlib/source/test/lux/data/bit.lux +++ b/stdlib/source/test/lux/data/bit.lux @@ -16,7 +16,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/data/collection.lux b/stdlib/source/test/lux/data/collection.lux index b30d8181f..0c1e1932f 100644 --- a/stdlib/source/test/lux/data/collection.lux +++ b/stdlib/source/test/lux/data/collection.lux @@ -52,7 +52,7 @@ /tree/zipper.test )) -(def: #export test +(def: .public test Test ($_ _.and /array.test diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index dc8527fdc..9925fccec 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -88,7 +88,7 @@ (/.any? n.even? the_array))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Array]) diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux index 402f52379..da4a759e5 100644 --- a/stdlib/source/test/lux/data/collection/bits.lux +++ b/stdlib/source/test/lux/data/collection/bits.lux @@ -19,7 +19,7 @@ (|> random.nat (\ random.monad map (|>> (n.% (inc max)) (n.max min))))) -(def: #export random +(def: .public random (Random Bits) (do {! random.monad} [size (\ ! map (n.% 1,000) random.nat)] @@ -29,7 +29,7 @@ [idx (|> random.nat (\ ! map (n.% size)))] (in (/.set idx /.empty)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Bits]) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index fe04241a1..aafa848b4 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -248,7 +248,7 @@ (maybe.assume (/.get non_key rebound))))))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Dictionary]) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index fb57cd70e..13971ad88 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -22,7 +22,7 @@ [\\library ["." /]]) -(def: #export (dictionary order gen_key gen_value size) +(def: .public (dictionary order gen_key gen_value size) (All [k v] (-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v)))) (case size @@ -37,7 +37,7 @@ value gen_value] (in (/.put key value partial))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Dictionary]) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index 316d7c7ce..fdbcccc06 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -20,7 +20,7 @@ [\\library ["." /]]) -(def: #export (random size gen_key gen_value) +(def: .public (random size gen_key gen_value) (All [v] (-> Nat (Random Text) (Random v) (Random (/.PList v)))) (do random.monad @@ -28,7 +28,7 @@ values (random.list size gen_value)] (in (list.zipped/2 (set.list keys) values)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.PList]) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index a0c6fc685..ee6b9e7cb 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -389,7 +389,7 @@ (not (/.any? n.even? sample)))) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.List]) diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index 36f6ef9a4..33ec7d9ba 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -23,7 +23,7 @@ (Injection /.Queue) (|>> list /.of_list)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Queue]) diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index 07eff44ac..42ec9677e 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -14,7 +14,7 @@ [\\library ["." / (#+ Queue)]]) -(def: #export (random size) +(def: .public (random size) (-> Nat (Random (Queue Nat))) (do {! random.monad} [inputs (random.list size random.nat)] @@ -25,7 +25,7 @@ /.empty inputs))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Queue]) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 343442e91..c57711e8e 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -129,7 +129,7 @@ )) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Row]) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index a5ba1f1bc..c94b19ac6 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -29,7 +29,7 @@ (/.take 100 reference) (/.take 100 subject)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Sequence]) diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index df0c653b9..18e0a03f0 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -25,7 +25,7 @@ (\ random.monad map (n.% 100) random.nat)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Set]) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 37645cbed..888ea2623 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -25,7 +25,7 @@ (Random Nat) (\ random.monad map (|>> (n.% 10) inc) random.nat)) -(def: #export (random size hash count element) +(def: .public (random size hash count element) (All [a] (-> Nat (Hash a) (Random Nat) (Random a) (Random (/.Set a)))) (do {! random.monad} [elements (random.set hash size element) @@ -108,7 +108,7 @@ common_changes!))) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Set]) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 620a63289..260d6ee39 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -23,7 +23,7 @@ (random.Random Nat) (\ random.monad map (n.% 100) random.nat)) -(def: #export (random size &order gen_value) +(def: .public (random size &order gen_value) (All [a] (-> Nat (Order a) (Random a) (Random (Set a)))) (case size 0 @@ -36,7 +36,7 @@ gen_value)] (in (/.add value partial))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Set]) diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index 6340c6fbd..082609904 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -21,7 +21,7 @@ (Injection /.Stack) (/.push value /.empty)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Stack]) diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index ea58f8f72..986ef566e 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -19,7 +19,7 @@ [\\library ["." / (#+ Tree)]]) -(def: #export (tree gen_value) +(def: .public (tree gen_value) (All [a] (-> (Random a) (Random [Nat (Tree a)]))) (do {! random.monad} [value gen_value @@ -31,7 +31,7 @@ {#/.value value #/.children (list\map product.right children)}]))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Tree]) diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index be46b8249..79140887d 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -27,7 +27,7 @@ @)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Tree]) diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index 756318c0b..60c18d514 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -151,7 +151,7 @@ (maybe.else false)))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Zipper]) diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index 990eb6aea..a4fc0911e 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -23,7 +23,7 @@ [\\library ["." /]]) -(def: #export random +(def: .public random (Random /.Color) (|> ($_ random.and random.nat random.nat random.nat) (\ random.monad map /.of_rgb))) @@ -176,7 +176,7 @@ [/.tetradic])) ))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Color]) diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index 11c699932..7f8c959b9 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -224,7 +224,7 @@ <colors>) - (def: #export test + (def: .public test Test (<| (_.covering /._) (`` ($_ _.and diff --git a/stdlib/source/test/lux/data/format/binary.lux b/stdlib/source/test/lux/data/format/binary.lux index 547f90f63..107d95714 100644 --- a/stdlib/source/test/lux/data/format/binary.lux +++ b/stdlib/source/test/lux/data/format/binary.lux @@ -25,7 +25,7 @@ (Random /.Specification) (\ random.monad map /.nat random.nat)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Mutation /.Specification /.Writer]) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 1c4469df2..6ff253a73 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -31,7 +31,7 @@ [\\library ["." / (#+ JSON) ("\." equivalence)]]) -(def: #export random +(def: .public random (Random /.JSON) (random.rec (function (_ recur) @@ -61,7 +61,7 @@ [value (macro.gensym "string")] (in (list (code.text (%.code value)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.JSON]) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 34618433b..4ccec923b 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -391,7 +391,7 @@ (try.else false))) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Tar]) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 1fec8a797..3ec5618a3 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -55,7 +55,7 @@ (random.and (..text 0 10) (..text 1 10))) -(def: #export random +(def: .public random (Random XML) (random.rec (function (_ random) (random.or (..text 1 10) @@ -66,7 +66,7 @@ (random.dictionary name.hash size ..identifier (..text 0 10)) (random.list size random))))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.XML]) diff --git a/stdlib/source/test/lux/data/identity.lux b/stdlib/source/test/lux/data/identity.lux index 030d441b1..f9a4e3a76 100644 --- a/stdlib/source/test/lux/data/identity.lux +++ b/stdlib/source/test/lux/data/identity.lux @@ -21,7 +21,7 @@ (function (_ ==) ==)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Identity]) diff --git a/stdlib/source/test/lux/data/lazy.lux b/stdlib/source/test/lux/data/lazy.lux index c30fd3692..c9de9cb25 100644 --- a/stdlib/source/test/lux/data/lazy.lux +++ b/stdlib/source/test/lux/data/lazy.lux @@ -27,11 +27,11 @@ (function (_ ==) (\ (/.equivalence ==) =))) -(def: #export lazy +(def: .public lazy (All [a] (-> (Random a) (Random (Lazy a)))) (\ random.functor map (|>> /.lazy))) -(def: #export test +(def: .public test Test (with_expansions [<eager> (: [Nat Nat] [(n.+ left right) diff --git a/stdlib/source/test/lux/data/maybe.lux b/stdlib/source/test/lux/data/maybe.lux index 65d405473..dd32c20db 100644 --- a/stdlib/source/test/lux/data/maybe.lux +++ b/stdlib/source/test/lux/data/maybe.lux @@ -25,7 +25,7 @@ [\\library ["." / ("#\." monoid monad)]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Maybe]) diff --git a/stdlib/source/test/lux/data/name.lux b/stdlib/source/test/lux/data/name.lux index e6f8b46c0..01d5131c8 100644 --- a/stdlib/source/test/lux/data/name.lux +++ b/stdlib/source/test/lux/data/name.lux @@ -20,12 +20,12 @@ [\\library ["." /]]) -(def: #export (random module_size short_size) +(def: .public (random module_size short_size) (-> Nat Nat (Random Name)) (random.and (random.ascii/alpha module_size) (random.ascii/alpha short_size))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/data/product.lux b/stdlib/source/test/lux/data/product.lux index 2f781972d..3b846940f 100644 --- a/stdlib/source/test/lux/data/product.lux +++ b/stdlib/source/test/lux/data/product.lux @@ -14,7 +14,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Tuple .And]) diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 73765d85f..ddb924273 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -20,7 +20,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Variant .Or]) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 5d02dbfcf..ca7f2f69f 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -258,7 +258,7 @@ inverse!))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Text]) diff --git a/stdlib/source/test/lux/data/text/buffer.lux b/stdlib/source/test/lux/data/text/buffer.lux index 0f6e73d35..393a20779 100644 --- a/stdlib/source/test/lux/data/text/buffer.lux +++ b/stdlib/source/test/lux/data/text/buffer.lux @@ -20,7 +20,7 @@ [size (\ ! map (|>> (n.% 10) inc) random.nat)] (random.ascii/alpha size))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Buffer]) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 4cdf461b7..662643d3c 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -210,14 +210,14 @@ <encodings>) - (def: #export random + (def: .public random (Random /.Encoding) (let [options (list.size ..all_encodings)] (do {! random.monad} [choice (\ ! map (n.% options) random.nat)] (in (maybe.assume (list.item choice ..all_encodings)))))) - (def: #export test + (def: .public test Test (<| (_.covering /._) (_.for [/.Encoding]) diff --git a/stdlib/source/test/lux/data/text/encoding/utf8.lux b/stdlib/source/test/lux/data/text/encoding/utf8.lux index a537a0277..ef75a174a 100644 --- a/stdlib/source/test/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/test/lux/data/text/encoding/utf8.lux @@ -12,7 +12,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.codec] diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 21266b277..3b320fd90 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -79,7 +79,7 @@ (syntax: (static_escape {un_escaped <code>.text}) (in (list (code.text (/.escape un_escaped))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index e8cdb1e67..e612dc9b6 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -117,7 +117,7 @@ )) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Format]) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 95f82e502..263c6cb50 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -278,7 +278,7 @@ (#try.Failure error) false)))]))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index e2a415abd..4f92f8db9 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -22,7 +22,7 @@ [\\library ["." /]]) -(def: #export random +(def: .public random (Random /.Block) (do {! random.monad} [start (\ ! map (n.% 1,000,000) random.nat) @@ -165,7 +165,7 @@ <blocks> ) - (def: #export test + (def: .public test Test (<| (_.covering /._) (_.for [/.Block]) diff --git a/stdlib/source/test/lux/data/text/unicode/set.lux b/stdlib/source/test/lux/data/text/unicode/set.lux index 0f50a1dd7..6efe6cb14 100644 --- a/stdlib/source/test/lux/data/text/unicode/set.lux +++ b/stdlib/source/test/lux/data/text/unicode/set.lux @@ -23,14 +23,14 @@ [// ["." block]]]]) -(def: #export random +(def: .public random (Random /.Set) (do {! random.monad} [left //block.random right //block.random] (in (/.set [left (list right)])))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Set]) diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index a0900230d..8d9a9ef4c 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -226,7 +226,7 @@ (type: My_Text Text) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 76172c10d..117fd784a 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -115,7 +115,7 @@ (`` ((~~ (static ..my_directive)))) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux index 6e8a38684..2ba2c8f7a 100644 --- a/stdlib/source/test/lux/ffi.js.lux +++ b/stdlib/source/test/lux/ffi.js.lux @@ -42,7 +42,7 @@ (new [/.String]) (decode [Uint8Array] /.String)]) -(def: #export test +(def: .public test Test (do {! random.monad} [boolean random.bit diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index c5f52200b..b393d363b 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -602,7 +602,7 @@ ([a] invalid [] (a java/lang/String))]))))) )) -(def: #export test +(def: .public test (<| (_.covering /._) ($_ _.and ..for_conversions diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 963d45387..43757eedf 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -13,7 +13,7 @@ (/.import: (os/getenv [/.String] #io #? /.String)) -(def: #export test +(def: .public test Test (do {! random.monad} [boolean random.bit diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index 0aa631ab8..7e9301b30 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -228,7 +228,7 @@ (/.type (java/util/List java/lang/Byte))))) ))) -(def: #export test +(def: .public test (<| (_.covering /._) ($_ _.and ..conversions diff --git a/stdlib/source/test/lux/ffi.php.lux b/stdlib/source/test/lux/ffi.php.lux index c8d4ea6d5..31dd43c5b 100644 --- a/stdlib/source/test/lux/ffi.php.lux +++ b/stdlib/source/test/lux/ffi.php.lux @@ -16,7 +16,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (do {! random.monad} [] diff --git a/stdlib/source/test/lux/ffi.py.lux b/stdlib/source/test/lux/ffi.py.lux index 18aab4188..a2f5c7444 100644 --- a/stdlib/source/test/lux/ffi.py.lux +++ b/stdlib/source/test/lux/ffi.py.lux @@ -16,7 +16,7 @@ (#static R_OK /.Integer) (#static W_OK /.Integer)]) -(def: #export test +(def: .public test Test (do {! random.monad} [boolean random.bit diff --git a/stdlib/source/test/lux/ffi.rb.lux b/stdlib/source/test/lux/ffi.rb.lux index 0b57aee7e..a6ba3d949 100644 --- a/stdlib/source/test/lux/ffi.rb.lux +++ b/stdlib/source/test/lux/ffi.rb.lux @@ -13,7 +13,7 @@ ["#::." (#static SEPARATOR /.String)]) -(def: #export test +(def: .public test Test (do {! random.monad} [boolean random.bit diff --git a/stdlib/source/test/lux/ffi.scm.lux b/stdlib/source/test/lux/ffi.scm.lux index c8d4ea6d5..31dd43c5b 100644 --- a/stdlib/source/test/lux/ffi.scm.lux +++ b/stdlib/source/test/lux/ffi.scm.lux @@ -16,7 +16,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (do {! random.monad} [] diff --git a/stdlib/source/test/lux/locale.lux b/stdlib/source/test/lux/locale.lux index ea6ac14e2..afc69ea50 100644 --- a/stdlib/source/test/lux/locale.lux +++ b/stdlib/source/test/lux/locale.lux @@ -45,7 +45,7 @@ encoding ..random_encoding] (in (/.locale language (#.Some territory) (#.Some encoding))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Locale]) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 8577301d8..09f2bfc52 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -212,9 +212,9 @@ ))))) (template: (!aliases <reference> <aliases>) - (_.cover <aliases> - (list.every? (\ /.equivalence = <reference>) - (`` (list (~~ (template.spliced <aliases>))))))) + [(_.cover <aliases> + (list.every? (\ /.equivalence = <reference>) + (`` (list (~~ (template.spliced <aliases>))))))]) (def: aliases_test/0 Test @@ -274,7 +274,7 @@ ..aliases_test/1 )) -(def: #export random +(def: .public random (Random /.Language) (let [options (|> ..languages (list\map (|>> (get@ #languages) set.list)) @@ -284,7 +284,7 @@ random.nat)] (in (maybe.assume (list.item choice options)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Language]) diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index a0dfbb4ee..8f323004c 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -169,9 +169,9 @@ ))))) (template: (!aliases <reference> <aliases>) - (_.cover <aliases> - (list.every? (\ /.equivalence = <reference>) - (`` (list (~~ (template.spliced <aliases>))))))) + [(_.cover <aliases> + (list.every? (\ /.equivalence = <reference>) + (`` (list (~~ (template.spliced <aliases>))))))]) (def: aliases_test Test @@ -200,7 +200,7 @@ (!aliases /.wallis [/.futuna]) )) -(def: #export random +(def: .public random (Random /.Territory) (let [options (|> ..territories (list\map (|>> (get@ #territories) set.list)) @@ -210,7 +210,7 @@ random.nat)] (in (maybe.assume (list.item choice options)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Territory]) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 8dc0c64db..bbc60bf4a 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -34,13 +34,13 @@ ["#." template]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> true - _ false)) + [(case <value> + <pattern> true + _ false)]) (template: (!global <definition>) - (: [Text .Global] - [(template.text [<definition>]) (#.Definition [true .Macro (' []) <definition>])])) + [(: [Text .Global] + [(template.text [<definition>]) (#.Definition [true .Macro (' []) <definition>])])]) (syntax: (pow/2 number) (in (list (` (nat.* (~ number) (~ number)))))) @@ -115,7 +115,7 @@ repetitions (\ ! map (nat.% 10) random.nat) .let [single_expansion (` (..pow/2 (..pow/2 (~ pow/1)))) expansion (` (nat.* (..pow/2 (~ pow/1)) - (..pow/2 (~ pow/1)))) + (..pow/2 (~ pow/1)))) full_expansion (` (nat.* (nat.* (~ pow/1) (~ pow/1)) (nat.* (~ pow/1) (~ pow/1))))]] (`` ($_ _.and @@ -148,7 +148,7 @@ (!expect (#try.Failure _))))) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 5d5f9121a..a5bb3a9e9 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -47,7 +47,7 @@ [size (|> random.nat (\ ! map (n.% 3)))] (random.list size (random.and random random)))) -(def: #export random +(def: .public random (Random Code) (random.rec (function (_ random) @@ -164,7 +164,7 @@ [/.local_identifier ..random_text #.Identifier] ))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index 8b8a14790..6102295d4 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -64,7 +64,7 @@ (macro.full_expansion pre_expansion) (in (list pre_expansion))))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/macro/poly.lux b/stdlib/source/test/lux/macro/poly.lux index 90c57c87c..41eb81b4f 100644 --- a/stdlib/source/test/lux/macro/poly.lux +++ b/stdlib/source/test/lux/macro/poly.lux @@ -9,7 +9,7 @@ ["#." functor] ["#." json]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index ca083482d..6bad7436a 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -76,7 +76,7 @@ (derived: equivalence (/.equivalence Record)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.equivalence] diff --git a/stdlib/source/test/lux/macro/poly/functor.lux b/stdlib/source/test/lux/macro/poly/functor.lux index 6eebf2d55..b98541232 100644 --- a/stdlib/source/test/lux/macro/poly/functor.lux +++ b/stdlib/source/test/lux/macro/poly/functor.lux @@ -21,7 +21,7 @@ (derived: state_functor (/.functor state.State)) (derived: identity_functor (/.functor identity.Identity)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.cover [/.functor] diff --git a/stdlib/source/test/lux/macro/poly/json.lux b/stdlib/source/test/lux/macro/poly/json.lux index d688dab2f..fa8e6facb 100644 --- a/stdlib/source/test/lux/macro/poly/json.lux +++ b/stdlib/source/test/lux/macro/poly/json.lux @@ -113,7 +113,7 @@ (derived: codec (/.codec Record)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.codec] diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux index 49ba85da7..62988d8de 100644 --- a/stdlib/source/test/lux/macro/syntax.lux +++ b/stdlib/source/test/lux/macro/syntax.lux @@ -23,7 +23,7 @@ (/.syntax: (+/3 a b c) (in (list (` ($_ n.+ (~ a) (~ b) (~ c)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/macro/syntax/annotations.lux b/stdlib/source/test/lux/macro/syntax/annotations.lux index cd6396535..be74194b9 100644 --- a/stdlib/source/test/lux/macro/syntax/annotations.lux +++ b/stdlib/source/test/lux/macro/syntax/annotations.lux @@ -22,7 +22,7 @@ ["$." /// #_ ["#." code]]) -(def: #export random +(def: .public random (Random /.Annotations) (let [word (random.ascii/alpha 10) tag (random.and word word)] @@ -30,7 +30,7 @@ [size (\ ! map (n.% 10) random.nat)] (random.list size (random.and tag $///code.random))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Annotations]) diff --git a/stdlib/source/test/lux/macro/syntax/check.lux b/stdlib/source/test/lux/macro/syntax/check.lux index 36ad565a2..e5f3e310e 100644 --- a/stdlib/source/test/lux/macro/syntax/check.lux +++ b/stdlib/source/test/lux/macro/syntax/check.lux @@ -19,14 +19,14 @@ ["$." /// #_ ["#." code]]) -(def: #export random +(def: .public random (Random /.Check) ($_ random.and $///code.random $///code.random )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Check]) diff --git a/stdlib/source/test/lux/macro/syntax/declaration.lux b/stdlib/source/test/lux/macro/syntax/declaration.lux index 0d1e61874..a260f84be 100644 --- a/stdlib/source/test/lux/macro/syntax/declaration.lux +++ b/stdlib/source/test/lux/macro/syntax/declaration.lux @@ -17,7 +17,7 @@ [\\library ["." /]]) -(def: #export random +(def: .public random (Random /.Declaration) (let [word (random.ascii/alpha 10)] ($_ random.and @@ -27,7 +27,7 @@ (random.list size word)) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Declaration]) diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux index e6acc2847..855a44545 100644 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/macro/syntax/definition.lux @@ -25,7 +25,7 @@ ["#/" // #_ ["#." code]]]) -(def: #export random +(def: .public random (Random /.Definition) ($_ random.and (random.ascii/alpha 5) @@ -53,7 +53,7 @@ #.extensions [] #.host []}) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Definition]) diff --git a/stdlib/source/test/lux/macro/syntax/export.lux b/stdlib/source/test/lux/macro/syntax/export.lux index 6e93f2e4b..adb95407f 100644 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ b/stdlib/source/test/lux/macro/syntax/export.lux @@ -15,7 +15,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/macro/syntax/input.lux b/stdlib/source/test/lux/macro/syntax/input.lux index e292cde72..fe01ab496 100644 --- a/stdlib/source/test/lux/macro/syntax/input.lux +++ b/stdlib/source/test/lux/macro/syntax/input.lux @@ -19,14 +19,14 @@ ["$." /// #_ ["#." code]]) -(def: #export random +(def: .public random (Random /.Input) ($_ random.and $///code.random $///code.random )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Input]) diff --git a/stdlib/source/test/lux/macro/syntax/type/variable.lux b/stdlib/source/test/lux/macro/syntax/type/variable.lux index 48882172a..af57cc222 100644 --- a/stdlib/source/test/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/test/lux/macro/syntax/type/variable.lux @@ -15,11 +15,11 @@ [\\library ["." /]]) -(def: #export random +(def: .public random (Random /.Variable) (random.ascii/alpha 10)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Variable]) diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux index ecec132d7..78df63f0d 100644 --- a/stdlib/source/test/lux/macro/template.lux +++ b/stdlib/source/test/lux/macro/template.lux @@ -35,7 +35,7 @@ (#try.Success _) (#try.Failure "OOPS!")))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux index 8eae10808..f1bbc7fa6 100644 --- a/stdlib/source/test/lux/math.lux +++ b/stdlib/source/test/lux/math.lux @@ -31,7 +31,7 @@ (let [normal (|> angle forward backward)] (|> normal forward backward (f.approximately? ..margin_of_error normal)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/math/infix.lux b/stdlib/source/test/lux/math/infix.lux index 2dafd35aa..9c8298346 100644 --- a/stdlib/source/test/lux/math/infix.lux +++ b/stdlib/source/test/lux/math/infix.lux @@ -15,7 +15,7 @@ ["." / ["." //]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/math/logic/continuous.lux b/stdlib/source/test/lux/math/logic/continuous.lux index ab7049221..a49e5c7d8 100644 --- a/stdlib/source/test/lux/math/logic/continuous.lux +++ b/stdlib/source/test/lux/math/logic/continuous.lux @@ -13,7 +13,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index bdbc790ac..f97ffb24f 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -332,7 +332,7 @@ (r.< threshold (/.membership set sample)))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Fuzzy]) diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index cafc576eb..b87f30bb1 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -28,13 +28,13 @@ ["/#" // #_ ["#" modulus]]]]) -(def: #export (random modulus) +(def: .public (random modulus) (All [%] (-> (//.Modulus %) (Random (/.Mod %)))) (\ random.monad map (/.modular modulus) random.int)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Mod]) diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 7a3cde72c..365fef83d 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -25,13 +25,13 @@ 0 +1 _ (.int divisor))))))) -(def: #export (random range) +(def: .public (random range) (Ex [%] (-> Int (Random (/.Modulus %)))) (|> random.int (\ random.monad map (i.% range)) (random.one (|>> /.modulus try.maybe)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Modulus]) diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux index b13fa5cf8..d97c73f45 100644 --- a/stdlib/source/test/lux/math/number.lux +++ b/stdlib/source/test/lux/math/number.lux @@ -28,7 +28,7 @@ (-> Text Text) (text.replace_all "," "")) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/math/number/complex.lux b/stdlib/source/test/lux/math/number/complex.lux index ddeb53c2f..25bdc1216 100644 --- a/stdlib/source/test/lux/math/number/complex.lux +++ b/stdlib/source/test/lux/math/number/complex.lux @@ -33,7 +33,7 @@ (in (f.* (|> factor .int int.frac) measure)))) -(def: #export random +(def: .public random (Random /.Complex) (do random.monad [real ..dimension @@ -267,7 +267,7 @@ (list\map (/.pow' (|> degree .int int.frac))) (list.every? (/.approximately? ..margin_of_error sample)))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Complex]) diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 7f59d94af..91f44f41b 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -126,7 +126,7 @@ @.jvm (as_is <jvm>)} (as_is))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Frac]) diff --git a/stdlib/source/test/lux/math/number/i16.lux b/stdlib/source/test/lux/math/number/i16.lux index bc1da4832..f82250048 100644 --- a/stdlib/source/test/lux/math/number/i16.lux +++ b/stdlib/source/test/lux/math/number/i16.lux @@ -14,11 +14,11 @@ ["i" int] ["#." i64]]]]) -(def: #export random +(def: .public random (Random /.I16) (\ random.functor map /.i16 random.i64)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.I16]) diff --git a/stdlib/source/test/lux/math/number/i32.lux b/stdlib/source/test/lux/math/number/i32.lux index 211156ef2..a4c503bf7 100644 --- a/stdlib/source/test/lux/math/number/i32.lux +++ b/stdlib/source/test/lux/math/number/i32.lux @@ -14,11 +14,11 @@ ["i" int] ["#." i64]]]]) -(def: #export random +(def: .public random (Random /.I32) (\ random.functor map /.i32 random.i64)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.I32]) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index ddc907939..3504af6f7 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -159,7 +159,7 @@ ($monoid.spec n.equivalence /.conjunction random.nat)) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.I64]) diff --git a/stdlib/source/test/lux/math/number/i8.lux b/stdlib/source/test/lux/math/number/i8.lux index 6bd0a3c9f..2764f93ec 100644 --- a/stdlib/source/test/lux/math/number/i8.lux +++ b/stdlib/source/test/lux/math/number/i8.lux @@ -14,11 +14,11 @@ ["i" int] ["#." i64]]]]) -(def: #export random +(def: .public random (Random /.I8) (\ random.functor map /.i8 random.i64)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.I8]) diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux index 6d8d2340b..6fba4351a 100644 --- a/stdlib/source/test/lux/math/number/int.lux +++ b/stdlib/source/test/lux/math/number/int.lux @@ -73,7 +73,7 @@ (not (/.odd? sample)))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Int]) diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux index 9b2a8d676..d6e64603e 100644 --- a/stdlib/source/test/lux/math/number/nat.lux +++ b/stdlib/source/test/lux/math/number/nat.lux @@ -62,7 +62,7 @@ (not (/.odd? sample)))) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Nat]) diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index c30830474..baf9f23a1 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -25,7 +25,7 @@ (|>> (n.% 1,000,000) (n.max 1)) random.nat)) -(def: #export random +(def: .public random (Random /.Ratio) (do random.monad [numerator ..part @@ -33,7 +33,7 @@ ..part)] (in (/.ratio numerator denominator)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Ratio]) diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux index 3c9d07138..b0d857464 100644 --- a/stdlib/source/test/lux/math/number/rev.lux +++ b/stdlib/source/test/lux/math/number/rev.lux @@ -53,7 +53,7 @@ )) ))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Rev]) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 45a6b5b10..9684fd3f6 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -35,9 +35,9 @@ ["#." location]]) (template: (!expect <pattern> <value>) - (case <value> - <pattern> true - _ false)) + [(case <value> + <pattern> true + _ false)]) (def: compiler_related Test @@ -886,7 +886,7 @@ _ false))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Meta .Lux]) diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux index 55a97ca60..e0fa2d3e5 100644 --- a/stdlib/source/test/lux/meta/annotation.lux +++ b/stdlib/source/test/lux/meta/annotation.lux @@ -46,9 +46,9 @@ (random.list size (random.and random random)))) (template: (!expect <pattern> <value>) - (case <value> - <pattern> true - _ false)) + [(case <value> + <pattern> true + _ false)]) (def: (annotation key value) (-> Name Code /.Annotation) @@ -142,7 +142,7 @@ )) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Annotation]) diff --git a/stdlib/source/test/lux/meta/location.lux b/stdlib/source/test/lux/meta/location.lux index 421c872dd..b7172f4c1 100644 --- a/stdlib/source/test/lux/meta/location.lux +++ b/stdlib/source/test/lux/meta/location.lux @@ -16,7 +16,7 @@ [macro ["#." code]]]) -(def: #export random +(def: .public random (Random Location) ($_ random.and (random.ascii/alpha 10) @@ -24,7 +24,7 @@ random.nat )) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [.Location]) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index c7b4cf98c..df55e17f4 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -26,7 +26,7 @@ <code>.any)}) (in (list actual_program))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/target.lux b/stdlib/source/test/lux/target.lux index c59dc9025..2f30bc909 100644 --- a/stdlib/source/test/lux/target.lux +++ b/stdlib/source/test/lux/target.lux @@ -35,7 +35,7 @@ (n.= (list.size ..all) (set.size ..unique))) - (def: #export test + (def: .public test Test (<| (_.covering /._) (_.for [/.Target]) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 9d9e17c80..e6cfcf082 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -321,15 +321,15 @@ (template [<name> <type>] [(template: (<name> <old_extension> <new_extension>) - (: (-> <type> <type> <type>) - (function (_ parameter subject) - (for {@.old - (<old_extension> subject parameter) - - @.jvm - ("jvm object cast" - (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject)))}))))] + [(: (-> <type> <type> <type>) + (function (_ parameter subject) + (for {@.old + (<old_extension> subject parameter) + + @.jvm + ("jvm object cast" + (<new_extension> ("jvm object cast" parameter) + ("jvm object cast" subject)))})))])] [int/2 java/lang/Integer] [long/2 java/lang/Long] @@ -338,15 +338,15 @@ ) (template: (int+long/2 <old_extension> <new_extension>) - (: (-> java/lang/Integer java/lang/Long java/lang/Long) - (function (_ parameter subject) - (for {@.old - (<old_extension> subject parameter) - - @.jvm - ("jvm object cast" - (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject)))})))) + [(: (-> java/lang/Integer java/lang/Long java/lang/Long) + (function (_ parameter subject) + (for {@.old + (<old_extension> subject parameter) + + @.jvm + ("jvm object cast" + (<new_extension> ("jvm object cast" parameter) + ("jvm object cast" subject)))})))]) (def: int Test @@ -1037,13 +1037,13 @@ ))) (template: (!::= <type> <old> <new>) - (: (-> <type> Any Bit) - (function (_ expected) - (for {@.old - (|>> (:as <type>) (<old> expected)) - - @.jvm - (|>> (:as <type>) "jvm object cast" (<new> ("jvm object cast" (:as <type> expected))))})))) + [(: (-> <type> Any Bit) + (function (_ expected) + (for {@.old + (|>> (:as <type>) (<old> expected)) + + @.jvm + (|>> (:as <type>) "jvm object cast" (<new> ("jvm object cast" (:as <type> expected))))})))]) (def: conversion Test @@ -1719,7 +1719,7 @@ (#try.Failure error) false)))) -(def: #export test +(def: .public test Test (<| (_.context (%.name (name_of .._))) ($_ _.and diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 543eb94cd..574feb176 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -163,7 +163,7 @@ ran_all_tests!)))))) )) -(def: #export dummy_target +(def: .public dummy_target "YOLO") (def: coverage @@ -215,7 +215,7 @@ (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) )) -(def: #export test +(def: .public test /.Test (<| (/.covering /._) (/.for [/.Test]) diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index 91711a048..e87761302 100644 --- a/stdlib/source/test/lux/time.lux +++ b/stdlib/source/test/lux/time.lux @@ -106,7 +106,7 @@ (#try.Failure error) false))) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Time]) diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index 8e77300da..10c44e678 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -25,7 +25,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Date]) diff --git a/stdlib/source/test/lux/time/day.lux b/stdlib/source/test/lux/time/day.lux index e65759f92..dd71f0f93 100644 --- a/stdlib/source/test/lux/time/day.lux +++ b/stdlib/source/test/lux/time/day.lux @@ -25,7 +25,7 @@ [\\library ["." /]]) -(def: #export random +(def: .public random (Random /.Day) (random.either (random.either (random.either (random\in #/.Sunday) (random\in #/.Monday)) @@ -35,7 +35,7 @@ (random\in #/.Friday)) (random\in #/.Saturday)))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Day]) diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index 1493cfd21..b43ef18bd 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -20,7 +20,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Duration]) diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index f737f7827..c48ae6955 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -24,7 +24,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Instant]) diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux index ec1c8134c..03c50086f 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -27,14 +27,14 @@ [// ["." duration]]]]) -(def: #export random +(def: .public random (Random /.Month) (let [december (/.number #/.December)] (|> random.nat (\ random.monad map (|>> (n.% december) inc)) (random.one (|>> /.by_number try.maybe))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Month]) diff --git a/stdlib/source/test/lux/time/year.lux b/stdlib/source/test/lux/time/year.lux index 84ed24fc4..366cc8bc2 100644 --- a/stdlib/source/test/lux/time/year.lux +++ b/stdlib/source/test/lux/time/year.lux @@ -27,11 +27,11 @@ ["#." instant] ["#." date]]]]) -(def: #export random +(def: .public random (Random /.Year) (random.one (|>> /.year try.maybe) random.int)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Year]) diff --git a/stdlib/source/test/lux/tool.lux b/stdlib/source/test/lux/tool.lux index ebda4eb93..5aaee9637 100644 --- a/stdlib/source/test/lux/tool.lux +++ b/stdlib/source/test/lux/tool.lux @@ -11,7 +11,7 @@ ["#." analysis] ["#." synthesis]]]]]]) -(def: #export test +(def: .public test Test ($_ _.and /syntax.test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux index 06b09fbf9..f2b318a33 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux @@ -12,7 +12,7 @@ [analysis ["#." lux]]]]]) -(def: #export test +(def: .public test Test ($_ _.and /primitive.test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index 752465bd0..ac408d71d 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -53,7 +53,7 @@ head head+] (in (#.Item head tail+))))) -(def: #export (exhaustive_branches allow_literals? variantTC inputC) +(def: .public (exhaustive_branches allow_literals? variantTC inputC) (-> Bit (List [Code Code]) Code (Random (List Code))) (case inputC [_ (#.Bit _)] @@ -116,7 +116,7 @@ (r\in (list)) )) -(def: #export (input variant_tags record_tags primitivesC) +(def: .public (input variant_tags record_tags primitivesC) (-> (List Code) (List Code) (List Code) (Random Code)) (r.rec (function (_ input) @@ -138,7 +138,7 @@ (-> Code Code [Code Code]) [pattern body]) -(def: #export test +(def: .public test (<| (_.context (name.module (name_of /._))) (do {! r.monad} [module_name (r.unicode 5) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index 08bfc6e99..7981f1422 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -123,7 +123,7 @@ (check_apply partial_polyT2 var_idx))) )))) -(def: #export test +(def: .public test Test (<| (_.context (name.module (name_of /._))) ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index 7fb549845..3b93ae562 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -32,25 +32,25 @@ [meta ["." archive]]]]]]]]) -(def: #export (expander macro inputs state) +(def: .public (expander macro inputs state) Expander (#try.Failure "NOPE")) -(def: #export (eval archive count type expression) +(def: .public (eval archive count type expression) Eval (function (_ state) (#try.Failure "NO!"))) -(def: #export phase +(def: .public phase ////analysis.Phase (//.phase ..expander)) -(def: #export state +(def: .public state ////analysis.State+ [(///analysis.bundle ..eval bundle.empty) (////analysis.state (////analysis.info version.version @.jvm))]) -(def: #export primitive +(def: .public primitive (Random [Type Code]) (`` ($_ r.either (~~ (template [<type> <code_wrapper> <value_gen>] @@ -83,7 +83,7 @@ (#try.Failure error) (#try.Failure error)))) -(def: #export test +(def: .public test (<| (_.context (name.module (name_of /._))) (`` ($_ _.and (_.test (%.name (name_of #////analysis.Unit)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux index e1f52e584..2d1a34d1b 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -62,7 +62,7 @@ (phase.run _primitive.state) check!)) -(def: #export test +(def: .public test (<| (_.context (name.module (name_of /._))) (do r.monad [[expectedT _] _primitive.primitive diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 11ca2b276..9bc61107b 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -39,7 +39,7 @@ ["." archive]]]]]]]]) (template [<name> <on_success> <on_error>] - [(def: #export <name> + [(def: .public <name> (All [a] (-> (Operation a) Bit)) (|>> (phase.run _primitive.state) (case> (#try.Success _) @@ -298,7 +298,7 @@ (|> (/.record archive.empty _primitive.phase recordC) (check_record module_name tags monoT monoT size)))))) -(def: #export test +(def: .public test Test (<| (_.context (name.module (name_of /._))) ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index a0643cbcd..508eed47f 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -191,7 +191,7 @@ (check_success+ "lux io current-time" (list) Int)) ))) -(def: #export test +(def: .public test Test (<| (_.context (name.module (name_of /._))) ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis.lux index 4a7a7c507..159790e36 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis.lux @@ -9,7 +9,7 @@ ["#." loop] ["#." variable]]) -(def: #export test +(def: .public test Test ($_ _.and /primitive.test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux index 59cad9258..7a5b44f51 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -340,7 +340,7 @@ _ false))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.synthesize]) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 60a009be1..188c50a86 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -455,7 +455,7 @@ (!expect (^multi (#try.Success funcS) (//primitive.corresponds? funcA funcS)))))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 3598bbf7c..9aa7bdfe9 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -261,7 +261,7 @@ (..extension offset arity next) )) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux index e4ccec535..25524e590 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux @@ -27,7 +27,7 @@ [meta ["." archive]]]]]]]]) -(def: #export primitive +(def: .public primitive (Random Analysis) (do r.monad [primitive (: (Random ////analysis.Primitive) @@ -41,7 +41,7 @@ (r.unicode 5)))] (in (#////analysis.Primitive primitive)))) -(def: #export (corresponds? analysis synthesis) +(def: .public (corresponds? analysis synthesis) (-> Analysis Synthesis Bit) (`` (case [analysis synthesis] (~~ (template [<analysis> <post_analysis> <synthesis> <post_synthesis>] @@ -70,7 +70,7 @@ _ false))) -(def: #export test +(def: .public test Test (<| (_.context (%.name (name_of #////synthesis.Primitive))) (`` ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux index a45c8af9e..4db00f1f2 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux @@ -72,7 +72,7 @@ _ false))))) -(def: #export test +(def: .public test Test (<| (_.context (%.name (name_of #////synthesis.Structure))) ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 04fb82336..cb0d81cfd 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -322,7 +322,7 @@ {#redundants 0 #necessary (dictionary.empty n.hash)}) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux index 7a103d60a..e5a1e45d3 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -137,7 +137,7 @@ (\ code.equivalence = parsed sample))) ))) -(def: #export test +(def: .public test Test (<| (_.context (name.module (name_of /._))) ($_ _.and diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index f248a2adb..171f34873 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -41,7 +41,7 @@ (Random Name) (random.and ..short ..short)) -(def: #export random +(def: .public random (Random Type) (random.rec (function (_ recur) @@ -62,7 +62,7 @@ (random.and ..name recur) ))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux index 2b96f6788..1b70b0fd2 100644 --- a/stdlib/source/test/lux/type/abstract.lux +++ b/stdlib/source/test/lux/type/abstract.lux @@ -45,12 +45,16 @@ (with_expansions [no_current! (..with_no_active_frames (..current)) no_specific! (..with_no_active_frames (..specific))] (/.abstract: (g!Foo a) + {} + Text (/.abstract: (g!Bar a) + {} + Nat - (def: #export test + (def: .public test Test (<| (_.covering /._) (_.for [/.abstract:]) diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 84426d1f7..eaa8cbb86 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -700,7 +700,7 @@ (try.else false)) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Check]) diff --git a/stdlib/source/test/lux/type/dynamic.lux b/stdlib/source/test/lux/type/dynamic.lux index 0c743cabf..04c25fb70 100644 --- a/stdlib/source/test/lux/type/dynamic.lux +++ b/stdlib/source/test/lux/type/dynamic.lux @@ -17,7 +17,7 @@ [\\library ["." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Dynamic]) diff --git a/stdlib/source/test/lux/type/implicit.lux b/stdlib/source/test/lux/type/implicit.lux index 6795b8aec..d032f19c5 100644 --- a/stdlib/source/test/lux/type/implicit.lux +++ b/stdlib/source/test/lux/type/implicit.lux @@ -21,7 +21,7 @@ (/.implicit: [n.multiplication]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux index b59879ef2..ae137a428 100644 --- a/stdlib/source/test/lux/type/quotient.lux +++ b/stdlib/source/test/lux/type/quotient.lux @@ -16,7 +16,7 @@ [\\library ["." /]]) -(def: #export (random class super) +(def: .public (random class super) (All [t c %] (-> (/.Class t c %) (Random t) (Random (/.Quotient t c %)))) (\ random.monad map (/.quotient class) super)) @@ -26,7 +26,7 @@ (def: Mod_10 (/.type ..mod_10_class)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do random.monad diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index 1dd71a4c6..da5826098 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -22,7 +22,7 @@ (def: _type (/.type _refiner)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Refined]) diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index 791c31e1f..18ee0164d 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -167,7 +167,7 @@ (#try.Failure error) true)))])))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Procedure]) diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index 32e2922a6..fa9a53c5f 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -182,7 +182,7 @@ (meter\= right))) )))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Qty]) diff --git a/stdlib/source/test/lux/type/variance.lux b/stdlib/source/test/lux/type/variance.lux index b0987e833..e683b1f64 100644 --- a/stdlib/source/test/lux/type/variance.lux +++ b/stdlib/source/test/lux/type/variance.lux @@ -17,7 +17,7 @@ (type: Sub (Super Bit)) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux index 795b3e55c..4750e0371 100644 --- a/stdlib/source/test/lux/world.lux +++ b/stdlib/source/test/lux/world.lux @@ -17,7 +17,7 @@ ["#/." client] ["#/." status]]]]) -(def: #export test +(def: .public test Test ($_ _.and /file.test diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index c51cce645..c358ca699 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -48,7 +48,7 @@ (exception.except ..dead []) (#try.Success [true content]))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index ecc596399..99155f805 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -15,7 +15,7 @@ [\\specification ["$." /]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index c5b89533b..6f70358e5 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -149,7 +149,7 @@ false) (list.empty? poll/3'))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Watcher]) diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index bfcc0db6c..c9c6cfee3 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -135,14 +135,14 @@ <groups>) - (def: #export random + (def: .public random (Random /.Key) (let [count (list.size ..listing)] (do {! random.monad} [choice (\ ! map (n.% count) random.nat)] (in (maybe.assume (list.item choice ..listing)))))) - (def: #export test + (def: .public test Test (<| (_.covering /._) (_.for [/.Key]) diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index bdfad7989..d1726c7e0 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -27,7 +27,7 @@ ["/#" // ["#." status]]]]) -(def: #export test +(def: .public test Test (<| (_.covering /._) (_.for [/.Client]) diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index 09f8fa86a..574ce8513 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -108,7 +108,7 @@ <categories>) - (def: #export test + (def: .public test Test (<| (_.covering /._) (`` ($_ _.and diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux index 378352c57..0775b263e 100644 --- a/stdlib/source/test/lux/world/output/video/resolution.lux +++ b/stdlib/source/test/lux/world/output/video/resolution.lux @@ -42,14 +42,14 @@ (Set /.Resolution) (set.of_list /.hash ..listing)) - (def: #export random + (def: .public random (Random /.Resolution) (let [count (list.size ..listing)] (do {! random.monad} [choice (\ ! map (n.% count) random.nat)] (in (maybe.assume (list.item choice ..listing)))))) - (def: #export test + (def: .public test Test (<| (_.covering /._) (_.for [/.Resolution]) diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux index 9940220ac..50e1b4ffd 100644 --- a/stdlib/source/test/lux/world/program.lux +++ b/stdlib/source/test/lux/world/program.lux @@ -38,7 +38,7 @@ (Random Path) (random.ascii/alpha 5)) -(def: #export test +(def: .public test Test (<| (_.covering /._) (do {! random.monad} diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 0d67c79a0..3db61b469 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -80,7 +80,7 @@ (def: (await _) (io.io (#try.Success exit)))))))) -(def: #export test +(def: .public test Test (<| (_.covering /._) ($_ _.and |