diff options
author | Eduardo Julian | 2021-08-27 20:59:34 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-27 20:59:34 -0400 |
commit | c5b61d2f46ac19bf511197f3a537c4be0f47df33 (patch) | |
tree | cd62d188403e9b3998ba293dc5308719a430f1fe /stdlib | |
parent | e814f667aed509a70bd386dcd54628929134def4 (diff) |
Updates to the Ruby compiler.
Diffstat (limited to '')
277 files changed, 2749 insertions, 2229 deletions
diff --git a/stdlib/commands.md b/stdlib/commands.md index 21f6dc09e..5bee8823d 100644 --- a/stdlib/commands.md +++ b/stdlib/commands.md @@ -18,6 +18,10 @@ cd ~/lux/stdlib/ \ cd ~/lux/stdlib/ \ && lux clean \ && lux with lua with bibliotheca auto test + +cd ~/lux/stdlib/ \ +&& lux clean \ +&& lux with ruby with bibliotheca auto test ``` ## Deploy diff --git a/stdlib/project.lux b/stdlib/project.lux index fe3cfb227..26ea4061b 100644 --- a/stdlib/project.lux +++ b/stdlib/project.lux @@ -16,6 +16,9 @@ "lua" {#compiler ["com.github.luxlang" "lux-lua" "0.6.0-SNAPSHOT" "jar"]} + "ruby" + {#compiler ["com.github.luxlang" "lux-ruby" "0.6.0-SNAPSHOT" "jar"]} + "bibliotheca" {#description "Standard library for the Lux programming language." #test "test/lux"} diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index b1d7ae466..712814250 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -150,19 +150,19 @@ (documentation: /.All "Universal quantification." - [(All [a] + [(All (_ a) (-> a a))] ["A name can be provided, to specify a recursive type." - (All List [a] + (All (List a) (Or Any [a (List a)]))]) (documentation: /.Ex "Existential quantification." - [(Ex [a] + [(Ex (_ a) [(Codec Text a) a])] ["A name can be provided, to specify a recursive type." - (Ex Self [a] + (Ex (Self a) [(Codec Text a) a (List (Self a))])]) @@ -304,7 +304,7 @@ (documentation: /.type "Takes a type expression and returns its representation as data-structure." - [(type (All [a] + [(type (All (_ a) (Maybe (List a))))]) (documentation: /.: @@ -400,7 +400,7 @@ (documentation: /.function "Syntax for creating functions." - [(: (All [a b] + [(: (All (_ a b) (-> a b a)) (function (_ x y) x))] @@ -533,7 +533,7 @@ (format "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.") [(def: .public (range enum from to) - (All [a] (-> (Enum a) a a (List a))) + (All (_ a) (-> (Enum a) a a (List a))) (let [(^open ".") enum] (loop [end to output #.End] @@ -777,7 +777,7 @@ "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: .public (of_list list) - (All [a] (-> (List a) (Row a))) + (All (_ a) (-> (List a) (Row a))) (list\mix add (: (Row (:parameter 0)) empty) diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index 6c97e056f..a1163c241 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -21,13 +21,13 @@ (documentation: /.=> "Concatenative function types." [(=> [Nat] [Nat])] - [(All [a] + [(All (_ a) (-> a (=> [] [a])))] - [(All [t] + [(All (_ t) (=> [t] []))] - [(All [a b c] + [(All (_ a b c) (=> [a b c] [b c a]))] - [(All [___a ___z] + [(All (_ ___a ___z) (=> {then (=> ___a ___z) else (=> ___a ___z)} ___a [Bit then else] ___z))]) diff --git a/stdlib/source/documentation/lux/control/security/policy.lux b/stdlib/source/documentation/lux/control/security/policy.lux index 8f7b100b7..37d499014 100644 --- a/stdlib/source/documentation/lux/control/security/policy.lux +++ b/stdlib/source/documentation/lux/control/security/policy.lux @@ -45,7 +45,7 @@ unsafe))) (def: (policy _) - (Ex [%] (-> Any (Policy %))) + (Ex (_ %) (-> Any (Policy %))) (with_policy (: (Context Privacy Policy) (function (_ (^open "%::.")) diff --git a/stdlib/source/documentation/lux/ffi.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index a781e10ff..a781e10ff 100644 --- a/stdlib/source/documentation/lux/ffi.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux new file mode 100644 index 000000000..ac2dd546c --- /dev/null +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -0,0 +1,265 @@ +(.module: + [library + [lux (#- int char type :as) + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(template [<name> <from> <to>] + [(documentation: <name> + "Type converter." + [(: (primitive <to>) + (<name> (: (primitive <from>) + it)))])] + + [/.byte_to_long "java.lang.Byte" "java.lang.Long"] + + [/.short_to_long "java.lang.Short" "java.lang.Long"] + + [/.double_to_int "java.lang.Double" "java.lang.Integer"] + [/.double_to_long "java.lang.Double" "java.lang.Long"] + [/.double_to_float "java.lang.Double" "java.lang.Float"] + + [/.float_to_int "java.lang.Float" "java.lang.Integer"] + [/.float_to_long "java.lang.Float" "java.lang.Long"] + [/.float_to_double "java.lang.Float" "java.lang.Double"] + + [/.int_to_byte "java.lang.Integer" "java.lang.Byte"] + [/.int_to_short "java.lang.Integer" "java.lang.Short"] + [/.int_to_long "java.lang.Integer" "java.lang.Long"] + [/.int_to_float "java.lang.Integer" "java.lang.Float"] + [/.int_to_double "java.lang.Integer" "java.lang.Double"] + [/.int_to_char "java.lang.Integer" "java.lang.Character"] + + [/.long_to_byte "java.lang.Long" "java.lang.Byte"] + [/.long_to_short "java.lang.Long" "java.lang.Short"] + [/.long_to_int "java.lang.Long" "java.lang.Integer"] + [/.long_to_float "java.lang.Long" "java.lang.Float"] + [/.long_to_double "java.lang.Long" "java.lang.Double"] + + [/.char_to_byte "java.lang.Character" "java.lang.Byte"] + [/.char_to_short "java.lang.Character" "java.lang.Short"] + [/.char_to_int "java.lang.Character" "java.lang.Integer"] + [/.char_to_long "java.lang.Character" "java.lang.Long"] + ) + +(documentation: /.class: + "Allows defining JVM classes in Lux code." + [(class: #final (TestClass A) [Runnable] + ... Fields + (#private foo boolean) + (#private bar A) + (#private baz java/lang/Object) + ... Methods + (#public [] (new [value A]) [] + (exec + (:= ::foo #1) + (:= ::bar value) + (:= ::baz "") + [])) + (#public (virtual) java/lang/Object + "") + (#public #static (static) java/lang/Object + "") + (Runnable [] (run) void + [])) + "The tuple corresponds to parent interfaces." + "An optional super-class can be specified before the tuple. If not specified, java.lang.Object will be assumed." + "Fields and methods defined in the class can be used with special syntax." + "For example:" + "::resolved, for accessing the 'resolved' field." + "(:= ::resolved #1) for modifying it." + "(::new! []) for calling the class's constructor." + "(::resolve! container [value]) for calling the 'resolve' method."]) + +(documentation: /.interface: + "Allows defining JVM interfaces." + [(interface: TestInterface + ([] foo [boolean String] void #throws [Exception]))]) + +(documentation: /.object + "Allows defining anonymous classes." + ["The 1st tuple corresponds to class-level type-variables." + "The 2nd tuple corresponds to parent interfaces." + "The 3rd tuple corresponds to arguments to the super class constructor." + "An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed." + (object [] [Runnable] + [] + (Runnable [] (run self) void + (exec (do_something some_value) + [])))]) + +(documentation: /.null + "Null object reference." + (null)) + +(documentation: /.null? + "Test for null object reference." + [(= (null? (null)) + true)] + [(= (null? "YOLO") + false)]) + +(documentation: /.??? + "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." + [(= (??? (: java/lang/String (null))) + #.None)] + [(= (??? "YOLO") + (#.Some "YOLO"))]) + +(documentation: /.!!! + "Takes a (Maybe ObjectType) and returns a ObjectType." + [(= "foo" + (!!! (??? "foo")))] + ["A #.None would get translated into a (null)." + (= (null) + (!!! (??? (: java/lang/Thread (null)))))]) + +(documentation: /.check + (format "Checks whether an object is an instance of a particular class." + \n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.") + [(case (check java/lang/String "YOLO") + (#.Some value_as_string) + #.None)]) + +(documentation: /.synchronized + "Evaluates body, while holding a lock on a given object." + [(synchronized object_to_be_locked + (exec + (do something) + (do_something else) + (finish the computation)))]) + +(documentation: /.do_to + "Call a variety of methods on an object. Then, return the object." + [(do_to object + (ClassName::method0 arg0 arg1 arg2) + (ClassName::method1 arg3 arg4 arg5))]) + +(documentation: /.import: + (format "Allows importing JVM classes, and using them as types." + \n "Their methods, fields and enum options can also be imported.") + [(import: java/lang/Object + ["#::." + (new []) + (equals [java/lang/Object] boolean) + (wait [int] #io #try void)])] + ["Special options can also be given for the return values." + "#? means that the values will be returned inside a Maybe type. That way, null becomes #.None." + "#try means that the computation might throw an exception, and the return value will be wrapped by the Try type." + "#io means the computation has side effects, and will be wrapped by the IO type." + "These options must show up in the following order [#io #try #?] (although, each option can be used independently)." + (import: java/lang/String + ["#::." + (new [[byte]]) + (#static valueOf [char] java/lang/String) + (#static valueOf #as int_valueOf [int] java/lang/String)]) + + (import: (java/util/List e) + ["#::." + (size [] int) + (get [int] e)]) + + (import: (java/util/ArrayList a) + ["#::." + ([T] toArray [[T]] [T])])] + ["The class-type that is generated is of the fully-qualified name." + "This avoids a clash between the java.util.List type, and Lux's own List type." + "All enum options to be imported must be specified." + (import: java/lang/Character$UnicodeScript + ["#::." + (#enum ARABIC CYRILLIC LATIN)])] + ["It should also be noted, the only types that may show up in method arguments or return values may be Java classes, arrays, primitives, void or type-parameters." + "Lux types, such as Maybe cannot be named (otherwise, they'd be confused for Java classes)." + (import: (lux/concurrency/async/JvmAsync A) + ["#::." + (resolve [A] boolean) + (poll [] A) + (wasResolved [] boolean) + (waitOn [lux/Function] void) + (#static [A] make [A] (lux/concurrency/async/JvmAsync A))])] + ["Also, the names of the imported members will look like Class::member" + (java/lang/Object::new []) + (java/lang/Object::equals [other_object] my_object) + (java/util/List::size [] my_list) + java/lang/Character$UnicodeScript::LATIN]) + +(documentation: /.array + "Create an array of the given type, with the given size." + [(array java/lang/Object 10)]) + +(documentation: /.length + "Gives the length of an array." + [(length my_array)]) + +(documentation: /.read! + "Loads an element from an array." + [(read! 10 my_array)]) + +(documentation: /.write! + "Stores an element into an array." + [(write! 10 my_object my_array)]) + +(documentation: /.class_for + "Loads the class as a java.lang.Class object." + [(: (primitive "java.lang.Class" ["java.lang.Object"]) + (class_for java/lang/String))]) + +(documentation: /.type + "" + [(: .Type + (type java/lang/String))]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..byte_to_long + ..short_to_long + ..double_to_int + ..double_to_long + ..double_to_float + ..float_to_int + ..float_to_long + ..float_to_double + ..int_to_byte + ..int_to_short + ..int_to_long + ..int_to_float + ..int_to_double + ..int_to_char + ..long_to_byte + ..long_to_short + ..long_to_int + ..long_to_float + ..long_to_double + ..char_to_byte + ..char_to_short + ..char_to_int + ..char_to_long + ..class: + ..interface: + ..object + ..null + ..null? + ..??? + ..!!! + ..check + ..synchronized + ..do_to + ..import: + ..array + ..length + ..read! + ..write! + ..class_for + ..type + ($.default /.Privacy) + ($.default /.State) + ($.default /.Inheritance)] + [])) diff --git a/stdlib/source/documentation/lux/ffi.rb.lux b/stdlib/source/documentation/lux/ffi.rb.lux new file mode 100644 index 000000000..9109e9253 --- /dev/null +++ b/stdlib/source/documentation/lux/ffi.rb.lux @@ -0,0 +1,46 @@ +(.module: + [library + [lux (#- int char type :as) + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.import: + "Easily import types, methods, functions and constants." + [(import: Stat + ["#::." + (executable? [] Bit) + (size Int)]) + + (import: File #as RubyFile + ["#::." + (#static SEPARATOR ..String) + (#static open [Path ..String] #io #try RubyFile) + (#static stat [Path] #io #try Stat) + (#static delete [Path] #io #try Int) + (#static file? [Path] #io #try Bit) + (#static directory? [Path] #io #try Bit) + + (read [] #io #try Binary) + (write [Binary] #io #try Int) + (flush [] #io #try #? Any) + (close [] #io #try #? Any)])]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..import: + ($.default /.Object) + ($.default /.Nil) + ($.default /.Function) + ($.default /.Function) + ($.default /.Integer) + ($.default /.Float) + ($.default /.String)] + [])) diff --git a/stdlib/source/documentation/lux/type/abstract.lux b/stdlib/source/documentation/lux/type/abstract.lux index 8b1bf10ca..e77660aa0 100644 --- a/stdlib/source/documentation/lux/type/abstract.lux +++ b/stdlib/source/documentation/lux/type/abstract.lux @@ -55,7 +55,7 @@ [a a] (def: (duplicate value) - (All [a] (-> a (Duplicate a))) + (All (_ a) (-> a (Duplicate a))) (:abstraction [value value])))] ["Definitions can be nested." (abstract: (Single a) @@ -64,7 +64,7 @@ a (def: (single value) - (All [a] (-> a (Single a))) + (All (_ a) (-> a (Single a))) (:abstraction value)) (abstract: (Double a) @@ -73,11 +73,11 @@ [a a] (def: (double value) - (All [a] (-> a (Double a))) + (All (_ a) (-> a (Double a))) (:abstraction [value value])) (def: (single' value) - (All [a] (-> a (Single a))) + (All (_ a) (-> a (Single a))) (:abstraction Single [value value])) (let [value 0123] @@ -130,7 +130,7 @@ (documentation: /.^:representation "Pattern-matching macro to easily extract a representation." [(def: (computation abstraction) - (All [a] (-> (Abstract a) ???)) + (All (_ a) (-> (Abstract a) ???)) (let [(^:representation value) abstraction] (foo (bar (baz value)))))]) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index c87b674f0..20614dc2f 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -19,7 +19,7 @@ #1) ... (type: .public Any -... (Ex [a] a)) +... (Ex (_ a) a)) ("lux def" Any ("lux type check type" (9 #1 ["library/lux" "Any"] @@ -29,7 +29,7 @@ #1) ... (type: .public Nothing -... (All [a] a)) +... (All (_ a) a)) ("lux def" Nothing ("lux type check type" (9 #1 ["library/lux" "Nothing"] @@ -1014,54 +1014,9 @@ ("lux type as" Int param) ("lux type as" Int subject)))) -(def:'' .private (nested_quantification code) - #End - (#Function Code Code) - ({[_ (#Tuple members)] - (tuple$ (list\each nested_quantification members)) - - [_ (#Record pairs)] - (record$ (list\each ("lux type check" (#Function (#Product Code Code) (#Product Code Code)) - (function'' [pair] - (let'' [name val] pair - [name (nested_quantification val)]))) - pairs)) - - [_ (#Form (#Item [_ (#Tag "library/lux" "Parameter")] (#Item [_ (#Nat idx)] #End)))] - (form$ (#Item (tag$ ["library/lux" "Parameter"]) (#Item (nat$ ("lux i64 +" 2 idx)) #End))) - - [_ (#Form members)] - (form$ (list\each nested_quantification members)) - - _ - code} - code)) - -(def:'' .private (quantified_args_parser args next) - #End - ... (-> (List Code) (-> (List Text) (Meta (List Code))) (Meta (List Code))) - (#Function ($' List Code) - (#Function (#Function ($' List Text) (#Apply ($' List Code) Meta)) - (#Apply ($' List Code) Meta) - )) - ({#End - (next #End) - - (#Item [_ (#Identifier "" arg_name)] args') - (quantified_args_parser args' (function'' [names] (next (#Item arg_name names)))) - - _ - (failure "Expected identifier.")} - args)) - -(def:'' .private (type_parameter idx) - #End - (#Function Nat Code) - (form$ (#Item (tag$ ["library/lux" "Parameter"]) (#Item (nat$ idx) #End)))) - (def:'' .private (list\mix f init xs) #End - ... (All [a b] (-> (-> b a a) a (List b) a)) + ... (All (_ a b) (-> (-> b a a) a (List b) a)) (#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1) (#Function (#Parameter 3) (#Parameter 3))) @@ -1081,84 +1036,231 @@ (#Function ($' List (#Parameter 1)) Nat)) (list\mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) -(macro:' .public (All tokens) +(def:'' .private (let$ binding value body) + #End + (#Function Code (#Function Code (#Function Code Code))) + (form$ (#Item (record$ (#Item [binding body] #End)) + (#Item value #End)))) + +(def:'' .private (UnivQ$ body) + #End + (#Function Code Code) + (form$ (#Item (tag$ ["library/lux" "UnivQ"]) (#Item (tag$ ["library/lux" "End"]) (#Item body #End))))) + +(def:'' .private (ExQ$ body) + #End + (#Function Code Code) + (form$ (#Item (tag$ ["library/lux" "ExQ"]) (#Item (tag$ ["library/lux" "End"]) (#Item body #End))))) + +(def:'' .private quantification_level + #End + Text + ("lux text concat" double_quote + ("lux text concat" "quantification_level" + double_quote))) + +(def:'' .private quantified + #End + (#Function Code Code) + (let$ (local_identifier$ ..quantification_level) (nat$ 0))) + +(def:'' .private (quantified_type_parameter idx) + #End + (#Function Nat Code) + (form$ (#Item (tag$ ["library/lux" "Parameter"]) + (#Item (form$ (#Item (text$ "lux i64 +") + (#Item (local_identifier$ ..quantification_level) + (#Item (nat$ idx) + #End)))) + #End)))) + +(def:'' .private (next_level depth) + #End + (#Function Nat Nat) + ("lux i64 +" 2 depth)) + +(def:'' .private (self_id? id) + #End + (#Function Nat Bit) + ("lux i64 =" id ("lux type as" Nat + ("lux i64 *" +2 + ("lux i64 /" +2 + ("lux type as" Int + id)))))) + +(def:'' .public (__adjusted_quantified_type__ permission depth type) + #End + (#Function Nat (#Function Nat (#Function Type Type))) + ({0 + ({... Jackpot! + (#Parameter id) + ({id' + ({#0 (#Parameter id') + #1 (#Parameter ("lux i64 -" 2 id'))} + (self_id? id))} + ("lux i64 -" ("lux i64 -" depth id) 0)) + + ... Recur + (#Primitive name parameters) + (#Primitive name (list\each (__adjusted_quantified_type__ permission depth) + parameters)) + + (#Sum left right) + (#Sum (__adjusted_quantified_type__ permission depth left) + (__adjusted_quantified_type__ permission depth right)) + + (#Product left right) + (#Product (__adjusted_quantified_type__ permission depth left) + (__adjusted_quantified_type__ permission depth right)) + + (#Function input output) + (#Function (__adjusted_quantified_type__ permission depth input) + (__adjusted_quantified_type__ permission depth output)) + + (#UnivQ environment body) + (#UnivQ environment + (__adjusted_quantified_type__ permission (next_level depth) body)) + + (#ExQ environment body) + (#ExQ environment + (__adjusted_quantified_type__ permission (next_level depth) body)) + + (#Apply parameter function) + (#Apply (__adjusted_quantified_type__ permission depth parameter) + (__adjusted_quantified_type__ permission depth function)) + + ... Leave these alone. + (#Named name anonymous) type + (#Var id) type + (#Ex id) type} + type) + + _ + type} + permission)) + +(def:'' .private (with_correct_quantification body) + #End + (#Function Code Code) + (form$ (#Item (identifier$ [prelude_module "__adjusted_quantified_type__"]) + (#Item (local_identifier$ ..quantification_level) + (#Item (nat$ 0) + (#Item body + #End)))))) + +(def:'' .private (with_quantification depth body) + #End + (#Function Nat (#Function Code Code)) + ({g!level + (let$ g!level + (form$ (#Item (text$ "lux i64 +") + (#Item g!level + (#Item (nat$ ("lux type as" Nat + ("lux i64 *" +2 + ("lux type as" Int + depth)))) + #End)))) + body)} + (local_identifier$ ..quantification_level))) + +(def:'' .private (initialized_quantification? lux) + #End + (#Function Lux Bit) + ({{#info _ #source _ #current_module _ #modules _ + #scopes scopes #type_context _ #host _ + #seed _ #expected _ #location _ #extensions _ + #scope_type_vars _ #eval _} + (list\mix (function'' [scope verdict] + ({#1 #1 + _ ({{#name _ #inner _ #captured _ + #locals {#counter _ + #mappings locals}} + (list\mix (function'' [local verdict] + ({[local _] + ({#1 #1 + _ ("lux text =" ..quantification_level local)} + verdict)} + local)) + #0 + locals)} + scope)} + verdict)) + #0 + scopes)} + lux)) + +(macro:' .public (All tokens lux) #End - (let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens) - [self_name tokens] - - _ - ["" tokens]} - tokens) - ({(#Item [_ (#Tuple args)] (#Item body #End)) - (quantified_args_parser args - (function'' [names] - (let'' body' (list\mix ("lux type check" (#Function Text (#Function Code Code)) - (function'' [name' body'] - (form$ (#Item (tag$ ["library/lux" "UnivQ"]) - (#Item (tag$ ["library/lux" "End"]) - (#Item (with_replacements (#Item [name' (type_parameter 1)] #End) - (nested_quantification body')) - #End)))))) - body - names) - (in_meta (#Item ({[#1 _] - body' - - [_ #End] - body' - - [#0 _] - (with_replacements (#Item [self_name (type_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #End) - body')} - [(text\= "" self_name) names]) - #End))))) - - _ - (failure "Wrong syntax for All")} - tokens))) + ({(#Item [_ (#Form (#Item self_name args))] + (#Item body #End)) + (#Right [lux + (#Item ({raw + ({#1 raw + #0 (..quantified raw)} + (initialized_quantification? lux))} + ({#End + body + + (#Item head tail) + (with_correct_quantification + (let$ self_name (quantified_type_parameter 0) + ({[_ raw] + raw} + (list\mix (function'' [parameter offset,body'] + ({[offset body'] + [("lux i64 +" 2 offset) + (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) + (UnivQ$ body'))]} + offset,body')) + [0 (with_quantification (list\size args) + body)] + args))))} + args)) + #End)]) + + _ + (#Left "Wrong syntax for All")} + tokens)) -(macro:' .public (Ex tokens) +(macro:' .public (Ex tokens lux) #End - (let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens) - [self_name tokens] - - _ - ["" tokens]} - tokens) - ({(#Item [_ (#Tuple args)] (#Item body #End)) - (quantified_args_parser args - (function'' [names] - (let'' body' (list\mix ("lux type check" (#Function Text (#Function Code Code)) - (function'' [name' body'] - (form$ (#Item (tag$ ["library/lux" "ExQ"]) - (#Item (tag$ ["library/lux" "End"]) - (#Item (with_replacements (#Item [name' (type_parameter 1)] #End) - (nested_quantification body')) - #End)))))) - body - names) - (in_meta (#Item ({[#1 _] - body' - - [_ #End] - body' - - [#0 _] - (with_replacements (#Item [self_name (type_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #End) - body')} - [(text\= "" self_name) names]) - #End))))) - - _ - (failure "Wrong syntax for Ex")} - tokens))) + ({(#Item [_ (#Form (#Item self_name args))] + (#Item body #End)) + (#Right [lux + (#Item ({raw + ({#1 raw + #0 (..quantified raw)} + (initialized_quantification? lux))} + ({#End + body + + (#Item head tail) + (with_correct_quantification + (let$ self_name (quantified_type_parameter 0) + ({[_ raw] + raw} + (list\mix (function'' [parameter offset,body'] + ({[offset body'] + [("lux i64 +" 2 offset) + (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) + (ExQ$ body'))]} + offset,body')) + [0 (with_quantification (list\size args) + body)] + args))))} + args)) + #End)]) + + _ + (#Left "Wrong syntax for Ex")} + tokens)) (def:'' .private (list\reversed list) #End - (All [a] (#Function ($' List a) ($' List a))) - (list\mix ("lux type check" (All [a] (#Function a (#Function ($' List a) ($' List a)))) + (All (_ a) + (#Function ($' List a) ($' List a))) + (list\mix ("lux type check" (All (_ a) + (#Function a (#Function ($' List a) ($' List a)))) (function'' [head tail] (#Item head tail))) #End list)) @@ -1291,7 +1393,7 @@ (def:''' .private (pairs xs) #End - (All [a] (-> ($' List a) ($' List (Tuple a a)))) + (All (_ a) (-> ($' List a) ($' List (Tuple a a)))) ({(#Item x (#Item y xs')) (#Item [x y] (pairs xs')) @@ -1316,7 +1418,7 @@ (def:''' .private (any? p xs) #End - (All [a] + (All (_ a) (-> (-> a Bit) ($' List a) Bit)) ({#End #0 @@ -1345,7 +1447,7 @@ (def:''' .private (list\composite xs ys) #End - (All [a] (-> ($' List a) ($' List a) ($' List a))) + (All (_ a) (-> ($' List a) ($' List a) ($' List a))) ({(#Item x xs') (#Item x (list\composite xs' ys)) @@ -1365,7 +1467,7 @@ (def:''' .private (function\flipped func) #End - (All [a b c] + (All (_ a b c) (-> (-> a b c) (-> b a c))) (function' [right left] (func left right))) @@ -1400,17 +1502,19 @@ ... (type: (Monad m) ... (Interface -... (: (All [a] (-> a (m a))) +... (: (All (_ a) (-> a (m a))) ... in) -... (: (All [a b] (-> (-> a (m b)) (m a) (m b))) +... (: (All (_ a b) (-> (-> a (m b)) (m a) (m b))) ... then))) ("lux def type tagged" Monad (#Named ["library/lux" "Monad"] - (All [m] - (Tuple (All [a] (-> a ($' m a))) - (All [a b] (-> (-> a ($' m b)) - ($' m a) - ($' m b)))))) + (All (_ !) + (Tuple (All (_ a) + (-> a ($' ! a))) + (All (_ a b) + (-> (-> a ($' ! b)) + ($' ! a) + ($' ! b)))))) (record$ (list)) ["in" "then"] #0) @@ -1480,9 +1584,7 @@ (def:''' .private (monad\each m f xs) #End - ... (All [m a b] - ... (-> (Monad m) (-> a (m b)) (List a) (m (List b)))) - (All [m a b] + (All (_ m a b) (-> ($' Monad m) (-> a ($' m b)) ($' List a) @@ -1500,9 +1602,7 @@ (def:''' .private (monad\mix m f y xs) #End - ... (All [m a b] - ... (-> (Monad m) (-> a b (m b)) b (List a) (m b))) - (All [m a b] + (All (_ m a b) (-> ($' Monad m) (-> a b ($' m b)) b @@ -1532,11 +1632,11 @@ (def:''' .private PList #End Type - (All [a] ($' List (Tuple Text a)))) + (All (_ a) ($' List (Tuple Text a)))) (def:''' .private (plist\value k plist) #End - (All [a] + (All (_ a) (-> Text ($' PList a) ($' Maybe a))) ({(#Item [[k' v] plist']) (if (text\= k k') @@ -1837,7 +1937,7 @@ (def:''' .private (function\composite f g) (list [(tag$ ["library/lux" "doc"]) (text$ "Function composition.")]) - (All [a b c] + (All (_ a b c) (-> (-> b c) (-> a b) (-> a c))) (function' [x] (f (g x)))) @@ -1911,7 +2011,7 @@ (def:''' .private (every? p xs) #End - (All [a] + (All (_ a) (-> (-> a Bit) ($' List a) Bit)) (list\mix (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) @@ -1945,7 +2045,7 @@ (def:''' .private (list\conjoint xs) #End - (All [a] + (All (_ a) (-> ($' List ($' List a)) ($' List a))) (list\mix list\composite #End (list\reversed xs))) @@ -2150,7 +2250,7 @@ (def:''' .private (list\interposed sep xs) #End - (All [a] + (All (_ a) (-> a ($' List a) ($' List a))) ({#End xs @@ -2327,6 +2427,24 @@ [_ (#Form (#Item [_ (#Identifier ["" ":~"])] (#Item expression #End)))] expression + [_0 (#Form (#Item [_1 (#Record (#Item [binding body] #End))] + (#Item value + #End)))] + [_0 (#Form (#Item [_1 (#Record (#Item [binding (normal_type body)] #End))] + (#Item value + #End)))] + + [_0 (#Form (#Item [_1 (#Identifier ["library/lux" "__adjusted_quantified_type__"])] + (#Item _permission + (#Item _level + (#Item body + #End)))))] + [_0 (#Form (#Item [_1 (#Identifier ["library/lux" "__adjusted_quantified_type__"])] + (#Item _permission + (#Item _level + (#Item (normal_type body) + #End)))))] + [_ (#Form (#Item type_fn args))] (list\mix ("lux type check" (-> Code Code Code) (function' [arg type_fn] (` (#.Apply (~ arg) (~ type_fn))))) @@ -2341,13 +2459,17 @@ (list) ({(#Item type #End) (do meta_monad - [type+ (full_expansion type)] - ({(#Item type' #End) - (in (list (normal_type type'))) + [initialized_quantification? (function' [lux] (#Right [lux (initialized_quantification? lux)]))] + (if initialized_quantification? + (do meta_monad + [type+ (full_expansion type)] + ({(#Item type' #End) + (in (list (normal_type type'))) - _ - (failure "The expansion of the type-syntax had to yield a single element.")} - type+)) + _ + (failure "The expansion of the type-syntax had to yield a single element.")} + type+)) + (in (list (..quantified (` (..type (~ type)))))))) _ (failure "Wrong syntax for type")} @@ -2356,7 +2478,9 @@ (macro:' .public (: tokens) (list) ({(#Item type (#Item value #End)) - (in_meta (list (` ("lux type check" (type (~ type)) (~ value))))) + (in_meta (list (` ("lux type check" + (..type (~ type)) + (~ value))))) _ (failure "Wrong syntax for :")} @@ -2365,7 +2489,9 @@ (macro:' .public (:as tokens) (list) ({(#Item type (#Item value #End)) - (in_meta (list (` ("lux type as" (type (~ type)) (~ value))))) + (in_meta (list (` ("lux type as" + (..type (~ type)) + (~ value))))) _ (failure "Wrong syntax for :as")} @@ -2373,7 +2499,8 @@ (def:''' .private (empty? xs) #End - (All [a] (-> ($' List a) Bit)) + (All (_ a) + (-> ($' List a) Bit)) ({#End #1 _ #0} xs)) @@ -2381,7 +2508,8 @@ (template [<name> <type> <value>] [(def:''' .private (<name> xy) #End - (All [a b] (-> (Tuple a b) <type>)) + (All (_ a b) + (-> (Tuple a b) <type>)) (let' [[x y] xy] <value>))] @@ -2931,7 +3059,7 @@ (failure "Wrong syntax for macro:"))) (def: (list\one f xs) - (All [a b] + (All (_ a b) (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs #End @@ -2999,7 +3127,7 @@ ("lux text clip" after_offset after_length input)))))) (def: (item idx xs) - (All [a] + (All (_ a) (-> Nat (List a) (Maybe a))) (case xs #End @@ -3199,6 +3327,52 @@ #None (#Left "Not expecting any type."))))) +(def: (type\encoded type) + (-> Type Text) + (case type + (#Primitive name params) + (case params + #End + name + + _ + ($_ text\composite "(" name " " (|> params (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")")) + + (#Sum _) + ($_ text\composite "(Or " (|> (flat_variant type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")") + + (#Product _) + ($_ text\composite "[" (|> (flat_tuple type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) "]") + + (#Function _) + ($_ text\composite "(-> " (|> (flat_lambda type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")") + + (#Parameter id) + (nat\encoded id) + + (#Var id) + ($_ text\composite "⌈v:" (nat\encoded id) "⌋") + + (#Ex id) + ($_ text\composite "⟨e:" (nat\encoded id) "⟩") + + (#UnivQ env body) + ($_ text\composite "(All " (type\encoded body) ")") + + (#ExQ env body) + ($_ text\composite "(Ex " (type\encoded body) ")") + + (#Apply _) + (let [[func args] (flat_application type)] + ($_ text\composite + "(" (type\encoded func) " " + (|> args (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) + ")")) + + (#Named name _) + (name\encoded name) + )) + (macro: .public (implementation tokens) (do meta_monad [tokens' (monad\each meta_monad expansion tokens) @@ -3210,7 +3384,9 @@ (in_meta tags) _ - (failure "No tags available for type."))) + (failure ($_ text\composite + "No tags available for type: " + (type\encoded struct_type))))) .let [tag_mappings (: (List [Text Code]) (list\each (function (_ tag) [(product\right tag) (tag$ tag)]) tags))] @@ -3304,12 +3480,14 @@ (failure "Wrong syntax for implementation:"))) (def: (function\identity value) - (All [a] (-> a a)) + (All (_ a) + (-> a a)) value) (def: (everyP itP tokens) - (All [a] (-> (-> (List Code) (Maybe [(List Code) a])) - (-> (List Code) (Maybe (List a))))) + (All (_ a) + (-> (-> (List Code) (Maybe [(List Code) a])) + (-> (List Code) (Maybe (List a))))) (case tokens (#Item _) (do maybe_monad @@ -3475,7 +3653,8 @@ (#Some type) _ - (#Some (` (.All (~ type_name) [(~+ (list\each local_identifier$ args))] (~ type)))))) + (#Some (` (.All ((~ type_name) (~+ (list\each local_identifier$ args))) + (~ type)))))) total_meta (let [meta (definition_annotations meta)] (` [(~ location_code) (#.Record (~ meta))]))]] @@ -3676,7 +3855,7 @@ relatives))) (def: (list\after amount list) - (All [a] (-> Nat (List a) (List a))) + (All (_ a) (-> Nat (List a) (List a))) (case [amount list] (^or [0 _] [_ #End]) list @@ -3829,7 +4008,8 @@ )) (def: (list\only p xs) - (All [a] (-> (-> a Bit) (List a) (List a))) + (All (_ a) + (-> (-> a Bit) (List a) (List a))) (case xs #End (list) @@ -3849,7 +4029,7 @@ output)) (def: (on_either f x1 x2) - (All [a b] + (All (_ a b) (-> (-> a (Maybe b)) a a (Maybe b))) (case (f x1) #None (f x2) @@ -3980,7 +4160,8 @@ ))) (def: (zipped/2 xs ys) - (All [a b] (-> (List a) (List b) (List [a b]))) + (All (_ a b) + (-> (List a) (List b) (List [a b]))) (case xs (#Item x xs') (case ys @@ -3993,52 +4174,6 @@ _ (list))) -(def: (type\encoded type) - (-> Type Text) - (case type - (#Primitive name params) - (case params - #End - name - - _ - ($_ text\composite "(" name " " (|> params (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")")) - - (#Sum _) - ($_ text\composite "(Or " (|> (flat_variant type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")") - - (#Product _) - ($_ text\composite "[" (|> (flat_tuple type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) "]") - - (#Function _) - ($_ text\composite "(-> " (|> (flat_lambda type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")") - - (#Parameter id) - (nat\encoded id) - - (#Var id) - ($_ text\composite "⌈v:" (nat\encoded id) "⌋") - - (#Ex id) - ($_ text\composite "⟨e:" (nat\encoded id) "⟩") - - (#UnivQ env body) - ($_ text\composite "(All " (type\encoded body) ")") - - (#ExQ env body) - ($_ text\composite "(Ex " (type\encoded body) ")") - - (#Apply _) - (let [[func args] (flat_application type)] - ($_ text\composite - "(" (type\encoded func) " " - (|> args (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) - ")")) - - (#Named name _) - (name\encoded name) - )) - (macro: .public (^open tokens) (case tokens (^ (list& [_ (#Form (list [_ (#Text alias)]))] body branches)) @@ -4100,7 +4235,8 @@ (failure "Wrong syntax for cond")))) (def: (enumeration' idx xs) - (All [a] (-> Nat (List a) (List [Nat a]))) + (All (_ a) + (-> Nat (List a) (List [Nat a]))) (case xs (#Item x xs') (#Item [idx x] (enumeration' ("lux i64 +" 1 idx) xs')) @@ -4109,7 +4245,8 @@ #End)) (def: (enumeration xs) - (All [a] (-> (List a) (List [Nat a]))) + (All (_ a) + (-> (List a) (List [Nat a]))) (enumeration' 0 xs)) (macro: .public (value@ tokens) @@ -4547,7 +4684,8 @@ (template [<name> <extension>] [(def: .public <name> - (All [s] (-> (I64 s) (I64 s))) + (All (_ s) + (-> (I64 s) (I64 s))) (|>> (<extension> 1)))] [++ "lux i64 +"] @@ -4555,7 +4693,8 @@ ) (def: (interleaved xs ys) - (All [a] (-> (List a) (List a) (List a))) + (All (_ a) + (-> (List a) (List a) (List a))) (case xs #End #End @@ -4943,7 +5082,8 @@ (failure (..wrong_syntax_error (name_of ..$))))) (def: .public (same? reference sample) - (All [a] (-> a a Bit)) + (All (_ a) + (-> a a Bit)) ("lux is" reference sample)) (macro: .public (^@ tokens) @@ -5354,24 +5494,26 @@ #None (failure "Wrong syntax for Interface")))) -(def: (recursive_type name body) - (-> Text Code Code) - (let [body' (|> body - nested_quantification - (with_replacements (list [name (` (#.Apply .Nothing (~ (type_parameter 0))))])))] - (` (#.Apply .Nothing (#.UnivQ #.End (~ body')))))) +(def: (recursive_type g!self g!dummy name body) + (-> Code Code Text Code Code) + (` ((.All ((~ g!self) (~ g!dummy)) + (~ (let$ (local_identifier$ name) (` (#.Apply .Nothing (~ g!self))) + body))) + .Nothing))) (macro: .public (Rec tokens) (case tokens (^ (list [_ (#Identifier "" name)] body)) (do meta_monad - [body' (expansion body)] + [body' (expansion body) + g!self (identifier "g!self") + g!dummy (identifier "g!dummy")] (case body' (^ (list body' labels)) - (in (list (..recursive_type name body') labels)) + (in (list (..recursive_type g!self g!dummy name body') labels)) (^ (list body')) - (in (list (..recursive_type name body'))) + (in (list (..recursive_type g!self g!dummy name body'))) _ (failure "Wrong syntax for Rec"))) diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux index c47951e89..c6f6a18a6 100644 --- a/stdlib/source/library/lux/abstract/apply.lux +++ b/stdlib/source/library/lux/abstract/apply.lux @@ -10,15 +10,15 @@ (Interface (: (Functor f) &functor) - (: (All [a b] + (: (All (_ a b) (-> (f a) (f (-> a b)) (f b))) on))) (implementation: .public (composite f_monad f_apply g_apply) - (All [F G] + (All (_ F G) (-> (Monad F) (Apply F) (Apply G) - ... TODO: Replace (All [a] (F (G a))) with (functor.Then F G) - (Apply (All [a] (F (G a)))))) + ... TODO: Replace (All (_ a) (F (G a))) with (functor.Then F G) + (Apply (All (_ a) (F (G a)))))) (def: &functor (functor.composite (value@ #&functor f_apply) diff --git a/stdlib/source/library/lux/abstract/codec.lux b/stdlib/source/library/lux/abstract/codec.lux index 0a1f8b2ba..e5cb66d50 100644 --- a/stdlib/source/library/lux/abstract/codec.lux +++ b/stdlib/source/library/lux/abstract/codec.lux @@ -15,7 +15,7 @@ decoded))) (implementation: .public (composite cb_codec ba_codec) - (All [a b c] + (All (_ a b c) (-> (Codec c b) (Codec b a) (Codec c a))) (def: encoded diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 3e0422762..06d8640e4 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -16,10 +16,10 @@ (Interface (: (Functor w) &functor) - (: (All [a] + (: (All (_ a) (-> (w a) a)) out) - (: (All [a] + (: (All (_ a) (-> (w a) (w (w a)))) disjoint))) diff --git a/stdlib/source/library/lux/abstract/comonad/cofree.lux b/stdlib/source/library/lux/abstract/comonad/cofree.lux index e7d9cea7f..f9bfc2dd1 100644 --- a/stdlib/source/library/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/library/lux/abstract/comonad/cofree.lux @@ -9,13 +9,13 @@ [a (F (CoFree F a))]) (implementation: .public (functor dsl) - (All [F] (-> (Functor F) (Functor (CoFree F)))) + (All (_ F) (-> (Functor F) (Functor (CoFree F)))) (def: (each f [head tail]) [(f head) (\ dsl each (each f) tail)])) (implementation: .public (comonad dsl) - (All [F] (-> (Functor F) (CoMonad (CoFree F)))) + (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 fd987f070..509669587 100644 --- a/stdlib/source/library/lux/abstract/enum.lux +++ b/stdlib/source/library/lux/abstract/enum.lux @@ -11,7 +11,7 @@ (: (-> e e) pred))) (def: .public (range enum from to) - (All [a] (-> (Enum a) a a (List a))) + (All (_ a) (-> (Enum a) a a (List a))) (let [(^open ".") enum] (loop [end to output #.End] diff --git a/stdlib/source/library/lux/abstract/equivalence.lux b/stdlib/source/library/lux/abstract/equivalence.lux index bfbe87a2d..d51ef9d9a 100644 --- a/stdlib/source/library/lux/abstract/equivalence.lux +++ b/stdlib/source/library/lux/abstract/equivalence.lux @@ -11,7 +11,8 @@ =))) (def: .public (rec sub) - (All [a] (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) + (All (_ a) + (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) (implementation (def: (= left right) (sub = left right)))) diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux index 78b647a59..a43110453 100644 --- a/stdlib/source/library/lux/abstract/functor.lux +++ b/stdlib/source/library/lux/abstract/functor.lux @@ -4,7 +4,7 @@ (type: .public (Functor f) (Interface - (: (All [a b] + (: (All (_ a b) (-> (-> a b) (-> (f a) (f b)))) each))) @@ -13,10 +13,10 @@ (f (Fix f))) (type: .public (Or f g) - (All [a] (.Or (f a) (g a)))) + (All (_ a) (.Or (f a) (g a)))) (def: .public (sum (^open "f\.") (^open "g\.")) - (All [F G] (-> (Functor F) (Functor G) (Functor (..Or F G)))) + (All (_ F G) (-> (Functor F) (Functor G) (Functor (..Or F G)))) (implementation (def: (each f fa|ga) (case fa|ga @@ -27,20 +27,20 @@ (#.Right (g\each f ga)))))) (type: .public (And f g) - (All [a] (.And (f a) (g a)))) + (All (_ a) (.And (f a) (g a)))) (def: .public (product (^open "f\.") (^open "g\.")) - (All [F G] (-> (Functor F) (Functor G) (Functor (..And F G)))) + (All (_ F G) (-> (Functor F) (Functor G) (Functor (..And F G)))) (implementation (def: (each f [fa ga]) [(f\each f fa) (g\each f ga)]))) (type: .public (Then f g) - (All [a] (f (g a)))) + (All (_ a) (f (g a)))) (def: .public (composite (^open "f\.") (^open "g\.")) - (All [F G] (-> (Functor F) (Functor G) (Functor (..Then F G)))) + (All (_ F G) (-> (Functor F) (Functor G) (Functor (..Then F G)))) (implementation (def: (each f fga) (f\each (g\each f) fga)))) diff --git a/stdlib/source/library/lux/abstract/functor/contravariant.lux b/stdlib/source/library/lux/abstract/functor/contravariant.lux index 374cb9a80..15b8053e6 100644 --- a/stdlib/source/library/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/library/lux/abstract/functor/contravariant.lux @@ -4,7 +4,7 @@ (type: .public (Functor f) (Interface - (: (All [a b] + (: (All (_ a b) (-> (-> b a) (-> (f a) (f b)))) each))) diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux index d97e9fcbb..d2af3e21c 100644 --- a/stdlib/source/library/lux/abstract/interval.lux +++ b/stdlib/source/library/lux/abstract/interval.lux @@ -19,14 +19,14 @@ top))) (def: .public (between enum bottom top) - (All [a] (-> (Enum a) a a (Interval a))) + (All (_ a) (-> (Enum a) a a (Interval a))) (implementation (def: &enum enum) (def: bottom bottom) (def: top top))) (def: .public (singleton enum elem) - (All [a] (-> (Enum a) a (Interval a))) + (All (_ a) (-> (Enum a) a (Interval a))) (implementation (def: &enum enum) (def: bottom elem) @@ -34,7 +34,7 @@ (template [<name> <comp>] [(def: .public (<name> interval) - (All [a] (-> (Interval a) Bit)) + (All (_ a) (-> (Interval a) Bit)) (let [(^open ",\.") interval] (<comp> ,\bottom ,\top)))] @@ -44,7 +44,7 @@ ) (def: .public (within? interval elem) - (All [a] (-> (Interval a) a Bit)) + (All (_ a) (-> (Interval a) a Bit)) (let [(^open ",\.") interval] (cond (inner? interval) (and (order.>= ,\&order ,\bottom elem) @@ -60,7 +60,7 @@ (template [<name> <limit>] [(def: .public (<name> elem interval) - (All [a] (-> a (Interval a) Bit)) + (All (_ a) (-> a (Interval a) Bit)) (let [(^open ".") interval] (= <limit> elem)))] @@ -69,45 +69,45 @@ ) (def: .public (borders? interval elem) - (All [a] (-> (Interval a) a Bit)) + (All (_ a) (-> (Interval a) a Bit)) (or (starts_with? elem interval) (ends_with? elem interval))) (implementation: .public (union left right) - (All [a] (-> (Interval a) (Interval a) (Interval a))) + (All (_ a) (-> (Interval a) (Interval a) (Interval a))) (def: &enum (value@ #&enum right)) (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom))) (def: top (order.max (\ right &order) (\ left top) (\ right top)))) (implementation: .public (intersection left right) - (All [a] (-> (Interval a) (Interval a) (Interval a))) + (All (_ a) (-> (Interval a) (Interval a) (Interval a))) (def: &enum (value@ #&enum right)) (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom))) (def: top (order.min (\ right &order) (\ left top) (\ right top)))) (implementation: .public (complement interval) - (All [a] (-> (Interval a) (Interval a))) + (All (_ a) (-> (Interval a) (Interval a))) (def: &enum (value@ #&enum interval)) (def: bottom (\ interval succ (\ interval top))) (def: top (\ interval pred (\ interval bottom)))) (def: .public (precedes? reference sample) - (All [a] (-> (Interval a) (Interval a) Bit)) + (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(^open ".") reference limit (\ reference bottom)] (and (< limit (\ sample bottom)) (< limit (\ sample top))))) (def: .public (succeeds? reference sample) - (All [a] (-> (Interval a) (Interval a) Bit)) + (All (_ a) (-> (Interval a) (Interval a) Bit)) (precedes? sample reference)) (template [<name> <comp>] [(def: .public (<name> reference sample) - (All [a] (-> a (Interval a) Bit)) + (All (_ a) (-> a (Interval a) Bit)) (let [(^open ",\.") sample] (and (<comp> reference ,\bottom) (<comp> reference ,\top))))] @@ -117,20 +117,20 @@ ) (def: .public (meets? reference sample) - (All [a] (-> (Interval a) (Interval a) Bit)) + (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(^open ",\.") reference limit (\ reference bottom)] (and (,\= limit (\ sample top)) (order.<= ,\&order limit (\ sample bottom))))) (def: .public (touches? reference sample) - (All [a] (-> (Interval a) (Interval a) Bit)) + (All (_ a) (-> (Interval a) (Interval a) Bit)) (or (meets? reference sample) (meets? sample reference))) (template [<name> <eq_side> <ineq> <ineq_side>] [(def: .public (<name> reference sample) - (All [a] (-> (Interval a) (Interval a) Bit)) + (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(^open ",\.") reference] (and (,\= (\ reference <eq_side>) (\ sample <eq_side>)) @@ -143,7 +143,7 @@ ) (implementation: .public equivalence - (All [a] (Equivalence (Interval a))) + (All (_ a) (Equivalence (Interval a))) (def: (= reference sample) (let [(^open ",\.") reference] @@ -151,7 +151,7 @@ (,\= ,\top (\ sample top)))))) (def: .public (nested? reference sample) - (All [a] (-> (Interval a) (Interval a) Bit)) + (All (_ a) (-> (Interval a) (Interval a) Bit)) (cond (or (singleton? sample) (and (inner? reference) (inner? sample)) (and (outer? reference) (outer? sample))) @@ -172,7 +172,7 @@ )) (def: .public (overlaps? reference sample) - (All [a] (-> (Interval a) (Interval a) Bit)) + (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(^open ",\.") reference] (and (not (\ ..equivalence = reference sample)) (cond (singleton? sample) diff --git a/stdlib/source/library/lux/abstract/mix.lux b/stdlib/source/library/lux/abstract/mix.lux index 9733066df..432fa6472 100644 --- a/stdlib/source/library/lux/abstract/mix.lux +++ b/stdlib/source/library/lux/abstract/mix.lux @@ -6,12 +6,12 @@ (type: .public (Mix F) (Interface - (: (All [a b] + (: (All (_ a b) (-> (-> b a a) a (F b) a)) mix))) (def: .public (with_monoid monoid mix value) - (All [F a] + (All (_ F a) (-> (Monoid a) (Mix F) (F a) a)) (let [(^open "/\.") monoid] (mix /\composite /\identity value))) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index ab03e9a18..b4d2eb7ed 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -7,7 +7,7 @@ [functor (#+ Functor)]]) (def: (list\mix f init xs) - (All [a b] + (All (_ a b) (-> (-> b a a) a (List b) a)) (case xs #.End @@ -17,7 +17,7 @@ (list\mix f (f x init) xs'))) (def: (list\size xs) - (All [a] (-> (List a) Nat)) + (All (_ a) (-> (List a) Nat)) (loop [counter 0 xs xs] (case xs @@ -28,14 +28,14 @@ (recur (++ counter) xs')))) (def: (reversed xs) - (All [a] + (All (_ a) (-> (List a) (List a))) (list\mix (function (_ head tail) (#.Item head tail)) #.End xs)) (def: (pairs xs) - (All [a] (-> (List a) (List [a a]))) + (All (_ a) (-> (List a) (List [a a]))) (case xs (#.Item x1 (#.Item x2 xs')) (#.Item [x1 x2] (pairs xs')) @@ -47,10 +47,10 @@ (Interface (: (Functor m) &functor) - (: (All [a] + (: (All (_ a) (-> a (m a))) in) - (: (All [a] + (: (All (_ a) (-> (m (m a)) (m a))) conjoint))) @@ -107,14 +107,14 @@ (#.Left "Wrong syntax for 'do'"))) (def: .public (then monad f) - (All [! a b] + (All (_ ! a b) (-> (Monad !) (-> a (! b)) (-> (! a) (! b)))) (|>> (\ monad each f) (\ monad conjoint))) (def: .public (all monad) - (All [! a] + (All (_ ! a) (-> (Monad !) (List (! a)) (! (List a)))) (let [(^open "!\.") monad] @@ -130,7 +130,7 @@ !\conjoint))))) (def: .public (each monad f) - (All [M a b] + (All (_ M a b) (-> (Monad M) (-> a (M b)) (List a) (M (List b)))) (let [(^open "!\.") monad] @@ -146,7 +146,7 @@ !\conjoint))))) (def: .public (only monad f) - (All [! a b] + (All (_ ! a b) (-> (Monad !) (-> a (! Bit)) (List a) (! (List a)))) (let [(^open "!\.") monad] @@ -166,7 +166,7 @@ !\conjoint))))) (def: .public (mix monad f init xs) - (All [M a b] + (All (_ M a b) (-> (Monad M) (-> b a (M a)) a (List b) (M a))) (case xs diff --git a/stdlib/source/library/lux/abstract/monad/free.lux b/stdlib/source/library/lux/abstract/monad/free.lux index 101a23d87..3dde675a6 100644 --- a/stdlib/source/library/lux/abstract/monad/free.lux +++ b/stdlib/source/library/lux/abstract/monad/free.lux @@ -12,7 +12,7 @@ (#Effect (F (Free F a))))) (implementation: .public (functor dsl) - (All [F] (-> (Functor F) (Functor (Free F)))) + (All (_ F) (-> (Functor F) (Functor (Free F)))) (def: (each f ea) (case ea @@ -23,7 +23,7 @@ (#Effect (\ dsl each (each f) value))))) (implementation: .public (apply dsl) - (All [F] (-> (Functor F) (Apply (Free F)))) + (All (_ F) (-> (Functor F) (Apply (Free F)))) (def: &functor (..functor dsl)) @@ -43,7 +43,7 @@ ))) (implementation: .public (monad dsl) - (All [F] (-> (Functor F) (Monad (Free F)))) + (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 98acab0e1..58e7e4633 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -14,11 +14,11 @@ (type: .public (IxMonad m) (Interface - (: (All [p a] + (: (All (_ p a) (-> a (m p p a))) in) - (: (All [ii it io vi vo] + (: (All (_ ii it io vi vo) (-> (-> vi (m it io vo)) (m ii it vi) (m ii io vo))) @@ -50,7 +50,7 @@ binding)) (def: (pair_list [binding value]) - (All [a] (-> [a a] (List a))) + (All (_ a) (-> [a a] (List a))) (list binding value)) (def: named_monad diff --git a/stdlib/source/library/lux/abstract/monoid.lux b/stdlib/source/library/lux/abstract/monoid.lux index 3012bd4bd..b8a31a356 100644 --- a/stdlib/source/library/lux/abstract/monoid.lux +++ b/stdlib/source/library/lux/abstract/monoid.lux @@ -10,7 +10,7 @@ composite))) (def: .public (and left right) - (All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r]))) + (All (_ l r) (-> (Monoid l) (Monoid r) (Monoid [l r]))) (implementation (def: identity [(\ left identity) (\ right identity)]) diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux index 5c5cde91b..16c927ac4 100644 --- a/stdlib/source/library/lux/abstract/predicate.lux +++ b/stdlib/source/library/lux/abstract/predicate.lux @@ -17,7 +17,7 @@ (function.constant <identity_value>)) (def: .public (<composition_name> left right) - (All [a] (-> (Predicate a) (Predicate a) (Predicate a))) + (All (_ a) (-> (Predicate a) (Predicate a) (Predicate a))) (function (_ value) (<composition> (left value) (right value))))] @@ -28,7 +28,7 @@ (template [<name> <identity> <composition>] [(implementation: .public <name> - (All [a] (Monoid (Predicate a))) + (All (_ a) (Monoid (Predicate a))) (def: identity <identity>) (def: composite <composition>))] @@ -38,17 +38,17 @@ ) (def: .public (complement predicate) - (All [a] (-> (Predicate a) (Predicate a))) + (All (_ a) (-> (Predicate a) (Predicate a))) (|>> predicate not)) (def: .public (difference sub base) - (All [a] (-> (Predicate a) (Predicate a) (Predicate a))) + (All (_ a) (-> (Predicate a) (Predicate a) (Predicate a))) (function (_ value) (.and (base value) (not (sub value))))) (def: .public (rec predicate) - (All [a] + (All (_ a) (-> (-> (Predicate a) (Predicate a)) (Predicate a))) (function (recur input) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 9cc286c29..6f3f64403 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -31,7 +31,7 @@ (type: Stack (Record - {#bottom (Maybe Nat) + {#bottom (Maybe Code) #top (List Code)})) (def: aliases^ @@ -41,15 +41,19 @@ <code>.record (<>.else (list)))) +(def: top^ + (Parser (List Code)) + (<code>.tuple (<>.some <code>.any))) + (def: bottom^ - (Parser Nat) - (<code>.form (<>.after (<code>.this! (` #.Parameter)) <code>.nat))) + (Parser Code) + (<code>.not ..top^)) (def: stack^ (Parser Stack) (<>.either (<>.and (<>.maybe bottom^) - (<code>.tuple (<>.some <code>.any))) - (<>.and (|> bottom^ (<>\each (|>> #.Some))) + ..top^) + (<>.and (<>\each (|>> #.Some) bottom^) (<>\in (list))))) (def: (stack_mix tops bottom) @@ -79,8 +83,8 @@ (code.replaced (code.local_identifier from) to pre)) aliased aliases))] - (case [(|> inputs (value@ #bottom) (maybe\each (|>> code.nat (~) #.Parameter (`)))) - (|> outputs (value@ #bottom) (maybe\each (|>> code.nat (~) #.Parameter (`))))] + (case [(value@ #bottom inputs) + (value@ #bottom outputs)] [(#.Some bottomI) (#.Some bottomO)] (monad.do meta.monad [inputC (singleton (macro.full_expansion (stack_mix (value@ #top inputs) bottomI))) @@ -93,16 +97,17 @@ (monad.do meta.monad [inputC (singleton (macro.full_expansion (stack_mix (value@ #top inputs) (maybe.else g!stack ?bottomI)))) outputC (singleton (macro.full_expansion (stack_mix (value@ #top outputs) (maybe.else g!stack ?bottomO))))] - (in (list (` (All [(~ g!stack)] - (-> (~ (de_alias inputC)) - (~ (de_alias outputC)))))))))))) + (with_identifiers [g!_] + (in (list (` (All ((~ g!_) (~ g!stack)) + (-> (~ (de_alias inputC)) + (~ (de_alias outputC))))))))))))) (def: begin! Any []) (def: end! - (All [a] (-> [Any a] a)) + (All (_ a) (-> [Any a] a)) (function (_ [_ top]) top)) @@ -129,14 +134,14 @@ (|>> (~+ commands))))))) (syntax: .public (apply [arity (<>.only (n.> 0) <code>.nat)]) - (with_identifiers [g! g!func g!stack g!output] + (with_identifiers [g!_ g!func g!stack g!output] (monad.do {! meta.monad} [g!inputs (|> (macro.identifier "input") (list.repeated arity) (monad.all !))] - (in (list (` (: (All [(~+ g!inputs) (~ g!output)] + (in (list (` (: (All ((~ g!_) (~+ g!inputs) (~ g!output)) (-> (-> (~+ g!inputs) (~ g!output)) (=> [(~+ g!inputs)] [(~ g!output)]))) - (function ((~ g!) (~ g!func)) - (function ((~ g!) (~ (stack_mix g!inputs g!stack))) + (function ((~ g!_) (~ g!func)) + (function ((~ g!_) (~ (stack_mix g!inputs g!stack))) [(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))) (template [<arity>] @@ -148,52 +153,52 @@ ) (def: .public (push x) - (All [a] (-> a (=> [] [a]))) + (All (_ a) (-> a (=> [] [a]))) (function (_ stack) [stack x])) (def: .public drop - (All [t] (=> [t] [])) + (All (_ t) (=> [t] [])) (function (_ [stack top]) stack)) (def: .public nip - (All [_ a] (=> [_ a] [a])) + (All (_ _ a) (=> [_ a] [a])) (function (_ [[stack _] top]) [stack top])) (def: .public dup - (All [a] (=> [a] [a a])) + (All (_ a) (=> [a] [a a])) (function (_ [stack top]) [[stack top] top])) (def: .public swap - (All [a b] (=> [a b] [b a])) + (All (_ a b) (=> [a b] [b a])) (function (_ [[stack l] r]) [[stack r] l])) (def: .public rotL - (All [a b c] (=> [a b c] [b c a])) + (All (_ a b c) (=> [a b c] [b c a])) (function (_ [[[stack a] b] c]) [[[stack b] c] a])) (def: .public rotR - (All [a b c] (=> [a b c] [c a b])) + (All (_ a b c) (=> [a b c] [c a b])) (function (_ [[[stack a] b] c]) [[[stack c] a] b])) (def: .public && - (All [a b] (=> [a b] [(Tuple a b)])) + (All (_ a b) (=> [a b] [(Tuple a b)])) (function (_ [[stack l] r]) [stack [l r]])) (def: .public ||L - (All [a b] (=> [a] [(Or a b)])) + (All (_ a b) (=> [a] [(Or a b)])) (function (_ [stack l]) [stack (0 #0 l)])) (def: .public ||R - (All [a b] (=> [b] [(Or a b)])) + (All (_ a b) (=> [b] [(Or a b)])) (function (_ [stack r]) [stack (0 #1 r)])) @@ -249,7 +254,7 @@ ) (def: .public if - (All [___a ___z] + (All (_ ___a ___z) (=> {then (=> ___a ___z) else (=> ___a ___z)} ___a [Bit then else] ___z)) @@ -259,14 +264,14 @@ (else stack)))) (def: .public call - (All [___a ___z] + (All (_ ___a ___z) (=> {quote (=> ___a ___z)} ___a [quote] ___z)) (function (_ [stack quote]) (quote stack))) (def: .public loop - (All [___] + (All (_ ___) (=> {test (=> ___ ___ [Bit])} ___ [test] ___)) (function (loop [stack pred]) @@ -276,21 +281,21 @@ stack')))) (def: .public dip - (All [___ a] + (All (_ ___ a) (=> ___ [a (=> ___ ___)] ___ [a])) (function (_ [[stack a] quote]) [(quote stack) a])) (def: .public dip/2 - (All [___ a b] + (All (_ ___ a b) (=> ___ [a b (=> ___ ___)] ___ [a b])) (function (_ [[[stack a] b] quote]) [[(quote stack) a] b])) (def: .public do - (All [___a ___z] + (All (_ ___a ___z) (=> {body (=> ___a ___z) pred (=> ___z ___a [Bit])} ___a [pred body] @@ -299,7 +304,7 @@ [[(body stack) pred] body])) (def: .public while - (All [___a ___z] + (All (_ ___a ___z) (=> {body (=> ___z ___a) pred (=> ___a ___z [Bit])} ___a [pred body] @@ -311,21 +316,21 @@ stack')))) (def: .public compose - (All [___a ___ ___z] + (All (_ ___a ___ ___z) (=> [(=> ___a ___) (=> ___ ___z)] [(=> ___a ___z)])) (function (_ [[stack f] g]) [stack (|>> f g)])) (def: .public partial - (All [___a ___z a] + (All (_ ___a ___z a) (=> ___a [a (=> ___a [a] ___z)] ___a [(=> ___a ___z)])) (function (_ [[stack arg] quote]) [stack (|>> (push arg) quote)])) (word: .public when - (All [___] + (All (_ ___) (=> {body (=> ___ ___)} ___ [Bit body] ___)) @@ -335,7 +340,7 @@ if) (word: .public ? - (All [a] + (All (_ a) (=> [Bit a a] [a])) rotL (push ..drop) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index f7f5644d3..6d47288df 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -47,7 +47,7 @@ (Resolver [<Mail> Mailbox])]))] (def: (pending [read write]) - (All [a] + (All (_ a) (-> (Rec Mailbox [(Async [a Mailbox]) (Resolver [a Mailbox])]) @@ -82,7 +82,7 @@ #on_mail (-> (Mail s) s (Actor s) (Async (Try s)))})) (def: .public (spawn! behavior init) - (All [o s] (-> (Behavior o s) o (IO (Actor s)))) + (All (_ o s) (-> (Behavior o s) o (IO (Actor s)))) (io (let [[on_init on_mail] behavior self (:sharing [o s] (Behavior o s) @@ -110,7 +110,7 @@ self))) (def: .public (alive? actor) - (All [s] (-> (Actor s) (IO Bit))) + (All (_ s) (-> (Actor s) (IO Bit))) (let [[obituary _] (value@ #obituary (:representation actor))] (|> obituary async.value @@ -122,18 +122,18 @@ bit.no)))))) (def: .public (obituary' actor) - (All [s] (-> (Actor s) (IO (Maybe (Obituary s))))) + (All (_ s) (-> (Actor s) (IO (Maybe (Obituary s))))) (let [[obituary _] (value@ #obituary (:representation actor))] (async.value obituary))) (def: .public obituary - (All [s] (-> (Actor s) (Async (Obituary s)))) + (All (_ s) (-> (Actor s) (Async (Obituary s)))) (|>> :representation (value@ #obituary) product.left)) (def: .public (mail! mail actor) - (All [s] (-> (Mail s) (Actor s) (IO (Try Any)))) + (All (_ s) (-> (Mail s) (Actor s) (IO (Try Any)))) (do {! io.monad} [alive? (..alive? actor)] (if alive? @@ -161,7 +161,7 @@ (-> s (Actor s) (Async (Try [s o])))) (def: (mail message) - (All [s o] (-> (Message s o) [(Async (Try o)) (Mail s)])) + (All (_ s o) (-> (Message s o) [(Async (Try o)) (Mail s)])) (let [[async resolve] (:sharing [s o] (Message s o) message @@ -185,7 +185,7 @@ (async.resolved (#try.Failure error))))))])) (def: .public (tell! message actor) - (All [s o] (-> (Message s o) (Actor s) (Async (Try o)))) + (All (_ s o) (-> (Message s o) (Actor s) (Async (Try o)))) (let [[async mail] (..mail message)] (do async.monad [outcome (async.future (..mail! mail actor))] @@ -199,16 +199,16 @@ ) (def: (default_on_mail mail state self) - (All [s] (-> (Mail s) s (Actor s) (Async (Try s)))) + (All (_ s) (-> (Mail s) s (Actor s) (Async (Try s)))) (mail state self)) (def: .public default - (All [s] (Behavior s s)) + (All (_ s) (Behavior s s)) {#on_init function.identity #on_mail ..default_on_mail}) (def: .public (poison! actor) - (All [s] (-> (Actor s) (IO (Try Any)))) + (All (_ s) (-> (Actor s) (IO (Try Any)))) (..mail! (function (_ state self) (async.resolved (exception.except ..poisoned []))) actor)) @@ -272,7 +272,7 @@ (~ state_type) (def: (~ export_policy) (~ g!actor) - (All [(~+ g!vars)] + (All ((~ g!_) (~+ g!vars)) (..Behavior (~ state_type) ((~ g!type) (~+ g!vars)))) {#..on_init (|>> ((~! abstract.:abstraction) (~ g!type))) #..on_mail (~ (..on_mail g!_ ?on_mail))}) @@ -336,7 +336,7 @@ g!self (|> signature (value@ #self) code.local_identifier)]] (in (list (` (def: (~ export_policy) ((~ g!message) (~+ g!inputsC)) (~ (|annotations|.format annotations)) - (All [(~+ g!all_vars)] + (All ((~ g!_) (~+ g!all_vars)) (-> (~+ g!inputsT) (..Message (~ (value@ #abstract.abstraction actor_scope)) (~ output_type)))) @@ -357,7 +357,7 @@ (def: stop! false) (def: .public (observe! action channel actor) - (All [e s] (-> (-> e Stop (Mail s)) (Channel e) (Actor s) (IO Any))) + (All (_ e s) (-> (-> e Stop (Mail s)) (Channel e) (Actor s) (IO Any))) (let [signal (: (Atom Bit) (atom.atom ..continue!)) stop (: Stop diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index c996e1dcc..90229a9f5 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -27,7 +27,7 @@ ... Sets an async's value if it has not been done yet. (def: (resolver async) - (All [a] (-> (Async a) (Resolver a))) + (All (_ a) (-> (Async a) (Resolver a))) (function (resolve value) (let [async (:representation async)] (do {! io.monad} @@ -48,22 +48,22 @@ (resolve value)))))))) (def: .public (resolved value) - (All [a] (-> a (Async a))) + (All (_ a) (-> a (Async a))) (:abstraction (atom [(#.Some value) (list)]))) (def: .public (async _) - (All [a] (-> Any [(Async a) (Resolver a)])) + (All (_ a) (-> Any [(Async a) (Resolver a)])) (let [async (:abstraction (atom [#.None (list)]))] [async (..resolver async)])) (def: .public value - (All [a] (-> (Async a) (IO (Maybe a)))) + (All (_ a) (-> (Async a) (IO (Maybe a)))) (|>> :representation atom.read! (\ io.functor each product.left))) (def: .public (upon! f async) - (All [a] (-> (-> a (IO Any)) (Async a) (IO Any))) + (All (_ a) (-> (-> a (IO Any)) (Async a) (IO Any))) (do {! io.monad} [.let [async (:representation async)] (^@ old [_value _observers]) (atom.read! async)] @@ -81,7 +81,7 @@ ) (def: .public resolved? - (All [a] (-> (Async a) (IO Bit))) + (All (_ a) (-> (Async a) (IO Bit))) (|>> ..value (\ io.functor each (|>> (case> #.None @@ -126,7 +126,7 @@ ma)))) (def: .public (and left right) - (All [a b] (-> (Async a) (Async b) (Async [a b]))) + (All (_ a b) (-> (Async a) (Async b) (Async [a b]))) (let [[read! write!] (:sharing [a b] [(Async a) (Async b)] [left right] @@ -142,7 +142,7 @@ read!)) (def: .public (or left right) - (All [a b] (-> (Async a) (Async b) (Async (Or a b)))) + (All (_ a b) (-> (Async a) (Async b) (Async (Or a b)))) (let [[a|b resolve] (..async [])] (with_expansions [<sides> (template [<async> <tag>] @@ -156,7 +156,7 @@ a|b)))) (def: .public (either left right) - (All [a] (-> (Async a) (Async a) (Async a))) + (All (_ a) (-> (Async a) (Async a) (Async a))) (let [[left||right resolve] (..async [])] (`` (exec (~~ (template [<async>] @@ -167,7 +167,7 @@ left||right)))) (def: .public (schedule! milli_seconds computation) - (All [a] (-> Nat (IO a) (Async a))) + (All (_ a) (-> Nat (IO a) (Async a))) (let [[!out resolve] (..async [])] (exec (|> (do io.monad @@ -178,11 +178,11 @@ !out))) (def: .public future - (All [a] (-> (IO a) (Async a))) + (All (_ a) (-> (IO a) (Async a))) (..schedule! 0)) (def: .public (after milli_seconds value) - (All [a] (-> Nat a (Async a))) + (All (_ a) (-> Nat a (Async a))) (..schedule! milli_seconds (io value))) (def: .public (delay milli_seconds) @@ -190,6 +190,6 @@ (..after milli_seconds [])) (def: .public (within milli_seconds async) - (All [a] (-> Nat (Async a) (Async (Maybe a)))) + (All (_ a) (-> Nat (Async a) (Async (Maybe a)))) (..or (..delay milli_seconds) async)) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 5be4a9059..963400278 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -55,21 +55,21 @@ (array.Array a))) (def: .public (atom value) - (All [a] (-> a (Atom a))) + (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: .public (read! atom) - (All [a] (-> (Atom a) (IO a))) + (All (_ a) (-> (Atom a) (IO a))) (io.io (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::get (:representation atom))] (for {@.old <jvm> @.jvm <jvm>} (<read> 0 (:representation atom)))))) (def: .public (compare_and_swap! current new atom) - (All [a] (-> a a (Atom a) (IO Bit))) + (All (_ a) (-> a a (Atom a) (IO Bit))) (io.io (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::compareAndSet current new (:representation atom))] (for {@.old <jvm> @.jvm <jvm>} @@ -81,7 +81,7 @@ )) (def: .public (update! f atom) - (All [a] (-> (-> a a) (Atom a) (IO [a a]))) + (All (_ a) (-> (-> a a) (Atom a) (IO [a a]))) (loop [_ []] (do io.monad [old (read! atom) @@ -92,7 +92,7 @@ (recur []))))) (def: .public (write! value atom) - (All [a] (-> a (Atom a) (IO a))) + (All (_ a) (-> a (Atom a) (IO a))) (|> atom (..update! (function.constant value)) (io\each product.left))) diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index c31908da3..7c13df0f4 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -30,7 +30,7 @@ feed))) (def: (sink resolve) - (All [a] + (All (_ a) (-> (async.Resolver (Maybe [a (Channel a)])) (Sink a))) (let [sink (atom.atom resolve)] @@ -79,7 +79,7 @@ (recur [])))))))))) (def: .public (channel _) - (All [a] (-> Any [(Channel a) (Sink a)])) + (All (_ a) (-> Any [(Channel a) (Sink a)])) (let [[async resolve] (async.async [])] [async (..sink resolve)])) @@ -151,7 +151,7 @@ (-> a (IO (Maybe Any)))) (def: .public (subscribe! subscriber channel) - (All [a] (-> (Subscriber a) (Channel a) (IO Any))) + (All (_ a) (-> (Subscriber a) (Channel a) (IO Any))) (io (exec (: (Async Any) (loop [channel channel] @@ -171,7 +171,7 @@ []))) (def: .public (only pass? channel) - (All [a] (-> (-> a Bit) (Channel a) (Channel a))) + (All (_ a) (-> (-> a Bit) (Channel a) (Channel a))) (do async.monad [item channel] (case item @@ -185,13 +185,13 @@ (in #.None)))) (def: .public (of_async async) - (All [a] (-> (Async a) (Channel a))) + (All (_ a) (-> (Async a) (Channel a))) (async\each (function (_ value) (#.Some [value ..empty])) async)) (def: .public (mix f init channel) - (All [a b] + (All (_ a b) (-> (-> b a (Async a)) a (Channel b) (Async a))) (do {! async.monad} @@ -206,7 +206,7 @@ (mix f init' tail))))) (def: .public (mixes f init channel) - (All [a b] + (All (_ a b) (-> (-> b a (Async a)) a (Channel b) (Channel a))) (do {! async.monad} @@ -221,7 +221,7 @@ (in (#.Some [init (mixes f init' tail)])))))) (def: .public (poll milli_seconds action) - (All [a] + (All (_ a) (-> Nat (IO a) [(Channel a) (Sink a)])) (let [[output sink] (channel [])] (exec @@ -237,7 +237,7 @@ (..poll milli_seconds (io []))) (def: .public (iterations f init) - (All [s o] (-> (-> s (Async (Maybe [s o]))) s (Channel o))) + (All (_ s o) (-> (-> s (Async (Maybe [s o]))) s (Channel o))) (do async.monad [?next (f init)] (case ?next @@ -248,7 +248,7 @@ (in #.None)))) (def: (distinct' equivalence previous channel) - (All [a] (-> (Equivalence a) a (Channel a) (Channel a))) + (All (_ a) (-> (Equivalence a) a (Channel a) (Channel a))) (do async.monad [item channel] (case item @@ -261,7 +261,7 @@ (in #.None)))) (def: .public (distinct equivalence channel) - (All [a] (-> (Equivalence a) (Channel a) (Channel a))) + (All (_ a) (-> (Equivalence a) (Channel a) (Channel a))) (do async.monad [item channel] (in (case item @@ -272,7 +272,7 @@ #.None)))) (def: .public (list channel) - (All [a] (-> (Channel a) (Async (List a)))) + (All (_ a) (-> (Channel a) (Async (List a)))) (do {! async.monad} [item channel] (case item @@ -284,7 +284,7 @@ (in #.End)))) (def: .public (sequential milli_seconds values) - (All [a] (-> Nat (List a) (Channel a))) + (All (_ a) (-> Nat (List a) (Channel a))) (case values #.End ..empty diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 8f2378d3d..f0ff9d7ba 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -47,7 +47,7 @@ #waiting_list queue.empty})))) (def: .public (wait! semaphore) - (Ex [k] (-> Semaphore (Async Any))) + (Ex (_ k) (-> Semaphore (Async Any))) (let [semaphore (:representation semaphore) [signal sink] (: [(Async Any) (Resolver Any)] (async.async []))] @@ -72,7 +72,7 @@ ["Max Positions" (%.nat max_positions)])) (def: .public (signal! semaphore) - (Ex [k] (-> Semaphore (Async (Try Int)))) + (Ex (_ k) (-> Semaphore (Async (Try Int)))) (let [semaphore (:representation semaphore)] (async.future (do {! io.monad} @@ -114,7 +114,7 @@ (|>> :representation ..signal!)) (def: .public (synchronize! mutex procedure) - (All [a] (-> Mutex (IO (Async a)) (Async a))) + (All (_ a) (-> Mutex (IO (Async a)) (Async a))) (do async.monad [_ (..acquire! mutex) output (io.run! procedure) diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index cb6a1e702..d8bb2568b 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -29,15 +29,15 @@ (Atom [a (List (Sink a))]) (def: .public (var value) - (All [a] (-> a (Var a))) + (All (_ a) (-> a (Var a))) (:abstraction (atom.atom [value (list)]))) (def: read! - (All [a] (-> (Var a) a)) + (All (_ a) (-> (Var a) a)) (|>> :representation atom.read! io.run! product.left)) (def: (un_follow! sink var) - (All [a] (-> (Sink a) (Var a) (IO Any))) + (All (_ a) (-> (Sink a) (Var a) (IO Any))) (do io.monad [_ (atom.update! (function (_ [value observers]) [value (list.only (|>> (same? sink) not) observers)]) @@ -45,7 +45,7 @@ (in []))) (def: (write! new_value var) - (All [a] (-> a (Var a) (IO Any))) + (All (_ a) (-> a (Var a) (IO Any))) (do {! io.monad} [.let [var' (:representation var)] (^@ old [old_value observers]) (atom.read! var') @@ -66,7 +66,7 @@ (write! new_value var)))) (def: .public (follow! target) - (All [a] (-> (Var a) (IO [(Channel a) (Sink a)]))) + (All (_ a) (-> (Var a) (IO [(Channel a) (Sink a)]))) (do io.monad [.let [[channel sink] (frp.channel [])] _ (atom.update! (function (_ [value observers]) @@ -82,13 +82,13 @@ #current a})) (type: Tx - (List (Ex [a] (Tx_Frame a)))) + (List (Ex (_ a) (Tx_Frame a)))) (type: .public (STM a) (-> Tx [Tx a])) (def: (var_value var tx) - (All [a] (-> (Var a) Tx (Maybe a))) + (All (_ a) (-> (Var a) Tx (Maybe a))) (|> tx (list.example (function (_ [_var _original _current]) (same? (:as (Var Any) var) @@ -98,7 +98,7 @@ :expected)) (def: .public (read var) - (All [a] (-> (Var a) (STM a))) + (All (_ a) (-> (Var a) (STM a))) (function (_ tx) (case (var_value var tx) (#.Some value) @@ -110,7 +110,7 @@ value])))) (def: (with_updated_var var value tx) - (All [a] (-> (Var a) a Tx Tx)) + (All (_ a) (-> (Var a) a Tx Tx)) (case tx #.End #.End @@ -128,7 +128,7 @@ (with_updated_var var value tx'))))) (def: .public (write value var) - (All [a] (-> a (Var a) (STM Any))) + (All (_ a) (-> a (Var a) (STM Any))) (function (_ tx) (case (var_value var tx) (#.Some _) @@ -173,7 +173,7 @@ (ma tx'))))) (def: .public (update f var) - (All [a] (-> (-> a a) (Var a) (STM [a a]))) + (All (_ a) (-> (-> a a) (Var a) (STM [a a]))) (do ..monad [a (..read var) .let [a' (f a)] @@ -187,7 +187,7 @@ tx)) (def: (commit_var! [_var _original _current]) - (-> (Ex [a] (Tx_Frame a)) (IO Any)) + (-> (Ex (_ a) (Tx_Frame a)) (IO Any)) (if (same? _original _current) (io []) (..write! _current _var))) @@ -201,8 +201,8 @@ (def: pending_commits (Atom (Rec Commits - [(Async [(Ex [a] (Commit a)) Commits]) - (Resolver [(Ex [a] (Commit a)) Commits])])) + [(Async [(Ex (_ a) (Commit a)) Commits]) + (Resolver [(Ex (_ a) (Commit a)) Commits])])) (atom (async.async []))) (def: commit_processor_flag @@ -210,7 +210,7 @@ (atom #0)) (def: (issue_commit! commit) - (All [a] (-> (Commit a) (IO Any))) + (All (_ a) (-> (Commit a) (IO Any))) (let [entry [commit (async.async [])]] (do {! io.monad} [|commits|&resolve (atom.read! pending_commits)] @@ -229,7 +229,7 @@ (recur tail))))))) (def: (process_commit! commit) - (All [a] (-> (Commit a) (IO Any))) + (All (_ a) (-> (Commit a) (IO Any))) (let [[stm_proc output resolve] commit [finished_tx value] (stm_proc fresh_tx)] (if (can_commit? finished_tx) @@ -258,7 +258,7 @@ ))) (def: .public (commit! stm_proc) - (All [a] (-> (STM a) (Async a))) + (All (_ a) (-> (STM a) (Async a))) (let [[output resolver] (async.async [])] (exec (io.run! (do io.monad diff --git a/stdlib/source/library/lux/control/continuation.lux b/stdlib/source/library/lux/control/continuation.lux index f56d127c7..ab9ec5ad7 100644 --- a/stdlib/source/library/lux/control/continuation.lux +++ b/stdlib/source/library/lux/control/continuation.lux @@ -17,15 +17,15 @@ (-> (-> i o) o)) (def: .public (continued next cont) - (All [i o] (-> (-> i o) (Cont i o) o)) + (All (_ i o) (-> (-> i o) (Cont i o) o)) (cont next)) (def: .public result - (All [a] (-> (Cont a a) a)) + (All (_ a) (-> (Cont a a) a)) (..continued function.identity)) (def: .public (with_current f) - (All [a b z] + (All (_ a b z) (-> (-> (-> a (Cont b z)) (Cont a z)) (Cont a z))) @@ -38,12 +38,12 @@ (in (list (` (.function ((~ g!_) (~ g!k)) ((~ g!k) (~ expr)))))))) (def: .public (reset scope) - (All [i o] (-> (Cont i i) (Cont i o))) + (All (_ i o) (-> (Cont i i) (Cont i o))) (function (_ k) (k (result scope)))) (def: .public (shift f) - (All [a] + (All (_ a) (-> (-> (-> a (Cont a a)) (Cont a a)) (Cont a a))) @@ -52,14 +52,14 @@ function.identity))) (implementation: .public functor - (All [o] (Functor (All [i] (Cont i o)))) + (All (_ o) (Functor (All (_ i) (Cont i o)))) (def: (each f fv) (function (_ k) (fv (function.composite k f))))) (implementation: .public apply - (All [o] (Apply (All [i] (Cont i o)))) + (All (_ o) (Apply (All (_ i) (Cont i o)))) (def: &functor ..functor) @@ -70,7 +70,7 @@ (function (_ f)) ff)))) (implementation: .public monad - (All [o] (Monad (All [i] (Cont i o)))) + (All (_ o) (Monad (All (_ i) (Cont i o)))) (def: &functor ..functor) @@ -82,7 +82,7 @@ (ffa (continued k))))) (def: .public (portal init) - (All [i o z] + (All (_ i o z) (-> i (Cont [(-> i (Cont o z)) i] diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index bdca98684..4998142f7 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -32,11 +32,11 @@ #constructor (-> a Text)})) (def: .public (match? exception error) - (All [e] (-> (Exception e) Text Bit)) + (All (_ e) (-> (Exception e) Text Bit)) (text.starts_with? (value@ #label exception) error)) (def: .public (when exception then try) - (All [e a] + (All (_ e a) (-> (Exception e) (-> Text a) (Try a) (Try a))) (case try @@ -53,7 +53,7 @@ (#//.Failure error))))) (def: .public (otherwise else try) - (All [a] + (All (_ a) (-> (-> Text a) (Try a) a)) (case try (#//.Success output) @@ -63,15 +63,15 @@ (else error))) (def: .public (error exception message) - (All [e] (-> (Exception e) e Text)) + (All (_ e) (-> (Exception e) e Text)) ((value@ #..constructor exception) message)) (def: .public (except exception message) - (All [e a] (-> (Exception e) e (Try a))) + (All (_ e a) (-> (Exception e) e (Try a))) (#//.Failure (..error exception message))) (def: .public (assertion exception message test) - (All [e] (-> (Exception e) e Bit (Try Any))) + (All (_ e) (-> (Exception e) e Bit (Try Any))) (if test (#//.Success []) (..except exception message))) @@ -91,14 +91,14 @@ ))) (syntax: .public (exception: [[export_policy t_vars [name inputs] body] ..exception]) - (macro.with_identifiers [g!descriptor] + (macro.with_identifiers [g!_ g!descriptor] (do meta.monad [current_module meta.current_module_name .let [descriptor ($_ text\composite "{" current_module "." name "}" text.new_line) g!self (code.local_identifier name)]] (in (list (` (def: (~ export_policy) (~ g!self) - (All [(~+ (list\each |type_variable|.format t_vars))] + (All ((~ g!_) (~+ (list\each |type_variable|.format t_vars))) (..Exception [(~+ (list\each (value@ #|input|.type) inputs))])) (let [(~ g!descriptor) (~ (code.text descriptor))] {#..label (~ g!descriptor) @@ -143,7 +143,7 @@ (` [(~ header) (~ message)]))))))))))) (def: .public (listing format entries) - (All [a] + (All (_ a) (-> (-> a Text) (List a) Text)) (|> entries (list\mix (function (_ entry [index next]) @@ -171,7 +171,7 @@ error)) (def: .public (with exception message computation) - (All [e a] (-> (Exception e) e (Try a) (Try a))) + (All (_ e a) (-> (Exception e) e (Try a) (Try a))) (case computation (#//.Failure error) (#//.Failure (case error diff --git a/stdlib/source/library/lux/control/function.lux b/stdlib/source/library/lux/control/function.lux index 3bbcd1bce..41ac6eeeb 100644 --- a/stdlib/source/library/lux/control/function.lux +++ b/stdlib/source/library/lux/control/function.lux @@ -5,30 +5,30 @@ [monoid (#+ Monoid)]]]]) (def: .public identity - (All [a] (-> a a)) + (All (_ a) (-> a a)) (|>>)) (def: .public (composite f g) - (All [a b c] + (All (_ a b c) (-> (-> b c) (-> a b) (-> a c))) (|>> g f)) (def: .public (constant value) - (All [o] (-> o (All [i] (-> i o)))) + (All (_ o) (-> o (All (_ i) (-> i o)))) (function (_ _) value)) (def: .public (flipped f) - (All [a b c] + (All (_ a b c) (-> (-> a b c) (-> b a c))) (function (_ x y) (f y x))) (def: .public (on input function) - (All [i o] + (All (_ i o) (-> i (-> i o) o)) (function input)) (implementation: .public monoid - (All [a] (Monoid (-> a a))) + (All (_ a) (Monoid (-> a a))) (def: identity ..identity) (def: composite ..composite)) diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index 6245dea04..233ee8d07 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: .public memoization - (All [i o] + (All (_ i o) (Mixin i (State (Dictionary i o) o))) (function (_ delegate recur) (function (_ input) @@ -36,7 +36,7 @@ (Recursive i (State (Dictionary i o) o))) (def: .public (open memo) - (All [i o] + (All (_ i o) (:let [Memory (Dictionary i o)] (-> (Memo i o) (-> [Memory i] [Memory o])))) (let [memo (//.fixed (//.mixed ..memoization (//.of_recursive memo)))] @@ -44,14 +44,14 @@ (|> input memo (state.result memory))))) (def: .public (closed hash memo) - (All [i o] + (All (_ i o) (-> (Hash i) (Memo i o) (-> i o))) (let [memo (//.fixed (//.mixed ..memoization (//.of_recursive memo))) empty (dictionary.empty hash)] (|>> memo (state.result empty) product.right))) (def: .public (none hash memo) - (All [i o] + (All (_ i o) (-> (Hash i) (Memo i o) (-> i o))) (let [memo (//.fixed (//.of_recursive memo)) empty (dictionary.empty hash)] diff --git a/stdlib/source/library/lux/control/function/mixin.lux b/stdlib/source/library/lux/control/function/mixin.lux index 68d2e4bf0..357fdb7c1 100644 --- a/stdlib/source/library/lux/control/function/mixin.lux +++ b/stdlib/source/library/lux/control/function/mixin.lux @@ -13,7 +13,7 @@ (-> (-> i o) (-> i o) (-> i o))) (def: .public (fixed f) - (All [i o] (-> (Mixin i o) (-> i o))) + (All (_ i o) (-> (Mixin i o) (-> i o))) (function (mix input) ((f mix mix) input))) @@ -23,32 +23,32 @@ delegate)) (def: .public (mixed parent child) - (All [i o] (-> (Mixin i o) (Mixin i o) (Mixin i o))) + (All (_ i o) (-> (Mixin i o) (Mixin i o) (Mixin i o))) (function (_ delegate recur) (parent (child delegate recur) recur))) (implementation: .public monoid - (All [i o] (Monoid (Mixin i o))) + (All (_ i o) (Monoid (Mixin i o))) (def: identity ..nothing) (def: composite ..mixed)) (def: .public (advice when then) - (All [i o] (-> (Predicate i) (Mixin i o) (Mixin i o))) + (All (_ i o) (-> (Predicate i) (Mixin i o) (Mixin i o))) (function (_ delegate recur input) (if (when input) ((then delegate recur) input) (delegate input)))) (def: .public (before monad action) - (All [! i o] (-> (Monad !) (-> i (! Any)) (Mixin i (! o)))) + (All (_ ! i o) (-> (Monad !) (-> i (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad [_ (action input)] (delegate input)))) (def: .public (after monad action) - (All [! i o] (-> (Monad !) (-> i o (! Any)) (Mixin i (! o)))) + (All (_ ! i o) (-> (Monad !) (-> i o (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad [output (delegate input) @@ -59,6 +59,6 @@ (-> (-> i o) (-> i o))) (def: .public (of_recursive recursive) - (All [i o] (-> (Recursive i o) (Mixin i o))) + (All (_ i o) (-> (Recursive i o) (Mixin i o))) (function (_ delegate recur) (recursive recur))) diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index b418d435f..c72bffa73 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -20,7 +20,7 @@ (-> Any a) (def: label - (All [a] (-> (-> Any a) (IO a))) + (All (_ _ a) (-> (-> Any a) (IO a))) (|>> :abstraction)) (template: (!io computation) @@ -38,7 +38,7 @@ (~ computation)))))))) (def: .public run! - (All [a] (-> (IO a) a)) + (All (_ _ a) (-> (IO a) a)) (|>> ..run!')) (implementation: .public functor diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index c3a351c71..4539fdc15 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -23,7 +23,7 @@ (-> [] a) (def: (lazy' generator) - (All [a] (-> (-> [] a) (Lazy a))) + (All (_ a) (-> (-> [] a) (Lazy a))) (let [cache (atom.atom #.None)] (:abstraction (function (_ _) (case (io.run! (atom.read! cache)) @@ -37,7 +37,7 @@ value))))))) (def: .public (value lazy) - (All [a] (-> (Lazy a) a)) + (All (_ a) (-> (Lazy a) a)) ((:representation lazy) []))) (syntax: .public (lazy [expression <code>.any]) @@ -45,7 +45,7 @@ (in (list (` ((~! ..lazy') (function ((~ g!_) (~ g!_)) (~ expression)))))))) (implementation: .public (equivalence (^open "\.")) - (All [a] (-> (Equivalence a) (Equivalence (Lazy a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Lazy a)))) (def: (= left right) (\= (..value left) diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux index 6fbc4b294..cccf64ddf 100644 --- a/stdlib/source/library/lux/control/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -16,7 +16,7 @@ ... (#.Some a)) (implementation: .public monoid - (All [a] (Monoid (Maybe a))) + (All (_ a) (Monoid (Maybe a))) (def: identity #.None) @@ -66,7 +66,7 @@ mx))) (implementation: .public (equivalence super) - (All [a] (-> (Equivalence a) (Equivalence (Maybe a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Maybe a)))) (def: (= mx my) (case [mx my] @@ -80,7 +80,7 @@ #0))) (implementation: .public (hash super) - (All [a] (-> (Hash a) (Hash (Maybe a)))) + (All (_ a) (-> (Hash a) (Hash (Maybe a)))) (def: &equivalence (..equivalence (\ super &equivalence))) @@ -94,7 +94,7 @@ (\ super hash value)))) (implementation: .public (with monad) - (All [M] (-> (Monad M) (Monad (All [a] (M (Maybe a)))))) + (All (_ M) (-> (Monad M) (Monad (All (_ a) (M (Maybe a)))))) (def: &functor (functor.composite (value@ #monad.&functor monad) @@ -113,7 +113,7 @@ Mma)))) (def: .public (lifted monad) - (All [M a] (-> (Monad M) (-> (M a) (M (Maybe a))))) + (All (_ M a) (-> (Monad M) (-> (M a) (M (Maybe a))))) (\ monad each (\ ..monad in))) (macro: .public (else tokens state) @@ -131,11 +131,11 @@ (#.Left "Wrong syntax for else"))) (def: .public trusted - (All [a] (-> (Maybe a) a)) + (All (_ a) (-> (Maybe a) a)) (|>> (..else (undefined)))) (def: .public (list value) - (All [a] (-> (Maybe a) (List a))) + (All (_ a) (-> (Maybe a) (List a))) (case value #.None #.End diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index 4d32c8df6..376ca3f53 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -20,7 +20,7 @@ (-> s (Try [s a]))) (implementation: .public functor - (All [s] (Functor (Parser s))) + (All (_ s) (Functor (Parser s))) (def: (each f ma) (function (_ input) @@ -32,7 +32,7 @@ (#try.Success [input' (f a)]))))) (implementation: .public apply - (All [s] (Apply (Parser s))) + (All (_ s) (Apply (Parser s))) (def: &functor ..functor) @@ -51,7 +51,7 @@ (#try.Failure msg))))) (implementation: .public monad - (All [s] (Monad (Parser s))) + (All (_ s) (Monad (Parser s))) (def: &functor ..functor) @@ -69,14 +69,14 @@ (ma input'))))) (def: .public (assertion message test) - (All [s] (-> Text Bit (Parser s Any))) + (All (_ s) (-> Text Bit (Parser s Any))) (function (_ input) (if test (#try.Success [input []]) (#try.Failure message)))) (def: .public (maybe parser) - (All [s a] + (All (_ s a) (-> (Parser s a) (Parser s (Maybe a)))) (function (_ input) (case (parser input) @@ -87,19 +87,19 @@ (#try.Success [input' (#.Some x)])))) (def: .public (result parser input) - (All [s a] + (All (_ s a) (-> (Parser s a) s (Try [s a]))) (parser input)) (def: .public (and first second) - (All [s a b] + (All (_ s a b) (-> (Parser s a) (Parser s b) (Parser s [a b]))) (do {! ..monad} [head first] (\ ! each (|>> [head]) second))) (def: .public (or left right) - (All [s a b] + (All (_ s a b) (-> (Parser s a) (Parser s b) (Parser s (Or a b)))) (function (_ tokens) (case (left tokens) @@ -115,7 +115,7 @@ (#try.Failure error))))) (def: .public (either this that) - (All [s a] + (All (_ s a) (-> (Parser s a) (Parser s a) (Parser s a))) (function (_ tokens) (case (this tokens) @@ -126,7 +126,7 @@ output))) (def: .public (some parser) - (All [s a] + (All (_ s a) (-> (Parser s a) (Parser s (List a)))) (function (_ input) (case (parser input) @@ -139,14 +139,14 @@ input')))) (def: .public (many parser) - (All [s a] + (All (_ s a) (-> (Parser s a) (Parser s (List a)))) (|> (..some parser) (..and parser) (\ ..monad each (|>> #.Item)))) (def: .public (exactly amount parser) - (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) + (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) (case amount 0 (\ ..monad in (list)) _ (do {! ..monad} @@ -156,13 +156,13 @@ (\ ! each (|>> (#.Item x))))))) (def: .public (at_least amount parser) - (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) + (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) (do {! ..monad} [minimum (..exactly amount parser)] (\ ! each (list\composite minimum) (..some parser)))) (def: .public (at_most amount parser) - (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) + (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) (case amount 0 (\ ..monad in (list)) _ (function (_ input) @@ -176,7 +176,7 @@ input'))))) (def: .public (between minimum additional parser) - (All [s a] (-> Nat Nat (Parser s a) (Parser s (List a)))) + (All (_ s a) (-> Nat Nat (Parser s a) (Parser s (List a)))) (do {! ..monad} [minimum (..exactly minimum parser)] (case additional @@ -185,7 +185,7 @@ (..at_most additional parser))))) (def: .public (separated_by separator parser) - (All [s a b] (-> (Parser s b) (Parser s a) (Parser s (List a)))) + (All (_ s a b) (-> (Parser s b) (Parser s a) (Parser s (List a)))) (do {! ..monad} [?x (..maybe parser)] (case ?x @@ -199,7 +199,7 @@ (\ ! each (|>> (list\each product.right) (#.Item x))))))) (def: .public (not parser) - (All [s a] (-> (Parser s a) (Parser s Any))) + (All (_ s a) (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) (#try.Failure msg) @@ -209,12 +209,12 @@ (#try.Failure "Expected to fail; yet succeeded.")))) (def: .public (failure message) - (All [s a] (-> Text (Parser s a))) + (All (_ s a) (-> Text (Parser s a))) (function (_ input) (#try.Failure message))) (def: .public (lifted operation) - (All [s a] (-> (Try a) (Parser s a))) + (All (_ s a) (-> (Try a) (Parser s a))) (function (_ input) (case operation (#try.Success output) @@ -224,7 +224,7 @@ (#try.Failure error)))) (def: .public (else value parser) - (All [s a] (-> a (Parser s a) (Parser s a))) + (All (_ s a) (-> a (Parser s a) (Parser s a))) (function (_ input) (case (parser input) (#try.Failure error) @@ -234,37 +234,37 @@ (#try.Success [input' output])))) (def: .public remaining - (All [s] (Parser s s)) + (All (_ s) (Parser s s)) (function (_ inputs) (#try.Success [inputs inputs]))) (def: .public (rec parser) - (All [s a] (-> (-> (Parser s a) (Parser s a)) (Parser s a))) + (All (_ s a) (-> (-> (Parser s a) (Parser s a)) (Parser s a))) (function (_ inputs) (..result (parser (rec parser)) inputs))) (def: .public (after param subject) - (All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a))) + (All (_ s _ a) (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad [_ param] subject)) (def: .public (before param subject) - (All [s _ a] (-> (Parser s _) (Parser s a) (Parser s a))) + (All (_ s _ a) (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad [output subject _ param] (in output))) (def: .public (only test parser) - (All [s a] (-> (-> a Bit) (Parser s a) (Parser s a))) + (All (_ s a) (-> (-> a Bit) (Parser s a) (Parser s a))) (do ..monad [output parser _ (..assertion "Constraint failed." (test output))] (in output))) (def: .public (parses? parser) - (All [s a] (-> (Parser s a) (Parser s Bit))) + (All (_ s a) (-> (Parser s a) (Parser s Bit))) (function (_ input) (case (parser input) (#try.Failure error) @@ -274,7 +274,7 @@ (#try.Success [input' true])))) (def: .public (parses parser) - (All [s a] (-> (Parser s a) (Parser s Any))) + (All (_ s a) (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) (#try.Failure error) @@ -284,7 +284,7 @@ (#try.Success [input' []])))) (def: .public (speculative parser) - (All [s a] (-> (Parser s a) (Parser s a))) + (All (_ s a) (-> (Parser s a) (Parser s a))) (function (_ input) (case (parser input) (#try.Success [input' output]) @@ -294,7 +294,7 @@ output))) (def: .public (codec codec parser) - (All [s a z] (-> (Codec a z) (Parser s a) (Parser s z))) + (All (_ s a z) (-> (Codec a z) (Parser s a) (Parser s z))) (function (_ input) (case (parser input) (#try.Failure error) diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux index 27caea2af..e069d4e9f 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -51,7 +51,7 @@ (//.Parser (List Analysis))) (def: .public (result parser input) - (All [a] (-> (Parser a) (List Analysis) (Try a))) + (All (_ a) (-> (Parser a) (List Analysis) (Try a))) (case (parser input) (#try.Failure error) (#try.Failure error) @@ -122,7 +122,7 @@ ) (def: .public (tuple parser) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (function (_ input) (case input (^ (list& (/.tuple head) tail)) diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index 220dd5ea2..409d2a872 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -38,7 +38,7 @@ ["Bytes read" (%.nat bytes_read)])) (def: .public (result parser input) - (All [a] (-> (Parser a) Binary (Try a))) + (All (_ a) (-> (Parser a) Binary (Try a))) (case (parser [0 input]) (#try.Failure msg) (#try.Failure msg) @@ -117,12 +117,12 @@ _ (//.lifted (exception.except ..invalid_tag [(~~ (template.amount <case>+)) flag])))))]) (def: .public (or left right) - (All [l r] (-> (Parser l) (Parser r) (Parser (Or l r)))) + (All (_ l r) (-> (Parser l) (Parser r) (Parser (Or l r)))) (!variant [[0 #.Left left] [1 #.Right right]])) (def: .public (rec body) - (All [a] (-> (-> (Parser a) (Parser a)) (Parser a))) + (All (_ a) (-> (-> (Parser a) (Parser a)) (Parser a))) (function (_ input) (let [parser (body (rec body))] (parser input)))) @@ -185,7 +185,7 @@ (template [<size> <name> <bits>] [(def: .public (<name> valueP) - (All [v] (-> (Parser v) (Parser (Row v)))) + (All (_ v) (-> (Parser v) (Parser (Row v)))) (do //.monad [amount (: (Parser Nat) <bits>)] @@ -210,11 +210,11 @@ ) (def: .public maybe - (All [a] (-> (Parser a) (Parser (Maybe a)))) + (All (_ a) (-> (Parser a) (Parser (Maybe a)))) (..or ..any)) (def: .public (list value) - (All [a] (-> (Parser a) (Parser (List a)))) + (All (_ a) (-> (Parser a) (Parser (List a)))) (..rec (|>> (//.and value) (..or ..any)))) @@ -222,7 +222,7 @@ (exception: .public set_elements_are_not_unique) (def: .public (set hash value) - (All [a] (-> (Hash a) (Parser a) (Parser (Set a)))) + (All (_ a) (-> (Hash a) (Parser a) (Parser (Set a)))) (do //.monad [raw (..list value) .let [output (set.of_list hash raw)] diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index d9b4928ab..75ab5ab4b 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -14,7 +14,7 @@ (//.Parser (List Text) a)) (def: .public (result parser inputs) - (All [a] (-> (Parser a) (List Text) (Try a))) + (All (_ a) (-> (Parser a) (List Text) (Try a))) (case (//.result parser inputs) (#try.Success [remaining output]) (case remaining @@ -38,7 +38,7 @@ (#try.Failure "Cannot parse empty arguments.")))) (def: .public (parse parser) - (All [a] (-> (-> Text (Try a)) (Parser a))) + (All (_ a) (-> (-> Text (Try a)) (Parser a))) (function (_ inputs) (do try.monad [[remaining raw] (any inputs) @@ -55,7 +55,7 @@ (#try.Failure (format "Missing token: '" reference "'")))))) (def: .public (somewhere cli) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (function (_ inputs) (loop [immediate inputs] (case (//.result cli immediate) @@ -81,13 +81,13 @@ _ (#try.Failure (format "Unknown parameters: " (text.interposed " " inputs)))))) (def: .public (named name value) - (All [a] (-> Text (Parser a) (Parser a))) + (All (_ a) (-> Text (Parser a) (Parser a))) (|> value (//.after (..this name)) ..somewhere)) (def: .public (parameter [short long] value) - (All [a] (-> [Text Text] (Parser a) (Parser a))) + (All (_ a) (-> [Text Text] (Parser a) (Parser a))) (|> value (//.after (//.either (..this short) (..this long))) ..somewhere)) diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index 9b83d835a..63b33e341 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 local) + [lux (#- nat int rev local not) [abstract ["." monad (#+ do)]] [control @@ -22,7 +22,7 @@ ["." //]) (def: (un_paired pairs) - (All [a] (-> (List [a a]) (List a))) + (All (_ a) (-> (List [a a]) (List a))) (case pairs #.End #.End (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) @@ -46,6 +46,16 @@ (#.Item [t tokens']) (#try.Success [tokens' t])))) +(def: .public next + (Parser Code) + (function (_ tokens) + (case tokens + #.End + (#try.Failure "There are no tokens to parse!") + + (#.Item next _) + (#try.Success [tokens next])))) + (template [<query> <check> <type> <tag> <eq> <desc>] [(with_expansions [<failure> (as_is (#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))))] (def: .public <query> @@ -123,7 +133,7 @@ (template [<name> <tag> <desc>] [(def: .public (<name> p) - (All [a] + (All (_ a) (-> (Parser a) (Parser a))) (function (_ tokens) (case tokens @@ -140,7 +150,7 @@ ) (def: .public (record p) - (All [a] + (All (_ a) (-> (Parser a) (Parser a))) (function (_ tokens) (case tokens @@ -167,7 +177,7 @@ _ false)]))) (def: .public (result parser inputs) - (All [a] (-> (Parser a) (List Code) (Try a))) + (All (_ a) (-> (Parser a) (List Code) (Try a))) (case (parser inputs) (#try.Failure error) (#try.Failure error) @@ -184,8 +194,18 @@ (text\composite "Unconsumed inputs: ")))))) (def: .public (local inputs parser) - (All [a] (-> (List Code) (Parser a) (Parser a))) + (All (_ a) (-> (List Code) (Parser a) (Parser a))) (function (_ real) (do try.monad [value (..result parser inputs)] (in [real value])))) + +(def: .public (not parser) + (All (_ a) (-> (Parser a) (Parser Code))) + (do //.monad + [sample ..next + result (//.or parser + ..any)] + (case result + (#.Left _) (//.failure (text\composite "Did NOT expect to parse code: " (code.format sample))) + (#.Right output) (in output)))) diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux index fbb7335f5..8ca8e2890 100644 --- a/stdlib/source/library/lux/control/parser/environment.lux +++ b/stdlib/source/library/lux/control/parser/environment.lux @@ -40,5 +40,5 @@ (exception.except ..unknown_property [name])))) (def: .public (result parser environment) - (All [a] (-> (Parser a) Environment (Try a))) + (All (_ a) (-> (Parser a) Environment (Try a))) (\ try.monad each product.right (parser environment))) diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index dcbda6f71..f73bf4ce8 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -32,7 +32,7 @@ (exception: .public empty_input) (def: .public (result parser json) - (All [a] (-> (Parser a) JSON (Try a))) + (All (_ a) (-> (Parser a) JSON (Try a))) (case (//.result parser (list json)) (#try.Success [remainder output]) (case remainder @@ -113,12 +113,12 @@ ) (def: .public (nullable parser) - (All [a] (-> (Parser a) (Parser (Maybe a)))) + (All (_ a) (-> (Parser a) (Parser (Maybe a)))) (//.or ..null parser)) (def: .public (array parser) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [head ..any] (case head @@ -139,7 +139,7 @@ (//.failure (exception.error ..unexpected_value [head]))))) (def: .public (object parser) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [head ..any] (case head @@ -165,7 +165,7 @@ (//.failure (exception.error ..unexpected_value [head]))))) (def: .public (field field_name parser) - (All [a] (-> Text (Parser a) (Parser a))) + (All (_ a) (-> Text (Parser a) (Parser a))) (function (recur inputs) (case inputs (^ (list& (#/.String key) value inputs')) @@ -191,7 +191,7 @@ (exception.except ..unconsumed_input inputs)))) (def: .public dictionary - (All [a] (-> (Parser a) (Parser (Dictionary Text a)))) + (All (_ a) (-> (Parser a) (Parser (Dictionary Text a)))) (|>> (//.and ..string) //.some ..object diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index d6c6fbeca..07406f1d9 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -50,7 +50,7 @@ (//.Parser (List Synthesis))) (def: .public (result parser input) - (All [a] (-> (Parser a) (List Synthesis) (Try a))) + (All (_ a) (-> (Parser a) (List Synthesis) (Try a))) (case (parser input) (#try.Failure error) (#try.Failure error) @@ -118,7 +118,7 @@ ) (def: .public (tuple parser) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (.function (_ input) (case input (^ (list& (/.tuple head) tail)) @@ -130,7 +130,7 @@ (exception.except ..cannot_parse input)))) (def: .public (function expected parser) - (All [a] (-> Arity (Parser a) (Parser [(Environment Synthesis) a]))) + (All (_ a) (-> Arity (Parser a) (Parser [(Environment Synthesis) a]))) (.function (_ input) (case input (^ (list& (/.function/abstraction [environment actual body]) tail)) @@ -144,7 +144,7 @@ (exception.except ..cannot_parse input)))) (def: .public (loop init_parsers iteration_parser) - (All [a b] (-> (Parser a) (Parser b) (Parser [Register a b]))) + (All (_ a b) (-> (Parser a) (Parser b) (Parser [Register a b]))) (.function (_ input) (case input (^ (list& (/.loop/scope [start inits iteration]) tail)) diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index 2dda427e6..5943fba26 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -54,7 +54,7 @@ (exception: .public cannot_slice) (def: .public (result parser input) - (All [a] (-> (Parser a) Text (Try a))) + (All (_ a) (-> (Parser a) Text (Try a))) (case (parser [start_offset input]) (#try.Failure msg) (#try.Failure msg) @@ -105,7 +105,7 @@ (template [<name> <type> <any>] [(`` (def: .public (<name> parser) - (All [a] (-> (Parser a) (Parser <type>))) + (All (_ a) (-> (Parser a) (Parser <type>))) (function (_ input) (case (parser input) (#try.Failure msg) @@ -328,13 +328,13 @@ (//.between minimum additional parser))) (def: .public (enclosed [start end] parser) - (All [a] (-> [Text Text] (Parser a) (Parser a))) + (All (_ a) (-> [Text Text] (Parser a) (Parser a))) (|> parser (//.before (this end)) (//.after (this start)))) (def: .public (local local_input parser) - (All [a] (-> Text (Parser a) (Parser a))) + (All (_ a) (-> Text (Parser a) (Parser a))) (function (_ real_input) (case (..result parser local_input) (#try.Failure error) @@ -356,7 +356,7 @@ (exception.except ..cannot_slice []))))) (def: .public (then structured text) - (All [s a] + (All (_ s a) (-> (Parser a) (//.Parser s Text) (//.Parser s a))) diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index 0208134a3..4c87f17f3 100644 --- a/stdlib/source/library/lux/control/parser/tree.lux +++ b/stdlib/source/library/lux/control/parser/tree.lux @@ -16,17 +16,17 @@ (//.Parser (Zipper t) a)) (def: .public (result' parser zipper) - (All [t a] (-> (Parser t a) (Zipper t) (Try a))) + (All (_ t a) (-> (Parser t a) (Zipper t) (Try a))) (do try.monad [[zipper output] (//.result parser zipper)] (in output))) (def: .public (result parser tree) - (All [t a] (-> (Parser t a) (Tree t) (Try a))) + (All (_ t a) (-> (Parser t a) (Tree t) (Try a))) (result' parser (zipper.zipper tree))) (def: .public value - (All [t] (Parser t t)) + (All (_ t) (Parser t t)) (function (_ zipper) (#try.Success [zipper (zipper.value zipper)]))) @@ -34,7 +34,7 @@ (template [<name> <direction>] [(def: .public <name> - (All [t] (Parser t [])) + (All (_ t) (Parser t [])) (function (_ zipper) (case (<direction> zipper) #.None diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index d51ebc152..96a2c6230 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -68,7 +68,7 @@ (dictionary.empty n.hash)) (def: (result' env poly types) - (All [a] (-> Env (Parser a) (List Type) (Try a))) + (All (_ a) (-> Env (Parser a) (List Type) (Try a))) (case (//.result poly [env types]) (#try.Failure error) (#try.Failure error) @@ -82,7 +82,7 @@ (exception.except ..unconsumed_input remaining)))) (def: .public (result poly type) - (All [a] (-> (Parser a) Type (Try a))) + (All (_ a) (-> (Parser a) Type (Try a))) (result' ..fresh poly (list type))) (def: .public env @@ -91,7 +91,7 @@ (#try.Success [[env inputs] env]))) (def: (with_env temp poly) - (All [a] (-> Env (Parser a) (Parser a))) + (All (_ a) (-> Env (Parser a) (Parser a))) (.function (_ [env inputs]) (case (//.result poly [temp inputs]) (#try.Failure error) @@ -121,7 +121,7 @@ (#try.Success [[env tail] headT])))) (def: .public (local types poly) - (All [a] (-> (List Type) (Parser a) (Parser a))) + (All (_ a) (-> (List Type) (Parser a) (Parser a))) (.function (_ [env pass_through]) (case (result' env poly types) (#try.Failure error) @@ -135,7 +135,7 @@ (code.local_identifier ($_ text\composite "label" text.tab (n\encoded idx)))) (def: .public (with_extension type poly) - (All [a] (-> Type (Parser a) (Parser [Code a]))) + (All (_ a) (-> Type (Parser a) (Parser [Code a]))) (.function (_ [env inputs]) (let [current_id (dictionary.size env) g!var (label current_id)] @@ -150,7 +150,7 @@ (template [<name> <flattener> <tag> <exception>] [(`` (def: .public (<name> poly) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [headT ..any] (let [members (<flattener> (type.anonymous headT))] @@ -172,7 +172,7 @@ (in [num_arg bodyT])))) (def: .public (polymorphic poly) - (All [a] (-> (Parser a) (Parser [Code (List Code) a]))) + (All (_ a) (-> (Parser a) (Parser [Code (List Code) a]))) (do {! //.monad} [headT any funcI (\ ! each dictionary.size ..env) @@ -209,7 +209,7 @@ (in [funcL all_varsL output]))))) (def: .public (function in_poly out_poly) - (All [i o] (-> (Parser i) (Parser o) (Parser [i o]))) + (All (_ i o) (-> (Parser i) (Parser o) (Parser [i o]))) (do //.monad [headT any .let [[inputsT outputT] (type.flat_function (type.anonymous headT))]] @@ -219,7 +219,7 @@ (//.failure (exception.error ..not_function headT))))) (def: .public (applied poly) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [headT any .let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] @@ -307,7 +307,7 @@ (#.Parameter 1)))])) (def: .public (recursive poly) - (All [a] (-> (Parser a) (Parser [Code a]))) + (All (_ a) (-> (Parser a) (Parser [Code a]))) (do {! //.monad} [headT any] (case (type.anonymous headT) diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index 6be4241d0..4a41dd75d 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -38,7 +38,7 @@ ["Inputs" (exception.listing (\ /.codec encoded) inputs)])) (def: (result' parser attrs documents) - (All [a] (-> (Parser a) Attrs (List XML) (Try a))) + (All (_ a) (-> (Parser a) Attrs (List XML) (Try a))) (case (//.result parser [attrs documents]) (#try.Success [[attrs' remaining] output]) (if (list.empty? remaining) @@ -49,7 +49,7 @@ (#try.Failure error))) (def: .public (result parser documents) - (All [a] (-> (Parser a) (List XML) (Try a))) + (All (_ a) (-> (Parser a) (List XML) (Try a))) (..result' parser /.attributes documents)) (def: .public text @@ -93,7 +93,7 @@ (#try.Success [[attrs documents] value])))) (def: .public (node expected parser) - (All [a] (-> Tag (Parser a) (Parser a))) + (All (_ a) (-> Tag (Parser a) (Parser a))) (function (_ [attrs documents]) (case documents #.End @@ -124,7 +124,7 @@ (exception: .public nowhere) (def: .public (somewhere parser) - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (function (recur [attrs input]) (case (//.result parser [attrs input]) (#try.Success [[attrs remaining] output]) diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux index b5b6c3e6e..6800a5e3c 100644 --- a/stdlib/source/library/lux/control/reader.lux +++ b/stdlib/source/library/lux/control/reader.lux @@ -10,26 +10,26 @@ (-> r a)) (def: .public read - (All [r] (Reader r r)) + (All (_ r) (Reader r r)) (function (_ env) env)) (def: .public (local change proc) - (All [r a] (-> (-> r r) (Reader r a) (Reader r a))) + (All (_ r a) (-> (-> r r) (Reader r a) (Reader r a))) (|>> change proc)) (def: .public (result env proc) - (All [r a] (-> r (Reader r a) a)) + (All (_ r a) (-> r (Reader r a) a)) (proc env)) (implementation: .public functor - (All [r] (Functor (Reader r))) + (All (_ r) (Functor (Reader r))) (def: (each f fa) (function (_ env) (f (fa env))))) (implementation: .public apply - (All [r] (Apply (Reader r))) + (All (_ r) (Apply (Reader r))) (def: &functor ..functor) @@ -38,7 +38,7 @@ ((ff env) (fa env))))) (implementation: .public monad - (All [r] (Monad (Reader r))) + (All (_ r) (Monad (Reader r))) (def: &functor ..functor) @@ -50,7 +50,7 @@ (mma env env)))) (implementation: .public (with monad) - (All [M] (-> (Monad M) (All [e] (Monad (All [a] (Reader e (M a))))))) + (All (_ M) (-> (Monad M) (All (_ e) (Monad (All (_ a) (Reader e (M a))))))) (def: &functor (functor.composite ..functor (value@ #monad.&functor monad))) @@ -65,5 +65,5 @@ (result env eMa))))) (def: .public lifted - (All [M e a] (-> (M a) (Reader e (M a)))) + (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 a8a30cfd2..e07656688 100644 --- a/stdlib/source/library/lux/control/region.lux +++ b/stdlib/source/library/lux/control/region.lux @@ -43,7 +43,7 @@ error|output)))) (def: (clean clean_up output) - (All [a] (-> (Try Any) (Try a) (Try a))) + (All (_ a) (-> (Try Any) (Try a) (Try a))) (case clean_up (#try.Success _) output @@ -52,8 +52,8 @@ (exception.except ..clean_up_error [error output]))) (def: .public (run! monad computation) - (All [! a] - (-> (Monad !) (All [r] (Region r ! a)) + (All (_ ! a) + (-> (Monad !) (All (_ r) (Region r ! a)) (! (Try a)))) (do {! monad} [[cleaners output] (computation [[] (list)])] @@ -62,17 +62,17 @@ (\ ! each (list\mix clean output))))) (def: .public (acquire! monad cleaner value) - (All [! a] (-> (Monad !) (-> a (! (Try Any))) a - (All [r] (Region r ! a)))) + (All (_ ! a) (-> (Monad !) (-> a (! (Try Any))) a + (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) (\ monad in [(#.Item (function (_ region) (cleaner value)) cleaners) (#try.Success value)]))) (implementation: .public (functor super) - (All [!] + (All (_ !) (-> (Functor !) - (All [r] (Functor (Region r !))))) + (All (_ r) (Functor (Region r !))))) (def: (each f) (function (_ fa) @@ -88,9 +88,9 @@ (fa region+cleaners)))))) (implementation: .public (apply super) - (All [!] + (All (_ !) (-> (Monad !) - (All [r] (Apply (Region r !))))) + (All (_ r) (Apply (Region r !))))) (def: &functor (..functor (value@ #monad.&functor super))) @@ -113,9 +113,9 @@ (in [cleaners (#try.Failure error)])))))) (implementation: .public (monad super) - (All [!] + (All (_ !) (-> (Monad !) - (All [r] (Monad (Region r !))))) + (All (_ r) (Monad (Region r !))))) (def: &functor (..functor (value@ #monad.&functor super))) @@ -136,22 +136,22 @@ (in [cleaners (#try.Failure error)])))))) (def: .public (failure monad error) - (All [! a] + (All (_ ! a) (-> (Monad !) Text - (All [r] (Region r ! a)))) + (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) (\ monad in [cleaners (#try.Failure error)]))) (def: .public (except monad exception message) - (All [! e a] + (All (_ ! e a) (-> (Monad !) (Exception e) e - (All [r] (Region r ! a)))) + (All (_ r) (Region r ! a)))) (failure monad (exception.error exception message))) (def: .public (lifted monad operation) - (All [! a] + (All (_ ! a) (-> (Monad !) (! a) - (All [r] (Region r ! a)))) + (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) (\ monad each (|>> #try.Success [cleaners]) diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index ec84db916..e6d2617c9 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -30,13 +30,13 @@ (-> input output) (def: capability - (All [brand input output] + (All (_ brand input output) (-> (-> input output) (Capability brand input output))) (|>> :abstraction)) (def: .public (use capability input) - (All [brand input output] + (All (_ brand input output) (-> (Capability brand input output) input output)) @@ -48,24 +48,25 @@ |declaration|.parser (<>.maybe |annotations|.parser) (<c>.form ($_ <>.and <c>.local_identifier <c>.any <c>.any))))]) - (do {! meta.monad} - [this_module meta.current_module_name - .let [[name vars] declaration] - g!brand (\ ! each (|>> %.code code.text) - (macro.identifier (format (%.name [this_module name])))) - .let [capability (` (..Capability (.primitive (~ g!brand)) (~ input) (~ output)))]] - (in (list (` (type: (~ export_policy) - (~ (|declaration|.format declaration)) - (~ capability))) - (` (def: (~ (code.local_identifier forger)) - (All [(~+ (list\each code.local_identifier vars))] - (-> (-> (~ input) (~ output)) - (~ capability))) - (~! ..capability))) - )))) + (macro.with_identifiers [g!_] + (do {! meta.monad} + [this_module meta.current_module_name + .let [[name vars] declaration] + g!brand (\ ! each (|>> %.code code.text) + (macro.identifier (format (%.name [this_module name])))) + .let [capability (` (..Capability (.primitive (~ g!brand)) (~ input) (~ output)))]] + (in (list (` (type: (~ export_policy) + (~ (|declaration|.format declaration)) + (~ capability))) + (` (def: (~ (code.local_identifier forger)) + (All ((~ g!_) (~+ (list\each code.local_identifier vars))) + (-> (-> (~ input) (~ output)) + (~ capability))) + (~! ..capability))) + ))))) (def: .public (async capability) - (All [brand input output] + (All (_ brand input output) (-> (Capability brand input (IO output)) (Capability brand input (Async output)))) (..capability (|>> ((:representation capability)) async.future))) diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index 1087cf751..c9e840698 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -25,12 +25,12 @@ #can_downgrade (Can_Downgrade brand label)})) (type: .public (Delegation brand from to) - (All [value] + (All (_ value) (-> (Policy brand value from) (Policy brand value to)))) (def: .public (delegation downgrade upgrade) - (All [brand from to] + (All (_ brand from to) (-> (Can_Downgrade brand from) (Can_Upgrade brand to) (Delegation brand from to))) (|>> downgrade upgrade)) @@ -45,16 +45,16 @@ #can_downgrade (|>> :representation)}) (def: .public (with_policy context) - (All [brand scope] - (Ex [label] + (All (_ brand scope) + (Ex (_ label) (-> (Context brand scope label) (scope label)))) (context ..privilege)) (def: (of_policy constructor) (-> Type Type) - (type (All [brand label] - (constructor (All [value] (Policy brand value label)))))) + (type (All (_ brand label) + (constructor (All (_ value) (Policy brand value label)))))) (implementation: .public functor (:~ (..of_policy Functor)) diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux index 4b3a64a08..a056cb49b 100644 --- a/stdlib/source/library/lux/control/state.lux +++ b/stdlib/source/library/lux/control/state.lux @@ -10,37 +10,37 @@ (-> s [s a])) (def: .public get - (All [s] (State s s)) + (All (_ s) (State s s)) (function (_ state) [state state])) (def: .public (put new_state) - (All [s] (-> s (State s Any))) + (All (_ s) (-> s (State s Any))) (function (_ state) [new_state []])) (def: .public (update change) - (All [s] (-> (-> s s) (State s Any))) + (All (_ s) (-> (-> s s) (State s Any))) (function (_ state) [(change state) []])) (def: .public (use user) - (All [s a] (-> (-> s a) (State s a))) + (All (_ s a) (-> (-> s a) (State s a))) (function (_ state) [state (user state)])) (def: .public (local change action) - (All [s a] (-> (-> s s) (State s a) (State s a))) + (All (_ s a) (-> (-> s s) (State s a) (State s a))) (function (_ state) (let [[state' output] (action (change state))] [state output]))) (def: .public (result state action) - (All [s a] (-> s (State s a) [s a])) + (All (_ s a) (-> s (State s a) [s a])) (action state)) (implementation: .public functor - (All [s] (Functor (State s))) + (All (_ s) (Functor (State s))) (def: (each f ma) (function (_ state) @@ -48,7 +48,7 @@ [state' (f a)])))) (implementation: .public apply - (All [s] (Apply (State s))) + (All (_ s) (Apply (State s))) (def: &functor ..functor) @@ -59,7 +59,7 @@ [state'' (f a)])))) (implementation: .public monad - (All [s] (Monad (State s))) + (All (_ s) (Monad (State s))) (def: &functor ..functor) @@ -73,7 +73,7 @@ (ma state'))))) (def: .public (while condition body) - (All [s] (-> (State s Bit) (State s Any) (State s Any))) + (All (_ s) (-> (State s Bit) (State s Any) (State s Any))) (do {! ..monad} [execute? condition] (if execute? @@ -83,13 +83,13 @@ (in [])))) (def: .public (do_while condition body) - (All [s] (-> (State s Bit) (State s Any) (State s Any))) + (All (_ s) (-> (State s Bit) (State s Any) (State s Any))) (do ..monad [_ body] (while condition body))) (implementation: (with//functor functor) - (All [M s] (-> (Functor M) (Functor (All [a] (-> s (M [s a])))))) + (All (_ M s) (-> (Functor M) (Functor (All (_ a) (-> s (M [s a])))))) (def: (each f sfa) (function (_ state) @@ -97,7 +97,7 @@ (sfa state))))) (implementation: (with//apply monad) - (All [M s] (-> (Monad M) (Apply (All [a] (-> s (M [s a])))))) + (All (_ M s) (-> (Monad M) (Apply (All (_ a) (-> s (M [s a])))))) (def: &functor (with//functor (\ monad &functor))) @@ -112,11 +112,11 @@ (-> s (M [s a]))) (def: .public (result' state action) - (All [M s a] (-> s (+State M s a) (M [s a]))) + (All (_ M s a) (-> s (+State M s a) (M [s a]))) (action state)) (implementation: .public (with monad) - (All [M s] (-> (Monad M) (Monad (+State M s)))) + (All (_ M s) (-> (Monad M) (Monad (+State M s)))) (def: &functor (with//functor (\ monad &functor))) @@ -131,7 +131,7 @@ (sMa state'))))) (def: .public (lifted monad ma) - (All [M s a] (-> (Monad M) (M a) (+State M s a))) + (All (_ M s a) (-> (Monad M) (M a) (+State M s a))) (function (_ state) (do monad [a ma] diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index a7acf841e..d938ddb88 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -23,14 +23,14 @@ (Array v) (def: .public (box init) - (All [a] (-> a (All [!] (Thread ! (Box ! a))))) + (All (_ a) (-> a (All (_ !) (Thread ! (Box ! a))))) (function (_ !) (|> (array.empty 1) (array.write! 0 init) :abstraction))) (def: .public (read! box) - (All [! a] (-> (Box ! a) (Thread ! a))) + (All (_ ! a) (-> (Box ! a) (Thread ! a))) (function (_ !) (for {@.old ("jvm aaload" (:representation box) 0) @@ -51,25 +51,25 @@ @.scheme ("scheme array read" 0 (:representation box))}))) (def: .public (write! value box) - (All [a] (-> a (All [!] (-> (Box ! a) (Thread ! Any))))) + (All (_ a) (-> a (All (_ !) (-> (Box ! a) (Thread ! Any))))) (function (_ !) (|> box :representation (array.write! 0 value) :abstraction))) ) (def: .public (result thread) - (All [a] - (-> (All [!] (Thread ! a)) + (All (_ a) + (-> (All (_ !) (Thread ! a)) a)) (thread [])) (def: .public io - (All [a] - (-> (All [!] (Thread ! a)) + (All (_ a) + (-> (All (_ !) (Thread ! a)) (IO a))) (|>> ..result io.io)) (implementation: .public functor - (All [!] (Functor (Thread !))) + (All (_ !) (Functor (Thread !))) (def: (each f) (function (_ fa) @@ -77,7 +77,7 @@ (f (fa !)))))) (implementation: .public apply - (All [!] (Apply (Thread !))) + (All (_ !) (Apply (Thread !))) (def: &functor ..functor) @@ -86,7 +86,7 @@ ((ff !) (fa !))))) (implementation: .public monad - (All [!] (Monad (Thread !))) + (All (_ !) (Monad (Thread !))) (def: &functor ..functor) @@ -99,7 +99,7 @@ ((ffa !) !)))) (def: .public (update! f box) - (All [a !] (-> (-> a a) (Box ! a) (Thread ! a))) + (All (_ a !) (-> (-> a a) (Box ! a) (Thread ! a))) (do ..monad [old (read! box) _ (write! (f old) box)] diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 48ee21443..a4ceae85d 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -60,8 +60,8 @@ ma))) (implementation: .public (with monad) - ... TODO: Replace (All [a] (! (Try a))) with (functor.Then ! Try) - (All [!] (-> (Monad !) (Monad (All [a] (! (Try a)))))) + ... TODO: Replace (All (_ a) (! (Try a))) with (functor.Then ! Try) + (All (_ !) (-> (Monad !) (Monad (All (_ a) (! (Try a)))))) (def: &functor (functor.composite (value@ #monad.&functor monad) ..functor)) @@ -81,11 +81,11 @@ Mea)))) (def: .public (lifted monad) - (All [! a] (-> (Monad !) (-> (! a) (! (Try a))))) + (All (_ ! a) (-> (Monad !) (-> (! a) (! (Try a))))) (\ monad each (\ ..monad in))) (implementation: .public (equivalence (^open "_\.")) - (All [a] (-> (Equivalence a) (Equivalence (Try a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Try a)))) (def: (= reference sample) (case [reference sample] @@ -100,7 +100,8 @@ ))) (def: .public (trusted try) - (All [a] (-> (Try a) a)) + (All (_ a) + (-> (Try a) a)) (case try (#Success value) value @@ -109,7 +110,8 @@ (panic! message))) (def: .public (maybe try) - (All [a] (-> (Try a) (Maybe a))) + (All (_ a) + (-> (Try a) (Maybe a))) (case try (#Success value) (#.Some value) @@ -118,7 +120,8 @@ #.None)) (def: .public (of_maybe maybe) - (All [a] (-> (Maybe a) (Try a))) + (All (_ a) + (-> (Maybe a) (Try a))) (case maybe (#.Some value) (#Success value) diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index 825700d8f..b933c4388 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -14,11 +14,11 @@ #value value})) (def: .public (write message) - (All [log] (-> log (Writer log Any))) + (All (_ log) (-> log (Writer log Any))) [message []]) (implementation: .public functor - (All [l] + (All (_ l) (Functor (Writer l))) (def: (each f fa) @@ -26,7 +26,7 @@ [log (f datum)]))) (implementation: .public (apply monoid) - (All [l] + (All (_ l) (-> (Monoid l) (Apply (Writer l)))) (def: &functor ..functor) @@ -37,7 +37,7 @@ [(\ monoid composite log1 log2) (f a)]))) (implementation: .public (monad monoid) - (All [l] + (All (_ l) (-> (Monoid l) (Monad (Writer l)))) (def: &functor ..functor) @@ -50,7 +50,7 @@ [(\ monoid composite log1 log2) a]))) (implementation: .public (with monoid monad) - (All [l M] (-> (Monoid l) (Monad M) (Monad (All [a] (M (Writer l a)))))) + (All (_ l M) (-> (Monoid l) (Monad M) (Monad (All (_ a) (M (Writer l a)))))) (def: &functor (functor.composite (value@ #monad.&functor monad) @@ -71,7 +71,7 @@ (in [(\ monoid composite l1 l2) a])))) (def: .public (lifted monoid monad) - (All [l M a] + (All (_ l M a) (-> (Monoid l) (Monad M) (-> (M a) (M (Writer l a))))) (\ monad each (|>> [(\ monoid identity)]))) diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index ada9bc855..c87d157ea 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -184,7 +184,7 @@ (array.empty size))) (def: .public (aggregate f init binary) - (All [a] (-> (-> I64 a a) a Binary a)) + (All (_ a) (-> (-> I64 a a) a Binary a)) (let [size (..!size binary)] (loop [index 0 output init] diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux index 6efecceb7..238f87e5d 100644 --- a/stdlib/source/library/lux/data/bit.lux +++ b/stdlib/source/library/lux/data/bit.lux @@ -61,5 +61,5 @@ _ (#.Left "Wrong syntax for Bit.")))) (def: .public complement - (All [a] (-> (-> a Bit) (-> a Bit))) + (All (_ a) (-> (-> a Bit) (-> a Bit))) (function.composite not)) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 73e8a209b..92586e228 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -36,7 +36,7 @@ (as_is)) (def: .public (empty size) - (All [a] (-> Nat (Array a))) + (All (_ a) (-> Nat (Array a))) (for {@.old (:expected ("jvm anewarray" "(java.lang.Object )" size)) @@ -55,7 +55,7 @@ @.scheme ("scheme array new" size)})) (def: .public (size array) - (All [a] (-> (Array a) Nat)) + (All (_ a) (-> (Array a) Nat)) (for {@.old ("jvm arraylength" array) @@ -82,7 +82,7 @@ (#.Some output)))]) (def: .public (read! index array) - (All [a] + (All (_ a) (-> Nat (Array a) (Maybe a))) (if (n.< (size array) index) (for {@.old @@ -108,7 +108,7 @@ #.None)) (def: .public (write! index value array) - (All [a] + (All (_ a) (-> Nat a (Array a) (Array a))) (for {@.old ("jvm aastore" array index value) @@ -127,7 +127,7 @@ @.scheme ("scheme array write" index value array)})) (def: .public (delete! index array) - (All [a] + (All (_ a) (-> Nat (Array a) (Array a))) (if (n.< (size array) index) (for {@.old @@ -146,7 +146,7 @@ ) (def: .public (contains? index array) - (All [a] + (All (_ a) (-> Nat (Array a) Bit)) (case (..read! index array) (#.Some _) @@ -156,7 +156,7 @@ false)) (def: .public (update! index transform array) - (All [a] + (All (_ a) (-> Nat (-> a a) (Array a) (Array a))) (case (read! index array) #.None @@ -166,14 +166,14 @@ (write! index (transform value) array))) (def: .public (upsert! index default transform array) - (All [a] + (All (_ a) (-> Nat a (-> a a) (Array a) (Array a))) (write! index (|> array (read! index) (maybe.else default) transform) array)) (def: .public (copy! length src_start src_array dest_start dest_array) - (All [a] + (All (_ a) (-> Nat Nat (Array a) Nat (Array a) (Array a))) (if (n.= 0 length) @@ -189,7 +189,7 @@ (list.indices length)))) (def: .public (occupancy array) - (All [a] (-> (Array a) Nat)) + (All (_ a) (-> (Array a) Nat)) (list\mix (function (_ idx count) (case (read! idx array) #.None @@ -201,11 +201,11 @@ (list.indices (size array)))) (def: .public (vacancy array) - (All [a] (-> (Array a) Nat)) + (All (_ a) (-> (Array a) Nat)) (n.- (..occupancy array) (..size array))) (def: .public (filter! p xs) - (All [a] + (All (_ a) (-> (Predicate a) (Array a) (Array a))) (list\mix (function (_ idx xs') (case (read! idx xs) @@ -220,7 +220,7 @@ (list.indices (size xs)))) (def: .public (example p xs) - (All [a] + (All (_ a) (-> (Predicate a) (Array a) (Maybe a))) (let [arr_size (size xs)] (loop [idx 0] @@ -236,7 +236,7 @@ #.None)))) (def: .public (example+ p xs) - (All [a] + (All (_ a) (-> (-> Nat a Bit) (Array a) (Maybe [Nat a]))) (let [arr_size (size xs)] (loop [idx 0] @@ -252,7 +252,7 @@ #.None)))) (def: .public (clone xs) - (All [a] (-> (Array a) (Array a))) + (All (_ a) (-> (Array a) (Array a))) (let [arr_size (size xs)] (list\mix (function (_ idx ys) (case (read! idx xs) @@ -265,7 +265,7 @@ (list.indices arr_size)))) (def: .public (of_list xs) - (All [a] (-> (List a) (Array a))) + (All (_ a) (-> (List a) (Array a))) (product.right (list\mix (function (_ x [idx arr]) [(++ idx) (write! idx x arr)]) [0 (empty (list.size xs))] @@ -276,7 +276,7 @@ (-- 0)) (def: (list|-default array) - (All [a] (-> (Array a) (List a))) + (All (_ a) (-> (Array a) (List a))) (loop [idx (-- (size array)) output #.End] (case idx @@ -293,7 +293,7 @@ output))))) (def: (list|+default default array) - (All [a] (-> a (Array a) (List a))) + (All (_ a) (-> a (Array a) (List a))) (loop [idx (-- (size array)) output #.End] (case idx @@ -306,7 +306,7 @@ output))))) (def: .public (list default array) - (All [a] (-> (Maybe a) (Array a) (List a))) + (All (_ a) (-> (Maybe a) (Array a) (List a))) (case default (#.Some default) (list|+default default array) @@ -315,7 +315,7 @@ (list|-default array))) (implementation: .public (equivalence (^open ",\.")) - (All [a] (-> (Equivalence a) (Equivalence (Array a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Array a)))) (def: (= xs ys) (let [sxs (size xs) @@ -336,7 +336,7 @@ (list.indices sxs)))))) (implementation: .public monoid - (All [a] (Monoid (Array a))) + (All (_ a) (Monoid (Array a))) (def: identity (empty 0)) @@ -383,7 +383,7 @@ (template [<name> <init> <op>] [(def: .public (<name> predicate) - (All [a] + (All (_ a) (-> (Predicate a) (Predicate (Array a)))) (function (_ array) (let [size (..size array)] diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 0828d54e2..ad65dabbd 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -132,7 +132,7 @@ ... Expands a copy of the array, to have 1 extra slot, which is used ... for storing the value. (def: (array\has idx value old_array) - (All [a] (-> Index a (Array a) (Array a))) + (All (_ a) (-> Index a (Array a) (Array a))) (let [old_size (array.size old_array)] (|> (array.empty (++ old_size)) (array.copy! idx 0 old_array 0) @@ -141,19 +141,19 @@ ... Creates a copy of an array with an index set to a particular value. (def: (array\revised idx value array) - (All [a] (-> Index a (Array a) (Array a))) + (All (_ a) (-> Index a (Array a) (Array a))) (|> array array.clone (array.write! idx value))) ... Creates a clone of the array, with an empty position at index. (def: (array\clear idx array) - (All [a] (-> Index (Array a) (Array a))) + (All (_ a) (-> Index (Array a) (Array a))) (|> array array.clone (array.delete! idx))) ... Shrinks a copy of the array by removing the space at index. (def: (array\lacks idx array) - (All [a] (-> Index (Array a) (Array a))) + (All (_ a) (-> Index (Array a) (Array a))) (let [new_size (-- (array.size array))] (|> (array.empty new_size) (array.copy! idx 0 array 0) @@ -227,7 +227,7 @@ ... Produces the index of a KV-pair within a #Collisions node. (def: (collision_index key_hash key colls) - (All [k v] (-> (Hash k) k (Collisions k v) (Maybe Index))) + (All (_ k v) (-> (Hash k) k (Collisions k v) (Maybe Index))) (\ maybe.monad each product.left (array.example+ (function (_ idx [key' val']) (\ key_hash = key key')) @@ -236,7 +236,7 @@ ... When #Hierarchy nodes grow too small, they're demoted to #Base ... nodes to save space. (def: (demotion except_idx [h_size h_array]) - (All [k v] (-> Index (Hierarchy k v) [Bit_Map (Base k v)])) + (All (_ k v) (-> Index (Hierarchy k v) [Bit_Map (Base k v)])) (product.right (list\mix (function (_ idx [insertion_idx node]) (let [[bitmap base] node] (case (array.read! idx h_array) @@ -258,7 +258,7 @@ (list.indices hierarchy_nodes_size)) (def: (promotion node\has key_hash level bitmap base) - (All [k v] + (All (_ k v) (-> (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v)) (Hash k) Level Bit_Map (Base k v) @@ -287,7 +287,7 @@ ... used). ... So, this test is introduced to detect them. (def: (node\empty? node) - (All [k v] (-> (Node k v) Bit)) + (All (_ k v) (-> (Node k v) Bit)) (`` (case node (#Base (~~ (static ..clean_bitmap)) _) #1 @@ -296,7 +296,7 @@ #0))) (def: (node\has level hash key val key_hash node) - (All [k v] (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v))) + (All (_ k v) (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v))) (case node ... For #Hierarchy nodes, check whether one can add the element to ... a sub-node. If impossible, introduce a new singleton sub-node. @@ -393,7 +393,7 @@ )) (def: (node\lacks level hash key key_hash node) - (All [k v] (-> Level Hash_Code k (Hash k) (Node k v) (Node k v))) + (All (_ k v) (-> Level Hash_Code k (Hash k) (Node k v) (Node k v))) (case node ... For #Hierarchy nodes, find out if there's a valid sub-node for ... the Hash-Code. @@ -485,7 +485,7 @@ )) (def: (node\value level hash key key_hash node) - (All [k v] (-> Level Hash_Code k (Hash k) (Node k v) (Maybe v))) + (All (_ k v) (-> Level Hash_Code k (Hash k) (Node k v) (Maybe v))) (case node ... For #Hierarchy nodes, just look-up the key on its children. (#Hierarchy _size hierarchy) @@ -518,7 +518,7 @@ )) (def: (node\size node) - (All [k v] (-> (Node k v) Nat)) + (All (_ k v) (-> (Node k v) Nat)) (case node (#Hierarchy _size hierarchy) (array\mix n.+ 0 (array\each node\size hierarchy)) @@ -535,7 +535,7 @@ )) (def: (node\entries node) - (All [k v] (-> (Node k v) (List [k v]))) + (All (_ k v) (-> (Node k v) (List [k v]))) (case node (#Hierarchy _size hierarchy) (array\mix (function (_ sub_node tail) (list\composite (node\entries sub_node) tail)) @@ -564,31 +564,31 @@ #root (Node k v)})) (def: .public key_hash - (All [k v] (-> (Dictionary k v) (Hash k))) + (All (_ k v) (-> (Dictionary k v) (Hash k))) (value@ #..hash)) (def: .public (empty key_hash) - (All [k v] (-> (Hash k) (Dictionary k v))) + (All (_ k v) (-> (Hash k) (Dictionary k v))) {#hash key_hash #root empty_node}) (def: .public (has key val dict) - (All [k v] (-> k v (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k v (Dictionary k v) (Dictionary k v))) (let [[key_hash node] dict] [key_hash (node\has root_level (\ key_hash hash key) key val key_hash node)])) (def: .public (lacks key dict) - (All [k v] (-> k (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k (Dictionary k v) (Dictionary k v))) (let [[key_hash node] dict] [key_hash (node\lacks root_level (\ key_hash hash key) key key_hash node)])) (def: .public (value key dict) - (All [k v] (-> k (Dictionary k v) (Maybe v))) + (All (_ k v) (-> k (Dictionary k v) (Maybe v))) (let [[key_hash node] dict] (node\value root_level (\ key_hash hash key) key key_hash node))) (def: .public (key? dict key) - (All [k v] (-> (Dictionary k v) k Bit)) + (All (_ k v) (-> (Dictionary k v) k Bit)) (case (value key dict) #.None #0 (#.Some _) #1)) @@ -596,13 +596,13 @@ (exception: .public key_already_exists) (def: .public (has' key val dict) - (All [k v] (-> k v (Dictionary k v) (Try (Dictionary k v)))) + (All (_ k v) (-> k v (Dictionary k v) (Try (Dictionary k v)))) (case (value key dict) #.None (#try.Success (has key val dict)) (#.Some _) (exception.except ..key_already_exists []))) (def: .public (revised key f dict) - (All [k v] (-> k (-> v v) (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v))) (case (value key dict) #.None dict @@ -611,26 +611,26 @@ (has key (f val) dict))) (def: .public (revised' key default f dict) - (All [k v] (-> k v (-> v v) (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k v (-> v v) (Dictionary k v) (Dictionary k v))) (..has key (f (maybe.else default (..value key dict))) dict)) (def: .public size - (All [k v] (-> (Dictionary k v) Nat)) + (All (_ k v) (-> (Dictionary k v) Nat)) (|>> product.right ..node\size)) (def: .public empty? - (All [k v] (-> (Dictionary k v) Bit)) + (All (_ k v) (-> (Dictionary k v) Bit)) (|>> size (n.= 0))) (def: .public entries - (All [k v] (-> (Dictionary k v) (List [k v]))) + (All (_ k v) (-> (Dictionary k v) (List [k v]))) (|>> product.right ..node\entries)) (def: .public (of_list key_hash kvs) - (All [k v] (-> (Hash k) (List [k v]) (Dictionary k v))) + (All (_ k v) (-> (Hash k) (List [k v]) (Dictionary k v))) (list\mix (function (_ [k v] dict) (..has k v dict)) (empty key_hash) @@ -638,7 +638,7 @@ (template [<side> <name>] [(def: .public <name> - (All [k v] (-> (Dictionary k v) (List <side>))) + (All (_ k v) (-> (Dictionary k v) (List <side>))) (|>> ..entries (list\mix (function (_ [k v] bundle) (#.Item <side> bundle)) @@ -649,13 +649,13 @@ ) (def: .public (merged dict2 dict1) - (All [k v] (-> (Dictionary k v) (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> (Dictionary k v) (Dictionary k v) (Dictionary k v))) (list\mix (function (_ [key val] dict) (has key val dict)) dict1 (entries dict2))) (def: .public (merged_with f dict2 dict1) - (All [k v] (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v))) (list\mix (function (_ [key val2] dict) (case (value key dict) #.None @@ -667,7 +667,7 @@ (entries dict2))) (def: .public (re_bound from_key to_key dict) - (All [k v] (-> k k (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k k (Dictionary k v) (Dictionary k v))) (case (value from_key dict) #.None dict @@ -678,7 +678,7 @@ (has to_key val)))) (def: .public (sub keys dict) - (All [k v] (-> (List k) (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> (List k) (Dictionary k v) (Dictionary k v))) (let [[key_hash _] dict] (list\mix (function (_ key new_dict) (case (value key dict) @@ -688,7 +688,7 @@ keys))) (implementation: .public (equivalence (^open ",\.")) - (All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v)))) + (All (_ k v) (-> (Equivalence v) (Equivalence (Dictionary k v)))) (def: (= reference subject) (and (n.= (..size reference) @@ -703,7 +703,7 @@ (..entries reference))))) (implementation: node_functor - (All [k] (Functor (Node k))) + (All (_ k) (Functor (Node k))) (def: (each f fa) (case fa @@ -726,7 +726,7 @@ collisions))))) (implementation: .public functor - (All [k] (Functor (Dictionary k))) + (All (_ k) (Functor (Dictionary k))) (def: (each f fa) (revised@ #root (\ ..node_functor each 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 ef9e53973..acb2599f2 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -33,7 +33,7 @@ (template [<create> <color>] [(def: (<create> key value left right) - (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) + (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) {#color <color> #key key #value value @@ -50,14 +50,14 @@ #root (Maybe (Node k v))})) (def: .public (empty order) - (All [k v] (-> (Order k) (Dictionary k v))) + (All (_ k v) (-> (Order k) (Dictionary k v))) {#&order order #root #.None}) ... TODO: Doing inneficient access of Order functions due to compiler bug. ... TODO: Must improve it as soon as bug is fixed. (def: .public (value key dict) - (All [k v] (-> k (Dictionary k v) (Maybe v))) + (All (_ k v) (-> k (Dictionary k v) (Maybe v))) (let [... (^open "_\.") (value@ #&order dict) ] (loop [node (value@ #root 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: .public (key? dict key) - (All [k v] (-> (Dictionary k v) k Bit)) + (All (_ k v) (-> (Dictionary k v) k Bit)) (let [... (^open "_\.") (value@ #&order dict) ] (loop [node (value@ #root dict)] @@ -101,7 +101,7 @@ (template [<name> <side>] [(def: .public (<name> dict) - (All [k v] (-> (Dictionary k v) (Maybe v))) + (All (_ k v) (-> (Dictionary k v) (Maybe v))) (case (value@ #root dict) #.None #.None @@ -120,7 +120,7 @@ ) (def: .public (size dict) - (All [k v] (-> (Dictionary k v) Nat)) + (All (_ k v) (-> (Dictionary k v) Nat)) (loop [node (value@ #root dict)] (case node #.None @@ -131,12 +131,12 @@ (recur (value@ #right node))))))) (def: .public empty? - (All [k v] (-> (Dictionary k v) Bit)) + (All (_ k v) (-> (Dictionary k v) Bit)) (|>> ..size (n.= 0))) (template [<name> <other_color> <self_color> <no_change>] [(def: (<name> self) - (All [k v] (-> (Node k v) (Node k v))) + (All (_ k v) (-> (Node k v) (Node k v))) (case (value@ #color self) <other_color> (with@ #color <self_color> self) @@ -150,7 +150,7 @@ ) (def: (with_left addition center) - (All [k v] (-> (Node k v) (Node k v) (Node k v))) + (All (_ k v) (-> (Node k v) (Node k v) (Node k v))) (case (value@ #color center) #Red (red (value@ #key center) @@ -199,7 +199,7 @@ <default_behavior>)))) (def: (with_right addition center) - (All [k v] (-> (Node k v) (Node k v) (Node k v))) + (All (_ k v) (-> (Node k v) (Node k v) (Node k v))) (case (value@ #color center) #Red (red (value@ #key center) @@ -248,7 +248,7 @@ <default_behavior>)))) (def: .public (has key value dict) - (All [k v] (-> k v (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k v (Dictionary k v) (Dictionary k v))) (let [(^open "_\.") (value@ #&order dict) root' (loop [?root (value@ #root dict)] (case ?root @@ -277,7 +277,7 @@ (with@ #root root' dict))) (def: (left_balanced key value ?left ?right) - (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) + (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^multi (#.Some left) {(value@ #color left) #Red} @@ -306,7 +306,7 @@ (black key value ?left ?right))) (def: (right_balanced key value ?left ?right) - (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) + (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^multi (#.Some right) {(value@ #color right) #Red} @@ -333,7 +333,7 @@ (black key value ?left ?right))) (def: (without_left key value ?left ?right) - (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) + (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^multi (#.Some left) {(value@ #color left) #Red}) @@ -362,7 +362,7 @@ )) (def: (without_right key value ?left ?right) - (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) + (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^multi (#.Some right) {(value@ #color right) #Red}) @@ -391,7 +391,7 @@ ))) (def: (prepended ?left ?right) - (All [k v] (-> (Maybe (Node k v)) (Maybe (Node k v)) (Maybe (Node k v)))) + (All (_ k v) (-> (Maybe (Node k v)) (Maybe (Node k v)) (Maybe (Node k v)))) (case [?left ?right] [#.None _] ?right @@ -471,7 +471,7 @@ (undefined))) (def: .public (lacks key dict) - (All [k v] (-> k (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k (Dictionary k v) (Dictionary k v))) (let [(^open "_\.") (value@ #&order dict) [?root found?] (loop [?root (value@ #root dict)] (case ?root @@ -526,7 +526,7 @@ ))) (def: .public (revised key transform dict) - (All [k v] (-> k (-> v v) (Dictionary k v) (Dictionary k v))) + (All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v))) (case (..value key dict) (#.Some old) (..has key (transform old) dict) @@ -535,7 +535,7 @@ dict)) (def: .public (of_list order list) - (All [k v] (-> (Order k) (List [k v]) (Dictionary k v))) + (All (_ k v) (-> (Order k) (List [k v]) (Dictionary k v))) (list\mix (function (_ [key value] dict) (has key value dict)) (empty order) @@ -543,7 +543,7 @@ (template [<name> <type> <output>] [(def: .public (<name> dict) - (All [k v] (-> (Dictionary k v) (List <type>))) + (All (_ k v) (-> (Dictionary k v) (List <type>))) (loop [node (value@ #root dict)] (case node #.None @@ -561,7 +561,7 @@ ) (implementation: .public (equivalence (^open ",\.")) - (All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v)))) + (All (_ k v) (-> (Equivalence v) (Equivalence (Dictionary k v)))) (def: (= reference sample) (let [(^open "/\.") (value@ #&order reference)] diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux index df834ae4c..b5f04aa4a 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux @@ -21,15 +21,15 @@ #.End) (def: .public size - (All [a] (-> (PList a) Nat)) + (All (_ a) (-> (PList a) Nat)) list.size) (def: .public empty? - (All [a] (-> (PList a) Bit)) + (All (_ a) (-> (PList a) Bit)) (|>> ..size (n.= 0))) (def: .public (value key properties) - (All [a] (-> Text (PList a) (Maybe a))) + (All (_ a) (-> Text (PList a) (Maybe a))) (case properties #.End #.None @@ -41,7 +41,7 @@ (template [<name> <type> <access>] [(def: .public <name> - (All [a] (-> (PList a) (List <type>))) + (All (_ a) (-> (PList a) (List <type>))) (list\each <access>))] [keys Text product.left] @@ -49,7 +49,7 @@ ) (def: .public (contains? key properties) - (All [a] (-> Text (PList a) Bit)) + (All (_ a) (-> Text (PList a) Bit)) (case (..value key properties) (#.Some _) true @@ -58,7 +58,7 @@ false)) (def: .public (has key val properties) - (All [a] (-> Text a (PList a) (PList a))) + (All (_ a) (-> Text a (PList a) (PList a))) (case properties #.End (list [key val]) @@ -71,7 +71,7 @@ (has key val properties'))))) (def: .public (revised key f properties) - (All [a] (-> Text (-> a a) (PList a) (PList a))) + (All (_ a) (-> Text (-> a a) (PList a) (PList a))) (case properties #.End #.End @@ -82,7 +82,7 @@ (#.Item [k' v'] (revised key f properties'))))) (def: .public (lacks key properties) - (All [a] (-> Text (PList a) (PList a))) + (All (_ a) (-> Text (PList a) (PList a))) (case properties #.End properties @@ -94,6 +94,6 @@ (lacks key properties'))))) (def: .public equivalence - (All [a] (-> (Equivalence a) (Equivalence (PList a)))) + (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 9ea9c3132..5649dacec 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -35,7 +35,7 @@ (mix f (f x init) xs')))) (def: .public (mixes f init inputs) - (All [a b] (-> (-> a b b) b (List a) (List b))) + (All (_ a b) (-> (-> a b b) b (List a) (List b))) (case inputs #.End (list init) @@ -44,14 +44,14 @@ (#.Item [init (mixes f (f head init) tail)]))) (def: .public (reversed xs) - (All [a] + (All (_ a) (-> (List a) (List a))) (mix (function (_ head tail) (#.Item head tail)) #.End xs)) (def: .public (only keep? xs) - (All [a] + (All (_ a) (-> (Predicate a) (List a) (List a))) (case xs #.End @@ -63,7 +63,7 @@ (only keep? xs')))) (def: .public (partition satisfies? list) - (All [a] (-> (Predicate a) (List a) [(List a) (List a)])) + (All (_ a) (-> (Predicate a) (List a) [(List a) (List a)])) (case list #.End [#.End #.End] @@ -75,7 +75,7 @@ [in (#.Item head out)])))) (def: .public (pairs xs) - (All [a] (-> (List a) (List [a a]))) + (All (_ a) (-> (List a) (List [a a]))) (case xs (^ (list& x1 x2 xs')) (#.Item [x1 x2] (pairs xs')) @@ -85,7 +85,7 @@ (template [<name> <then> <else>] [(def: .public (<name> n xs) - (All [a] + (All (_ a) (-> Nat (List a) (List a))) (if (n.> 0 n) (case xs @@ -102,7 +102,7 @@ (template [<name> <then> <else>] [(def: .public (<name> predicate xs) - (All [a] + (All (_ a) (-> (Predicate a) (List a) (List a))) (case xs #.End @@ -118,7 +118,7 @@ ) (def: .public (split_at n xs) - (All [a] + (All (_ a) (-> Nat (List a) [(List a) (List a)])) (if (n.> 0 n) (case xs @@ -131,7 +131,7 @@ [#.End xs])) (def: (split_when' predicate ys xs) - (All [a] + (All (_ a) (-> (Predicate a) (List a) (List a) [(List a) (List a)])) (case xs #.End @@ -143,13 +143,13 @@ (split_when' predicate (#.Item x ys) xs')))) (def: .public (split_when predicate xs) - (All [a] + (All (_ a) (-> (Predicate a) (List a) [(List a) (List a)])) (let [[ys' xs'] (split_when' predicate #.End xs)] [(reversed ys') xs'])) (def: .public (sub size list) - (All [a] (-> Nat (List a) (List (List a)))) + (All (_ a) (-> Nat (List a) (List (List a)))) (case list #.End #.End @@ -159,14 +159,14 @@ (#.Item pre (sub size post))))) (def: .public (repeated n x) - (All [a] + (All (_ a) (-> Nat a (List a))) (case n 0 #.End _ (#.Item x (repeated (-- n) x)))) (def: (iterations' f x) - (All [a] + (All (_ a) (-> (-> a (Maybe a)) a (List a))) (case (f x) (#.Some x') @@ -176,7 +176,7 @@ (list))) (def: .public (iterations f x) - (All [a] + (All (_ a) (-> (-> a (Maybe a)) a (List a))) (case (f x) (#.Some x') @@ -186,7 +186,7 @@ (list x))) (def: .public (one check xs) - (All [a b] + (All (_ a b) (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs #.End @@ -201,7 +201,7 @@ (one check xs')))) (def: .public (all check xs) - (All [a b] + (All (_ a b) (-> (-> a (Maybe b)) (List a) (List b))) (for {... TODO: Stop relying on this ASAP. @.js @@ -227,7 +227,7 @@ (all check xs'))))) (def: .public (example predicate xs) - (All [a] + (All (_ a) (-> (Predicate a) (List a) (Maybe a))) (..one (function (_ value) (if (predicate value) @@ -236,7 +236,7 @@ xs)) (def: .public (interposed sep xs) - (All [a] + (All (_ a) (-> a (List a) (List a))) (case xs #.End @@ -249,12 +249,12 @@ (list& x sep (interposed sep xs')))) (def: .public (size list) - (All [a] (-> (List a) Nat)) + (All (_ a) (-> (List a) Nat)) (mix (function (_ _ acc) (n.+ 1 acc)) 0 list)) (template [<name> <init> <op>] [(def: .public (<name> predicate items) - (All [a] + (All (_ a) (-> (Predicate a) (List a) Bit)) (case items #.End @@ -269,7 +269,7 @@ ) (def: .public (item i xs) - (All [a] + (All (_ a) (-> Nat (List a) (Maybe a))) (case xs #.End @@ -281,7 +281,7 @@ _ (item (-- i) xs')))) (implementation: .public (equivalence Equivalence<a>) - (All [a] (-> (Equivalence a) (Equivalence (List a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (List a)))) (def: (= xs ys) (case [xs ys] @@ -297,7 +297,7 @@ ))) (implementation: .public (hash super) - (All [a] (-> (Hash a) (Hash (List a)))) + (All (_ a) (-> (Hash a) (Hash (List a)))) (def: &equivalence (..equivalence (\ super &equivalence))) @@ -309,7 +309,7 @@ 0))) (implementation: .public monoid - (All [a] (Monoid (List a))) + (All (_ a) (Monoid (List a))) (def: identity #.End) (def: (composite xs ys) @@ -362,7 +362,7 @@ (|>> reversed (mix composite identity)))) (def: .public (sorted < xs) - (All [a] (-> (-> a a Bit) (List a) (List a))) + (All (_ a) (-> (-> a a Bit) (List a) (List a))) (case xs #.End (list) @@ -377,7 +377,7 @@ ($_ composite (sorted < pre) (list x) (sorted < post))))) (def: .public (empty? xs) - (All [a] (Predicate (List a))) + (All (_ a) (Predicate (List a))) (case xs #.End true @@ -386,7 +386,7 @@ false)) (def: .public (member? eq xs x) - (All [a] (-> (Equivalence a) (List a) a Bit)) + (All (_ a) (-> (Equivalence a) (List a) a Bit)) (case xs #.End #0 @@ -397,7 +397,7 @@ (template [<name> <output> <side>] [(def: .public (<name> xs) - (All [a] (-> (List a) (Maybe <output>))) + (All (_ a) (-> (List a) (Maybe <output>))) (case xs #.End #.None @@ -410,7 +410,7 @@ ) (def: .public (indices size) - (All [a] (-> Nat (List Nat))) + (All (_ a) (-> Nat (List Nat))) (case size 0 (list) _ (|> size -- (enum.range n.enum 0)))) @@ -448,7 +448,7 @@ (let [(^open ".") ..functor indices (..indices num_lists) type_vars (: (List Code) (each (|>> nat\encoded identifier$) indices)) - zipped_type (` (All [(~+ type_vars)] + zipped_type (` (.All ((~ (identifier$ "0_")) (~+ type_vars)) (-> (~+ (each (: (-> Code Code) (function (_ var) (` (List (~ var))))) type_vars)) (List [(~+ type_vars)])))) @@ -490,7 +490,7 @@ g!return_type (identifier$ "0return_type0") g!func (identifier$ "0func0") type_vars (: (List Code) (each (|>> nat\encoded identifier$) indices)) - zipped_type (` (All [(~+ type_vars) (~ g!return_type)] + zipped_type (` (All ((~ (identifier$ "0_")) (~+ type_vars) (~ g!return_type)) (-> (-> (~+ type_vars) (~ g!return_type)) (~+ (each (: (-> Code Code) (function (_ var) (` (List (~ var))))) type_vars)) @@ -525,7 +525,7 @@ (def: .public zipped_with/3 (zipped_with 3)) (def: .public (last xs) - (All [a] (-> (List a) (Maybe a))) + (All (_ a) (-> (List a) (Maybe a))) (case xs #.End #.None @@ -537,7 +537,7 @@ (last xs'))) (def: .public (inits xs) - (All [a] (-> (List a) (Maybe (List a)))) + (All (_ a) (-> (List a) (Maybe (List a)))) (case xs #.End #.None @@ -555,11 +555,11 @@ )) (def: .public together - (All [a] (-> (List (List a)) (List a))) + (All (_ a) (-> (List (List a)) (List a))) (\ ..monad conjoint)) (implementation: .public (with monad) - (All [M] (-> (Monad M) (Monad (All [a] (M (List a)))))) + (All (_ M) (-> (Monad M) (Monad (All (_ a) (M (List a)))))) (def: &functor (functor.composite (value@ #monad.&functor monad) @@ -579,11 +579,11 @@ (in (..together lla))))) (def: .public (lifted monad) - (All [M a] (-> (Monad M) (-> (M a) (M (List a))))) + (All (_ M a) (-> (Monad M) (-> (M a) (M (List a))))) (\ monad each (\ ..monad in))) (def: .public (enumeration xs) - (All [a] (-> (List a) (List [Nat a]))) + (All (_ a) (-> (List a) (List [Nat a]))) (loop [idx 0 xs xs] (case xs diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index ca41352b6..524c14067 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -22,37 +22,37 @@ #rear (.list)}) (def: .public (of_list entries) - (All [a] (-> (List a) (Queue a))) + (All (_ a) (-> (List a) (Queue a))) {#front entries #rear (.list)}) (def: .public (list queue) - (All [a] (-> (Queue a) (List a))) + (All (_ a) (-> (Queue a) (List a))) (let [(^slots [#front #rear]) queue] (list\composite front (list.reversed rear)))) (def: .public front - (All [a] (-> (Queue a) (Maybe a))) + (All (_ a) (-> (Queue a) (Maybe a))) (|>> (value@ #front) list.head)) (def: .public (size queue) - (All [a] (-> (Queue a) Nat)) + (All (_ a) (-> (Queue a) Nat)) (let [(^slots [#front #rear]) queue] (n.+ (list.size front) (list.size rear)))) (def: .public empty? - (All [a] (-> (Queue a) Bit)) + (All (_ a) (-> (Queue a) Bit)) (|>> (value@ #front) list.empty?)) (def: .public (member? equivalence queue member) - (All [a] (-> (Equivalence a) (Queue a) a Bit)) + (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: .public (next queue) - (All [a] (-> (Queue a) (Queue a))) + (All (_ a) (-> (Queue a) (Queue a))) (case (value@ #front queue) ... Empty... (^ (.list)) @@ -70,7 +70,7 @@ (with@ #front front')))) (def: .public (end val queue) - (All [a] (-> a (Queue a) (Queue a))) + (All (_ a) (-> a (Queue a) (Queue a))) (case (value@ #front queue) #.End (with@ #front (.list val) queue) @@ -79,7 +79,7 @@ (revised@ #rear (|>> (#.Item val)) queue))) (implementation: .public (equivalence super) - (All [a] (-> (Equivalence a) (Equivalence (Queue a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Queue a)))) (def: (= reference subject) (\ (list.equivalence super) = diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index 88da217c3..d3fb97cbb 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -47,14 +47,14 @@ (:abstraction #.None)) (def: .public (front queue) - (All [a] (-> (Queue a) (Maybe a))) + (All (_ a) (-> (Queue a) (Maybe a))) (do maybe.monad [tree (:representation queue)] (tree.one (n.= (tree.tag tree)) tree))) (def: .public (size queue) - (All [a] (-> (Queue a) Nat)) + (All (_ a) (-> (Queue a) Nat)) (case (:representation queue) #.None 0 @@ -69,7 +69,7 @@ (n.+ (recur left) (recur right)))))) (def: .public (member? equivalence queue member) - (All [a] (-> (Equivalence a) (Queue a) a Bit)) + (All (_ a) (-> (Equivalence a) (Queue a) a Bit)) (case (:representation queue) #.None false @@ -85,7 +85,7 @@ (recur right)))))) (def: .public (next queue) - (All [a] (-> (Queue a) (Queue a))) + (All (_ a) (-> (Queue a) (Queue a))) (:abstraction (do maybe.monad [tree (:representation queue) @@ -113,7 +113,7 @@ (#.Some (\ ..builder branch left =right))))))))) (def: .public (end priority value queue) - (All [a] (-> Priority a (Queue a) (Queue a))) + (All (_ a) (-> Priority a (Queue a) (Queue a))) (let [addition (\ ..builder leaf priority value)] (:abstraction (case (:representation queue) @@ -125,5 +125,5 @@ ) (def: .public empty? - (All [a] (-> (Queue a) Bit)) + (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 30a2323c4..59f48d867 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -79,7 +79,7 @@ (i64.and branch_idx_mask)) (def: (empty_hierarchy _) - (All [a] (-> Any (Hierarchy a))) + (All (_ a) (-> Any (Hierarchy a))) (array.empty ..full_node_size)) (def: (tail_off row_size) @@ -91,7 +91,7 @@ (i64.left_shifted branching_exponent)))) (def: (path level tail) - (All [a] (-> Level (Base a) (Node a))) + (All (_ a) (-> Level (Base a) (Node a))) (if (n.= 0 level) (#Base tail) (|> (empty_hierarchy []) @@ -99,12 +99,12 @@ #Hierarchy))) (def: (tail singleton) - (All [a] (-> a (Base a))) + (All (_ a) (-> a (Base a))) (|> (array.empty 1) (array.write! 0 singleton))) (def: (with_tail size level tail parent) - (All [a] (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a))) + (All (_ a) (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a))) (let [sub_idx (branch_idx (i64.right_shifted level (-- size))) ... If we're currently on a bottom node sub_node (if (n.= branching_exponent level) @@ -126,14 +126,14 @@ (array.write! sub_idx sub_node)))) (def: (expanded_tail val tail) - (All [a] (-> a (Base a) (Base a))) + (All (_ a) (-> a (Base a) (Base a))) (let [tail_size (array.size tail)] (|> (array.empty (++ tail_size)) (array.copy! tail_size 0 tail 0) (array.write! tail_size val)))) (def: (hierarchy\has level idx val hierarchy) - (All [a] (-> Level Index a (Hierarchy a) (Hierarchy a))) + (All (_ a) (-> Level Index a (Hierarchy a) (Hierarchy a))) (let [sub_idx (branch_idx (i64.right_shifted level idx))] (case (array.read! sub_idx hierarchy) (#.Some (#Hierarchy sub_node)) @@ -151,7 +151,7 @@ (undefined)))) (def: (without_tail size level hierarchy) - (All [a] (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a)))) + (All (_ a) (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a)))) (let [sub_idx (branch_idx (i64.right_shifted level (n.- 2 size)))] (cond (n.= 0 sub_idx) #.None @@ -176,7 +176,7 @@ ))) (def: (node\list node) - (All [a] (-> (Node a) (List a))) + (All (_ a) (-> (Node a) (List a))) (case node (#Base base) (array.list #.None base) @@ -204,11 +204,11 @@ #tail (array.empty 0)}) (def: .public (size row) - (All [a] (-> (Row a) Nat)) + (All (_ a) (-> (Row a) Nat)) (value@ #size row)) (def: .public (suffix val row) - (All [a] (-> a (Row a) (Row a))) + (All (_ a) (-> a (Row a) (Row a))) ... Check if there is room in the tail. (let [row_size (value@ #size row)] (if (|> row_size (n.- (tail_off row_size)) (n.< full_node_size)) @@ -249,11 +249,11 @@ (exception: base_was_not_found) (def: .public (within_bounds? row idx) - (All [a] (-> (Row a) Nat Bit)) + (All (_ a) (-> (Row a) Nat Bit)) (n.< (value@ #size row) idx)) (def: (base_for idx row) - (All [a] (-> Index (Row a) (Try (Base a)))) + (All (_ a) (-> Index (Row a) (Try (Base a)))) (if (within_bounds? row idx) (if (n.< (tail_off (value@ #size row)) idx) (loop [level (value@ #level row) @@ -275,7 +275,7 @@ (exception.except ..index_out_of_bounds [row idx]))) (def: .public (item idx row) - (All [a] (-> Nat (Row a) (Try a))) + (All (_ a) (-> Nat (Row a) (Try a))) (do try.monad [base (base_for idx row)] (case (array.read! (branch_idx idx) base) @@ -286,7 +286,7 @@ (exception.except ..incorrect_row_structure [])))) (def: .public (has idx val row) - (All [a] (-> Nat a (Row a) (Try (Row a)))) + (All (_ a) (-> Nat a (Row a) (Try (Row a)))) (let [row_size (value@ #size row)] (if (within_bounds? row idx) (#try.Success (if (n.< (tail_off row_size) idx) @@ -300,13 +300,13 @@ (exception.except ..index_out_of_bounds [row idx])))) (def: .public (revised idx f row) - (All [a] (-> Nat (-> a a) (Row a) (Try (Row a)))) + (All (_ a) (-> Nat (-> a a) (Row a) (Try (Row a)))) (do try.monad [val (..item idx row)] (..has idx (f val) row))) (def: .public (prefix row) - (All [a] (-> (Row a) (Row a))) + (All (_ a) (-> (Row a) (Row a))) (case (value@ #size row) 0 empty @@ -348,27 +348,27 @@ )) (def: .public (list row) - (All [a] (-> (Row a) (List a))) + (All (_ a) (-> (Row a) (List a))) (list\composite (node\list (#Hierarchy (value@ #root row))) (node\list (#Base (value@ #tail row))))) (def: .public of_list - (All [a] (-> (List a) (Row a))) + (All (_ a) (-> (List a) (Row a))) (list\mix ..suffix ..empty)) (def: .public (member? equivalence row val) - (All [a] (-> (Equivalence a) (Row a) a Bit)) + (All (_ a) (-> (Equivalence a) (Row a) a Bit)) (list.member? equivalence (list row) val)) (def: .public empty? - (All [a] (-> (Row a) Bit)) + (All (_ a) (-> (Row a) Bit)) (|>> (value@ #size) (n.= 0))) (syntax: .public (row [elems (<>.some <code>.any)]) (in (.list (` (..of_list (.list (~+ elems))))))) (implementation: (node_equivalence Equivalence<a>) - (All [a] (-> (Equivalence a) (Equivalence (Node a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Node a)))) (def: (= v1 v2) (case [v1 v2] @@ -382,7 +382,7 @@ #0))) (implementation: .public (equivalence Equivalence<a>) - (All [a] (-> (Equivalence a) (Equivalence (Row a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Row a)))) (def: (= v1 v2) (and (n.= (value@ #size v1) (value@ #size v2)) @@ -417,7 +417,7 @@ (#Base (value@ #tail xs)))))) (implementation: .public monoid - (All [a] (Monoid (Row a))) + (All (_ a) (Monoid (Row a))) (def: identity ..empty) @@ -471,16 +471,16 @@ (mix (function (_ post pre) (composite pre post)) identity)))) (def: .public reversed - (All [a] (-> (Row a) (Row a))) + (All (_ a) (-> (Row a) (Row a))) (|>> ..list list.reversed (list\mix suffix ..empty))) (template [<name> <array> <init> <op>] [(def: .public <name> - (All [a] + (All (_ a) (-> (Predicate a) (Row a) Bit)) - (let [help (: (All [a] + (let [help (: (All (_ a) (-> (Predicate a) (Node a) Bit)) (function (help predicate node) (case node diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 8efb47cce..72821bf95 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -23,18 +23,18 @@ (Cont [a (Sequence a)])) (def: .public (iterations step init) - (All [a b] + (All (_ a b) (-> (-> a [a b]) a (Sequence b))) (let [[next x] (step init)] (//.pending [x (iterations step next)]))) (def: .public (repeated x) - (All [a] + (All (_ a) (-> a (Sequence a))) (//.pending [x (repeated x)])) (def: .public (cycle [start next]) - (All [a] + (All (_ a) (-> [a (List a)] (Sequence a))) (loop [head start tail next] @@ -47,7 +47,7 @@ (template [<name> <return>] [(def: .public (<name> sequence) - (All [a] (-> (Sequence a) <return>)) + (All (_ a) (-> (Sequence a) <return>)) (let [[head tail] (//.result sequence)] <name>))] @@ -56,7 +56,7 @@ ) (def: .public (item idx sequence) - (All [a] (-> Nat (Sequence a) a)) + (All (_ a) (-> Nat (Sequence a) a)) (let [[head tail] (//.result sequence)] (case idx 0 head @@ -64,7 +64,7 @@ (template [<taker> <dropper> <pred_type> <pred_test> <pred_step> <post_test>] [(def: .public (<taker> pred xs) - (All [a] + (All (_ a) (-> <pred_type> (Sequence a) (List a))) (let [[x xs'] (//.result xs)] (if (<post_test> <pred_test>) @@ -72,7 +72,7 @@ (list)))) (def: .public (<dropper> pred xs) - (All [a] + (All (_ a) (-> <pred_type> (Sequence a) (Sequence a))) (let [[x xs'] (//.result xs)] (if (<post_test> <pred_test>) @@ -85,7 +85,7 @@ (template [<splitter> <pred_type> <pred_test> <pred_step>] [(def: .public (<splitter> pred xs) - (All [a] + (All (_ a) (-> <pred_type> (Sequence a) [(List a) (Sequence a)])) (let [[x xs'] (//.result xs)] (if <pred_test> @@ -98,14 +98,14 @@ ) (def: .public (only predicate sequence) - (All [a] (-> (-> a Bit) (Sequence a) (Sequence a))) + (All (_ a) (-> (-> a Bit) (Sequence a) (Sequence a))) (let [[head tail] (//.result sequence)] (if (predicate head) (//.pending [head (only predicate tail)]) (only predicate tail)))) (def: .public (partition left? xs) - (All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) + (All (_ a) (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) [(..only left? xs) (..only (bit.complement left?) xs)]) diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux index d9c18877b..62e155534 100644 --- a/stdlib/source/library/lux/data/collection/set.lux +++ b/stdlib/source/library/lux/data/collection/set.lux @@ -19,48 +19,48 @@ (Dictionary a Any)) (def: .public member_hash - (All [a] (-> (Set a) (Hash a))) + (All (_ a) (-> (Set a) (Hash a))) //.key_hash) (def: .public empty - (All [a] (-> (Hash a) (Set a))) + (All (_ a) (-> (Hash a) (Set a))) //.empty) (def: .public size - (All [a] (-> (Set a) Nat)) + (All (_ a) (-> (Set a) Nat)) //.size) (def: .public (has elem set) - (All [a] (-> a (Set a) (Set a))) + (All (_ a) (-> a (Set a) (Set a))) (|> set (//.has elem []))) (def: .public lacks - (All [a] (-> a (Set a) (Set a))) + (All (_ a) (-> a (Set a) (Set a))) //.lacks) (def: .public member? - (All [a] (-> (Set a) a Bit)) + (All (_ a) (-> (Set a) a Bit)) //.key?) (def: .public list - (All [a] (-> (Set a) (List a))) + (All (_ a) (-> (Set a) (List a))) //.keys) (def: .public union - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) //.merged) (def: .public (difference sub base) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (list\mix ..lacks base (..list sub))) (def: .public (intersection filter base) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (//.sub (//.keys filter) base)) (implementation: .public equivalence - (All [a] (Equivalence (Set a))) + (All (_ a) (Equivalence (Set a))) (def: (= (^@ reference [hash _]) sample) (and (n.= (..size reference) @@ -69,7 +69,7 @@ (..list sample))))) (implementation: .public hash - (All [a] (Hash (Set a))) + (All (_ a) (Hash (Set a))) (def: &equivalence ..equivalence) @@ -79,27 +79,27 @@ (\ (list.hash (..member_hash set)) hash)))) (implementation: .public (monoid hash) - (All [a] (-> (Hash a) (Monoid (Set a)))) + (All (_ a) (-> (Hash a) (Monoid (Set a)))) (def: identity (..empty hash)) (def: composite ..union)) (def: .public empty? - (All [a] (-> (Set a) Bit)) + (All (_ a) (-> (Set a) Bit)) (|>> ..size (n.= 0))) (def: .public (of_list hash elements) - (All [a] (-> (Hash a) (List a) (Set a))) + (All (_ a) (-> (Hash a) (List a) (Set a))) (list\mix ..has (..empty hash) elements)) (def: .public (sub? super sub) - (All [a] (-> (Set a) (Set a) Bit)) + (All (_ a) (-> (Set a) (Set a) Bit)) (list.every? (..member? super) (..list sub))) (def: .public (super? sub super) - (All [a] (-> (Set a) (Set a) Bit)) + (All (_ a) (-> (Set a) (Set a) Bit)) (..sub? super sub)) (def: .public predicate - (All [a] (-> (Set a) (Predicate a))) + (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 73964bc7a..62aa7a52f 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -24,15 +24,15 @@ (Dictionary a Nat) (def: .public empty - (All [a] (-> (Hash a) (Set a))) + (All (_ a) (-> (Hash a) (Set a))) (|>> dictionary.empty :abstraction)) (def: .public size - (All [a] (-> (Set a) Nat)) + (All (_ a) (-> (Set a) Nat)) (|>> :representation dictionary.values (list\mix n.+ 0))) (def: .public (has multiplicity elem set) - (All [a] (-> Nat a (Set a) (Set a))) + (All (_ a) (-> Nat a (Set a) (Set a))) (case multiplicity 0 set _ (|> set @@ -41,7 +41,7 @@ :abstraction))) (def: .public (lacks multiplicity elem set) - (All [a] (-> Nat a (Set a) (Set a))) + (All (_ a) (-> Nat a (Set a) (Set a))) (case multiplicity 0 set _ (case (dictionary.value elem (:representation set)) @@ -55,11 +55,11 @@ set))) (def: .public (multiplicity set elem) - (All [a] (-> (Set a) a Nat)) + (All (_ a) (-> (Set a) a Nat)) (|> set :representation (dictionary.value elem) (maybe.else 0))) (def: .public list - (All [a] (-> (Set a) (List a))) + (All (_ a) (-> (Set a) (List a))) (|>> :representation dictionary.entries (list\mix (function (_ [elem multiplicity] output) @@ -68,7 +68,7 @@ (template [<name> <composite>] [(def: .public (<name> parameter subject) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (:abstraction (dictionary.merged_with <composite> (:representation parameter) (:representation subject))))] [union n.max] @@ -76,7 +76,7 @@ ) (def: .public (intersection parameter (^:representation subject)) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (list\mix (function (_ [elem multiplicity] output) (..has (n.min (..multiplicity parameter elem) multiplicity) @@ -86,7 +86,7 @@ (dictionary.entries subject))) (def: .public (difference parameter subject) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (|> parameter :representation dictionary.entries @@ -95,7 +95,7 @@ subject))) (def: .public (sub? reference subject) - (All [a] (-> (Set a) (Set a) Bit)) + (All (_ a) (-> (Set a) (Set a) Bit)) (|> subject :representation dictionary.entries @@ -105,14 +105,14 @@ (n.>= multiplicity)))))) (def: .public (support set) - (All [a] (-> (Set a) (//.Set a))) + (All (_ a) (-> (Set a) (//.Set a))) (let [(^@ set [hash _]) (:representation set)] (|> set dictionary.keys (//.of_list hash)))) (implementation: .public equivalence - (All [a] (Equivalence (Set a))) + (All (_ a) (Equivalence (Set a))) (def: (= (^:representation reference) sample) (and (n.= (dictionary.size reference) @@ -125,7 +125,7 @@ (n.= multiplicity)))))))) (implementation: .public hash - (All [a] (Hash (Set a))) + (All (_ a) (Hash (Set a))) (def: &equivalence ..equivalence) @@ -138,22 +138,22 @@ ) (def: .public (member? set elem) - (All [a] (-> (Set a) a Bit)) + (All (_ a) (-> (Set a) a Bit)) (|> elem (..multiplicity set) (n.> 0))) (def: .public empty? - (All [a] (-> (Set a) Bit)) + (All (_ a) (-> (Set a) Bit)) (|>> ..size (n.= 0))) (def: .public (of_list hash subject) - (All [a] (-> (Hash a) (List a) (Set a))) + (All (_ a) (-> (Hash a) (List a) (Set a))) (list\mix (..has 1) (..empty hash) subject)) (def: .public (of_set subject) - (All [a] (-> (//.Set a) (Set a))) + (All (_ a) (-> (//.Set a) (Set a))) (..of_list (//.member_hash subject) (//.list subject))) (def: .public super? - (All [a] (-> (Set a) (Set a) Bit)) + (All (_ a) (-> (Set a) (Set a) Bit)) (function.flipped sub?)) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index eeb66fa5e..ac8c54ac0 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -18,16 +18,16 @@ (/.Dictionary a a) (def: .public empty - (All [a] (-> (Order a) (Set a))) + (All (_ a) (-> (Order a) (Set a))) (|>> /.empty :abstraction)) (def: .public (member? set elem) - (All [a] (-> (Set a) a Bit)) + (All (_ a) (-> (Set a) a Bit)) (/.key? (:representation set) elem)) (template [<type> <name> <alias>] [(def: .public <name> - (All [a] (-> (Set a) <type>)) + (All (_ a) (-> (Set a) <type>)) (|>> :representation <alias>))] [(Maybe a) min /.min] @@ -37,39 +37,39 @@ ) (def: .public (has elem set) - (All [a] (-> a (Set a) (Set a))) + (All (_ a) (-> a (Set a) (Set a))) (|> set :representation (/.has elem elem) :abstraction)) (def: .public (lacks elem set) - (All [a] (-> a (Set a) (Set a))) + (All (_ a) (-> a (Set a) (Set a))) (|> set :representation (/.lacks elem) :abstraction)) (def: .public list - (All [a] (-> (Set a) (List a))) + (All (_ a) (-> (Set a) (List a))) (|>> :representation /.keys)) (def: .public (of_list &order list) - (All [a] (-> (Order a) (List a) (Set a))) + (All (_ a) (-> (Order a) (List a) (Set a))) (list\mix has (..empty &order) list)) (def: .public (union left right) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (list\mix ..has right (..list left))) (def: .public (intersection left right) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list right) (list.only (..member? left)) (..of_list (value@ #/.&order (:representation right))))) (def: .public (difference param subject) - (All [a] (-> (Set a) (Set a) (Set a))) + (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list subject) (list.only (|>> (..member? param) not)) (..of_list (value@ #/.&order (:representation subject))))) (implementation: .public equivalence - (All [a] (Equivalence (Set a))) + (All (_ a) (Equivalence (Set a))) (def: (= reference sample) (\ (list.equivalence (\ (:representation reference) &equivalence)) @@ -77,11 +77,11 @@ ) (def: .public (sub? super sub) - (All [a] (-> (Set a) (Set a) Bit)) + (All (_ a) (-> (Set a) (Set a) Bit)) (|> sub ..list (list.every? (..member? super)))) (def: .public (super? sub super) - (All [a] (-> (Set a) (Set a) Bit)) + (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 549450cbd..8bb20bff3 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -20,15 +20,15 @@ (:abstraction (list))) (def: .public size - (All [a] (-> (Stack a) Nat)) + (All (_ a) (-> (Stack a) Nat)) (|>> :representation //.size)) (def: .public empty? - (All [a] (-> (Stack a) Bit)) + (All (_ a) (-> (Stack a) Bit)) (|>> :representation //.empty?)) (def: .public (value stack) - (All [a] (-> (Stack a) (Maybe a))) + (All (_ a) (-> (Stack a) (Maybe a))) (case (:representation stack) #.End #.None @@ -37,7 +37,7 @@ (#.Some value))) (def: .public (next stack) - (All [a] (-> (Stack a) (Maybe [a (Stack a)]))) + (All (_ a) (-> (Stack a) (Maybe [a (Stack a)]))) (case (:representation stack) #.End #.None @@ -46,11 +46,11 @@ (#.Some [top (:abstraction stack')]))) (def: .public (top value stack) - (All [a] (-> a (Stack a) (Stack a))) + (All (_ a) (-> a (Stack a) (Stack a))) (:abstraction (#.Item value (:representation stack)))) (implementation: .public (equivalence super) - (All [a] + (All (_ a) (-> (Equivalence a) (Equivalence (Stack a)))) diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index 47a4c8957..d16d02c74 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -22,7 +22,7 @@ #children (List (Tree a))})) (def: .public (flat tree) - (All [a] (-> (Tree a) (List a))) + (All (_ a) (-> (Tree a) (List a))) (|> tree (value@ #children) (list\each flat) @@ -30,12 +30,12 @@ (#.Item (value@ #value tree)))) (def: .public (leaf value) - (All [a] (-> a (Tree a))) + (All (_ a) (-> a (Tree a))) {#value value #children (list)}) (def: .public (branch value children) - (All [a] (-> a (List (Tree a)) (Tree a))) + (All (_ a) (-> a (List (Tree a)) (Tree a))) {#value value #children children}) @@ -60,7 +60,7 @@ #children (list (~+ (list\each recur children)))}))))))) (implementation: .public (equivalence super) - (All [a] (-> (Equivalence a) (Equivalence (Tree a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Tree a)))) (def: (= tx ty) (and (\ super = (value@ #value tx) (value@ #value ty)) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index 3f807f49f..b8313112c 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -22,10 +22,10 @@ (type: .public (Builder @ t) (Interface - (: (All [v] + (: (All (_ v) (-> t v (Tree @ t v))) leaf) - (: (All [v] + (: (All (_ v) (-> (Tree @ t v) (Tree @ t v) (Tree @ t v))) @@ -33,7 +33,7 @@ (template [<name> <tag> <output>] [(def: .public <name> - (All [@ t v] (-> (Tree @ t v) <output>)) + (All (_ @ t v) (-> (Tree @ t v) <output>)) (|>> :representation (value@ <tag>)))] [tag #tag t] @@ -41,7 +41,7 @@ ) (implementation: .public (builder monoid) - (All [t] (Ex [@] (-> (Monoid t) (Builder @ t)))) + (All (_ t) (Ex (_ @) (-> (Monoid t) (Builder @ t)))) (def: (leaf tag value) (:abstraction @@ -56,7 +56,7 @@ #root (0 #1 [left right])}))) (def: .public (value tree) - (All [@ t v] (-> (Tree @ t v) v)) + (All (_ @ t v) (-> (Tree @ t v) v)) (case (value@ #root (:representation tree)) (0 #0 value) value @@ -65,7 +65,7 @@ (value left))) (def: .public (tags tree) - (All [@ t v] (-> (Tree @ t v) (List t))) + (All (_ @ t v) (-> (Tree @ t v) (List t))) (case (value@ #root (:representation tree)) (0 #0 value) (list (value@ #tag (:representation tree))) @@ -75,7 +75,7 @@ (tags right)))) (def: .public (values tree) - (All [@ t v] (-> (Tree @ t v) (List v))) + (All (_ @ t v) (-> (Tree @ t v) (List v))) (case (value@ #root (:representation tree)) (0 #0 value) (list value) @@ -85,7 +85,7 @@ (values right)))) (def: .public (one predicate tree) - (All [@ t v] (-> (Predicate t) (Tree @ t v) (Maybe v))) + (All (_ @ t v) (-> (Predicate t) (Tree @ t v) (Maybe v))) (let [[monoid tag root] (:representation tree)] (if (predicate tag) (let [(^open "tag//.") monoid] @@ -104,7 +104,7 @@ ) (def: .public (exists? predicate tree) - (All [@ t v] (-> (Predicate t) (Tree @ t v) Bit)) + (All (_ @ t v) (-> (Predicate t) (Tree @ t v) Bit)) (case (..one predicate tree) (#.Some _) true diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index cec25e125..7f168c2d3 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -30,7 +30,7 @@ #node (Tree a)})) (implementation: .public (equivalence super) - (All [a] + (All (_ a) (-> (Equivalence a) (Equivalence (Zipper a)))) @@ -45,40 +45,40 @@ (== reference sample)))) (def: .public (zipper tree) - (All [a] (-> (Tree a) (Zipper a))) + (All (_ a) (-> (Tree a) (Zipper a))) {#family #.None #node tree}) (def: .public tree - (All [a] (-> (Zipper a) (Tree a))) + (All (_ a) (-> (Zipper a) (Tree a))) (value@ #node)) (def: .public value - (All [a] (-> (Zipper a) a)) + (All (_ a) (-> (Zipper a) a)) (value@ [#node #//.value])) (def: .public (set value zipper) - (All [a] (-> a (Zipper a) (Zipper a))) + (All (_ a) (-> a (Zipper a) (Zipper a))) (with@ [#node #//.value] value zipper)) (def: .public (update transform zipper) - (All [a] (-> (-> a a) (Zipper a) (Zipper a))) + (All (_ a) (-> (-> a a) (Zipper a) (Zipper a))) (revised@ [#node #//.value] transform zipper)) (def: children - (All [a] (-> (Zipper a) (List (Tree a)))) + (All (_ a) (-> (Zipper a) (List (Tree a)))) (value@ [#node #//.children])) (def: .public leaf? - (All [a] (-> (Zipper a) Bit)) + (All (_ a) (-> (Zipper a) Bit)) (|>> ..children list.empty?)) (def: .public branch? - (All [a] (-> (Zipper a) Bit)) + (All (_ a) (-> (Zipper a) Bit)) (|>> ..leaf? not)) (def: .public (start? zipper) - (All [a] (-> (Zipper a) Bit)) + (All (_ a) (-> (Zipper a) Bit)) (case (value@ #family zipper) #.None true @@ -87,7 +87,7 @@ false)) (def: .public (down zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..children zipper) #.End #.None @@ -99,7 +99,7 @@ #node head}))) (def: .public (up zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (do maybe.monad [family (value@ #family zipper)] (in (let [(^slots [#parent #lefts #rights]) family] @@ -118,7 +118,7 @@ (template [<one> <all> <side> <op_side>] [(def: .public (<one> zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (value@ #family zipper) (#.Some family) (case (value@ <side> family) @@ -128,7 +128,7 @@ (with@ <side> side') (revised@ <op_side> (|>> (#.Item (value@ #node zipper)))))) #node next}} - (let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) + (let [move (: (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) (function (_ side' zipper) (|>> (with@ <side> side') (revised@ <op_side> (|>> (#.Item (value@ #node zipper)))))))] @@ -142,7 +142,7 @@ #.None)) (def: .public (<all> zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (value@ #family zipper) #.None #.None @@ -158,7 +158,7 @@ (revised@ <op_side> (|>> (#.Item (value@ #node zipper)) (list\composite prevs))))) #node last}} - (let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) + (let [move (: (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) (function (_ prevs zipper) (|>> (with@ <side> #.End) (revised@ <op_side> (|>> (#.Item (value@ #node zipper)) @@ -171,7 +171,7 @@ ) (def: .public (next zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..down zipper) (#.Some forward) (#.Some forward) @@ -188,7 +188,7 @@ (recur @)))))) (def: (bottom zipper) - (All [a] (-> (Zipper a) (Zipper a))) + (All (_ a) (-> (Zipper a) (Zipper a))) (case (..right zipper) (#.Some forward) (bottom forward) @@ -202,7 +202,7 @@ zipper))) (def: .public (previous zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..left zipper) #.None (..up zipper) @@ -217,7 +217,7 @@ (template [<name> <move>] [(def: .public (<name> zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (<move> zipper) #.None #.None @@ -236,7 +236,7 @@ ) (def: .public (end? zipper) - (All [a] (-> (Zipper a) Bit)) + (All (_ a) (-> (Zipper a) Bit)) (case (..end zipper) #.None true @@ -245,19 +245,19 @@ false)) (def: .public (interpose value zipper) - (All [a] (-> a (Zipper a) (Zipper a))) + (All (_ a) (-> a (Zipper a) (Zipper a))) (revised@ [#node #//.children] (|>> (//.branch value) list) zipper)) (def: .public (adopt value zipper) - (All [a] (-> a (Zipper a) (Zipper a))) + (All (_ a) (-> a (Zipper a) (Zipper a))) (revised@ [#node #//.children] (|>> (#.Item (//.leaf value))) zipper)) (def: .public (remove zipper) - (All [a] (-> (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (do maybe.monad [family (value@ #family zipper)] (case (value@ #lefts family) @@ -275,7 +275,7 @@ (template [<name> <side>] [(def: .public (<name> value zipper) - (All [a] (-> a (Zipper a) (Maybe (Zipper a)))) + (All (_ a) (-> a (Zipper a) (Maybe (Zipper a)))) (case (value@ #family zipper) #.None #.None @@ -308,7 +308,7 @@ (def: out (value@ [#node #//.value])) (def: (disjoint (^slots [#family #node])) - (let [tree_splitter (: (All [a] (-> (Tree a) (Tree (Zipper a)))) + (let [tree_splitter (: (All (_ a) (-> (Tree a) (Tree (Zipper a)))) (function (tree_splitter tree) {#//.value (..zipper tree) #//.children (|> tree diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 1e0ca5937..109b1c19d 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -60,7 +60,7 @@ (-> a Specification)) (def: .public (result writer value) - (All [a] (-> (Writer a) a Binary)) + (All (_ a) (-> (Writer a) a Binary)) (..instance (writer value))) (template [<name> <size> <write>] @@ -81,7 +81,7 @@ ) (def: .public (or left right) - (All [l r] (-> (Writer l) (Writer r) (Writer (Or l r)))) + (All (_ l r) (-> (Writer l) (Writer r) (Writer (Or l r)))) (function (_ altV) (case altV (^template [<number> <tag> <writer>] @@ -99,12 +99,12 @@ ))) (def: .public (and pre post) - (All [a b] (-> (Writer a) (Writer b) (Writer [a b]))) + (All (_ a b) (-> (Writer a) (Writer b) (Writer [a b]))) (function (_ [preV postV]) (\ ..monoid composite (pre preV) (post postV)))) (def: .public (rec body) - (All [a] (-> (-> (Writer a) (Writer a)) (Writer a))) + (All (_ a) (-> (-> (Writer a) (Writer a)) (Writer a))) (function (recur value) (body recur value))) @@ -177,7 +177,7 @@ (template [<name> <size> <write>] [(def: .public (<name> valueW) - (All [v] (-> (Writer v) (Writer (Row v)))) + (All (_ v) (-> (Writer v) (Writer (Row v)))) (function (_ value) (let [original_count (row.size value) capped_count (i64.and (..mask <size>) @@ -206,17 +206,17 @@ ) (def: .public maybe - (All [a] (-> (Writer a) (Writer (Maybe a)))) + (All (_ a) (-> (Writer a) (Writer (Maybe a)))) (..or ..any)) (def: .public (list value) - (All [a] (-> (Writer a) (Writer (List a)))) + (All (_ a) (-> (Writer a) (Writer (List a)))) (..rec (|>> (..and value) (..or ..any)))) (def: .public (set value) - (All [a] (-> (Writer a) (Writer (Set a)))) + (All (_ a) (-> (Writer a) (Writer (Set a)))) (|>> set.list (..list value))) (def: .public name diff --git a/stdlib/source/library/lux/data/format/css/style.lux b/stdlib/source/library/lux/data/format/css/style.lux index a8ad45203..5aae7d013 100644 --- a/stdlib/source/library/lux/data/format/css/style.lux +++ b/stdlib/source/library/lux/data/format/css/style.lux @@ -23,7 +23,7 @@ " ") (def: .public (with [property value]) - (All [brand] + (All (_ brand) (-> [(Property brand) (Value brand)] (-> Style Style))) (|>> :representation diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index ffd4ab75a..bc17e00f6 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -126,11 +126,11 @@ (|>> :representation)) (def: .public (and pre post) - (All [brand] (-> (HTML brand) (HTML brand) (HTML brand))) + (All (_ brand) (-> (HTML brand) (HTML brand) (HTML brand))) (:abstraction (format (:representation pre) (:representation post)))) (def: .public (comment content node) - (All [brand] (-> Text (HTML brand) (HTML brand))) + (All (_ brand) (-> Text (HTML brand) (HTML brand))) (:abstraction (format (text.enclosed ["<!--" "-->"] content) (:representation node)))) diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux index fdbfd4b69..a2df019bb 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -188,6 +188,6 @@ ) (def: .public markdown - (All [a] (-> (Markdown a) Text)) + (All (_ a) (-> (Markdown a) Text)) (|>> :representation)) ) diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index 9c29b086a..ab5981b4f 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -102,7 +102,7 @@ (def: attr_name^ namespaced_symbol^) (def: spaced^ - (All [a] (-> (Parser a) (Parser a))) + (All (_ a) (-> (Parser a) (Parser a))) (let [white_space^ (<>.some <text>.space)] (|>> (<>.before white_space^) (<>.after white_space^)))) diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux index 1e0bc9c96..3ad1ba207 100644 --- a/stdlib/source/library/lux/data/product.lux +++ b/stdlib/source/library/lux/data/product.lux @@ -7,7 +7,7 @@ (template [<name>] [(def: .public (<name> [left right]) - (All [left right] + (All (_ left right) (-> [left right] <name>)) <name>)] @@ -17,14 +17,14 @@ ... https://en.wikipedia.org/wiki/Currying (def: .public (curried f) - (All [a b c] + (All (_ a b c) (-> (-> [a b] c) (-> a b c))) (function (_ x y) (f [x y]))) (def: .public (uncurried f) - (All [a b c] + (All (_ a b c) (-> (-> a b c) (-> [a b] c))) (function (_ xy) @@ -32,32 +32,32 @@ (f x y)))) (def: .public (swapped [left right]) - (All [left right] (-> [left right] [right left])) + (All (_ left right) (-> [left right] [right left])) [right left]) (def: .public (then f g) - (All [a b c d] + (All (_ a b c d) (-> (-> a c) (-> b d) (-> [a b] [c d]))) (function (_ [x y]) [(f x) (g y)])) (def: .public (forked f g) - (All [a l r] + (All (_ a l r) (-> (-> a l) (-> a r) (-> a [l r]))) (function (_ x) [(f x) (g x)])) (implementation: .public (equivalence left right) - (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence [l r]))) + (All (_ l r) (-> (Equivalence l) (Equivalence r) (Equivalence [l r]))) (def: (= [rl rr] [sl sr]) (and (\ left = rl sl) (\ right = rr sr)))) (def: .public (hash left right) - (All [l r] (-> (Hash l) (Hash r) (Hash [l r]))) + (All (_ l r) (-> (Hash l) (Hash r) (Hash [l r]))) (implementation (def: &equivalence (..equivalence (\ left &equivalence) diff --git a/stdlib/source/library/lux/data/store.lux b/stdlib/source/library/lux/data/store.lux index 5fc594957..24f7005fd 100644 --- a/stdlib/source/library/lux/data/store.lux +++ b/stdlib/source/library/lux/data/store.lux @@ -13,12 +13,12 @@ #peek (-> s a)})) (def: (extend f wa) - (All [s a b] (-> (-> (Store s a) b) (Store s a) (Store s b))) + (All (_ s a b) (-> (-> (Store s a) b) (Store s a) (Store s b))) {#cursor (value@ #cursor wa) #peek (function (_ s) (f (with@ #cursor s wa)))}) (implementation: .public functor - (All [s] (Functor (Store s))) + (All (_ s) (Functor (Store s))) (def: (each f fa) (extend (function (_ store) @@ -26,7 +26,7 @@ fa))) (implementation: .public comonad - (All [s] (CoMonad (Store s))) + (All (_ s) (CoMonad (Store s))) (def: &functor ..functor) @@ -38,17 +38,17 @@ (extend id))) (def: .public (peeks trans store) - (All [s a] (-> (-> s s) (Store s a) a)) + (All (_ s a) (-> (-> s s) (Store s a) a)) (|> (\\ cursor) trans (\\ peek))) (def: .public (seek cursor store) - (All [s a] (-> s (Store s a) (Store s a))) + (All (_ s a) (-> s (Store s a) (Store s a))) (\ (\\ disjoint store) peek cursor)) (def: .public (seeks change store) - (All [s a] (-> (-> s s) (Store s a) (Store s a))) + (All (_ s a) (-> (-> s s) (Store s a) (Store s a))) (|> store (\\ disjoint) (peeks change))) (def: .public (experiment Functor<f> change store) - (All [f s a] (-> (Functor f) (-> s (f s)) (Store s a) (f a))) + (All (_ f s a) (-> (Functor f) (-> s (f s)) (Store s a) (f a))) (\ Functor<f> each (\\ peek) (change (\\ cursor)))) diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux index 193f25a05..7c8696012 100644 --- a/stdlib/source/library/lux/data/sum.lux +++ b/stdlib/source/library/lux/data/sum.lux @@ -7,7 +7,7 @@ (template [<right?> <name>] [(def: .public (<name> value) - (All [left right] + (All (_ left right) (-> <name> (Or left right))) (0 <right?> value))] @@ -15,7 +15,7 @@ [#1 right]) (def: .public (either on_left on_right) - (All [a b c] + (All (_ a b c) (-> (-> a c) (-> b c) (-> (Or a b) c))) (function (_ input) @@ -24,7 +24,7 @@ (0 #1 r) (on_right r)))) (def: .public (then on_left on_right) - (All [l l' r r'] + (All (_ l l' r r') (-> (-> l l') (-> r r') (-> (Or l r) (Or l' r')))) (function (_ input) @@ -34,7 +34,7 @@ (template [<name> <side> <right?>] [(def: .public (<name> items) - (All [a b] (-> (List (Or a b)) (List <side>))) + (All (_ a b) (-> (List (Or a b)) (List <side>))) (case items #.End #.End @@ -50,7 +50,7 @@ ) (def: .public (partition xs) - (All [a b] (-> (List (Or a b)) [(List a) (List b)])) + (All (_ a b) (-> (List (Or a b)) [(List a) (List b)])) (case xs #.End [#.End #.End] @@ -62,7 +62,7 @@ (0 #1 x') [lefts (#.Item x' rights)])))) (def: .public (equivalence left right) - (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (Or l r)))) + (All (_ l r) (-> (Equivalence l) (Equivalence r) (Equivalence (Or l r)))) (implementation (def: (= reference sample) (case [reference sample] @@ -76,7 +76,7 @@ false)))) (def: .public (hash left right) - (All [l r] (-> (Hash l) (Hash r) (Hash (Or l r)))) + (All (_ l r) (-> (Hash l) (Hash r) (Hash (Or l r)))) (implementation (def: &equivalence (..equivalence (\ left &equivalence) diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux index 11d1523e8..a41022153 100644 --- a/stdlib/source/library/lux/data/text/format.lux +++ b/stdlib/source/library/lux/data/text/format.lux @@ -111,18 +111,18 @@ ) (def: .public (mod modular) - (All [m] (Format (modular.Mod m))) + (All (_ m) (Format (modular.Mod m))) (let [codec (modular.codec (modular.modulus modular))] (\ codec encoded modular))) (def: .public (list formatter) - (All [a] (-> (Format a) (Format (List a)))) + (All (_ a) (-> (Format a) (Format (List a)))) (|>> (list\each (|>> formatter (format " "))) text.together (text.enclosed ["(list" ")"]))) (def: .public (maybe format) - (All [a] (-> (Format a) (Format (Maybe a)))) + (All (_ a) (-> (Format a) (Format (Maybe a)))) (function (_ value) (case value #.None diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index fcfb718ab..bdab7c6a1 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -37,7 +37,7 @@ regex_char^))) (def: (refine^ refinement^ base^) - (All [a] (-> (Parser a) (Parser Text) (Parser Text))) + (All (_ a) (-> (Parser a) (Parser Text) (Parser Text))) (do <>.monad [output base^ _ (<text>.local output refinement^)] @@ -330,7 +330,7 @@ (<>.and lexer (\ <>.monad in []))) (def: (|||^ left right) - (All [l r] (-> (Parser [Text l]) (Parser [Text r]) (Parser [Text (Or l r)]))) + (All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser [Text (Or l r)]))) (function (_ input) (case (left input) (#try.Success [input' [lt lv]]) @@ -345,7 +345,7 @@ (#try.Failure error))))) (def: (|||_^ left right) - (All [l r] (-> (Parser [Text l]) (Parser [Text r]) (Parser Text))) + (All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser Text))) (function (_ input) (case (left input) (#try.Success [input' [lt lv]]) diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index 7c473d64d..a4f4d9eb2 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -56,7 +56,7 @@ (|> end (n.- start) ++))) (def: .public (within? block char) - (All [a] (-> Block Char Bit)) + (All (_ a) (-> Block Char Bit)) (interval.within? (:representation block) char)) ) diff --git a/stdlib/source/library/lux/data/trace.lux b/stdlib/source/library/lux/data/trace.lux index f07c533d9..35d97e9f9 100644 --- a/stdlib/source/library/lux/data/trace.lux +++ b/stdlib/source/library/lux/data/trace.lux @@ -13,13 +13,13 @@ #trace (-> t a)})) (implementation: .public functor - (All [t] (Functor (Trace t))) + (All (_ t) (Functor (Trace t))) (def: (each f fa) (revised@ #trace (composite f) fa))) (implementation: .public comonad - (All [t] (CoMonad (Trace t))) + (All (_ t) (CoMonad (Trace t))) (def: &functor ..functor) @@ -37,5 +37,5 @@ (\ monoid composite t1 t2)))})}))) (def: .public (result context tracer) - (All [t a] (-> t (Trace t a) a)) + (All (_ t a) (-> t (Trace t a) a)) (\ tracer trace context)) diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index 937401d5d..c73a71cd2 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -4,7 +4,8 @@ ["." meta] ["." type ("#\." equivalence)] [abstract - [monad (#+ do)]] + [monad (#+ do)] + ["." enum]] [control ["." maybe ("#\." functor)] ["." exception (#+ exception:)] @@ -16,7 +17,8 @@ ["%" format (#+ format)]] [collection ["." list ("#\." monad mix monoid)] - ["." set (#+ Set)]] + ["." set (#+ Set)] + ["." sequence (#+ Sequence)]] [format ["md" markdown (#+ Markdown Block)]]] ["." macro @@ -85,16 +87,29 @@ (text.together (list.repeated (n.- reference_column new_column) " ")))))) (def: un_paired - (All [a] (-> (List [a a]) (List a))) - (let [melded (: (All [a] (-> [a a] (List a) (List a))) + (All (_ a) (-> (List [a a]) (List a))) + (let [melded (: (All (_ a) (-> [a a] (List a) (List a))) (function (_ [left right] tail) (list& left right tail)))] (|>> list.reversed (list\mix melded #.End)))) -(def: (code_documentation old_location reference_column example) - (-> Location Nat Code [Location Text]) +(def: (code_documentation expected_module old_location reference_column example) + (-> Text Location Nat Code [Location Text]) (case example + [new_location (#.Identifier [module short])] + (let [documentation (cond (text\= expected_module module) + short + + (text\= .prelude_module module) + (format "." short) + + ... else + (%.name [module short]))] + [(revised@ #.column (n.+ (text.size documentation)) new_location) + (format (padding reference_column old_location new_location) + documentation)]) + (^template [<tag> <format>] [[new_location (<tag> value)] (let [documentation (`` (|> value (~~ (template.spliced <format>))))] @@ -107,13 +122,12 @@ [#.Rev [%.rev]] [#.Frac [%.frac]] [#.Text [%.text]] - [#.Identifier [%.name]] [#.Tag [%.name (text.prefix syntax.sigil)]]) (^template [|<| |>| <tag> <prep>] [[group_location (<tag> members)] (let [[group_location' members_documentation] (list\mix (function (_ part [last_location text_accum]) - (let [[member_location member_documentation] (code_documentation last_location reference_column part)] + (let [[member_location member_documentation] (code_documentation expected_module last_location reference_column part)] [member_location (format text_accum member_documentation)])) [(revised@ #.column ++ group_location) ""] (<prep> members))] @@ -133,8 +147,8 @@ (-> Text Text) (text.prefix "... ")) -(def: (fragment_documentation fragment) - (-> Fragment Text) +(def: (fragment_documentation module fragment) + (-> Text Fragment Text) (case fragment (#Comment comment) (..single_line_comment comment) @@ -143,12 +157,130 @@ (let [reference_column (..reference_column example) [location _] example] (|> example - (..code_documentation (with@ #.column reference_column location) reference_column) + (..code_documentation module (with@ #.column reference_column location) reference_column) product.right)))) +(def: parameter_name_options "abcdefghijklmnopqrstuvwxyz") +(def: parameter_name_options_count (text.size parameter_name_options)) + +(def: (parameter_type_name id) + (-> Nat Text) + (case (text.char id ..parameter_name_options) + (#.Some char) + (text.of_char char) + + #.None + (format (parameter_type_name (n./ parameter_name_options_count id)) + (parameter_type_name (n.% parameter_name_options_count id))))) + +(def: type_variable_names + (Sequence Text) + (sequence.iterations (product.forked ++ parameter_type_name) + 0)) + +(template [<name> <partition>] + [(def: (<name> id) + (-> Nat Bit) + (<partition> id))] + + [type_function? n.even?] + [type_parameter? n.odd?] + ) + +(def: (parameter_id level id) + (-> Nat Nat Nat) + (n.- (n./ 2 id) level)) + +(def: (parameter_name [type_function_name type_function_arguments] level id) + (-> [Text (List Text)] Nat Nat Text) + (if (type_parameter? id) + (let [parameter_id (..parameter_id level id)] + (case (list.item parameter_id type_function_arguments) + (#.Some found) + found + + _ + (|> type_variable_names + (sequence.only (function (_ var_name) + (not (list.member? text.equivalence type_function_arguments var_name)))) + (sequence.item parameter_id)))) + type_function_name)) + +(def: (level_parameters offset level) + (-> Nat Nat (List Text)) + (if (n.= 0 level) + (list) + (|> level + -- + (enum.range n.enum 0) + (list\each (|>> (n.+ (++ offset)) parameter_type_name))))) + +(def: (%type' level type_function_name module type) + (-> Nat Text Text Type Text) + (case type + (#.Primitive name params) + (|> params + (list\each (|>> (%type' level type_function_name module) + (format " "))) + (#.Item (%.text name)) + text.together + (text.enclosed ["(primitive " ")"])) + + (#.Sum _) + (|> type + type.flat_variant + (list\each (%type' level type_function_name module)) + (text.interposed " ") + (text.enclosed ["(Or " ")"])) + + (#.Product _) + (|> type + type.flat_tuple + (list\each (%type' level type_function_name module)) + (text.interposed " ") + (text.enclosed ["[" "]"])) + + (#.Function input output) + (let [[ins out] (type.flat_function type)] + (format "(-> " + (|> ins (list\each (%type' level type_function_name module)) (text.interposed " ")) + " " + (%type' level type_function_name module out) + ")")) + + (#.Parameter idx) + (parameter_name [type_function_name (list)] level idx) + + (^template [<tag> <pre> <post>] + [(<tag> id) + (format <pre> (%.nat id) <post>)]) + ([#.Var "⌈" "⌋"] + [#.Ex "⟨" "⟩"]) + + (^template [<tag> <name> <flat>] + [(<tag> _) + (let [[level' body] (<flat> type) + args (level_parameters level level') + body_doc (%type' (n.+ level level') type_function_name module body)] + (format "(" <name> " " "(_ " (|> args (text.interposed " ")) ")" + (format " " body_doc) + ")"))]) + ([#.UnivQ "All" type.flat_univ_q] + [#.ExQ "Ex" type.flat_ex_q]) + + (#.Apply param fun) + (let [[type_func type_arguments] (type.flat_application type)] + (format "(" (%type' level type_function_name module type_func) " " (|> type_arguments (list\each (%type' level type_function_name module)) (text.interposed " ")) ")")) + + (#.Named [_module _name] type) + (if (text\= module _module) + _name + (%.name [_module _name])) + )) + (def: type - (-> Type Text) - %.type) + (-> Text Type Text) + (%type' (-- 0) "?")) (def: description (Parser (Maybe Code)) @@ -186,36 +318,38 @@ (Parser Example) (<code>.tuple (<>.many ..fragment))) -(def: example_documentation - (-> Example Code) - (|>> (list\each ..fragment_documentation) - (list.interposed ..blank_line) - (text.interposed "") - code.text)) +(def: (example_documentation module example) + (-> Text Example Code) + (|> example + (list\each (..fragment_documentation module)) + (list.interposed ..blank_line) + (text.interposed "") + code.text)) (syntax: (minimal_definition_documentation [name ..qualified_identifier]) - (with_expansions [<\n> (~! text.\n)] - (macro.with_identifiers [g!type] - (in (list (` ($_ ((~! md.then)) - ... Name - (<| ((~! md.heading/3)) - (~ (code.text (|> name product.right [""] %.name)))) - ... Type - (let [(~ g!type) ("lux in-module" - (~ (code.text (product.left name))) - (.:of (~ (code.identifier name))))] - ((~! md.code) - (if ((~! type\=) .Type (~ g!type)) - (|> (~ (code.identifier name)) - (:as .Type) - ((~! type.anonymous)) - ((~! ..type)) - ((~! %.format) - ((~! ..single_line_comment) ((~! ..type) (~ g!type))) - <\n>)) - ((~! ..type) (~ g!type)))))) - )))))) + (let [g!module (code.text (product.left name))] + (with_expansions [<\n> (~! text.\n)] + (macro.with_identifiers [g!type] + (in (list (` ($_ ((~! md.then)) + ... Name + (<| ((~! md.heading/3)) + (~ (code.text (|> name product.right [""] %.name)))) + ... Type + (let [(~ g!type) ("lux in-module" + (~ g!module) + (.:of (~ (code.identifier name))))] + ((~! md.code) + (if ((~! type\=) .Type (~ g!type)) + (|> (~ (code.identifier name)) + (:as .Type) + ((~! type.anonymous)) + ((~! ..type) (~ g!module)) + ((~! %.format) + ((~! ..single_line_comment) ((~! ..type) (~ g!module) (~ g!type))) + <\n>)) + ((~! ..type) (~ g!module) (~ g!type)))))) + ))))))) (syntax: (definition_documentation [name ..qualified_identifier @@ -243,7 +377,7 @@ (list (` (<| ((~! md.code)) ((~! %.format) (~+ (|> examples - (list\each ..example_documentation) + (list\each (..example_documentation (product.left name))) (list.interposed ..example_separator)))))))))) ))))) diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux index 6d1867dfc..cb2fafe6f 100644 --- a/stdlib/source/library/lux/ffi.js.lux +++ b/stdlib/source/library/lux/ffi.js.lux @@ -250,7 +250,7 @@ ["#::." (new [..String]) (decode [..String] String)]))} - (with_identifiers [g!temp] + (with_identifiers [g!temp g!_] (case import (#Class [[class_name class_parameters] format members]) (with_identifiers [g!object] @@ -272,7 +272,7 @@ (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify "new")) [(~+ (list\each product.right g!inputs))]) - (All [(~+ class_parameters)] + (All ((~ g!_) (~+ class_parameters)) (-> [(~+ (list\each nullable_type inputsT))] (~ declaration))) (:expected @@ -288,7 +288,7 @@ ("js constant" (~ (code.text (%.format real_class "." field)))))))))) (` (def: ((~ (qualify field)) (~ g!object)) - (All [(~+ class_parameters)] + (All ((~ g!_) (~+ class_parameters)) (-> (~ declaration) (~ (nullable_type fieldT)))) (:expected @@ -310,7 +310,7 @@ (` (def: ((~ (qualify (maybe.else method alias))) [(~+ (list\each product.right g!inputs))] (~ g!object)) - (All [(~+ class_parameters)] + (All ((~ g!_) (~+ class_parameters)) (-> [(~+ (list\each nullable_type inputsT))] (~ declaration) (~ (|> (nullable_type outputT) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 363effd18..d01286a1a 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -45,12 +45,12 @@ name.read)) (def: signature - (All [category] + (All (_ category) (-> (Type category) Text)) (|>> type.signature signature.signature)) (def: reflection - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) Text)) (|>> type.reflection reflection.reflection)) @@ -561,7 +561,7 @@ ["Type Variables" (exception.listing parser.name type_vars)])) (def: (assertion exception payload test) - (All [e] (-> (Exception e) e Bit (Parser Any))) + (All (_ e) (-> (Exception e) e Bit (Parser Any))) (<>.assertion (exception.error exception payload) test)) @@ -634,7 +634,7 @@ ))))) (def: (itself^ type) - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) (Parser (Type (<| Return' Value' category))))) (do <>.monad @@ -1319,12 +1319,13 @@ (let [[full_name params] (parser.declaration declaration) def_name (..internal full_name) params' (list\each ..var$' params)] - (` (def: (~ (code.identifier ["" def_name])) - {#..jvm_class (~ (code.text (..internal full_name)))} - .Type - (All [(~+ params')] - (primitive (~ (code.text full_name)) - [(~+ params')])))))) + (template.with_locals [g!_] + (` (def: (~ (code.identifier ["" def_name])) + {#..jvm_class (~ (code.text (..internal full_name)))} + .Type + (All ((~ (' g!_)) (~+ params')) + (primitive (~ (code.text full_name)) + [(~+ params')]))))))) (def: (member_type_vars class_tvars member) (-> (List (Type Var)) Import_Member_Declaration (List (Type Var))) @@ -1506,22 +1507,23 @@ (let [[full_name class_tvars] (parser.declaration class)] (case member (#EnumDecl enum_members) - (do meta.monad - [.let [enum_type (: Code - (case class_tvars - #.End - (` (primitive (~ (code.text full_name)))) - - _ - (let [=class_tvars (list\each ..var$' class_tvars)] - (` (All [(~+ =class_tvars)] (primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) - getter_interop (: (-> Text Code) - (function (_ name) - (let [getter_name (code.identifier ["" (..import_name import_format method_prefix name)])] - (` (def: (~ getter_name) - (~ enum_type) - (~ (get_static_field full_name name)))))))]] - (in (list\each getter_interop enum_members))) + (with_identifiers [g!_] + (do meta.monad + [.let [enum_type (: Code + (case class_tvars + #.End + (` (primitive (~ (code.text full_name)))) + + _ + (let [=class_tvars (list\each ..var$' class_tvars)] + (` (All ((~ g!_) (~+ =class_tvars)) (primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) + getter_interop (: (-> Text Code) + (function (_ name) + (let [getter_name (code.identifier ["" (..import_name import_format method_prefix name)])] + (` (def: (~ getter_name) + (~ enum_type) + (~ (get_static_field full_name name)))))))]] + (in (list\each getter_interop enum_members)))) (#ConstructorDecl [commons _]) (do meta.monad @@ -1652,7 +1654,7 @@ (member_def_interop vars kind class =args member method_prefix import_format)))) (def: interface? - (All [a] (-> (primitive "java.lang.Class" [a]) Bit)) + (All (_ a) (-> (primitive "java.lang.Class" [a]) Bit)) (|>> ("jvm member invoke virtual" [] "java.lang.Class" "isInterface" []) "jvm object cast" (: ..Boolean) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 8e8c03e53..016bce2b5 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -20,17 +20,15 @@ [collection ["." array (#+ Array)] ["." list ("#\." monad mix monoid)]]] - [macro (#+ with_identifiers) + ["." macro (#+ with_identifiers) [syntax (#+ syntax:)] - ["." code]] + ["." code] + ["." template]] ["." meta ["." annotation]]]]) (template [<name> <op> <from> <to>] [(def: .public (<name> value) - {#.doc (example "Type converter." - (: <to> - (<name> (: <from> foo))))} (-> (primitive <from>) (primitive <to>)) (<op> value))] @@ -1203,36 +1201,6 @@ annotations ..annotations^ fields (<>.some (..field_decl^ class_vars)) methods (<>.some (..method_def^ class_vars))]) - {#.doc (example "Allows defining JVM classes in Lux code." - "For example:" - (class: #final (TestClass A) [Runnable] - ... Fields - (#private foo boolean) - (#private bar A) - (#private baz java/lang/Object) - ... Methods - (#public [] (new [value A]) [] - (exec (:= ::foo #1) - (:= ::bar value) - (:= ::baz "") - [])) - (#public (virtual) java/lang/Object - "") - (#public #static (static) java/lang/Object - "") - (Runnable [] (run) void - []) - ) - - "The tuple corresponds to parent interfaces." - "An optional super-class can be specified before the tuple. If not specified, java.lang.Object will be assumed." - "Fields and methods defined in the class can be used with special syntax." - "For example:" - "::resolved, for accessing the 'resolved' field." - "(:= ::resolved #1) for modifying it." - "(::new! []) for calling the class's constructor." - "(::resolve! container [value]) for calling the 'resolve' method." - )} (do meta.monad [current_module meta.current_module_name .let [fully_qualified_class_name (format (safe current_module) "." full_class_name) @@ -1257,16 +1225,12 @@ (<code>.tuple (<>.some (..super_class_decl^ class_vars)))) annotations ..annotations^ members (<>.some (..method_decl^ class_vars))]) - {#.doc (example "Allows defining JVM interfaces." - (interface: TestInterface - ([] foo [boolean String] void #throws [Exception])))} (let [def_code (format "jvm interface:" (spaced (list (class_decl$ class_decl) (with_brackets (spaced (list\each super_class_decl$ supers))) (with_brackets (spaced (list\each annotation$ annotations))) (spaced (list\each method_decl$ members)))))] - (in (list (` ((~ (code.text def_code)))))) - )) + (in (list (` ((~ (code.text def_code)))))))) (syntax: .public (object [class_vars (<code>.tuple (<>.some ..type_param^)) super (<>.else object_super_class @@ -1275,17 +1239,6 @@ (<code>.tuple (<>.some (..super_class_decl^ class_vars)))) constructor_args (..constructor_args^ class_vars) methods (<>.some ..overriden_method_def^)]) - {#.doc (example "Allows defining anonymous classes." - "The 1st tuple corresponds to class-level type-variables." - "The 2nd tuple corresponds to parent interfaces." - "The 3rd tuple corresponds to arguments to the super class constructor." - "An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed." - (object [] [Runnable] - [] - (Runnable [] (run self) void - (exec (do_something some_value) - []))) - )} (let [def_code (format "jvm anon-class:" (spaced (list (super_class_decl$ super) (with_brackets (spaced (list\each super_class_decl$ interfaces))) @@ -1294,25 +1247,13 @@ (in (list (` ((~ (code.text def_code)))))))) (syntax: .public (null []) - {#.doc (example "Null object reference." - (null))} (in (list (` ("jvm object null"))))) (def: .public (null? obj) - {#.doc (example "Test for null object reference." - (= (null? (null)) - true) - (= (null? "YOLO") - false))} (-> (primitive "java.lang.Object") Bit) ("jvm object null?" obj)) (syntax: .public (??? [expr <code>.any]) - {#.doc (example "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." - (= (??? (: java/lang/String (null))) - #.None) - (= (??? "YOLO") - (#.Some "YOLO")))} (with_identifiers [g!temp] (in (list (` (let [(~ g!temp) (~ expr)] (if ("jvm object null?" (~ g!temp)) @@ -1320,12 +1261,6 @@ (#.Some (~ g!temp))))))))) (syntax: .public (!!! [expr <code>.any]) - {#.doc (example "Takes a (Maybe ObjectType) and returns a ObjectType." - "A #.None would get translated into a (null)." - (= (null) - (!!! (??? (: java/lang/Thread (null))))) - (= "foo" - (!!! (??? "foo"))))} (with_identifiers [g!value] (in (list (` ({(#.Some (~ g!value)) (~ g!value) @@ -1336,11 +1271,6 @@ (syntax: .public (check [class (..generic_type^ (list)) unchecked (<>.maybe <code>.any)]) - {#.doc (example "Checks whether an object is an instance of a particular class." - "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes." - (case (check java/lang/String "YOLO") - (#.Some value_as_string) - #.None))} (with_identifiers [g!_ g!unchecked] (let [class_name (simple_class$ (list) class) class_type (` (.primitive (~ (code.text class_name)))) @@ -1363,19 +1293,10 @@ (syntax: .public (synchronized [lock <code>.any body <code>.any]) - {#.doc (example "Evaluates body, while holding a lock on a given object." - (synchronized object_to_be_locked - (exec (do_something ___) - (do_something_else ___) - (finish_the_computation ___))))} (in (list (` ("jvm object synchronized" (~ lock) (~ body)))))) (syntax: .public (do_to [obj <code>.any methods (<>.some partial_call^)]) - {#.doc (example "Call a variety of methods on an object. Then, return the object." - (do_to object - (ClassName::method1 arg0 arg1 arg2) - (ClassName::method2 arg3 arg4 arg5)))} (with_identifiers [g!obj] (in (list (` (let [(~ g!obj) (~ obj)] (exec (~+ (list\each (complete_call$ g!obj) methods)) @@ -1384,12 +1305,13 @@ (def: (class_import$ [full_name params]) (-> Class_Declaration Code) (let [params' (list\each (|>> product.left code.local_identifier) params)] - (` (def: (~ (code.identifier ["" full_name])) - {#..jvm_class (~ (code.text full_name))} - Type - (All [(~+ params')] - (primitive (~ (code.text (safe full_name))) - [(~+ params')])))))) + (template.with_locals [g!_] + (` (def: (~ (code.identifier ["" full_name])) + {#..jvm_class (~ (code.text full_name))} + Type + (All ((~ (' g!_)) (~+ params')) + (primitive (~ (code.text (safe full_name))) + [(~+ params')]))))))) (def: (member_type_vars class_tvars member) (-> (List Type_Parameter) Import_Member_Declaration (List Type_Parameter)) @@ -1533,24 +1455,25 @@ (list\each lux_type_parameter))] (case member (#EnumDecl enum_members) - (do {! meta.monad} - [.let [enum_type (: Code - (case class_tvars - #.End - (` (primitive (~ (code.text full_name)))) - - _ - (let [=class_tvars (|> class_tvars - (list.only free_type_param?) - (list\each lux_type_parameter))] - (` (All [(~+ =class_tvars)] (primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) - getter_interop (: (-> Text Code) - (function (_ name) - (let [getter_name (code.identifier ["" (..import_name import_format method_prefix name)])] - (` (def: (~ getter_name) - (~ enum_type) - ((~ (code.text (format "jvm getstatic" ":" full_name ":" name)))))))))]] - (in (list\each getter_interop enum_members))) + (macro.with_identifiers [g!_] + (do {! meta.monad} + [.let [enum_type (: Code + (case class_tvars + #.End + (` (primitive (~ (code.text full_name)))) + + _ + (let [=class_tvars (|> class_tvars + (list.only free_type_param?) + (list\each lux_type_parameter))] + (` (All ((~ g!_) (~+ =class_tvars)) (primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) + getter_interop (: (-> Text Code) + (function (_ name) + (let [getter_name (code.identifier ["" (..import_name import_format method_prefix name)])] + (` (def: (~ getter_name) + (~ enum_type) + ((~ (code.text (format "jvm getstatic" ":" full_name ":" name)))))))))]] + (in (list\each getter_interop enum_members)))) (#ConstructorDecl [commons _]) (do meta.monad @@ -1666,7 +1589,7 @@ (primitive "java.lang.Class" [a])) (def: interface? - (All [a] (-> (java/lang/Class a) Bit)) + (All (_ a) (-> (java/lang/Class a) Bit)) (|>> "jvm invokevirtual:java.lang.Class:isInterface:")) (def: (load_class class_name) @@ -1688,57 +1611,6 @@ (syntax: .public (import: [class_decl ..class_decl^ bundles (<>.some (..bundle (product.right class_decl)))]) - {#.doc (example "Allows importing JVM classes, and using them as types." - "Their methods, fields and enum options can also be imported." - (import: java/lang/Object - ["#::." - (new []) - (equals [java/lang/Object] boolean) - (wait [int] #io #try void)]) - - "Special options can also be given for the return values." - "#? means that the values will be returned inside a Maybe type. That way, null becomes #.None." - "#try means that the computation might throw an exception, and the return value will be wrapped by the Try type." - "#io means the computation has side effects, and will be wrapped by the IO type." - "These options must show up in the following order [#io #try #?] (although, each option can be used independently)." - (import: java/lang/String - ["#::." - (new [[byte]]) - (#static valueOf [char] java/lang/String) - (#static valueOf #as int_valueOf [int] java/lang/String)]) - - (import: (java/util/List e) - ["#::." - (size [] int) - (get [int] e)]) - - (import: (java/util/ArrayList a) - ["#::." - ([T] toArray [[T]] [T])]) - - "The class-type that is generated is of the fully-qualified name." - "This avoids a clash between the java.util.List type, and Lux's own List type." - "All enum options to be imported must be specified." - (import: java/lang/Character$UnicodeScript - ["#::." - (#enum ARABIC CYRILLIC LATIN)]) - - "It should also be noted, the only types that may show up in method arguments or return values may be Java classes, arrays, primitives, void or type-parameters." - "Lux types, such as Maybe cannot be named (otherwise, they'd be confused for Java classes)." - (import: (lux/concurrency/async/JvmAsync A) - ["#::." - (resolve [A] boolean) - (poll [] A) - (wasResolved [] boolean) - (waitOn [lux/Function] void) - (#static [A] make [A] (lux/concurrency/async/JvmAsync A))]) - - "Also, the names of the imported members will look like Class::member" - (java/lang/Object::new []) - (java/lang/Object::equals [other_object] my_object) - (java/util/List::size [] my_list) - java/lang/Character$UnicodeScript::LATIN - )} (do {! meta.monad} [kind (class_kind class_decl) =members (|> bundles @@ -1750,8 +1622,6 @@ (syntax: .public (array [type (..generic_type^ (list)) size <code>.any]) - {#.doc (example "Create an array of the given type, with the given size." - (array java/lang/Object 10))} (case type (^template [<type> <array_op>] [(^ (#GenericClass <type> (list))) @@ -1769,8 +1639,6 @@ (in (list (` ("jvm anewarray" (~ (code.text (generic_type$ type))) (~ size))))))) (syntax: .public (length [array <code>.any]) - {#.doc (example "Gives the length of an array." - (length my_array))} (in (list (` ("jvm arraylength" (~ array)))))) (def: (type_class_name type) @@ -1797,8 +1665,6 @@ (syntax: .public (read! [idx <code>.any array <code>.any]) - {#.doc (example "Loads an element from an array." - (read! 10 my_array))} (case array [_ (#.Identifier array_name)] (do meta.monad @@ -1828,8 +1694,6 @@ (syntax: .public (write! [idx <code>.any value <code>.any array <code>.any]) - {#.doc (example "Stores an element into an array." - (write! 10 my_object my_array))} (case array [_ (#.Identifier array_name)] (do meta.monad @@ -1857,8 +1721,6 @@ (..write! (~ idx) (~ value) (~ g!array))))))))) (syntax: .public (class_for [type (..generic_type^ (list))]) - {#.doc (example "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: .public (type [type (..generic_type^ (list))]) diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux index 060b3dfea..3c1da5d57 100644 --- a/stdlib/source/library/lux/ffi.rb.lux +++ b/stdlib/source/library/lux/ffi.rb.lux @@ -232,25 +232,6 @@ (~+ (list\each (with_nil g!temp) g!inputs))))))))))) (syntax: .public (import: [[?module import] ..import]) - {#.doc (example "Easily import types, methods, functions and constants." - (import: Stat - ["#::." - (executable? [] Bit) - (size Int)]) - - (import: File #as RubyFile - ["#::." - (#static SEPARATOR ..String) - (#static open [Path ..String] #io #try RubyFile) - (#static stat [Path] #io #try Stat) - (#static delete [Path] #io #try Int) - (#static file? [Path] #io #try Bit) - (#static directory? [Path] #io #try Bit) - - (read [] #io #try Binary) - (write [Binary] #io #try Int) - (flush [] #io #try #? Any) - (close [] #io #try #? Any)]))} (with_identifiers [g!temp] (case import (#Class [class alias format members]) diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index 68e22410e..edf8ca784 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -32,7 +32,7 @@ ) (def: (with_module name body) - (All [a] (-> Text (-> Module (Try [Module a])) (Meta a))) + (All (_ a) (-> Text (-> Module (Try [Module a])) (Meta a))) (function (_ compiler) (case (|> compiler (value@ #.modules) (plist.value name)) (#.Some module) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index c77d67feb..106048f90 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -24,7 +24,7 @@ ["." code]]) (def: (self_documenting binding parser) - (All [a] (-> Code (Parser a) (Parser a))) + (All (_ a) (-> Code (Parser a) (Parser a))) (function (_ tokens) (case (parser tokens) (#try.Success [tokens output]) @@ -36,7 +36,7 @@ error))))) (def: (un_paired pairs) - (All [a] (-> (List [a a]) (List a))) + (All (_ a) (-> (List [a a]) (List a))) (case pairs #.End #.End (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux index e4cb2ddac..445e8ae23 100644 --- a/stdlib/source/library/lux/macro/syntax/export.lux +++ b/stdlib/source/library/lux/macro/syntax/export.lux @@ -10,6 +10,6 @@ (` .private)) (def: .public (parser un_exported) - (All [a] (-> (Parser a) (Parser [Code a]))) + (All (_ a) (-> (Parser a) (Parser [Code a]))) (<>.either (<>.and <code>.any un_exported) (<>.and (<>\in ..default_policy) un_exported))) diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux index 4c3745470..36277f723 100644 --- a/stdlib/source/library/lux/math/logic/fuzzy.lux +++ b/stdlib/source/library/lux/math/logic/fuzzy.lux @@ -36,12 +36,12 @@ ) (def: .public (membership set elem) - (All [a] (-> (Fuzzy a) a Rev)) + (All (_ a) (-> (Fuzzy a) a Rev)) (set elem)) (template [<set_composition> <membership_composition>] [(def: .public (<set_composition> left right) - (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) + (All (_ a) (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (function (_ elem) (<membership_composition> (left elem) (right elem))))] @@ -51,27 +51,27 @@ ) (def: .public (complement set) - (All [a] (-> (Fuzzy a) (Fuzzy a))) + (All (_ a) (-> (Fuzzy a) (Fuzzy a))) (|>> set //.not)) (def: .public (difference sub base) - (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) + (All (_ a) (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (..intersection (..complement sub) base)) (def: .public (of_predicate predicate) - (All [a] (-> (Predicate a) (Fuzzy a))) + (All (_ a) (-> (Predicate a) (Fuzzy a))) (function (_ elem) (if (predicate elem) //.true //.false))) (def: .public (predicate treshold set) - (All [a] (-> Rev (Fuzzy a) (Predicate a))) + (All (_ a) (-> Rev (Fuzzy a) (Predicate a))) (function (_ elem) (/.> treshold (set elem)))) (def: .public of_set - (All [a] (-> (Set a) (Fuzzy a))) + (All (_ a) (-> (Set a) (Fuzzy a))) (|>> set.member? ..of_predicate)) (def: (ascending from to) @@ -125,7 +125,7 @@ (..descending middle_top' top')))) (def: .public (cut treshold set) - (All [a] (-> Rev (Fuzzy a) (Fuzzy a))) + (All (_ a) (-> Rev (Fuzzy a) (Fuzzy a))) (function (_ elem) (let [membership (set elem)] (if (/.< treshold membership) diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index acfdbab2d..5b462ccfd 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -35,13 +35,13 @@ #value Int}) (def: .public (modular modulus value) - (All [%] (-> (Modulus %) Int (Mod %))) + (All (_ %) (-> (Modulus %) Int (Mod %))) (:abstraction {#modulus modulus #value (i.mod (//.divisor modulus) value)})) (template [<name> <type> <side>] [(def: .public <name> - (All [%] (-> (Mod %) <type>)) + (All (_ %) (-> (Mod %) <type>)) (|>> :representation <side>))] [modulus (Modulus %) product.left] @@ -63,7 +63,7 @@ (<text>.and (<text>.one_of "-+") (<text>.many <text>.decimal)))) (implementation: .public (codec expected) - (All [%] (-> (Modulus %) (Codec Text (Mod %)))) + (All (_ %) (-> (Modulus %) (Codec Text (Mod %)))) (def: (encoded modular) (let [[_ value] (:representation modular)] @@ -82,7 +82,7 @@ (template [<name> <op>] [(def: .public (<name> reference subject) - (All [%] (-> (Mod %) (Mod %) Bit)) + (All (_ %) (-> (Mod %) (Mod %) Bit)) (let [[_ reference] (:representation reference) [_ subject] (:representation subject)] (<op> reference subject)))] @@ -95,19 +95,19 @@ ) (implementation: .public equivalence - (All [%] (Equivalence (Mod %))) + (All (_ %) (Equivalence (Mod %))) (def: = ..=)) (implementation: .public order - (All [%] (Order (Mod %))) + (All (_ %) (Order (Mod %))) (def: &equivalence ..equivalence) (def: < ..<)) (template [<name> <op>] [(def: .public (<name> param subject) - (All [%] (-> (Mod %) (Mod %) (Mod %))) + (All (_ %) (-> (Mod %) (Mod %) (Mod %))) (let [[modulus param] (:representation param) [_ subject] (:representation subject)] (:abstraction {#modulus modulus @@ -122,7 +122,7 @@ (template [<composition> <identity> <monoid>] [(implementation: .public (<monoid> modulus) - (All [%] (-> (Modulus %) (Monoid (Mod %)))) + (All (_ %) (-> (Modulus %) (Monoid (Mod %)))) (def: identity (..modular modulus <identity>)) @@ -134,7 +134,7 @@ ) (def: .public (inverse modular) - (All [%] (-> (Mod %) (Maybe (Mod %)))) + (All (_ %) (-> (Mod %) (Maybe (Mod %)))) (let [[modulus value] (:representation modular) [[vk mk] gcd] (i.extended_gcd value (//.divisor modulus))] (case gcd @@ -149,7 +149,7 @@ ["Subject" (i\encoded (//.divisor subject))])) (def: .public (adapter reference subject) - (All [r% s%] + (All (_ r% s%) (-> (Modulus r%) (Modulus s%) (Try (-> (Mod s%) (Mod r%))))) (if (//.= reference subject) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index f52210e24..6ca5a9033 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -26,22 +26,22 @@ Int (def: .public (modulus value) - (Ex [%] (-> Int (Try (Modulus %)))) + (Ex (_ %) (-> Int (Try (Modulus %)))) (if (i.= +0 value) (exception.except ..zero_cannot_be_a_modulus []) (#try.Success (:abstraction value)))) (def: .public divisor - (All [%] (-> (Modulus %) Int)) + (All (_ %) (-> (Modulus %) Int)) (|>> :representation)) (def: .public (= reference subject) - (All [%r %s] (-> (Modulus %r) (Modulus %s) Bit)) + (All (_ %r %s) (-> (Modulus %r) (Modulus %s) Bit)) (i.= (:representation reference) (:representation subject))) (def: .public (congruent? modulus reference subject) - (All [%] (-> (Modulus %) Int Int Bit)) + (All (_ %) (-> (Modulus %) Int Int Bit)) (|> subject (i.- reference) (i.% (:representation modulus)) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index 7c4f1d8b1..4f510366c 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -431,7 +431,7 @@ (..< margin_of_error))) (def: .public (mod divisor dividend) - (All [m] (-> Frac Frac Frac)) + (All (_ m) (-> Frac Frac Frac)) (let [remainder (..% divisor dividend)] (if (or (and (..< +0.0 divisor) (..> +0.0 remainder)) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index ecad8a4ec..475ad82d6 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -23,7 +23,7 @@ (template [<parameter_type> <name> <op>] [(def: .public (<name> parameter subject) - (All [s] (-> <parameter_type> (I64 s) (I64 s))) + (All (_ s) (-> <parameter_type> (I64 s) (I64 s))) (<op> parameter subject))] [(I64 Any) or "lux i64 or"] @@ -47,7 +47,7 @@ (..bit (-- ..width))) (def: .public not - (All [s] (-> (I64 s) (I64 s))) + (All (_ s) (-> (I64 s) (I64 s))) (..xor (.i64 (-- 0)))) (def: .public false @@ -83,12 +83,12 @@ (..and 127)))) (def: .public (zero index input) - (All [s] (-> Nat (I64 s) (I64 s))) + (All (_ s) (-> Nat (I64 s) (I64 s))) (|> index ..bit ..not (..and input))) (template [<name> <op>] [(def: .public (<name> index input) - (All [s] (-> Nat (I64 s) (I64 s))) + (All (_ s) (-> Nat (I64 s) (I64 s))) (|> index ..bit (<op> input)))] [one ..or] @@ -105,7 +105,7 @@ (template [<name> <forward> <backward>] [(def: .public (<name> distance input) - (All [s] (-> Nat (I64 s) (I64 s))) + (All (_ s) (-> Nat (I64 s) (I64 s))) (..or (<forward> distance input) (<backward> (n.- (n.% ..width distance) ..width) input)))] @@ -118,13 +118,13 @@ (..left_rotated offset (..mask size))) (implementation: .public equivalence - (All [a] (Equivalence (I64 a))) + (All (_ a) (Equivalence (I64 a))) (def: (= reference sample) ("lux i64 =" reference sample))) (implementation: .public hash - (All [a] (Hash (I64 a))) + (All (_ a) (Hash (I64 a))) (def: &equivalence ..equivalence) @@ -132,7 +132,7 @@ (template [<monoid> <identity> <composite>] [(implementation: .public <monoid> - (All [a] (Monoid (I64 a))) + (All (_ a) (Monoid (I64 a))) (def: identity <identity>) (def: composite <composite>))] @@ -142,8 +142,8 @@ ) (def: .public reversed - (All [a] (-> (I64 a) (I64 a))) - (let [swapper (: (-> Nat (All [a] (-> (I64 a) (I64 a)))) + (All (_ a) (-> (I64 a) (I64 a))) + (let [swapper (: (-> Nat (All (_ a) (-> (I64 a) (I64 a)))) (function (_ power) (let [size (..left_shifted power 1) repetitions (: (-> Nat Text Text) @@ -190,7 +190,7 @@ wide))) (def: .public (sub width) - (Ex [size] (-> Nat (Maybe (Sub size)))) + (Ex (_ size) (-> Nat (Maybe (Sub size)))) (if (.and (n.> 0 width) (n.< ..width width)) (let [sign_shift (n.- width ..width) diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index 91eaa9de4..02430432b 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -100,7 +100,7 @@ ... https://rob.conery.io/2018/08/21/mod-and-remainder-are-not-the-same/ (def: .public (mod divisor dividend) - (All [m] (-> Int Int Int)) + (All (_ m) (-> Int Int Int)) (let [remainder (..% divisor dividend)] (if (or (and (..< +0 divisor) (..> +0 remainder)) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index b416d2c8a..8803ab037 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -78,7 +78,7 @@ (fa state'))))) (def: .public (only pred gen) - (All [a] (-> (-> a Bit) (Random a) (Random a))) + (All (_ a) (-> (-> a Bit) (Random a) (Random a))) (do ..monad [sample gen] (if (pred sample) @@ -86,7 +86,7 @@ (only pred gen)))) (def: .public (one check random) - (All [a b] + (All (_ a b) (-> (-> a (Maybe b)) (Random a) (Random b))) (do ..monad [sample random] @@ -98,7 +98,7 @@ (one check random)))) (def: .public (refined refiner gen) - (All [t r] (-> (Refiner t r) (Random t) (Random (Refined t r)))) + (All (_ t r) (-> (Refiner t r) (Random t) (Random (Refined t r)))) (do ..monad [sample gen] (case (refiner sample) @@ -194,14 +194,14 @@ ) (def: .public (and left right) - (All [a b] (-> (Random a) (Random b) (Random [a b]))) + (All (_ a b) (-> (Random a) (Random b) (Random [a b]))) (do ..monad [=left left =right right] (in [=left =right]))) (def: .public (or left right) - (All [a b] (-> (Random a) (Random b) (Random (Or a b)))) + (All (_ a b) (-> (Random a) (Random b) (Random (Or a b)))) (do {! ..monad} [? bit] (if ? @@ -213,7 +213,7 @@ (in (0 #1 =right)))))) (def: .public (either left right) - (All [a] (-> (Random a) (Random a) (Random a))) + (All (_ a) (-> (Random a) (Random a) (Random a))) (do ..monad [? bit] (if ? @@ -221,13 +221,13 @@ right))) (def: .public (rec gen) - (All [a] (-> (-> (Random a) (Random a)) (Random a))) + (All (_ a) (-> (-> (Random a) (Random a)) (Random a))) (function (_ state) (let [gen' (gen (rec gen))] (gen' state)))) (def: .public (maybe value_gen) - (All [a] (-> (Random a) (Random (Maybe a)))) + (All (_ a) (-> (Random a) (Random (Maybe a)))) (do {! ..monad} [some? bit] (if some? @@ -238,7 +238,7 @@ (template [<name> <type> <zero> <plus>] [(def: .public (<name> size value_gen) - (All [a] (-> Nat (Random a) (Random (<type> a)))) + (All (_ a) (-> Nat (Random a) (Random (<type> a)))) (if (n.> 0 size) (do ..monad [x value_gen @@ -252,7 +252,7 @@ (template [<name> <type> <ctor>] [(def: .public (<name> size value_gen) - (All [a] (-> Nat (Random a) (Random (<type> a)))) + (All (_ a) (-> Nat (Random a) (Random (<type> a)))) (do ..monad [values (list size value_gen)] (in (|> values <ctor>))))] @@ -263,7 +263,7 @@ ) (def: .public (set hash size value_gen) - (All [a] (-> (Hash a) Nat (Random a) (Random (Set a)))) + (All (_ a) (-> (Hash a) Nat (Random a) (Random (Set a)))) (if (n.> 0 size) (do {! ..monad} [xs (set hash (-- size) value_gen)] @@ -277,7 +277,7 @@ (\ ..monad in (set.empty hash)))) (def: .public (dictionary hash size key_gen value_gen) - (All [k v] (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v)))) + (All (_ k v) (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v)))) (if (n.> 0 size) (do {! ..monad} [kv (dictionary hash (-- size) key_gen value_gen)] @@ -335,11 +335,11 @@ (\in #day.Saturday)))))) (def: .public (result prng calc) - (All [a] (-> PRNG (Random a) [PRNG a])) + (All (_ a) (-> PRNG (Random a) [PRNG a])) (calc prng)) (def: .public (prng update return) - (All [a] (-> (-> a a) (-> a I64) (-> a PRNG))) + (All (_ a) (-> (-> a a) (-> a I64) (-> a PRNG))) (function (recur state) (function (_ _) [(recur (update state)) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index c51425fcc..208663367 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -78,11 +78,11 @@ (ma lux'))))) (def: .public (result' lux action) - (All [a] (-> Lux (Meta a) (Try [Lux a]))) + (All (_ a) (-> Lux (Meta a) (Try [Lux a]))) (action lux)) (def: .public (result lux action) - (All [a] (-> Lux (Meta a) (Try a))) + (All (_ a) (-> Lux (Meta a) (Try a))) (case (action lux) (#try.Failure error) (#try.Failure error) @@ -91,7 +91,7 @@ (#try.Success output))) (def: .public (either left right) - (All [a] (-> (Meta a) (Meta a) (Meta a))) + (All (_ a) (-> (Meta a) (Meta a) (Meta a))) (function (_ lux) (case (left lux) (#try.Failure error) @@ -108,7 +108,7 @@ (#try.Failure message)))) (def: .public (failure error) - (All [a] + (All (_ a) (-> Text (Meta a))) (function (_ state) (#try.Failure (location.with (value@ #.location state) error)))) @@ -208,7 +208,7 @@ #0)]))) (def: (on_either f x1 x2) - (All [a b] + (All (_ a b) (-> (-> a (Maybe b)) a a (Maybe b))) (case (f x1) #.None (f x2) @@ -553,7 +553,7 @@ (#try.Success [lux (value@ #.type_context lux)]))) (def: .public (lifted result) - (All [a] (-> (Try a) (Meta a))) + (All (_ a) (-> (Try a) (Meta a))) (case result (#try.Success output) (\ ..monad in output) diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux index a332842ed..668a23331 100644 --- a/stdlib/source/library/lux/static.lux +++ b/stdlib/source/library/lux/static.lux @@ -31,7 +31,7 @@ Nat (hex "FEDCBA9876543210")) -(with_expansions [<type> (Ex [a] +(with_expansions [<type> (Ex (_ a) [(-> a Code) a])] (syntax: .public (literal [format <code>.any @@ -56,7 +56,7 @@ [random_frac random.frac code.frac] ) -(with_expansions [<type> (Ex [a] +(with_expansions [<type> (Ex (_ a) [(-> a Code) (Random a)])] (syntax: .public (random [format <code>.any diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index a2b83491d..07318b451 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -393,7 +393,7 @@ ) (def: .public (comment commentary on) - (All [kind] (-> Text (Code kind) (Code kind))) + (All (_ kind) (-> Text (Code kind) (Code kind))) (:abstraction (format "/* " commentary " */" " " (:representation on)))) (def: .public (switch input cases default) diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 658b53a06..4d79cfb86 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -32,7 +32,7 @@ #info about})) (def: .public (info_equivalence Equivalence<about>) - (All [about] + (All (_ about) (-> (Equivalence about) (Equivalence (Info about)))) ($_ product.equivalence @@ -41,7 +41,7 @@ Equivalence<about>)) (def: (info_writer writer) - (All [about] + (All (_ about) (-> (Writer about) (Writer (Info about)))) (function (_ [name length info]) diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index d63057a68..a36208054 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -30,7 +30,7 @@ #attributes (Row Attribute)})) (def: .public (length length code) - (All [Attribute] (-> (-> Attribute Nat) (Code Attribute) Nat)) + (All (_ Attribute) (-> (-> Attribute Nat) (Code Attribute) Nat)) ($_ n.+ ... u2 max_stack; ... u2 max_locals; @@ -55,7 +55,7 @@ (row\mix n.+ 0)))) (def: .public (equivalence attribute_equivalence) - (All [attribute] + (All (_ attribute) (-> (Equivalence attribute) (Equivalence (Code attribute)))) ($_ product.equivalence ///limit.equivalence @@ -66,7 +66,7 @@ ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 (def: .public (writer writer code) - (All [Attribute] (-> (Writer Attribute) (Writer (Code Attribute)))) + (All (_ Attribute) (-> (Writer Attribute) (Writer (Code Attribute)))) ($_ binaryF\composite ... u2 max_stack; ... u2 max_locals; diff --git a/stdlib/source/library/lux/target/jvm/attribute/constant.lux b/stdlib/source/library/lux/target/jvm/attribute/constant.lux index 8d7a0a26a..d9242dc89 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/constant.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/constant.lux @@ -16,12 +16,12 @@ (Index (Value a))) (def: .public equivalence - (All [a] (Equivalence (Constant a))) + (All (_ a) (Equivalence (Constant a))) ///index.equivalence) (def: .public length ///index.length) (def: .public writer - (All [a] (Writer (Constant a))) + (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 1fe22ef1a..9c106e442 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -170,11 +170,11 @@ (|>> #try.Failure function.constant)) (def: .public (except exception value) - (All [e] (-> (exception.Exception e) e Bytecode)) + (All (_ e) (-> (exception.Exception e) e Bytecode)) (..failure (exception.error exception value))) (def: .public (resolve environment bytecode) - (All [a] (-> Environment (Bytecode a) (Resource [Environment (Row Exception) Instruction a]))) + (All (_ a) (-> Environment (Bytecode a) (Resource [Environment (Row Exception) Instruction a]))) (function (_ pool) (do try.monad [[[pool environment tracker] [relative output]] (bytecode [pool environment ..fresh]) @@ -186,7 +186,7 @@ (/address.move (estimator counter) counter)) (def: (bytecode consumption production registry [estimator bytecode] input) - (All [a] (-> U2 U2 Registry [Estimator (-> [a] Instruction)] [a] (Bytecode Any))) + (All (_ a) (-> U2 U2 Registry [Estimator (-> [a] Instruction)] [a] (Bytecode Any))) (function (_ [pool environment tracker]) (do {! try.monad} [environment' (|> environment @@ -440,7 +440,7 @@ (..bytecode $0 $1 @_ _.bipush [byte])) (def: (lifted resource) - (All [a] + (All (_ a) (-> (Resource a) (Bytecode a))) (function (_ [pool environment tracker]) @@ -920,7 +920,7 @@ []]])))))) (def: reflection - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) Text)) (|>> type.reflection reflection.reflection)) @@ -1044,7 +1044,7 @@ []]])))) (def: .public (composite pre post) - (All [pre post] + (All (_ pre post) (-> (Bytecode pre) (Bytecode post) (Bytecode post))) (do ..monad [_ pre] diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index c2756715e..0775af818 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -91,11 +91,11 @@ kind (def: .public value - (All [kind] (-> (Value kind) kind)) + (All (_ kind) (-> (Value kind) kind)) (|>> :representation)) (def: .public (value_equivalence Equivalence<kind>) - (All [kind] + (All (_ kind) (-> (Equivalence kind) (Equivalence (Value kind)))) (\ equivalence.functor each diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index 50872e835..d71b3727e 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -114,7 +114,7 @@ (!add #//.Class //.class_equivalence value))) (def: .public (descriptor value) - (All [kind] + (All (_ kind) (-> (Descriptor kind) (Resource (Index (Descriptor kind))))) (let [value (//descriptor.descriptor value)] @@ -126,7 +126,7 @@ #descriptor (Descriptor of)})) (def: .public (name_and_type [name descriptor]) - (All [of] + (All (_ of) (-> (Member of) (Resource (Index (Name_And_Type of))))) (do ..monad [@name (utf8 name) diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index 1c03a5c47..5a687eaba 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -32,12 +32,12 @@ (|>> :representation)) (implementation: .public equivalence - (All [brand] (Equivalence (Signed brand))) + (All (_ brand) (Equivalence (Signed brand))) (def: (= reference sample) (i.= (:representation reference) (:representation sample)))) (implementation: .public order - (All [brand] (Order (Signed brand))) + (All (_ brand) (Order (Signed brand))) (def: &equivalence ..equivalence) (def: (< reference sample) diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index c294201b6..2b38774f5 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -31,13 +31,13 @@ (|>> :representation)) (implementation: .public equivalence - (All [brand] (Equivalence (Unsigned brand))) + (All (_ brand) (Equivalence (Unsigned brand))) (def: (= reference sample) (n.= (:representation reference) (:representation sample)))) (implementation: .public order - (All [brand] (Order (Unsigned brand))) + (All (_ brand) (Order (Unsigned brand))) (def: &equivalence ..equivalence) (def: (< reference sample) diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux index 07ae1e85d..5651ac589 100644 --- a/stdlib/source/library/lux/target/jvm/index.lux +++ b/stdlib/source/library/lux/target/jvm/index.lux @@ -21,7 +21,7 @@ U2 (def: .public index - (All [kind] (-> U2 (Index kind))) + (All (_ kind) (-> U2 (Index kind))) (|>> :abstraction)) (def: .public value @@ -29,12 +29,12 @@ (|>> :representation)) (def: .public equivalence - (All [kind] (Equivalence (Index kind))) + (All (_ kind) (Equivalence (Index kind))) (\ equivalence.functor each ..value //unsigned.equivalence)) (def: .public writer - (All [kind] (Writer (Index kind))) + (All (_ kind) (Writer (Index kind))) (|>> :representation //unsigned.writer/2)) ) diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index 64359dea1..b50127bc2 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -33,7 +33,7 @@ (|>> :representation)) (implementation: .public equivalence - (All [of] (Equivalence (Modifier of))) + (All (_ of) (Equivalence (Modifier of))) (def: (= reference sample) (\ //unsigned.equivalence = @@ -52,14 +52,14 @@ //unsigned.value)]) (def: .public (has? sub super) - (All [of] (-> (Modifier of) (Modifier of) Bit)) + (All (_ of) (-> (Modifier of) (Modifier of) Bit)) (let [sub (!unwrap sub)] (|> (!unwrap super) (i64.and sub) (\ i64.equivalence = sub)))) (implementation: .public monoid - (All [of] (Monoid (Modifier of))) + (All (_ of) (Monoid (Modifier of))) (def: identity (!wrap (hex "0000"))) @@ -72,7 +72,7 @@ (\ ..monoid identity)) (def: .public writer - (All [of] (Writer (Modifier of))) + (All (_ of) (Writer (Modifier of))) (|>> :representation //unsigned.writer/2)) (def: modifier diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index 1eeccbe72..0b89649c3 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -44,7 +44,7 @@ (template [<name> <style>] [(def: .public (<name> type) - (All [category] (-> (Type category) (<style> category))) + (All (_ category) (-> (Type category) (<style> category))) (let [[signature descriptor reflection] (:representation type)] <name>))] @@ -53,7 +53,7 @@ ) (def: .public (reflection type) - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) (Reflection (<| Return' Value' category)))) (let [[signature descriptor reflection] (:representation type)] @@ -150,7 +150,7 @@ (:expected ..void)])) (implementation: .public equivalence - (All [category] (Equivalence (Type category))) + (All (_ category) (Equivalence (Type category))) (def: (= parameter subject) (\ /signature.equivalence = @@ -158,7 +158,7 @@ (..signature subject)))) (implementation: .public hash - (All [category] (Hash (Type category))) + (All (_ category) (Hash (Type category))) (def: &equivalence ..equivalence) (def: hash (|>> ..signature (\ /signature.hash hash)))) @@ -207,5 +207,5 @@ #.None))) (def: .public format - (All [a] (Format (Type a))) + (All (_ a) (Format (Type a))) (|>> ..signature /signature.signature)) diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux index c9d622ca0..851213003 100644 --- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux @@ -103,7 +103,7 @@ (:representation output)))) (implementation: .public equivalence - (All [category] (Equivalence (Descriptor category))) + (All (_ category) (Equivalence (Descriptor category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index d7b6f155e..1e44c7a25 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -227,7 +227,7 @@ )) (def: .public (check operation input) - (All [a] (-> (Parser (Check a)) Text (Check a))) + (All (_ a) (-> (Parser (Check a)) Text (Check a))) (case (<text>.result operation input) (#try.Success check) check diff --git a/stdlib/source/library/lux/target/jvm/type/reflection.lux b/stdlib/source/library/lux/target/jvm/type/reflection.lux index f525e56f6..936e7347e 100644 --- a/stdlib/source/library/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux @@ -25,7 +25,7 @@ (|>> :representation)) (implementation: .public equivalence - (All [category] (Equivalence (Reflection category))) + (All (_ category) (Equivalence (Reflection category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index 5e2f5fbdf..957926021 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -149,14 +149,14 @@ text.together)))) (implementation: .public equivalence - (All [category] (Equivalence (Signature category))) + (All (_ category) (Equivalence (Signature category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) (implementation: .public hash - (All [category] (Hash (Signature category))) + (All (_ category) (Hash (Signature category))) (def: &equivalence ..equivalence) (def: hash (|>> :representation text\hash))) diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index b307e8a79..42d8d60e5 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -41,13 +41,13 @@ Text (implementation: .public equivalence - (All [brand] (Equivalence (Code brand))) + (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) (implementation: .public hash - (All [brand] (Hash (Code brand))) + (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 031198ffa..0e228dc57 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -49,13 +49,13 @@ Text (implementation: .public equivalence - (All [brand] (Equivalence (Code brand))) + (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) (implementation: .public hash - (All [brand] (Hash (Code brand))) + (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index b63e24118..8a41d3ae8 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -53,13 +53,13 @@ Text (implementation: .public equivalence - (All [brand] (Equivalence (Code brand))) + (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) (implementation: .public hash - (All [brand] (Hash (Code brand))) + (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) @@ -183,7 +183,7 @@ :abstraction)) (def: (composite_literal left_delimiter right_delimiter entry_serializer) - (All [a] + (All (_ a) (-> Text Text (-> a Text) (-> (List a) Literal))) (function (_ entries) @@ -435,7 +435,7 @@ (format "exec" (:representation (..tuple (list& code extra))))))) (def: .public (def name args body) - (-> SVar (List (Ex [k] (Var k))) (Statement Any) (Statement Any)) + (-> SVar (List (Ex (_ k) (Var k))) (Statement Any) (Statement Any)) (:abstraction (format "def " (:representation name) "(" (|> args (list\each ..code) (text.interposed ", ")) "):" @@ -446,7 +446,7 @@ (:abstraction (format "import " module_name))) (def: .public (comment commentary on) - (All [brand] (-> Text (Code brand) (Code brand))) + (All (_ brand) (-> Text (Code brand) (Code brand))) (:abstraction (format "# " (..safe commentary) text.new_line (:representation on)))) ) diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index 02b192b08..5b7b9bb47 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -327,7 +327,7 @@ (format (:representation from) ":" (:representation to)))) (def: .public (function inputs body) - (-> (List (Ex [k] (Var k))) Expression Expression) + (-> (List (Ex (_ k) (Var k))) Expression Expression) (let [args (|> inputs (list\each ..code) (text.interposed ", "))] (..self_contained (format "function(" args ") " diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 04ddd831c..fb1eaed26 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -41,13 +41,13 @@ Text (implementation: .public code_equivalence - (All [brand] (Equivalence (Code brand))) + (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) (implementation: .public code_hash - (All [brand] (Hash (Code brand))) + (All (_ brand) (Hash (Code brand))) (def: &equivalence ..code_equivalence) (def: hash (|>> :representation (\ text.hash hash)))) @@ -235,7 +235,7 @@ (-> Text Expression Access) (:abstraction (format (:representation object) "." field))) - (def: .public (nth idx array) + (def: .public (item idx array) (-> Expression Expression Access) (|> (:representation idx) (text.enclosed ["[" "]"]) @@ -418,7 +418,7 @@ ) (def: .public (comment commentary on) - (All [brand] (-> Text (Code brand) (Code brand))) + (All (_ brand) (-> Text (Code brand) (Code brand))) (:abstraction (format "# " (..safe commentary) text.new_line (:representation on)))) ) diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index 104e8dda2..97aabfb76 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -32,13 +32,13 @@ Text (implementation: .public equivalence - (All [brand] (Equivalence (Code brand))) + (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) (implementation: .public hash - (All [brand] (Hash (Code brand))) + (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) (def: hash (|>> :representation (\ text.hash hash)))) diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index d7e8ca736..2bbbb5ede 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -52,7 +52,7 @@ ]) (def: .public (state target module expander host_analysis host generate generation_bundle) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Target Module Expander @@ -75,7 +75,7 @@ #///directive.phase generate}}])) (def: .public (with_default_directives expander host_analysis program anchorT,expressionT,directiveT extender) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Expander ///analysis.Bundle (Program expression directive) @@ -112,7 +112,7 @@ [source' output]]))))) (type: (Operation a) - (All [anchor expression directive] + (All (_ anchor expression directive) (///directive.Operation anchor expression directive a))) (type: (Payload directive) @@ -121,7 +121,7 @@ (def: (begin dependencies hash input) (-> (List Module) Nat ///.Input - (All [anchor expression directive] + (All (_ anchor expression directive) (///directive.Operation anchor expression directive [Source (Payload directive)]))) (do ///phase.monad @@ -138,7 +138,7 @@ (def: (end module) (-> Module - (All [anchor expression directive] + (All (_ anchor expression directive) (///directive.Operation anchor expression directive [.Module (Payload directive)]))) (do ///phase.monad [_ (///directive.lifted_analysis @@ -156,9 +156,9 @@ ... TODO: Inline ASAP (def: (get_current_payload _) - (All [directive] + (All (_ directive) (-> (Payload directive) - (All [anchor expression] + (All (_ anchor expression) (///directive.Operation anchor expression directive (Payload directive))))) (do ///phase.monad @@ -170,9 +170,9 @@ ... TODO: Inline ASAP (def: (process_directive wrapper archive expander pre_payoad code) - (All [directive] + (All (_ directive) (-> ///phase.Wrapper Archive Expander (Payload directive) Code - (All [anchor expression] + (All (_ anchor expression) (///directive.Operation anchor expression directive [Requirements (Payload directive)])))) (do ///phase.monad @@ -187,9 +187,9 @@ (in [requirements post_payload]))) (def: (iteration' wrapper archive expander reader source pre_payload) - (All [directive] + (All (_ directive) (-> ///phase.Wrapper Archive Expander Reader Source (Payload directive) - (All [anchor expression] + (All (_ anchor expression) (///directive.Operation anchor expression directive [Source Requirements (Payload directive)])))) (do ///phase.monad @@ -199,9 +199,9 @@ (in [source requirements post_payload]))) (def: (iteration wrapper archive expander module source pre_payload aliases) - (All [directive] + (All (_ directive) (-> ///phase.Wrapper Archive Expander Module Source (Payload directive) Aliases - (All [anchor expression] + (All (_ anchor expression) (///directive.Operation anchor expression directive (Maybe [Source Requirements (Payload directive)]))))) (do ///phase.monad @@ -229,7 +229,7 @@ (|>> (value@ #.module_aliases) (dictionary.of_list text.hash))) (def: .public (compiler wrapper expander prelude write_directive) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> ///phase.Wrapper Expander Module (-> directive Binary) (Instancer (///directive.State+ anchor expression directive) .Module))) (let [execute! (directiveP.phase wrapper expander)] diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 16571b165..33c22c1f7 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -92,7 +92,7 @@ (document.writer $.writer))) (def: (cache_module static platform module_id [descriptor document output]) - (All [<type_vars>] + (All (_ <type_vars>) (-> Static <Platform> archive.ID [Descriptor (Document Any) Output] (Async (Try Any)))) (let [system (value@ #&file_system platform) @@ -117,13 +117,13 @@ ... TODO: Inline ASAP (def: initialize_buffer! - (All [<type_vars>] + (All (_ <type_vars>) (///generation.Operation <type_vars> Any)) (///generation.set_buffer ///generation.empty_buffer)) ... TODO: Inline ASAP (def: (compile_runtime! platform) - (All [<type_vars>] + (All (_ <type_vars>) (-> <Platform> (///generation.Operation <type_vars> [Registry Output]))) (do ///phase.monad [_ ..initialize_buffer!] @@ -143,7 +143,7 @@ (document.write $.key (module.empty 0))) (def: (process_runtime archive platform) - (All [<type_vars>] + (All (_ <type_vars>) (-> Archive <Platform> (///directive.Operation <type_vars> [Archive [Descriptor (Document .Module) Output]]))) @@ -165,7 +165,7 @@ directives] analysis_state state) - (All [<type_vars>] + (All (_ <type_vars>) (-> Extender [(Dictionary Text ///analysis.Handler) (Dictionary Text ///synthesis.Handler) @@ -194,7 +194,7 @@ (\ try.monad each product.left))) (def: (phase_wrapper archive platform state) - (All [<type_vars>] + (All (_ <type_vars>) (-> Archive <Platform> <State+> (Try [<State+> ///phase.Wrapper]))) (let [phase_wrapper (value@ #phase_wrapper platform)] (|> archive @@ -203,7 +203,7 @@ (///phase.result' state)))) (def: (complete_extensions host_directive_bundle phase_wrapper [analysers synthesizers generators directives]) - (All [<type_vars>] + (All (_ <type_vars>) (-> (-> ///phase.Wrapper (///directive.Bundle <type_vars>)) ///phase.Wrapper [(Dictionary Text ///analysis.Handler) @@ -221,7 +221,7 @@ (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>] + (All (_ <type_vars>) (-> Static Module Expander @@ -244,7 +244,7 @@ _ (ioW.enable (value@ #&file_system platform) static) [archive analysis_state bundles] (ioW.thaw (value@ #host platform) (value@ #&file_system platform) static import compilation_sources) .let [with_missing_extensions - (: (All [<type_vars>] + (: (All (_ <type_vars>) (-> <Platform> (Program expression directive) <State+> (Async (Try [///phase.Wrapper <State+>])))) (function (_ platform program state) @@ -274,7 +274,7 @@ (format text.new_line text.tab)) (def: (module_compilation_log module) - (All [<type_vars>] + (All (_ <type_vars>) (-> Module <State+> Text)) (|>> (value@ [#extension.state #///directive.generation @@ -286,7 +286,7 @@ module))) (def: with_reset_log - (All [<type_vars>] + (All (_ <type_vars>) (-> <State+> <State+>)) (with@ [#extension.state #///directive.generation @@ -392,7 +392,7 @@ <Importer> (as_is (-> Module Module <Return>)) <Compiler> (as_is (-> Module <Importer> archive.ID <Context> Module <Return>))] (def: (parallel initial) - (All [<type_vars>] + (All (_ <type_vars>) (-> <Context> (-> <Compiler> <Importer>))) (let [current (stm.var initial) @@ -488,7 +488,7 @@ ... TODO: Find a better way, as this only works for the Lux compiler. (def: (updated_state archive state) - (All [<type_vars>] + (All (_ <type_vars>) (-> Archive <State+> (Try <State+>))) (do {! try.monad} [modules (monad.each ! (function (_ module) @@ -517,7 +517,7 @@ state)))) (def: (set_current_module module state) - (All [<type_vars>] + (All (_ <type_vars>) (-> Module <State+> <State+>)) (|> (///directive.set_current_module module) (///phase.result' state) @@ -525,7 +525,7 @@ product.left)) (def: .public (compile phase_wrapper import static expander platform compilation context) - (All [<type_vars>] + (All (_ <type_vars>) (-> ///phase.Wrapper Import Static Expander <Platform> Compilation <Context> <Return>)) (let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation base_compiler (:sharing [<type_vars>] 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 e7c01dc34..326c95b78 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -137,7 +137,7 @@ false))) (implementation: .public (composite_equivalence (^open "/\.")) - (All [a] (-> (Equivalence a) (Equivalence (Composite a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Composite a)))) (def: (= reference sample) (case [reference sample] @@ -154,7 +154,7 @@ false))) (implementation: .public (composite_hash super) - (All [a] (-> (Hash a) (Hash (Composite a)))) + (All (_ a) (-> (Hash a) (Hash (Composite a)))) (def: &equivalence (..composite_equivalence (\ super &equivalence))) @@ -408,7 +408,7 @@ ) (def: .public (with_source_code source action) - (All [a] (-> Source (Operation a) (Operation a))) + (All (_ a) (-> Source (Operation a) (Operation a))) (function (_ [bundle state]) (let [old_source (value@ #.source state)] (case (action [bundle (with@ #.source source state)]) @@ -420,7 +420,7 @@ (#try.Failure error))))) (def: fresh_bindings - (All [k v] (Bindings k v)) + (All (_ k v) (Bindings k v)) {#.counter 0 #.mappings (list)}) @@ -432,7 +432,7 @@ #.captured fresh_bindings}) (def: .public (with_scope action) - (All [a] (-> (Operation a) (Operation [Scope a]))) + (All (_ a) (-> (Operation a) (Operation [Scope a]))) (function (_ [bundle state]) (case (action [bundle (revised@ #.scopes (|>> (#.Item fresh_scope)) state)]) (#try.Success [[bundle' state'] output]) @@ -448,13 +448,13 @@ (#try.Failure error)))) (def: .public (with_current_module name) - (All [a] (-> Text (Operation a) (Operation a))) + (All (_ a) (-> Text (Operation a) (Operation a))) (extension.localized (value@ #.current_module) (with@ #.current_module) (function.constant (#.Some name)))) (def: .public (with_location location action) - (All [a] (-> Location (Operation a) (Operation a))) + (All (_ a) (-> Location (Operation a) (Operation a))) (if (text\= "" (product.left location)) action (function (_ [bundle state]) @@ -478,11 +478,11 @@ (#try.Failure (locate_error (value@ #.location state) error)))) (def: .public (except exception parameters) - (All [e] (-> (Exception e) e Operation)) + (All (_ e) (-> (Exception e) e Operation)) (..failure (exception.error exception parameters))) (def: .public (assertion exception parameters condition) - (All [e] (-> (Exception e) e Bit (Operation Any))) + (All (_ e) (-> (Exception e) e Bit (Operation Any))) (if condition (\ phase.monad in []) (..except exception parameters))) @@ -493,11 +493,11 @@ (#try.Failure (locate_error (value@ #.location state) error)))) (def: .public (except' exception parameters) - (All [e] (-> (Exception e) e (phase.Operation Lux))) + (All (_ e) (-> (Exception e) e (phase.Operation Lux))) (..failure' (exception.error exception parameters))) (def: .public (with_stack exception message action) - (All [e o] (-> (Exception e) e (Operation o) (Operation o))) + (All (_ e o) (-> (Exception e) e (Operation o) (Operation o))) (function (_ bundle,state) (case (exception.with exception message (action bundle,state)) 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 8bba841e2..723f61d29 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 @@ -35,7 +35,7 @@ [(n.- module_id 0) artifact_id]) (def: .public (evaluator expander synthesis_state generation_state generate) - (All [anchor expression artifact] + (All (_ anchor expression artifact) (-> Expander synthesis.State+ (generation.State+ anchor expression artifact) 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 fa8525f02..e5fb06e7d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux @@ -67,7 +67,7 @@ (template [<name> <component> <phase>] [(def: .public <name> - (All [anchor expression directive] + (All (_ anchor expression directive) (Operation anchor expression directive <phase>)) (function (_ [bundle state]) (#try.Success [[bundle state] (value@ [<component> #..phase] state)])))] @@ -79,7 +79,7 @@ (template [<name> <component> <operation>] [(def: .public <name> - (All [anchor expression directive output] + (All (_ anchor expression directive output) (-> (<operation> output) (Operation anchor expression directive output))) (|>> (phase.sub [(value@ [<component> #..state]) @@ -92,7 +92,7 @@ ) (def: .public (set_current_module module) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Module (Operation anchor expression directive Any))) (do phase.monad [_ (..lifted_analysis 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 1b8cc945d..6f9a03763 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -89,7 +89,7 @@ ) (def: .public (state host module) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (Host expression directive) Module (..State anchor expression directive))) @@ -110,7 +110,7 @@ [(exception: .public <exception>) (def: .public <with_declaration> - (All [anchor expression directive output] <with_type>) + (All (_ anchor expression directive output) <with_type>) (function (_ body) (function (_ [bundle state]) (case (body [bundle (with@ <tag> (#.Some <with_value>) state)]) @@ -122,7 +122,7 @@ (#try.Failure error))))) (def: .public <get> - (All [anchor expression directive] + (All (_ anchor expression directive) (Operation anchor expression directive <get_type>)) (function (_ (^@ stateE [bundle state])) (case (value@ <tag> state) @@ -133,7 +133,7 @@ (exception.except <exception> [])))) (def: .public (<set> value) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> <get_type> (Operation anchor expression directive Any))) (function (_ [bundle state]) (#try.Success [[bundle (with@ <tag> (#.Some value) state)] @@ -155,20 +155,20 @@ ) (def: .public get_registry - (All [anchor expression directive] + (All (_ anchor expression directive) (Operation anchor expression directive artifact.Registry)) (function (_ (^@ stateE [bundle state])) (#try.Success [stateE (value@ #registry state)]))) (def: .public (set_registry value) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> artifact.Registry (Operation anchor expression directive Any))) (function (_ [bundle state]) (#try.Success [[bundle (with@ #registry value state)] []]))) (def: .public next - (All [anchor expression directive] + (All (_ anchor expression directive) (Operation anchor expression directive Nat)) (do phase.monad [count (extension.read (value@ #counter)) @@ -176,22 +176,22 @@ (in count))) (def: .public (identifier prefix) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Text (Operation anchor expression directive Text))) (\ phase.monad each (|>> %.nat (format prefix)) ..next)) (def: .public (enter_module module) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Module (Operation anchor expression directive Any))) (extension.update (with@ #module module))) (def: .public module - (All [anchor expression directive] + (All (_ anchor expression directive) (Operation anchor expression directive Module)) (extension.read (value@ #module))) (def: .public (evaluate! label code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Context expression (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) (case (\ (value@ #host state) evaluate! label code) @@ -202,7 +202,7 @@ (exception.except ..cannot_interpret error)))) (def: .public (execute! code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> directive (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) (case (\ (value@ #host state) execute! code) @@ -213,7 +213,7 @@ (exception.except ..cannot_interpret error)))) (def: .public (define! context custom code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Context (Maybe Text) expression (Operation anchor expression directive [Text Any directive]))) (function (_ (^@ stateE [bundle state])) (case (\ (value@ #host state) define! context custom code) @@ -224,7 +224,7 @@ (exception.except ..cannot_interpret error)))) (def: .public (save! artifact_id custom code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> artifact.ID (Maybe Text) directive (Operation anchor expression directive Any))) (do {! phase.monad} [?buffer (extension.read (value@ #buffer))] @@ -240,7 +240,7 @@ (template [<name> <artifact>] [(def: .public (<name> name) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Text (Operation anchor expression directive artifact.ID))) (function (_ (^@ stateE [bundle state])) (let [[id registry'] (<artifact> name (value@ #registry state))] @@ -263,7 +263,7 @@ ["Known Definitions" (exception.listing function.identity known_definitions)])) (def: .public (remember archive name) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive Name (Operation anchor expression directive Context))) (function (_ (^@ stateE [bundle state])) (let [[_module _name] name] @@ -284,7 +284,7 @@ (exception: .public no_context) (def: .public (module_id module archive) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Module Archive (Operation anchor expression directive archive.ID))) (function (_ (^@ stateE [bundle state])) (do try.monad @@ -292,7 +292,7 @@ (in [stateE module_id])))) (def: .public (context archive) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive (Operation anchor expression directive Context))) (function (_ (^@ stateE [bundle state])) (case (value@ #context state) @@ -305,7 +305,7 @@ (in [stateE [module_id id]]))))) (def: .public (with_context id body) - (All [anchor expression directive a] + (All (_ anchor expression directive a) (-> artifact.ID (Operation anchor expression directive a) (Operation anchor expression directive a))) @@ -316,7 +316,7 @@ output])))) (def: .public (with_new_context archive body) - (All [anchor expression directive a] + (All (_ anchor expression directive a) (-> Archive (Operation anchor expression directive a) (Operation anchor expression directive [Context a]))) (function (_ (^@ stateE [bundle state])) @@ -331,7 +331,7 @@ output]]))))) (def: .public (log! message) - (All [anchor expression directive a] + (All (_ anchor expression directive a) (-> Text (Operation anchor expression directive Any))) (function (_ [bundle state]) (#try.Success [[bundle 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 5532c5977..d008fde0e 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 @@ -138,7 +138,7 @@ (\ ///.monad in (re_quantify envs caseT))))) (def: (analyse_primitive type inputT location output next) - (All [a] (-> Type Type Location Pattern (Operation a) (Operation [Pattern a]))) + (All (_ a) (-> Type Type Location Pattern (Operation a) (Operation [Pattern a]))) (/.with_location location (do ///.monad [_ (//type.with_env @@ -163,7 +163,7 @@ ... That is why the body must be analysed in the context of the ... pattern, and not separately. (def: (analyse_pattern num_tags inputT pattern next) - (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) + (All (_ a) (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) (.case pattern [location (#.Identifier ["" name])] (/.with_location location @@ -216,12 +216,12 @@ _ (undefined)))] (do ! - [[memberP+ thenA] (list\mix (: (All [a] + [[memberP+ thenA] (list\mix (: (All (_ a) (-> [Type Code] (Operation [(List Pattern) a]) (Operation [(List Pattern) a]))) (function (_ [memberT memberC] then) (do ! - [[memberP [memberP+ thenA]] ((:as (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) + [[memberP [memberP+ thenA]] ((:as (All (_ a) (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) analyse_pattern) #.None memberT memberC then)] (in [(list& memberP memberP+) thenA])))) 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 1ffb4f787..42dc67db6 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 @@ -163,7 +163,7 @@ []])))) (def: .public (with_module hash name action) - (All [a] (-> Nat Text (Operation a) (Operation [Module a]))) + (All (_ a) (-> Nat Text (Operation a) (Operation [Module a]))) (do ///.monad [_ (create hash name) output (/.with_current_module 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 c66a7b13f..0d01a4936 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 @@ -110,7 +110,7 @@ (exception: .public invalid_scope_alteration) (def: .public (with_local [name type] action) - (All [a] (-> [Text Type] (Operation a) (Operation a))) + (All (_ a) (-> [Text Type] (Operation a) (Operation a))) (function (_ [bundle state]) (case (value@ #.scopes state) (#.Item head tail) @@ -159,7 +159,7 @@ #.captured init_captured}) (def: .public (with_scope name action) - (All [a] (-> Text (Operation a) (Operation a))) + (All (_ a) (-> Text (Operation a) (Operation a))) (function (_ [bundle state]) (let [parent_name (case (value@ #.scopes state) #.End 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 f1ffa9026..5b837152b 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 @@ -17,12 +17,12 @@ ["#" phase]]]]) (def: .public (with_type expected) - (All [a] (-> Type (Operation a) (Operation a))) + (All (_ a) (-> Type (Operation a) (Operation a))) (///extension.localized (value@ #.expected) (with@ #.expected) (function.constant (#.Some expected)))) (def: .public (with_env action) - (All [a] (-> (Check a) (Operation a))) + (All (_ a) (-> (Check a) (Operation a))) (function (_ (^@ stateE [bundle state])) (case (action (value@ #.type_context state)) (#try.Success [context' output]) @@ -33,7 +33,7 @@ ((/.failure error) stateE)))) (def: .public with_fresh_env - (All [a] (-> (Operation a) (Operation a))) + (All (_ a) (-> (Operation a) (Operation a))) (///extension.localized (value@ #.type_context) (with@ #.type_context) (function.constant check.fresh_context))) @@ -45,7 +45,7 @@ (check.check expectedT actualT)))) (def: .public (with_inference action) - (All [a] (-> (Operation a) (Operation [Type a]))) + (All (_ a) (-> (Operation a) (Operation [Type a]))) (do ///.monad [[_ varT] (..with_env check.var) 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 898766876..f47780c61 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 @@ -28,12 +28,12 @@ [Name (List a)]) (def: .public equivalence - (All [a] (-> (Equivalence a) (Equivalence (Extension a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Extension a)))) (|>> list.equivalence (product.equivalence text.equivalence))) (def: .public hash - (All [a] (-> (Hash a) (Hash (Extension a)))) + (All (_ a) (-> (Hash a) (Hash (Extension a)))) (|>> list.hash (product.hash text.hash))) @@ -88,7 +88,7 @@ (-> Any (Handler s i o))) (def: .public (install extender name handler) - (All [s i o] + (All (_ s i o) (-> (Extender s i o) Text (Handler s i o) (Operation s i o Any))) (function (_ [bundle state]) (case (dictionary.value name bundle) @@ -100,7 +100,7 @@ (exception.except ..cannot_overwrite name)))) (def: .public (with extender extensions) - (All [s i o] + (All (_ s i o) (-> Extender (Bundle s i o) (Operation s i o Any))) (|> extensions dictionary.entries @@ -110,7 +110,7 @@ []))) (def: .public (apply archive phase [name parameters]) - (All [s i o] + (All (_ s i o) (-> Archive (Phase s i o) (Extension i) (Operation s i o o))) (function (_ (^@ stateE [bundle state])) (case (dictionary.value name bundle) @@ -122,7 +122,7 @@ (exception.except ..unknown [name bundle])))) (def: .public (localized get set transform) - (All [s s' i o v] + (All (_ s s' i o v) (-> (-> s s') (-> s' s s) (-> s' s') (-> (Operation s i o v) (Operation s i o v)))) (function (_ operation) @@ -136,7 +136,7 @@ (#try.Failure error)))))) (def: .public (temporary transform) - (All [s i o v] + (All (_ s i o v) (-> (-> s s) (-> (Operation s i o v) (Operation s i o v)))) (function (_ operation) @@ -149,24 +149,24 @@ (#try.Failure error))))) (def: .public (with_state state) - (All [s i o v] + (All (_ s i o v) (-> s (-> (Operation s i o v) (Operation s i o v)))) (..temporary (function.constant state))) (def: .public (read get) - (All [s i o v] + (All (_ s i o v) (-> (-> s v) (Operation s i o v))) (function (_ [bundle state]) (#try.Success [[bundle state] (get state)]))) (def: .public (update transform) - (All [s i o] + (All (_ s i o) (-> (-> s s) (Operation s i o Any))) (function (_ [bundle state]) (#try.Success [[bundle (transform state)] []]))) (def: .public (lifted action) - (All [s i o v] + (All (_ s i o v) (-> (//.Operation s v) (//.Operation [(Bundle s i o) s] v))) (function (_ [bundle state]) 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 ef87ca48a..d3384588e 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 @@ -145,7 +145,7 @@ not)))) (def: reflection - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) Text)) (|>> jvm.reflection reflection.reflection)) 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 827edf300..7952434ee 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 @@ -35,7 +35,7 @@ [archive (#+ Archive)]]]]]]) (def: .public (custom [syntax handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text Phase Archive s (Operation Analysis))] Handler)) 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 d9621c994..c3b9b9a9e 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 @@ -16,13 +16,13 @@ (dictionary.empty text.hash)) (def: .public (install name anonymous) - (All [s i o] + (All (_ s i o) (-> Text (Handler s i o) (-> (Bundle s i o) (Bundle s i o)))) (dictionary.has name anonymous)) (def: .public (prefix prefix) - (All [s i o] + (All (_ s i o) (-> Text (-> (Bundle s i o) (Bundle s i o)))) (|>> dictionary.entries (list\each (function (_ [key val]) [(format prefix " " key) val])) 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 7a3ccaf26..c805124dd 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 @@ -44,7 +44,7 @@ ["." archive (#+ Archive)]]]]]]) (def: .public (custom [syntax handler]) - (All [anchor expression directive s] + (All (_ anchor expression directive s) (-> [(Parser s) (-> Text (Phase anchor expression directive) @@ -67,7 +67,7 @@ ... TODO: Inline "evaluate!'" into "evaluate!" ASAP (def: (evaluate!' archive generate code//type codeS) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive (/////generation.Phase anchor expression directive) Type @@ -83,7 +83,7 @@ (in [code//type codeG codeV])))) (def: .public (evaluate! archive type codeC) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive Type Code (Operation anchor expression directive [Type expression Any]))) (do phase.monad [state (///.lifted phase.get_state) @@ -101,7 +101,7 @@ ... TODO: Inline "definition'" into "definition" ASAP (def: (definition' archive generate [module name] code//type codeS) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive (/////generation.Phase anchor expression directive) Name @@ -118,7 +118,7 @@ (in [code//type codeG value])))) (def: (definition archive name expected codeC) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive Name (Maybe Type) Code (Operation anchor expression directive [Type expression Any]))) (do {! phase.monad} @@ -150,7 +150,7 @@ (template [<full> <partial> <learn>] [... TODO: Inline "<partial>" into "<full>" ASAP (def: (<partial> archive generate extension codeT codeS) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive (/////generation.Phase anchor expression directive) Text @@ -170,7 +170,7 @@ (in [codeG value]))))) (def: .public (<full> archive extension codeT codeC) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Archive Text Type Code (Operation anchor expression directive [expression Any]))) (do phase.monad @@ -194,7 +194,7 @@ ) (def: (refresh expander host_analysis) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Expander /////analysis.Bundle (Operation anchor expression directive Any))) (do phase.monad [[bundle state] phase.get_state @@ -210,7 +210,7 @@ state)]))) (def: (announce_definition! short type) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Text Type (Operation anchor expression directive Any))) (/////directive.lifted_generation (/////generation.log! (format short " : " (%.type type))))) @@ -237,7 +237,7 @@ (phase.except ///.invalid_syntax [extension_name %.code inputsC+])))) (def: (announce_tags! tags owner) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (List Text) Type (Operation anchor expression directive (List Any)))) (/////directive.lifted_generation (monad.each phase.monad (function (_ tag) @@ -326,7 +326,7 @@ (template [<description> <mame> <def_type> <type> <scope> <definer>] [(def: (<mame> [anchorT expressionT directiveT] extender) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> [Type Type Type] Extender (Handler anchor expression directive))) (function (handler extension_name phase archive inputsC+) @@ -378,7 +378,7 @@ ... because the old compiler couldn't handle a fully-inlined definition ... for "def::program". Inline them ASAP. (def: (prepare_program archive analyse synthesize programC) - (All [anchor expression directive output] + (All (_ anchor expression directive output) (-> Archive /////analysis.Phase /////synthesis.Phase @@ -394,7 +394,7 @@ (synthesize archive programA)))) (def: (define_program archive module_id generate program programS) - (All [anchor expression directive output] + (All (_ anchor expression directive output) (-> Archive archive.ID (/////generation.Phase anchor expression directive) @@ -407,7 +407,7 @@ (/////generation.save! artifact_id #.None (program [module_id artifact_id] programG)))) (def: (def::program program) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (Program expression directive) (Handler anchor expression directive))) (function (handler extension_name phase archive inputsC+) (case inputsC+ @@ -429,7 +429,7 @@ (phase.except ///.invalid_syntax [extension_name %.code inputsC+])))) (def: (bundle::def expander host_analysis program anchorT,expressionT,directiveT extender) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Expander /////analysis.Bundle (Program expression directive) @@ -449,7 +449,7 @@ ))) (def: .public (bundle expander host_analysis program anchorT,expressionT,directiveT extender) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Expander /////analysis.Bundle (Program expression directive) 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 bebec6929..3f63dbcd9 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 @@ -39,7 +39,7 @@ ["#" phase]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) 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 00da05b89..3aad68a7f 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 @@ -33,7 +33,7 @@ ["#" phase]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) 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 759b2ad63..ce860dbf9 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 @@ -43,7 +43,7 @@ [archive (#+ Archive)]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text Phase Archive s (Operation (Bytecode Any)))] Handler)) 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 e176bcda7..cf9f14c00 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 @@ -569,7 +569,7 @@ (_.invokestatic ..$Boolean "valueOf" (type.method [(list type.boolean) ..$Boolean (list)]))))))])) (def: reflection - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) Text)) (|>> type.reflection reflection.reflection)) 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 0c812936b..4cfaa6335 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 @@ -42,7 +42,7 @@ ["#" phase ("#\." monad)]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) 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 f22dc34f1..0ba08dfd9 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 @@ -39,7 +39,7 @@ ["#" phase]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) 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 16ac4b882..fcf5e8b2d 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 @@ -82,7 +82,7 @@ )) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) 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 1593d7a25..a07c72c74 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 @@ -39,7 +39,7 @@ ["#" phase]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) 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 83791324e..d55550954 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 @@ -19,7 +19,7 @@ [number ["f" frac]]] [target - ["_" ruby (#+ Expression)]]]] + ["_" ruby (#+ Expression Statement)]]]] ["." //// #_ ["/" bundle] ["/#" // #_ @@ -28,15 +28,21 @@ [extension (#+ Nullary Unary Binary Trinary nullary unary binary trinary)] ["//" ruby #_ - ["#." runtime (#+ Operation Phase Handler Bundle Generator)]]] + ["#." runtime (#+ Operation Phase Phase! Handler Bundle Generator)] + ["#." primitive] + ["#." structure] + ["#." reference] + ["#." function] + ["#." case] + ["#." loop]]] [// - [synthesis (#+ %synthesis)] + ["." synthesis (#+ %synthesis)] ["." generation] [/// - ["#" phase]]]]]) + ["#" phase ("#\." monad)]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) @@ -48,6 +54,45 @@ (#try.Failure error) (/////.except extension.invalid_syntax [extension_name %synthesis input])))) +(def: .public (statement expression archive synthesis) + Phase! + (case synthesis + ... TODO: Get rid of this ASAP + (#synthesis.Extension "lux syntax char case!" parameters) + (do /////.monad + [body (expression archive synthesis)] + (in (:as Statement + body))) + + (^template [<tag>] + [(^ (<tag> value)) + (/////\each _.return (expression archive synthesis))]) + ([synthesis.bit] + [synthesis.i64] + [synthesis.f64] + [synthesis.text] + [synthesis.variant] + [synthesis.tuple] + [#synthesis.Reference] + [synthesis.branch/get] + [synthesis.function/apply] + [#synthesis.Extension]) + + (^ (synthesis.branch/case case)) + (//case.case! false statement expression archive case) + + (^template [<tag> <generator>] + [(^ (<tag> value)) + (<generator> statement expression archive value)]) + ([synthesis.branch/let //case.let!] + [synthesis.branch/if //case.if!] + [synthesis.loop/scope //loop.scope!] + [synthesis.loop/recur //loop.recur!]) + + (^ (synthesis.function/abstraction abstraction)) + (/////\each _.return (//function.function statement expression archive abstraction)) + )) + ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! (..custom [($_ <>.and @@ -59,12 +104,12 @@ (function (_ extension_name phase archive [input else conditionals]) (do {! /////.monad} [inputG (phase archive input) - elseG (phase archive else) + else! (statement phase archive else) @input (\ ! each _.local (generation.identifier "input")) - conditionalsG (: (Operation (List [Expression Expression])) + conditionals! (: (Operation (List [Expression Statement])) (monad.each ! (function (_ [chars branch]) (do ! - [branchG (phase archive branch)] + [branch! (statement phase archive branch)] (in [(|> chars (list\each (|>> .int _.int (_.= @input))) (list\mix (function (_ clause total) @@ -72,14 +117,23 @@ clause (_.or clause total))) _.nil)) - branchG]))) + branch!]))) conditionals)) - .let [closure (_.lambda #.None (list @input) - (list\mix (function (_ [test then] else) - (_.if test (_.return then) else)) - (_.return elseG) - conditionalsG))]] - (in (_.apply_lambda/* (list inputG) closure))))])) + ... .let [closure (_.lambda #.None (list @input) + ... (list\mix (function (_ [test then] else) + ... (_.if test (_.return then) else)) + ... (_.return else!) + ... conditionals!))] + ] + ... (in (_.apply_lambda/* (list inputG) closure)) + (in (<| (:as Expression) + (: Statement) + ($_ _.then + (_.set (list @input) inputG) + (list\mix (function (_ [test then!] else!) + (_.if test then! else!)) + else! + conditionals!))))))])) (def: lux_procs Bundle @@ -101,8 +155,8 @@ (/.install "and" (binary (product.uncurried //runtime.i64//and))) (/.install "or" (binary (product.uncurried //runtime.i64//or))) (/.install "xor" (binary (product.uncurried //runtime.i64//xor))) - (/.install "left-shift" (binary (product.uncurried //runtime.i64//left_shift))) - (/.install "right-shift" (binary (product.uncurried //runtime.i64//right_shift))) + (/.install "left-shift" (binary (product.uncurried //runtime.i64//left_shifted))) + (/.install "right-shift" (binary (product.uncurried //runtime.i64//right_shifted))) (/.install "<" (binary (product.uncurried _.<))) (/.install "=" (binary (product.uncurried _.=))) 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 3b3e87e30..e51c2b542 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 @@ -39,7 +39,7 @@ ["#" phase]]]]]) (def: .public (custom [parser handler]) - (All [s] + (All (_ s) (-> [(Parser s) (-> Text (Generator s))] Handler)) 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 c7b2eba9d..5c5e43e8b 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 @@ -38,7 +38,7 @@ (do {! meta.monad} [g!input+ (monad.all ! (list.repeated arity (macro.identifier "input")))] (in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!extension)) - (All [(~ g!anchor) (~ g!expression) (~ g!directive)] + (All ((~ g!_) (~ g!anchor) (~ g!expression) (~ g!directive)) (-> ((~ type) (~ g!expression)) (generation.Handler (~ g!anchor) (~ g!expression) (~ g!directive)))) (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!archive) (~ g!inputs)) @@ -60,7 +60,7 @@ (arity: 3 trinary ..Trinary) (def: .public (variadic extension) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (Variadic expression) (generation.Handler anchor expression directive))) (function (_ extension_name) (function (_ phase archive inputsS) 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 afa615823..f43a360d2 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 @@ -90,7 +90,7 @@ (def: this_offset 1) (def: internal - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) Internal)) (|>> type.reflection reflection.reflection name.internal)) 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 469ab0e89..d99cfca3d 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 @@ -504,7 +504,7 @@ ))))) (def: reflection - (All [category] + (All (_ category) (-> (Type (<| Return' Value' category)) Text)) (|>> type.reflection reflection.reflection)) 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 cc0e2e859..7c29f3367 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 @@ -52,7 +52,7 @@ variable))) (def: .public (constant system archive name) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (System expression) Archive Name (////generation.Operation anchor expression directive expression))) (phase\each (|>> ..artifact (\ system constant)) @@ -60,7 +60,7 @@ (template [<sigil> <name>] [(def: .public (<name> system) - (All [expression] + (All (_ expression) (-> (System expression) (-> Register expression))) (|>> %.nat (format <sigil>) (\ system variable)))] @@ -70,7 +70,7 @@ ) (def: .public (variable system variable) - (All [expression] + (All (_ expression) (-> (System expression) Variable expression)) (case variable (#variable.Local register) @@ -80,7 +80,7 @@ (..foreign system register))) (def: .public (reference system archive reference) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (System expression) Archive Reference (////generation.Operation anchor expression directive expression))) (case reference (#reference.Constant value) 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 e963dad17..a88cade6b 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 @@ -18,7 +18,10 @@ ["/#" // #_ ["#." reference] ["/#" // #_ - ["#." extension] + ["#." extension + [generation + [ruby + ["#/." common]]]] ["/#" // #_ [analysis (#+)] ["#." synthesis] @@ -27,38 +30,6 @@ [reference (#+) [variable (#+)]]]]]]]) -(def: (statement expression archive synthesis) - Phase! - (case synthesis - (^template [<tag>] - [(^ (<tag> value)) - (//////phase\each _.return (expression archive synthesis))]) - ([////synthesis.bit] - [////synthesis.i64] - [////synthesis.f64] - [////synthesis.text] - [////synthesis.variant] - [////synthesis.tuple] - [#////synthesis.Reference] - [////synthesis.branch/get] - [////synthesis.function/apply] - [#////synthesis.Extension]) - - (^ (////synthesis.branch/case case)) - (/case.case! false statement expression archive case) - - (^template [<tag> <generator>] - [(^ (<tag> value)) - (<generator> statement expression archive value)]) - ([////synthesis.branch/let /case.let!] - [////synthesis.branch/if /case.if!] - [////synthesis.loop/scope /loop.scope!] - [////synthesis.loop/recur /loop.recur!]) - - (^ (////synthesis.function/abstraction abstraction)) - (//////phase\each _.return (/function.function statement expression archive abstraction)) - )) - (exception: .public cannot_recur_as_an_expression) (def: (expression archive synthesis) @@ -86,7 +57,7 @@ (^template [<tag> <generator>] [(^ (<tag> value)) - (<generator> statement expression archive value)]) + (<generator> ///extension/common.statement expression archive value)]) ([////synthesis.branch/case /case.case] [////synthesis.loop/scope /loop.scope] [////synthesis.function/abstraction /function.function]) 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 276716fef..a9ab2c87b 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 @@ -324,10 +324,7 @@ post! (recur postP) g!once (..identifier "once") g!continue? (..identifier "continue")] - (in (..alternation in_closure? g!once g!continue? pre! post!))) - - _ - (undefined)))))) + (in (..alternation in_closure? g!once g!continue? pre! post!)))))))) (def: (pattern_matching in_closure? statement expression archive pathP) (-> Bit (Generator! Path)) 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 768d4a928..dbca8e747 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- function) + [lux (#- Variant Tuple function) [abstract ["." monad (#+ do)]] [data 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 a5ac11d83..136d05d92 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 @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- Variant Tuple) [abstract ["." monad (#+ do)]] [target 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 b6544e285..4cfc0dc5d 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 @@ -95,8 +95,8 @@ (path' pattern true (///\each (|>> #/.Then) (synthesize archive bodyA)))) (def: (weave_branch weave equivalence [new_test new_then] [[old_test old_then] old_tail]) - (All [a] (-> (-> Path Path Path) (Equivalence a) [a Path] (/.Fork a Path) - (/.Fork a Path))) + (All (_ a) (-> (-> Path Path Path) (Equivalence a) [a Path] (/.Fork a Path) + (/.Fork a Path))) (if (\ equivalence = new_test old_test) [[old_test (weave new_then old_then)] old_tail] [[old_test old_then] @@ -108,8 +108,8 @@ (#.Item (weave_branch weave equivalence [new_test new_then] old_item)))])) (def: (weave_fork weave equivalence new_fork old_fork) - (All [a] (-> (-> Path Path Path) (Equivalence a) (/.Fork a Path) (/.Fork a Path) - (/.Fork a Path))) + (All (_ a) (-> (-> Path Path Path) (Equivalence a) (/.Fork a Path) (/.Fork a Path) + (/.Fork a Path))) (list\mix (..weave_branch weave equivalence) old_fork (#.Item new_fork))) (def: (weave new old) 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 212a2a0a2..f4eb9691c 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 @@ -194,7 +194,7 @@ (-> [Redundancy a] (Try [Redundancy a]))) (def: (list_optimization optimization) - (All [a] (-> (Optimization a) (Optimization (List a)))) + (All (_ a) (-> (Optimization a) (Optimization (List a)))) (function (recur [redundancy values]) (case values #.End 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 1fe8d3abd..ec9c6d81e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -202,7 +202,7 @@ (template [<with> <query> <tag> <type>] [(def: .public (<with> value) - (-> <type> (All [a] (-> (Operation a) (Operation a)))) + (-> <type> (All (_ a) (-> (Operation a) (Operation a)))) (extension.temporary (with@ <tag> value))) (def: .public <query> @@ -214,7 +214,7 @@ ) (def: .public with_new_local - (All [a] (-> (Operation a) (Operation a))) + (All (_ a) (-> (Operation a) (Operation a))) (<<| (do phase.monad [locals ..locals]) (..with_locals (++ locals)))) @@ -271,7 +271,7 @@ ) (def: .public (%path' %then value) - (All [a] (-> (Format a) (Format (Path' a)))) + (All (_ a) (-> (Format a) (Format (Path' a)))) (case value #Pop "_" @@ -499,7 +499,7 @@ [#Member]))))) (implementation: .public (path'_equivalence equivalence) - (All [a] (-> (Equivalence a) (Equivalence (Path' a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Path' a)))) (def: (= reference sample) (case [reference sample] @@ -542,7 +542,7 @@ false))) (implementation: (path'_hash super) - (All [a] (-> (Hash a) (Hash (Path' a)))) + (All (_ a) (-> (Hash a) (Hash (Path' a)))) (def: &equivalence (..path'_equivalence (\ super &equivalence))) @@ -587,7 +587,7 @@ ))) (implementation: (branch_equivalence (^open "\.")) - (All [a] (-> (Equivalence a) (Equivalence (Branch a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Branch a)))) (def: (= reference sample) (case [reference sample] @@ -617,7 +617,7 @@ false))) (implementation: (branch_hash super) - (All [a] (-> (Hash a) (Hash (Branch a)))) + (All (_ a) (-> (Hash a) (Hash (Branch a)))) (def: &equivalence (..branch_equivalence (\ super &equivalence))) @@ -648,7 +648,7 @@ ))) (implementation: (loop_equivalence (^open "\.")) - (All [a] (-> (Equivalence a) (Equivalence (Loop a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Loop a)))) (def: (= reference sample) (case [reference sample] @@ -665,7 +665,7 @@ false))) (implementation: (loop_hash super) - (All [a] (-> (Hash a) (Hash (Loop a)))) + (All (_ a) (-> (Hash a) (Hash (Loop a)))) (def: &equivalence (..loop_equivalence (\ super &equivalence))) @@ -684,7 +684,7 @@ ))) (implementation: (function_equivalence (^open "\.")) - (All [a] (-> (Equivalence a) (Equivalence (Function a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Function a)))) (def: (= reference sample) (case [reference sample] @@ -703,7 +703,7 @@ false))) (implementation: (function_hash super) - (All [a] (-> (Hash a) (Hash (Function a)))) + (All (_ a) (-> (Hash a) (Hash (Function a)))) (def: &equivalence (..function_equivalence (\ super &equivalence))) @@ -723,7 +723,7 @@ ))) (implementation: (control_equivalence (^open "\.")) - (All [a] (-> (Equivalence a) (Equivalence (Control a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Control a)))) (def: (= reference sample) (case [reference sample] @@ -738,7 +738,7 @@ false))) (implementation: (control_hash super) - (All [a] (-> (Hash a) (Hash (Control a)))) + (All (_ a) (-> (Hash a) (Hash (Control a)))) (def: &equivalence (..control_equivalence (\ super &equivalence))) 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 8858eefa3..07c8b0841 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -33,7 +33,7 @@ #content d}) (def: .public (read key document) - (All [d] (-> (Key d) (Document Any) (Try d))) + (All (_ d) (-> (Key d) (Document Any) (Try d))) (let [[document//signature document//content] (:representation document)] (if (\ signature.equivalence = (key.signature key) @@ -48,12 +48,12 @@ document//signature])))) (def: .public (write key content) - (All [d] (-> (Key d) d (Document d))) + (All (_ d) (-> (Key d) d (Document d))) (:abstraction {#signature (key.signature key) #content content})) (def: .public (check key document) - (All [d] (-> (Key d) (Document Any) (Try (Document d)))) + (All (_ d) (-> (Key d) (Document Any) (Try (Document d)))) (do try.monad [_ (..read key document)] (in (:expected document)))) @@ -63,13 +63,13 @@ (|>> :representation (value@ #signature))) (def: .public (writer content) - (All [d] (-> (Writer d) (Writer (Document d)))) + (All (_ d) (-> (Writer d) (Writer (Document d)))) (let [writer (binary.and signature.writer content)] (|>> :representation writer))) (def: .public parser - (All [d] (-> (Parser d) (Parser (Document d)))) + (All (_ d) (-> (Parser d) (Parser (Document d)))) (|>> (<>.and signature.parser) (\ <>.monad each (|>> :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 41de7eba0..494956e83 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux @@ -16,6 +16,6 @@ (|>> :representation)) (def: .public (key signature sample) - (All [d] (-> Signature d (Key d))) + (All (_ d) (-> Signature d (Key d))) (:abstraction signature)) ) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io.lux b/stdlib/source/library/lux/tool/compiler/meta/io.lux index 72f98b3d9..9e54f0df9 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io.lux @@ -13,7 +13,7 @@ Text) (def: .public (safe system) - (All [m] (-> (System m) Text Text)) + (All (_ m) (-> (System m) Text Text)) (text.replaced "/" (\ system separator))) (def: .public lux_context 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 efb13c9e8..25b9ec0b4 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -60,31 +60,31 @@ ["Error" error])) (def: (archive fs static) - (All [!] (-> (file.System !) Static file.Path)) + (All (_ !) (-> (file.System !) Static file.Path)) (format (value@ #static.target static) (\ fs separator) (value@ #static.host static))) (def: (unversioned_lux_archive fs static) - (All [!] (-> (file.System !) Static file.Path)) + (All (_ !) (-> (file.System !) Static file.Path)) (format (..archive fs static) (\ fs separator) //.lux_context)) (def: (versioned_lux_archive fs static) - (All [!] (-> (file.System !) Static file.Path)) + (All (_ !) (-> (file.System !) Static file.Path)) (format (..unversioned_lux_archive fs static) (\ fs separator) (%.nat version.version))) (def: (module fs static module_id) - (All [!] (-> (file.System !) Static archive.ID file.Path)) + (All (_ !) (-> (file.System !) Static archive.ID file.Path)) (format (..versioned_lux_archive fs static) (\ fs separator) (%.nat module_id))) (def: .public (artifact fs static module_id artifact_id) - (All [!] (-> (file.System !) Static archive.ID artifact.ID file.Path)) + (All (_ !) (-> (file.System !) Static archive.ID artifact.ID file.Path)) (format (..module fs static module_id) (\ fs separator) (%.nat artifact_id) @@ -211,7 +211,7 @@ (dictionary.empty text.hash)]) (def: (loaded_document extension host module_id expected actual document) - (All [expression directive] + (All (_ expression directive) (-> Text (generation.Host expression directive) archive.ID (Row Artifact) (Dictionary Text Binary) (Document .Module) (Try [(Document .Module) Bundles Output]))) (do {! try.monad} @@ -338,7 +338,7 @@ bundles]))) (def: (load_definitions fs static module_id host_environment descriptor document) - (All [expression directive] + (All (_ expression directive) (-> (file.System Async) Static archive.ID (generation.Host expression directive) Descriptor (Document .Module) (Async (Try [[Descriptor (Document .Module) Output] @@ -403,7 +403,7 @@ "(Lux Caching System)") (def: (load_every_reserved_module host_environment fs static import contexts archive) - (All [expression directive] + (All (_ expression directive) (-> (generation.Host expression directive) (file.System Async) Static Import (List Context) Archive (Async (Try [Archive .Lux Bundles])))) (do {! (try.with async.monad)} @@ -460,7 +460,7 @@ loaded_caches)]))))) (def: .public (thaw host_environment fs static import contexts) - (All [expression directive] + (All (_ expression directive) (-> (generation.Host expression directive) (file.System Async) Static Import (List Context) (Async (Try [Archive .Lux Bundles])))) (do async.monad 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 fe83f0fb3..797d1e2e4 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -48,7 +48,7 @@ ".lux") (def: .public (path fs context module) - (All [m] (-> (file.System m) Context Module file.Path)) + (All (_ m) (-> (file.System m) Context Module file.Path)) (|> module (//.safe fs) (format context (\ fs separator)))) @@ -159,7 +159,7 @@ (\ ! conjoint)))) (def: Action - (type (All [a] (Async (Try a))))) + (type (All (_ a) (Async (Try a))))) (def: (canonical fs context) (-> (file.System Async) Context (Action Context)) 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 0beeffa1c..10ef01271 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux @@ -34,7 +34,7 @@ [generation (#+ Context)]]]]]]) (def: (write_module sequence [module output] so_far) - (All [directive] + (All (_ directive) (-> (-> directive directive directive) [archive.ID Output] directive (Try directive))) (|> output @@ -55,7 +55,7 @@ so_far))) (def: .public (package header code sequence scope) - (All [directive] + (All (_ directive) (-> directive (-> directive Text) (-> directive directive directive) diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index 22362318a..b80e262c4 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -28,41 +28,41 @@ (state.+State Try s o)) (def: .public monad - (All [s] (Monad (Operation s))) + (All (_ s) (Monad (Operation s))) (state.with try.monad)) (type: .public (Phase s i o) (-> Archive i (Operation s o))) (type: .public Wrapper - (All [s i o] (-> (Phase s i o) Any))) + (All (_ s i o) (-> (Phase s i o) Any))) (def: .public (result' state operation) - (All [s o] + (All (_ s o) (-> s (Operation s o) (Try [s o]))) (operation state)) (def: .public (result state operation) - (All [s o] + (All (_ s o) (-> s (Operation s o) (Try o))) (|> state operation (\ try.monad each product.right))) (def: .public get_state - (All [s o] + (All (_ s o) (Operation s s)) (function (_ state) (#try.Success [state state]))) (def: .public (set_state state) - (All [s o] + (All (_ s o) (-> s (Operation s Any))) (function (_ _) (#try.Success [state []]))) (def: .public (sub [get set] operation) - (All [s s' o] + (All (_ s s' o) (-> [(-> s s') (-> s' s s)] (Operation s' o) (Operation s o))) @@ -76,11 +76,11 @@ (|>> #try.Failure (state.lifted try.monad))) (def: .public (except exception parameters) - (All [e] (-> (Exception e) e Operation)) + (All (_ e) (-> (Exception e) e Operation)) (..failure (ex.error exception parameters))) (def: .public (lifted error) - (All [s a] (-> (Try a) (Operation s a))) + (All (_ s a) (-> (Try a) (Operation s a))) (function (_ state) (try\each (|>> [state]) error))) @@ -92,12 +92,12 @@ (..except (~ exception) (~ message))))))) (def: .public identity - (All [s a] (Phase s a a)) + (All (_ s a) (Phase s a a)) (function (_ archive input state) (#try.Success [state input]))) (def: .public (composite pre post) - (All [s0 s1 i t o] + (All (_ s0 s1 i t o) (-> (Phase s0 i t) (Phase s1 t o) (Phase [s0 s1] i o))) @@ -108,7 +108,7 @@ (in [[pre/state' post/state'] output])))) (def: .public (timed definition description operation) - (All [s a] + (All (_ s a) (-> Name Text (Operation s a) (Operation s a))) (do ..monad [_ (in []) diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index c26e9b789..dd6713ff4 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -58,7 +58,7 @@ "Till next time...") (def: enter_module - (All [anchor expression directive] + (All (_ anchor expression directive) (Operation anchor expression directive Any)) (directive.lifted_analysis (do phase.monad @@ -66,7 +66,7 @@ (analysis.set_current_module ..module)))) (def: (initialize Monad<!> Console<!> platform configuration generation_bundle) - (All [! anchor expression directive] + (All (_ ! anchor expression directive) (-> (Monad !) (Console !) (Platform ! anchor expression directive) Configuration @@ -90,7 +90,7 @@ (with_expansions [<Interpretation> (as_is (Operation anchor expression directive [Type Any]))] (def: (interpret_directive code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Code <Interpretation>)) (do phase.monad [_ (total.phase code) @@ -98,7 +98,7 @@ (in [Any []]))) (def: (interpret_expression code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Code <Interpretation>)) (do {! phase.monad} [state (extension.lifted phase.get_state) @@ -125,7 +125,7 @@ (in [codeT codeV])))))) (def: (interpret configuration code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Configuration Code <Interpretation>)) (function (_ state) (case (<| (phase.result' state) @@ -149,7 +149,7 @@ ) (def: (execute configuration code) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Configuration Code (Operation anchor expression directive Text))) (do phase.monad [[codeT codeV] (interpret configuration code) @@ -169,7 +169,7 @@ (with_expansions [<Context> (as_is (Context anchor expression directive))] (def: (read_eval_print context) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> <Context> (Try [<Context> Text]))) (do try.monad [.let [[_where _offset _code] (value@ #source context)] @@ -193,7 +193,7 @@ representation])))) (def: .public (run! Monad<!> Console<!> platform configuration generation_bundle) - (All [! anchor expression directive] + (All (_ ! anchor expression directive) (-> (Monad !) (Console !) (Platform ! anchor expression directive) Configuration diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index 60aebf7e9..a9eeac328 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -420,15 +420,16 @@ input <code>.any output <code>.any value (<>.maybe <code>.any)]) - (let [casterC (` (: (All [(~+ (list\each code.local_identifier type_vars))] - (-> (~ input) (~ output))) - (|>> :expected)))] - (case value - #.None - (in (list casterC)) - - (#.Some value) - (in (list (` ((~ casterC) (~ value)))))))) + (macro.with_identifiers [g!_] + (let [casterC (` (: (All ((~ g!_) (~+ (list\each code.local_identifier type_vars))) + (-> (~ input) (~ output))) + (|>> :expected)))] + (case value + #.None + (in (list casterC)) + + (#.Some value) + (in (list (` ((~ casterC) (~ value))))))))) (type: Typed (Record @@ -444,9 +445,11 @@ exemplar ..typed computation ..typed]) (macro.with_identifiers [g!_] - (let [shareC (` (: (All [(~+ (list\each code.local_identifier type_vars))] - (-> (~ (value@ #type exemplar)) - (~ (value@ #type computation)))) + (let [typeC (("lux in-module" "library/lux" .quantified) + (` (All ((~ g!_) (~+ (list\each code.local_identifier type_vars))) + (-> (~ (value@ #type exemplar)) + (~ (value@ #type computation)))))) + shareC (` (: (~ typeC) (.function ((~ g!_) (~ g!_)) (~ (value@ #expression computation)))))] (in (list (` ((~ shareC) (~ (value@ #expression exemplar))))))))) @@ -454,11 +457,12 @@ (syntax: .public (:by_example [type_vars ..type_parameters exemplar ..typed extraction <code>.any]) - (in (list (` (:of ((~! :sharing) + (in (list (` (:of ((~! ..:sharing) [(~+ (list\each code.local_identifier type_vars))] (~ (value@ #type exemplar)) (~ (value@ #expression exemplar)) (~ extraction) - (:expected []))))))) + ... The value of this expression will never be relevant, so it doesn't matter what it is. + (.:as .Nothing []))))))) diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux index 4e9e07045..837f6ba11 100644 --- a/stdlib/source/library/lux/type/abstract.lux +++ b/stdlib/source/library/lux/type/abstract.lux @@ -23,15 +23,15 @@ List) (def: peek - (All [a] (-> (Stack a) (Maybe a))) + (All (_ a) (-> (Stack a) (Maybe a))) list.head) (def: (push value stack) - (All [a] (-> a (Stack a) (Stack a))) + (All (_ a) (-> a (Stack a) (Stack a))) (#.Item value stack)) (def: pop - (All [a] (-> (Stack a) (Maybe (Stack a)))) + (All (_ a) (-> (Stack a) (Maybe (Stack a)))) list.tail) (type: .public Frame @@ -248,7 +248,7 @@ (#Current a))) (def: (selection parser) - (All [a] (-> (Parser a) (Parser (Selection a)))) + (All (_ a) (-> (Parser a) (Parser (Selection a)))) (<>.or (<>.and <code>.any parser) parser)) diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index aaac468d1..a42a519df 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -157,7 +157,7 @@ (var::put id value plist'))))) (def: .public (result context proc) - (All [a] (-> Type_Context (Check a) (Try a))) + (All (_ a) (-> Type_Context (Check a) (Try a))) (case (proc context) (#try.Success [context' output]) (#try.Success output) @@ -166,7 +166,7 @@ (#try.Failure error))) (def: .public (failure message) - (All [a] (-> Text (Check a))) + (All (_ a) (-> Text (Check a))) (function (_ context) (#try.Failure message))) @@ -178,7 +178,7 @@ (#try.Failure message)))) (def: .public (except exception message) - (All [e a] (-> (Exception e) e (Check a))) + (All (_ e a) (-> (Exception e) e (Check a))) (..failure (exception.error exception message))) (def: .public existential @@ -328,7 +328,7 @@ #.var_bindings (list)}) (def: (attempt op) - (All [a] (-> (Check a) (Check (Maybe a)))) + (All (_ a) (-> (Check a) (Check (Maybe a)))) (function (_ context) (case (op context) (#try.Success [context' output]) @@ -338,7 +338,7 @@ (#try.Success [context #.None])))) (def: (either left right) - (All [a] (-> (Check a) (Check a) (Check a))) + (All (_ a) (-> (Check a) (Check a) (Check a))) (function (_ context) (case (left context) (#try.Failure _) @@ -356,7 +356,7 @@ ... TODO: "if_can_bind" can be optimized... (def: (if_can_bind id type then else) - (All [a] + (All (_ a) (-> Var Type (Check a) (-> Type (Check a)) (Check a))) ($_ either @@ -454,7 +454,7 @@ (check' assumptions etype atype)))))) (def: silent_failure! - (All [a] (Check a)) + (All (_ a) (Check a)) (..failure "")) ... TODO: "check_apply" can be optimized... @@ -545,7 +545,7 @@ ..silent_failure!))) (def: (with exception parameter check) - (All [e a] (-> (Exception e) e (Check a) (Check a))) + (All (_ e a) (-> (Exception e) e (Check a) (Check a))) (|>> check (exception.with exception parameter))) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index ca568e7fd..c092139d2 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -303,7 +303,7 @@ #0)) (def: (pair_list [l r]) - (All [a] (-> [a a] (List a))) + (All (_ a) (-> [a a] (List a))) (list l r)) (def: (instance$ [constructor dependencies]) diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux index 42da7c4d7..1436e4597 100644 --- a/stdlib/source/library/lux/type/quotient.lux +++ b/stdlib/source/library/lux/type/quotient.lux @@ -17,8 +17,8 @@ (-> t c) (def: .public class - (All [t c] - (Ex [%] + (All (_ t c) + (Ex (_ %) (-> (-> t c) (Class t c %)))) (|>> :abstraction)) @@ -30,7 +30,7 @@ #label c}) (def: .public (quotient class value) - (All [t c %] + (All (_ t c %) (-> (Class t c %) t (Quotient t c %))) (:abstraction {#value value @@ -38,7 +38,7 @@ (template [<name> <output> <slot>] [(def: .public <name> - (All [t c %] (-> (Quotient t c %) <output>)) + (All (_ t c %) (-> (Quotient t c %) <output>)) (|>> :representation (value@ <slot>)))] [value t #value] @@ -58,7 +58,7 @@ (..Quotient (~ g!t) (~ g!c) (~ g!%)))))))) (implementation: .public (equivalence super) - (All [t c %] (-> (Equivalence c) (Equivalence (..Quotient t c %)))) + (All (_ t c %) (-> (Equivalence c) (Equivalence (..Quotient t c %)))) (def: (= reference sample) (\ super = (..label reference) (..label sample)))) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index 03d064acc..7cecd9111 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -22,8 +22,8 @@ (-> t (Maybe (Refined t %)))) (def: .public (refiner predicate) - (All [t] - (Ex [%] + (All (_ t) + (Ex (_ %) (-> (Predicate t) (Refiner t %)))) (function (_ value) (if (predicate value) @@ -33,7 +33,7 @@ (template [<name> <output> <slot>] [(def: .public <name> - (All [t %] (-> (Refined t %) <output>)) + (All (_ t %) (-> (Refined t %) <output>)) (|>> :representation (value@ <slot>)))] [value t #value] @@ -41,7 +41,7 @@ ) (def: .public (lifted transform) - (All [t %] + (All (_ t %) (-> (-> t t) (-> (Refined t %) (Maybe (Refined t %))))) (function (_ refined) @@ -54,7 +54,7 @@ ) (def: .public (only refiner values) - (All [t %] + (All (_ t %) (-> (Refiner t %) (List t) (List (Refined t %)))) (case values #.End @@ -69,7 +69,7 @@ (only refiner tail)))) (def: .public (partition refiner values) - (All [t %] + (All (_ t %) (-> (Refiner t %) (List t) [(List (Refined t %)) (List t)])) (case values #.End diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index b07f56303..f9ca4ea6e 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -29,19 +29,19 @@ (-> input (monad [output value]))) (type: .public (Linear monad value) - (All [keys] + (All (_ keys) (Procedure monad keys keys value))) (type: .public (Affine monad permissions value) - (All [keys] + (All (_ keys) (Procedure monad keys [permissions keys] value))) (type: .public (Relevant monad permissions value) - (All [keys] + (All (_ keys) (Procedure monad [permissions keys] keys value))) (implementation: .public (monad monad) - (All [!] (-> (Monad !) (IxMonad (Procedure !)))) + (All (_ !) (-> (Monad !) (IxMonad (Procedure !)))) (def: (in value) (function (_ keys) @@ -54,13 +54,13 @@ ((f value) keysT))))) (def: .public (run! monad procedure) - (All [! v] (-> (Monad !) (Linear ! v) (! v))) + (All (_ ! v) (-> (Monad !) (Linear ! v) (! v))) (do monad [[_ output] (procedure [])] (in output))) (def: .public (lifted monad procedure) - (All [! v] (-> (Monad !) (! v) (Linear ! v))) + (All (_ ! v) (-> (Monad !) (! v) (Linear ! v))) (function (_ keys) (do monad [output procedure] @@ -76,7 +76,7 @@ (template [<name> <mode>] [(def: <name> - (Ex [k] (-> Any (Key <mode> k))) + (Ex (_ k) (-> Any (Key <mode> k))) (|>> :abstraction))] [ordered_key Ordered] @@ -90,7 +90,7 @@ (template [<name> <mode> <key>] [(def: .public (<name> monad value) - (All [! v] (Ex [k] (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v))))) + (All (_ ! v) (Ex (_ k) (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v))))) (function (_ keys) (\ monad in [[(<key> []) keys] (:abstraction value)])))] @@ -99,7 +99,7 @@ ) (def: .public (read monad resource) - (All [! v k m] + (All (_ ! v k m) (-> (Monad !) (Res k v) (Relevant ! (Key m k) v))) (function (_ [key keys]) (\ monad in [keys (:representation resource)]))) @@ -126,7 +126,7 @@ (in (list& head tail)))))))) (def: (no_op monad) - (All [m] (-> (Monad m) (Linear m Any))) + (All (_ m) (-> (Monad m) (Linear m Any))) (function (_ context) (\ monad in [context []]))) @@ -151,7 +151,7 @@ row.list) g!inputsT+ (list\each (|>> (~) (..Key ..Commutative) (`)) g!inputs) g!outputsT+ (list\each (|>> (~) (..Key ..Commutative) (`)) g!outputs)]] - (in (list (` (: (All [(~ g!!) (~+ g!inputs) (~ g!context)] + (in (list (` (: (All ((~ g!_) (~ g!!) (~+ g!inputs) (~ g!context)) (-> ((~! monad.Monad) (~ g!!)) (Procedure (~ g!!) [(~+ g!inputsT+) (~ g!context)] @@ -175,7 +175,7 @@ [g!keys (|> (macro.identifier "keys") (list.repeated amount) (monad.all !))] - (in (list (` (: (All [(~ g!!) (~+ g!keys) (~ g!context)] + (in (list (` (: (All ((~ g!_) (~ g!!) (~+ g!keys) (~ g!context)) (-> ((~! monad.Monad) (~ g!!)) (Procedure (~ g!!) [<from> (~ g!context)] diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux index 5c42da5ed..adc5b8dc3 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/type/unit.lux @@ -33,16 +33,16 @@ Int (def: in - (All [unit] (-> Int (Qty unit))) + (All (_ unit) (-> Int (Qty unit))) (|>> :abstraction)) (def: out - (All [unit] (-> (Qty unit) Int)) + (All (_ unit) (-> (Qty unit) Int)) (|>> :representation)) (template [<name> <op>] [(def: .public (<name> param subject) - (All [unit] (-> (Qty unit) (Qty unit) (Qty unit))) + (All (_ unit) (-> (Qty unit) (Qty unit) (Qty unit))) (:abstraction (<op> (:representation param) (:representation subject))))] @@ -52,7 +52,7 @@ (template [<name> <op> <p> <s> <p*s>] [(def: .public (<name> param subject) - (All [p s] (-> (Qty <p>) (Qty <s>) (Qty <p*s>))) + (All (_ p s) (-> (Qty <p>) (Qty <s>) (Qty <p*s>))) (:abstraction (<op> (:representation param) (:representation subject))))] @@ -70,9 +70,9 @@ (type: .public (Scale s) (Interface - (: (All [u] (-> (Qty u) (Qty (s u)))) + (: (All (_ u) (-> (Qty u) (Qty (s u)))) scale) - (: (All [u] (-> (Qty (s u)) (Qty u))) + (: (All (_ u) (-> (Qty (s u)) (Qty u))) de_scale) (: Ratio ratio))) @@ -152,7 +152,7 @@ )))) (def: .public (re_scaled from to quantity) - (All [si so u] (-> (Scale si) (Scale so) (Qty (si u)) (Qty (so u)))) + (All (_ si so u) (-> (Scale si) (Scale so) (Qty (si u)) (Qty (so u)))) (let [[numerator denominator] (ratio./ (\ from ratio) (\ to ratio))] (|> quantity @@ -189,13 +189,13 @@ ) (implementation: .public equivalence - (All [unit] (Equivalence (Qty unit))) + (All (_ unit) (Equivalence (Qty unit))) (def: (= reference sample) (i.= (..out reference) (..out sample)))) (implementation: .public order - (All [unit] (Order (Qty unit))) + (All (_ unit) (Order (Qty unit))) (def: &equivalence ..equivalence) @@ -203,7 +203,7 @@ (i.< (..out reference) (..out sample)))) (implementation: .public enum - (All [unit] (Enum (Qty unit))) + (All (_ unit) (Enum (Qty unit))) (def: &order ..order) (def: succ (|>> ..out ++ ..in)) diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index d113e1fab..b3b9813ed 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -100,7 +100,7 @@ (as_is))) (def: .public (write_line message console) - (All [!] (-> Text (Console !) (! (Try Any)))) + (All (_ !) (-> Text (Console !) (! (Try Any)))) (\ console write (format message text.new_line))) (type: .public (Mock s) @@ -115,7 +115,7 @@ on_close))) (def: .public (mock mock init) - (All [s] (-> (Mock s) s (Console IO))) + (All (_ s) (-> (Mock s) s (Console IO))) (let [state (atom.atom init)] (`` (implementation (~~ (template [<method> <mock>] diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux index dd11cd4f3..47701f3b0 100644 --- a/stdlib/source/library/lux/world/db/jdbc.lux +++ b/stdlib/source/library/lux/world/db/jdbc.lux @@ -91,7 +91,7 @@ close))) (def: (with_statement statement conn action) - (All [i a] + (All (_ i a) (-> (Statement i) java/sql/Connection (-> java/sql/PreparedStatement (IO (Try a))) (IO (Try a)))) @@ -158,7 +158,7 @@ ))))) (def: .public (with_db creds action) - (All [a] + (All (_ a) (-> Credentials (-> (DB IO) (IO (Try a))) (IO (Try a)))) @@ -169,7 +169,7 @@ (in result))) (def: .public (with_async_db creds action) - (All [a] + (All (_ a) (-> Credentials (-> (DB Async) (Async (Try a))) (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 e9035aded..f108a2fbf 100644 --- a/stdlib/source/library/lux/world/db/jdbc/input.lux +++ b/stdlib/source/library/lux/world/db/jdbc/input.lux @@ -55,14 +55,14 @@ (fb (f value) circumstance)))) (def: .public (and pre post) - (All [l r] (-> (Input l) (Input r) (Input [l r]))) + (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: .public (fail error) - (All [a] (-> Text (Input a))) + (All (_ a) (-> Text (Input a))) (function (_ value [idx context]) (#try.Failure error))) diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux index 933830e1e..59e30845c 100644 --- a/stdlib/source/library/lux/world/db/jdbc/output.lux +++ b/stdlib/source/library/lux/world/db/jdbc/output.lux @@ -100,12 +100,12 @@ (ma [idx' rs]))))) (def: .public (fail error) - (All [a] (-> Text (Output a))) + (All (_ a) (-> Text (Output a))) (function (_ [idx result_set]) (#try.Failure error))) (def: .public (and left right) - (All [a b] + (All (_ a b) (-> (Output a) (Output b) (Output [a b]))) (do ..monad [=left left @@ -155,7 +155,7 @@ ) (def: .public (rows output results) - (All [a] (-> (Output a) java/sql/ResultSet (IO (Try (List a))))) + (All (_ a) (-> (Output a) java/sql/ResultSet (IO (Try (List a))))) (case (java/sql/ResultSet::next results) (#try.Success has_next?) (if has_next? diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index 6b01531bc..aff994825 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -10,6 +10,8 @@ ["%" format (#+ format)]] [collection ["." list ("#\." functor)]]] + [macro + ["." template]] [type abstract]]]) @@ -258,13 +260,13 @@ ) (template [<name> <sql> <variables> <input> <output>] - [(def: .public (<name> value query) - (All <variables> - (-> Nat <input> <output>)) - (:abstraction - (format (:representation query) - " " <sql> " " - (%.nat value))))] + [(`` (def: .public (<name> value query) + (All (_ (~~ (template.spliced <variables>))) + (-> Nat <input> <output>)) + (:abstraction + (format (:representation query) + " " <sql> " " + (%.nat value)))))] [limit "LIMIT" [where having order group offset] (Query where having order group No_Limit offset) @@ -285,7 +287,7 @@ ) (def: .public (order_by pairs query) - (All [where having group limit offset] + (All (_ where having group limit offset) (-> (List [Value Order]) (Query where having No_Order group limit offset) (Query where having With_Order group limit offset))) @@ -303,7 +305,7 @@ (text.interposed ", ")))))) (def: .public (group_by pairs query) - (All [where having order limit offset] + (All (_ where having order limit offset) (-> (List Value) (Query where having order No_Group limit offset) (Query where having order With_Group limit offset))) @@ -348,7 +350,7 @@ ... Action (def: .public (where condition prev) - (All [kind having] + (All (_ kind having) (-> Condition (Action No_Where having kind) (Action With_Where having kind))) (:abstraction (format (:representation prev) @@ -356,7 +358,7 @@ (:representation condition)))) (def: .public (having condition prev) - (All [where kind] + (All (_ where kind) (-> Condition (Action where No_Having kind) (Action where With_Having kind))) (:abstraction (format (:representation prev) @@ -467,7 +469,7 @@ " ON " (:representation table) " " (..parenthesize (..listing columns))))) (def: .public (with alias query body) - (All [where having order group limit offset] + (All (_ where having order group limit offset) (-> Table Any_Query (Query where having order group limit offset) (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 3fd525b37..f80d00462 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -78,7 +78,7 @@ )) (def: (un_rooted fs path) - (All [!] (-> (System !) Path (Maybe [Path Text]))) + (All (_ !) (-> (System !) Path (Maybe [Path Text]))) (let [/ (\ fs separator)] (case (text.last_index / path) #.None @@ -91,13 +91,13 @@ (in [parent child]))))) (def: .public (parent fs path) - (All [!] (-> (System !) Path (Maybe Path))) + (All (_ !) (-> (System !) Path (Maybe Path))) (|> path (..un_rooted fs) (maybe\each product.left))) (def: .public (name fs path) - (All [!] (-> (System !) Path Text)) + (All (_ !) (-> (System !) Path Text)) (|> path (..un_rooted fs) (maybe\each product.right) @@ -138,7 +138,7 @@ ))) (def: .public (rooted fs parent child) - (All [!] (-> (System !) Path Text Path)) + (All (_ !) (-> (System !) Path Text Path)) (format parent (\ fs separator) child)) (template [<name>] @@ -357,7 +357,7 @@ (#try.Failure (Error::toString [] (:as Error error)))))) (def: (value_callback write!) - (All [a] (-> (async.Resolver (Try a)) ffi.Function)) + (All (_ a) (-> (async.Resolver (Try a)) ffi.Function)) (<| (ffi.closure [error datum]) io.run! write! @@ -986,7 +986,7 @@ (as_is))) (def: .public (exists? monad fs path) - (All [!] (-> (Monad !) (System !) Path (! Bit))) + (All (_ !) (-> (Monad !) (System !) Path (! Bit))) (do monad [verdict (\ fs file? path)] (if verdict @@ -1106,7 +1106,7 @@ (exception.except ..cannot_delete [path])))) (def: (attempt! transform var) - (All [a] (-> (-> a (Try a)) (Var a) (STM (Try Any)))) + (All (_ a) (-> (-> a (Try a)) (Var a) (STM (Try Any)))) (do {! stm.monad} [|var| (stm.read var)] (case (transform |var|) @@ -1313,7 +1313,7 @@ )))) (def: (check_or_make_directory monad fs path) - (All [!] (-> (Monad !) (System !) Path (! (Try Any)))) + (All (_ !) (-> (Monad !) (System !) Path (! (Try Any)))) (do monad [? (\ fs directory? path)] (if ? @@ -1321,7 +1321,7 @@ (\ fs make_directory path)))) (def: .public (make_directories monad fs path) - (All [!] (-> (Monad !) (System !) Path (! (Try Any)))) + (All (_ !) (-> (Monad !) (System !) Path (! (Try Any)))) (let [rooted? (text.starts_with? (\ fs separator) path) segments (text.all_split_by (\ fs separator) path)] (case (if rooted? @@ -1353,7 +1353,7 @@ (in (#try.Failure error))))))))) (def: .public (make_file monad fs content path) - (All [!] (-> (Monad !) (System !) Binary Path (! (Try Any)))) + (All (_ !) (-> (Monad !) (System !) Binary Path (! (Try Any)))) (do monad [? (\ fs file? path)] (if ? diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index decd4d5a5..e5998a925 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -274,7 +274,7 @@ (get [int] a)]) (def: (default_list list) - (All [a] (-> (java/util/List a) (List a))) + (All (_ a) (-> (java/util/List a) (List a))) (let [size (.nat (java/util/List::size list))] (loop [idx 0 output #.End] @@ -304,7 +304,7 @@ (#static ENTRY_DELETE (java/nio/file/WatchEvent$Kind java/nio/file/Path))]) (def: (default_event_concern event) - (All [a] + (All (_ a) (-> (java/nio/file/WatchEvent a) Concern)) (let [kind (:as (java/nio/file/WatchEvent$Kind java/nio/file/Path) (java/nio/file/WatchEvent::kind event))] diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index f1c4120a1..72130914c 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -42,7 +42,7 @@ (template [<method>] [(with_expansions [<name> (method_function <method>)] (def: .public (<name> url headers data client) - (All [!] + (All (_ !) (-> URL //.Headers (Maybe Binary) (Client !) (! (Try (//.Response !))))) (\ client request <method> url headers data)))] diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index 26e25e7a7..1db8ac044 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -53,7 +53,7 @@ (def: failure (//response.bad_request "")) (def: .public (json reader server) - (All [a] (-> (<json>.Reader a) (-> a Server) Server)) + (All (_ a) (-> (<json>.Reader a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad [?raw (read_text_body (value@ #//.body message))] @@ -80,7 +80,7 @@ (async.resolved ..failure))))) (def: .public (query property server) - (All [a] (-> (Property a) (-> a Server) Server)) + (All (_ a) (-> (Property a) (-> a Server) Server)) (function (_ [identification protocol resource message]) (let [full (value@ #//.uri resource) [uri query] (|> full @@ -98,7 +98,7 @@ (async.resolved ..failure))))) (def: .public (form property server) - (All [a] (-> (Property a) (-> a Server) Server)) + (All (_ a) (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad [?body (read_text_body (value@ #//.body message))] @@ -113,7 +113,7 @@ (async.resolved ..failure))))) (def: .public (cookies property server) - (All [a] (-> (Property a) (-> a Server) Server)) + (All (_ a) (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (case (do try.monad [cookies (|> (value@ #//.headers message) diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 6fd8c63bc..98a642fcf 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -53,7 +53,7 @@ exit))) (def: .public (environment monad program) - (All [!] (-> (Monad !) (Program !) (! Environment))) + (All (_ !) (-> (Monad !) (Program !) (! Environment))) (do {! monad} [variables (\ program available_variables []) entries (monad.each ! (function (_ name) @@ -135,7 +135,7 @@ (#static exit [int] #io void)]) (def: (jvm\\consume iterator) - (All [a] (-> (java/util/Iterator a) (List a))) + (All (_ a) (-> (java/util/Iterator a) (List a))) (if (java/util/Iterator::hasNext iterator) (#.Item (java/util/Iterator::next iterator) (jvm\\consume iterator)) @@ -316,23 +316,23 @@ (case (ffi.constant Object [process env]) (#.Some process/env) (|> (Object::entries [process/env]) - array.list + (array.list #.None) (list\each (|>> (array.read! 0) maybe.trusted))) #.None (list)) (list))) - @.python (\ io.monad each array.list (os/environ::keys [])) + @.python (\ io.monad each (array.list #.None) (os/environ::keys [])) ... Lua offers no way to get all the environment variables available. @.lua (io.io (list)) @.ruby (|> (RubyEnv::keys []) - array.list + (array.list #.None) io.io) ... @.php (do io.monad ... [environment (..getenv/0 [])] ... (in (|> environment ... ..array_keys - ... array.list + ... (array.list #.None) ... (list\each (function (_ variable) ... [variable ("php array read" (:as Nat variable) environment)])) ... (dictionary.of_list text.hash)))) diff --git a/stdlib/source/library/lux/world/service/journal.lux b/stdlib/source/library/lux/world/service/journal.lux index afab93a3e..648e084d6 100644 --- a/stdlib/source/library/lux/world/service/journal.lux +++ b/stdlib/source/library/lux/world/service/journal.lux @@ -31,7 +31,7 @@ (def: top end))) (implementation: .public (equivalence (^open "_\.")) - (All [a] (-> (Equivalence a) (Equivalence (Entry a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (Entry a)))) (def: (= reference sample) (and (_\= (value@ #what reference) (value@ #what sample)) (text\= (value@ #why reference) (value@ #why sample)) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index d473f7cdb..e04977d5e 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -100,7 +100,7 @@ command) (: (-> Argument (Safe Argument ?)) argument) - (: (All [a] (-> (Safe a ?) a)) + (: (All (_ a) (-> (Safe a ?) a)) value))) (type: (Sanitizer a) @@ -137,7 +137,7 @@ (..replaced "{" replacer) (..replaced "}" replacer))))) (def: (policy safe_command safe_argument) - (Ex [?] (-> (Sanitizer Command) (Sanitizer Argument) (Policy ?))) + (Ex (_ ?) (-> (Sanitizer Command) (Sanitizer Argument) (Policy ?))) (?.with_policy (: (Context Safety Policy) (function (_ (^open "?\.")) @@ -324,7 +324,7 @@ on_await))) (`` (implementation: (mock_process state mock) - (All [s] (-> (Atom s) (Mock s) (Process IO))) + (All (_ s) (-> (Atom s) (Mock s) (Process IO))) (~~ (template [<name> <mock>] [(def: (<name> _) @@ -367,7 +367,7 @@ (in (#try.Failure error))))))) (implementation: .public (mock mock init) - (All [s] + (All (_ s) (-> (-> [Environment Path Command (List Argument)] (Try (Mock s))) s diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux index a75f56f2d..fddbc16ff 100644 --- a/stdlib/source/poly/lux/abstract/equivalence.lux +++ b/stdlib/source/poly/lux/abstract/equivalence.lux @@ -155,7 +155,7 @@ ... Polymorphism (do ! [[funcC varsC bodyC] (<type>.polymorphic equivalence)] - (in (` (: (All [(~+ varsC)] + (in (` (: (All ((~ g!_) (~+ varsC)) (-> (~+ (list\each (|>> (~) ((~! /.Equivalence)) (`)) varsC)) ((~! /.Equivalence) ((~ (poly.code *env* inputT)) (~+ varsC))))) (function ((~ funcC) (~+ varsC)) diff --git a/stdlib/source/poly/lux/abstract/functor.lux b/stdlib/source/poly/lux/abstract/functor.lux index e607f1174..44a3bdaef 100644 --- a/stdlib/source/poly/lux/abstract/functor.lux +++ b/stdlib/source/poly/lux/abstract/functor.lux @@ -26,7 +26,8 @@ (poly: .public functor (do {! p.monad} - [.let [type_funcC (code.local_identifier "____________type_funcC") + [.let [g!_ (code.local_identifier "____________") + type_funcC (code.local_identifier "____________type_funcC") funcC (code.local_identifier "____________funcC") inputC (code.local_identifier "____________inputC")] *env* <type>.env @@ -39,7 +40,7 @@ (if (n.= 1 num_vars) (` ((~! /.Functor) (~ (poly.code *env* unwrappedT)))) (let [paramsC (|> num_vars -- list.indices (list\each (|>> %.nat code.local_identifier)))] - (` (All [(~+ paramsC)] + (` (All ((~ g!_) (~+ paramsC)) ((~! /.Functor) ((~ (poly.code *env* unwrappedT)) (~+ paramsC))))))))) Arg<?> (: (-> Code (<type>.Parser Code)) (function (Arg<?> valueC) diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index d538a7e92..512ca920c 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -45,9 +45,9 @@ (|>> .int int.frac)) (def: (rec_encoded non_rec) - (All [a] (-> (-> (-> a JSON) - (-> a JSON)) - (-> a JSON))) + (All (_ a) (-> (-> (-> a JSON) + (-> a JSON)) + (-> a JSON))) (function (_ input) (non_rec (rec_encoded non_rec) input))) @@ -80,14 +80,14 @@ (def: (nullable writer) {#.doc "Builds a JSON generator for potentially inexistent values."} - (All [a] (-> (-> a JSON) (-> (Maybe a) JSON))) + (All (_ a) (-> (-> a JSON) (-> (Maybe a) JSON))) (function (_ elem) (case elem #.None #/.Null (#.Some value) (writer value)))) (implementation: qty_codec - (All [unit] + (All (_ unit) (codec.Codec JSON (unit.Qty unit))) (def: encoded @@ -125,7 +125,8 @@ [month.Month month.codec])] (do {! <>.monad} [*env* <type>.env - .let [@JSON\encoded (: (-> Type Code) + .let [g!_ (code.local_identifier "_______") + @JSON\encoded (: (-> Type Code) (function (_ type) (` (-> (~ (poly.code *env* type)) /.JSON))))] inputT <type>.next] @@ -208,7 +209,7 @@ ... Polymorphism (do ! [[funcC varsC bodyC] (<type>.polymorphic encoded)] - (in (` (: (All [(~+ varsC)] + (in (` (: (All ((~ g!_) (~+ varsC)) (-> (~+ (list\each (function (_ varC) (` (-> (~ varC) /.JSON))) varsC)) (-> ((~ (poly.code *env* inputT)) (~+ varsC)) @@ -248,7 +249,8 @@ [month.Month month.codec])] (do {! <>.monad} [*env* <type>.env - .let [@JSON\decoded (: (-> Type Code) + .let [g!_ (code.local_identifier "_______") + @JSON\decoded (: (-> Type Code) (function (_ type) (` (</>.Parser (~ (poly.code *env* type))))))] inputT <type>.next] @@ -312,7 +314,7 @@ ... Polymorphism (do ! [[funcC varsC bodyC] (<type>.polymorphic decoded)] - (in (` (: (All [(~+ varsC)] + (in (` (: (All ((~ g!_) (~+ varsC)) (-> (~+ (list\each (|>> (~) </>.Parser (`)) varsC)) (</>.Parser ((~ (poly.code *env* inputT)) (~+ varsC))))) (function ((~ funcC) (~+ varsC)) diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index 2e557839b..123433b8c 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -71,7 +71,7 @@ (list\each (|>> (/repository/remote.repository http.default #.None) /repository.async)))) (def: (with_dependencies program console command profile) - (All [a] + (All (_ a) (-> (Program Async) (Console Async) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) (Command a))) @@ -112,7 +112,7 @@ (\ program.default exit shell.error))) (def: (command action) - (All [a] (-> (Async (Try a)) (IO Any))) + (All (_ a) (-> (Async (Try a)) (IO Any))) (exec (do async.monad [outcome action] (async.future diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index 77a0c8714..a4f6e0fca 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -44,7 +44,7 @@ (async.after delay (#try.Success []))) (def: .public (do! delay watcher command) - (All [a] + (All (_ a) (-> Nat (Watcher Async) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])))) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index ff4ace158..421fd7086 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -110,7 +110,7 @@ (exception.except ..no_available_compiler [])))) (def: (path fs home dependency) - (All [!] (-> (file.System !) Path Dependency Path)) + (All (_ !) (-> (file.System !) Path Dependency Path)) (let [/ (\ fs separator) artifact (value@ #///dependency.artifact dependency)] (|> artifact @@ -120,7 +120,7 @@ (text.suffix (format "." (value@ #///dependency.type dependency)))))) (def: (libraries fs home) - (All [!] (-> (file.System !) Path Resolution (List Path))) + (All (_ !) (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys (list.only (|>> (value@ #///dependency.type) (text\= ///artifact/type.lux_library))) @@ -155,7 +155,7 @@ false)))) (def: .public (host_dependencies fs home) - (All [!] (-> (file.System !) Path Resolution (List Path))) + (All (_ !) (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys (list.only (|>> (value@ #///dependency.type) (text\= ///artifact/type.lux_library) diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index 22788dc3d..92f0b55bf 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -44,7 +44,7 @@ (-> (Repository Async) ///artifact.Version Dependency [Binary Status] (Async (Try Any))) (let [artifact (format (///artifact.uri version_template artifact) (///artifact/extension.extension type)) - deploy_hash (: (All [h] (-> (Codec Text (Hash h)) Extension (Hash h) (Async (Try Any)))) + deploy_hash (: (All (_ h) (-> (Codec Text (Hash h)) Extension (Hash h) (Async (Try Any)))) (function (_ codec extension hash) (|> hash (\ codec encoded) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 8de6d2423..a90712796 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -74,7 +74,7 @@ (trim [] java/lang/String)]) (def: (verified_hash library repository version_template artifact extension hash codec exception) - (All [h] + (All (_ h) (-> Binary (Repository Async) Version Artifact Extension (-> Binary (Hash h)) (Codec Text (Hash h)) (Exception [Artifact Extension Text]) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index d36d597b3..1933d2be0 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -68,7 +68,7 @@ (dictionary.empty text.hash)) (def: (on_maybe field value format aggregate) - (All [a] + (All (_ a) (-> Text (Maybe a) (Format a) Aggregate Aggregate)) (case value #.None @@ -78,7 +78,7 @@ (dictionary.has field (format value) aggregate))) (def: (on_list field value format aggregate) - (All [a] + (All (_ a) (-> Text (List a) (Format a) Aggregate Aggregate)) (case value #.End @@ -88,12 +88,12 @@ (dictionary.has field (` [(~+ (list\each format value))]) aggregate))) (def: (on_set field value format aggregate) - (All [a] + (All (_ a) (-> Text (Set a) (Format a) Aggregate Aggregate)) (..on_list field (set.list value) format aggregate)) (def: (on_dictionary field value key_format value_format aggregate) - (All [k v] + (All (_ k v) (-> Text (Dictionary k v) (Format k) (Format v) Aggregate Aggregate)) (if (dictionary.empty? value) aggregate diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 74e78ca55..403fdb677 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -40,7 +40,7 @@ Binary (def: .public data - (All [h] (-> (Hash h) Binary)) + (All (_ h) (-> (Hash h) Binary)) (|>> :representation)) (template [<name> <kind> <algorithm>] @@ -116,7 +116,7 @@ (n.* ..hex_per_byte)) (def: (decoded size constructor encoded) - (All [h] + (All (_ h) (-> Nat (-> Binary (Try (Hash h))) (-> Text (Try (Hash h))))) (let [hash_size (..hash_size encoded)] @@ -159,7 +159,7 @@ ) (implementation: .public equivalence - (All [h] (Equivalence (Hash h))) + (All (_ h) (Equivalence (Hash h))) (def: (= reference subject) (\ binary.equivalence = diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index 43edc3404..08f309968 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -50,7 +50,7 @@ [(list) (<code>.result //parser.project)]))) (def: .public (read monad fs profiles) - (All [!] (-> (Monad !) (file.System !) (List Name) (! (Try Profile)))) + (All (_ !) (-> (Monad !) (file.System !) (List Name) (! (Try Profile)))) (|> //project.file (\ fs read) (\ monad each diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 8ece73b51..21c8ac270 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -38,12 +38,12 @@ (list))) (def: (singular input tag parser) - (All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser a))) + (All (_ a) (-> (Dictionary Text Code) Text (Parser a) (Parser a))) (<code>.local (..as_input (dictionary.value tag input)) parser)) (def: (plural input tag parser) - (All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser (List a)))) + (All (_ a) (-> (Dictionary Text Code) Text (Parser a) (Parser (List a)))) (<code>.local (..as_input (dictionary.value tag input)) (<code>.tuple (<>.some parser)))) diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index d1aa5a1b9..38fb27ead 100644 --- a/stdlib/source/program/aedifex/repository.lux +++ b/stdlib/source/program/aedifex/repository.lux @@ -46,7 +46,7 @@ on_upload))) (def: .public (mock mock init) - (All [s] (-> (Mock s) s (Repository Async))) + (All (_ s) (-> (Mock s) s (Repository Async))) (let [state (stm.var init)] (implementation (def: description diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index d6cea3f06..af9613db7 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -55,7 +55,7 @@ (list ["User-Agent" ..user_agent])) (implementation: .public (repository http identity address) - (All [s] (-> (http.Client IO) (Maybe Identity) Address (//.Repository IO))) + (All (_ s) (-> (http.Client IO) (Maybe Identity) Address (//.Repository IO))) (def: description address) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 637ed76e1..bca81bd88 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -58,7 +58,7 @@ ["#." import]]) (def: (or_crash! failure_description action) - (All [a] + (All (_ a) (-> Text (Async (Try a)) (Async a))) (do async.monad [?output action] @@ -73,7 +73,7 @@ (in output)))) (def: (timed process) - (All [a] + (All (_ a) (-> (Async (Try a)) (Async (Try a)))) (do async.monad [.let [start (io.run! instant.now)] @@ -115,7 +115,7 @@ expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender service packager,package) - (All [<parameters>] + (All (_ <parameters>) (-> Static Expander analysis.Bundle diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux index d05867201..230b0325e 100644 --- a/stdlib/source/program/compositor/import.lux +++ b/stdlib/source/program/compositor/import.lux @@ -30,7 +30,7 @@ [cli (#+ Library)]]) (def: Action - (type (All [a] (Async (Try a))))) + (type (All (_ a) (Async (Try a))))) (exception: .public useless_tar_entry) diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index 6841682df..438b071ec 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -36,59 +36,59 @@ ... and their documentation is generated. [test/lux (#+)]) -(def: name_options "abcdefghijklmnopqrstuvwxyz") -(def: name_options_count (text.size name_options)) - -(def: (parameter_type_name id) - (-> Nat Text) - (case (text.char id ..name_options) - (#.Some char) - (text.of_char char) - - #.None - (format (parameter_type_name (n./ name_options_count id)) - (parameter_type_name (n.% name_options_count id))))) - -(def: type_var_names - (Sequence Text) - (|> 0 (sequence.iterations ++) (sequence\each parameter_type_name))) - -(template [<name> <partition>] - [(def: (<name> id) - (-> Nat Bit) - (<partition> id))] - - [type_func? n.even?] - [type_arg? n.odd?] - ) - -(def: (arg_id level id) - (-> Nat Nat Nat) - (n.- (n./ 2 id) level)) - -(def: (parameter_name [type_func_name type_function_arguments] level id) - (-> [Text (List Text)] Nat Nat Text) - (if (type_arg? id) - (let [arg_id (..arg_id level id)] - (case (list.item arg_id type_function_arguments) - (#.Some found) - found - - _ - (|> type_var_names - (sequence.only (function (_ var_name) - (not (list.member? text.equivalence type_function_arguments var_name)))) - (sequence.item arg_id)))) - type_func_name)) - -(def: (level_parameters offset level) - (-> Nat Nat (List Text)) - (if (n.= 0 level) - (list) - (|> level - -- - (enum.range n.enum 0) - (list\each (|>> (n.+ (++ offset)) parameter_type_name))))) +... (def: parameter_name_options "abcdefghijklmnopqrstuvwxyz") +... (def: parameter_name_options_count (text.size parameter_name_options)) + +... (def: (parameter_type_name id) +... (-> Nat Text) +... (case (text.char id ..parameter_name_options) +... (#.Some char) +... (text.of_char char) + +... #.None +... (format (parameter_type_name (n./ parameter_name_options_count id)) +... (parameter_type_name (n.% parameter_name_options_count id))))) + +... (def: type_variable_names +... (Sequence Text) +... (|> 0 (sequence.iterations ++) (sequence\each parameter_type_name))) + +... (template [<name> <partition>] +... [(def: (<name> id) +... (-> Nat Bit) +... (<partition> id))] + +... [type_function? n.even?] +... [type_parameter? n.odd?] +... ) + +... (def: (parameter_id level id) +... (-> Nat Nat Nat) +... (n.- (n./ 2 id) level)) + +... (def: (parameter_name [type_function_name type_function_arguments] level id) +... (-> [Text (List Text)] Nat Nat Text) +... (if (type_parameter? id) +... (let [parameter_id (..parameter_id level id)] +... (case (list.item parameter_id type_function_arguments) +... (#.Some found) +... found + +... _ +... (|> type_variable_names +... (sequence.only (function (_ var_name) +... (not (list.member? text.equivalence type_function_arguments var_name)))) +... (sequence.item parameter_id)))) +... type_function_name)) + +... (def: (level_parameters offset level) +... (-> Nat Nat (List Text)) +... (if (n.= 0 level) +... (list) +... (|> level +... -- +... (enum.range n.enum 0) +... (list\each (|>> (n.+ (++ offset)) parameter_type_name))))) (def: (prefix_lines prefix lines) (-> Text Text Text) @@ -97,13 +97,13 @@ (list\each (|>> (format prefix))) (text.interposed text.new_line))) -(def: (pprint_type_definition level type_func_info tags module interface? recursive_type? type) +(def: (pprint_type_definition level type_function_info tags module interface? recursive_type? type) (-> Nat [Text (List Text)] (List Name) Text Bit Bit Type Text) (case tags (^ (list [_ single_tag])) (if interface? - (format "(: " (pprint_type_definition level type_func_info #.None module interface? recursive_type? type) text.new_line " " single_tag ")") - (format "{#" single_tag " " (pprint_type_definition level type_func_info #.None module interface? recursive_type? type) "}")) + (format "(: " (pprint_type_definition level type_function_info #.None module interface? recursive_type? type) text.new_line " " single_tag ")") + (format "{#" single_tag " " (pprint_type_definition level type_function_info #.None module interface? recursive_type? type) "}")) _ (case [recursive_type? type] @@ -113,7 +113,7 @@ (format "(primitive " (%.text name) ")") _ - (format "(primitive " (%.text name) " " (|> params (list\each (pprint_type_definition level type_func_info #.None module interface? recursive_type?)) (text.interposed " ")) ")")) + (format "(primitive " (%.text name) " " (|> params (list\each (pprint_type_definition level type_function_info #.None module interface? recursive_type?)) (text.interposed " ")) ")")) [_ (#.Sum _)] (let [members (type.flat_variant type)] @@ -121,7 +121,7 @@ #.End (format "(Or " (|> members - (list\each (pprint_type_definition level type_func_info #.None module interface? recursive_type?)) + (list\each (pprint_type_definition level type_function_info #.None module interface? recursive_type?)) (text.interposed " ")) ")") @@ -134,27 +134,27 @@ (let [types (type.flat_tuple type)] (format "(#" t_name " " (|> types - (list\each (pprint_type_definition level type_func_info #.None module interface? recursive_type?)) + (list\each (pprint_type_definition level type_function_info #.None module interface? recursive_type?)) (text.interposed " ")) ")")) _ - (format "(#" t_name " " (pprint_type_definition level type_func_info #.None module interface? recursive_type? type) ")")))) + (format "(#" t_name " " (pprint_type_definition level type_function_info #.None module interface? recursive_type? type) ")")))) (text.interposed text.new_line)))) [_ (#.Product _)] (let [members (type.flat_tuple type)] (case tags #.End - (format "[" (|> members (list\each (pprint_type_definition level type_func_info #.None module interface? recursive_type?)) (text.interposed " ")) "]") + (format "[" (|> members (list\each (pprint_type_definition level type_function_info #.None module interface? recursive_type?)) (text.interposed " ")) "]") _ (let [member_docs (|> members (list.zipped/2 tags) (list\each (function (_ [[_ t_name] type]) (if interface? - (format "(: " (pprint_type_definition level type_func_info #.None module interface? recursive_type? type) text.new_line " " t_name ")") - (format "#" t_name " " (pprint_type_definition level type_func_info #.None module interface? recursive_type? type))))) + (format "(: " (pprint_type_definition level type_function_info #.None module interface? recursive_type? type) text.new_line " " t_name ")") + (format "#" t_name " " (pprint_type_definition level type_function_info #.None module interface? recursive_type? type))))) (text.interposed (format text.new_line " ")))] (if interface? member_docs @@ -162,13 +162,13 @@ [_ (#.Function input output)] (let [[ins out] (type.flat_function type)] - (format "(-> " (|> ins (list\each (pprint_type_definition level type_func_info #.None module interface? recursive_type?)) (text.interposed " ")) + (format "(-> " (|> ins (list\each (pprint_type_definition level type_function_info #.None module interface? recursive_type?)) (text.interposed " ")) " " - (pprint_type_definition level type_func_info #.None module interface? recursive_type? out) + (pprint_type_definition level type_function_info #.None module interface? recursive_type? out) ")")) [_ (#.Parameter idx)] - (parameter_name type_func_info level idx) + (parameter_name type_function_info level idx) (^template [<tag> <pre> <post>] [[_ (<tag> id)] @@ -180,7 +180,7 @@ [[_ (<tag> _)] (let [[level' body] (<flat> type) args (level_parameters level level') - body_doc (pprint_type_definition (n.+ level level') type_func_info tags module interface? recursive_type? body)] + body_doc (pprint_type_definition (n.+ level level') type_function_info tags module interface? recursive_type? body)] (format "(" <name> " " "[" (text.interposed " " args) "]" (case tags #.End @@ -193,11 +193,11 @@ [#.ExQ "Ex" type.flat_ex_q]) [true (#.Apply (#.Parameter 1) (#.Parameter 0))] - (product.left type_func_info) + (product.left type_function_info) [_ (#.Apply param fun)] (let [[type_func type_arguments] (type.flat_application type)] - (format "(" (pprint_type_definition level type_func_info tags module interface? recursive_type? type_func) " " (|> type_arguments (list\each (pprint_type_definition level type_func_info #.None module interface? recursive_type?)) (text.interposed " ")) ")")) + (format "(" (pprint_type_definition level type_function_info tags module interface? recursive_type? type_func) " " (|> type_arguments (list\each (pprint_type_definition level type_function_info #.None module interface? recursive_type?)) (text.interposed " ")) ")")) [_ (#.Named [_module _name] type)] (if (text\= module _module) @@ -205,124 +205,124 @@ (%.name [_module _name])) ))) -(def: (pprint_type level type_func_name module type) - (-> Nat Text Text Type Text) - (case type - (#.Primitive name params) - (case params - #.End - (format "(primitive " (%.text name) ")") - - _ - (format "(primitive " (%.text name) " " (|> params (list\each (pprint_type level type_func_name module)) (text.interposed " ")) ")")) - - (#.Sum _) - (let [members (type.flat_variant type)] - (format "(Or " (|> members (list\each (pprint_type level type_func_name module)) (text.interposed " ")) ")")) - - (#.Product _) - (let [members (type.flat_tuple type)] - (format "[" (|> members (list\each (pprint_type level type_func_name module)) (text.interposed " ")) "]")) - - (#.Function input output) - (let [[ins out] (type.flat_function type)] - (format "(-> " - (|> ins (list\each (pprint_type level type_func_name module)) (text.interposed " ")) - " " - (pprint_type level type_func_name module out) - ")")) - - (#.Parameter idx) - (parameter_name [type_func_name (list)] level idx) - - (^template [<tag> <pre> <post>] - [(<tag> id) - (format <pre> (%.nat id) <post>)]) - ([#.Var "⌈" "⌋"] - [#.Ex "⟨" "⟩"]) - - (^template [<tag> <name> <flat>] - [(<tag> _) - (let [[level' body] (<flat> type) - args (level_parameters level level') - body_doc (pprint_type (n.+ level level') type_func_name module body)] - (format "(" <name> " " "[" (|> args (text.interposed " ")) "]" - (format " " body_doc) - ")"))]) - ([#.UnivQ "All" type.flat_univ_q] - [#.ExQ "Ex" type.flat_ex_q]) - - (#.Apply param fun) - (let [[type_func type_arguments] (type.flat_application type)] - (format "(" (pprint_type level type_func_name module type_func) " " (|> type_arguments (list\each (pprint_type level type_func_name module)) (text.interposed " ")) ")")) - - (#.Named [_module _name] type) - (if (text\= module _module) - _name - (%.name [_module _name])) - )) - -(type: (Mutation a) - (-> a a)) - -(type: Value - [Text Code Type]) - -(type: Organization - {#types (List Value) - #macros (List [Text Code]) - #implementations (List Value) - #values (List Value)}) - -(def: (lux_module? module_name) - (-> Text Bit) - (let [prefix (format .prelude_module "/")] - (or (text\= .prelude_module module_name) - (text.starts_with? prefix module_name)))) - -(def: (add_definition [name [exported? def_type def_annotations def_value]] organization) - (-> [Text Definition] Organization Organization) - (cond (type\= .Type def_type) - (revised@ #types - (: (Mutation (List Value)) - (|>> (#.Item [name def_annotations (:as Type def_value)]))) - organization) - - (type\= .Macro def_type) - (revised@ #macros - (: (Mutation (List [Text Code])) - (|>> (#.Item [name def_annotations]))) - organization) - - (annotation.implementation? def_annotations) - (revised@ #implementations - (: (Mutation (List Value)) - (|>> (#.Item [name def_annotations def_type]))) - organization) - - ... else - (revised@ #values - (: (Mutation (List Value)) - (|>> (#.Item [name def_annotations def_type]))) - organization))) - -(def: name_sort - (All [r] (-> [Text r] [Text r] Bit)) - (let [text\< (\ text.order <)] - (function (_ [n1 _] [n2 _]) - (text\< n1 n2)))) - -(def: (organize_definitions defs) - (-> (List [Text Definition]) Organization) - (let [init {#types (list) - #macros (list) - #implementations (list) - #values (list)}] - (|> (list\mix add_definition init defs) - (revised@ #types (list.sorted name_sort)) - (revised@ #macros (list.sorted name_sort)) - (revised@ #implementations (list.sorted name_sort)) - (revised@ #values (list.sorted name_sort))))) +... (def: (pprint_type level type_function_name module type) +... (-> Nat Text Text Type Text) +... (case type +... (#.Primitive name params) +... (case params +... #.End +... (format "(primitive " (%.text name) ")") + +... _ +... (format "(primitive " (%.text name) " " (|> params (list\each (pprint_type level type_function_name module)) (text.interposed " ")) ")")) + +... (#.Sum _) +... (let [members (type.flat_variant type)] +... (format "(Or " (|> members (list\each (pprint_type level type_function_name module)) (text.interposed " ")) ")")) + +... (#.Product _) +... (let [members (type.flat_tuple type)] +... (format "[" (|> members (list\each (pprint_type level type_function_name module)) (text.interposed " ")) "]")) + +... (#.Function input output) +... (let [[ins out] (type.flat_function type)] +... (format "(-> " +... (|> ins (list\each (pprint_type level type_function_name module)) (text.interposed " ")) +... " " +... (pprint_type level type_function_name module out) +... ")")) + +... (#.Parameter idx) +... (parameter_name [type_function_name (list)] level idx) + +... (^template [<tag> <pre> <post>] +... [(<tag> id) +... (format <pre> (%.nat id) <post>)]) +... ([#.Var "⌈" "⌋"] +... [#.Ex "⟨" "⟩"]) + +... (^template [<tag> <name> <flat>] +... [(<tag> _) +... (let [[level' body] (<flat> type) +... args (level_parameters level level') +... body_doc (pprint_type (n.+ level level') type_function_name module body)] +... (format "(" <name> " " "[" (|> args (text.interposed " ")) "]" +... (format " " body_doc) +... ")"))]) +... ([#.UnivQ "All" type.flat_univ_q] +... [#.ExQ "Ex" type.flat_ex_q]) + +... (#.Apply param fun) +... (let [[type_func type_arguments] (type.flat_application type)] +... (format "(" (pprint_type level type_function_name module type_func) " " (|> type_arguments (list\each (pprint_type level type_function_name module)) (text.interposed " ")) ")")) + +... (#.Named [_module _name] type) +... (if (text\= module _module) +... _name +... (%.name [_module _name])) +... )) + +... (type: (Mutation a) +... (-> a a)) + +... (type: Value +... [Text Code Type]) + +... (type: Organization +... {#types (List Value) +... #macros (List [Text Code]) +... #implementations (List Value) +... #values (List Value)}) + +... (def: (lux_module? module_name) +... (-> Text Bit) +... (let [prefix (format .prelude_module "/")] +... (or (text\= .prelude_module module_name) +... (text.starts_with? prefix module_name)))) + +... (def: (add_definition [name [exported? def_type def_annotations def_value]] organization) +... (-> [Text Definition] Organization Organization) +... (cond (type\= .Type def_type) +... (revised@ #types +... (: (Mutation (List Value)) +... (|>> (#.Item [name def_annotations (:as Type def_value)]))) +... organization) + +... (type\= .Macro def_type) +... (revised@ #macros +... (: (Mutation (List [Text Code])) +... (|>> (#.Item [name def_annotations]))) +... organization) + +... (annotation.implementation? def_annotations) +... (revised@ #implementations +... (: (Mutation (List Value)) +... (|>> (#.Item [name def_annotations def_type]))) +... organization) + +... ... else +... (revised@ #values +... (: (Mutation (List Value)) +... (|>> (#.Item [name def_annotations def_type]))) +... organization))) + +... (def: name_sort +... (All (_ r) (-> [Text r] [Text r] Bit)) +... (let [text\< (\ text.order <)] +... (function (_ [n1 _] [n2 _]) +... (text\< n1 n2)))) + +... (def: (organize_definitions defs) +... (-> (List [Text Definition]) Organization) +... (let [init {#types (list) +... #macros (list) +... #implementations (list) +... #values (list)}] +... (|> (list\mix add_definition init defs) +... (revised@ #types (list.sorted name_sort)) +... (revised@ #macros (list.sorted name_sort)) +... (revised@ #implementations (list.sorted name_sort)) +... (revised@ #values (list.sorted name_sort))))) (def: (unravel_type_func level type) (-> Nat Type Type) @@ -403,119 +403,119 @@ (md.heading/2 "Types") type_docs)))) -(def: (document_macros module_name names) - (-> Text (List [Text Code]) (Markdown Block)) - (|> names - (list\each (: (-> [Text Code] (Markdown Block)) - (function (_ [name def_annotations]) - ($_ md.then - (md.heading/3 name) - (<| (: (Markdown Block)) - (maybe.else md.empty) - (do maybe.monad - [documentation (annotation.documentation def_annotations)] - (in (md.code documentation)))))))) - (list\mix (function.flipped md.then) - (md.heading/2 "Macros")))) - -(template [<singular> <plural> <header>] - [(def: (<singular> module type) - (-> Text Type (Markdown Block)) - (md.code (pprint_type (-- 0) "?" module type))) - - (def: (<plural> module values) - (-> Text (List Value) (Markdown Block)) - (|> values - (list\each (function (_ [name def_annotations value_type]) - (let [?doc (annotation.documentation def_annotations) - usage (case (annotation.function_arguments def_annotations) - #.End - name - - args - (format "(" (text.interposed " " (list& name args)) ")"))] - ($_ md.then - (md.heading/3 usage) - (case ?doc - (#.Some doc) - (md.code doc) - - _ - md.empty) - (<singular> module value_type))))) - (list\mix (function.flipped md.then) - (md.heading/2 <header>))))] - - [document_implementation document_implementations "Implementations"] - [document_value document_values "Values"] - ) - -(def: (enclose_lines pre+post block) - (-> [Text Text] Text Text) - (|> block - (text.all_split_by text.new_line) - (list\each (text.enclosed pre+post)) - (text.interposed text.new_line))) - -(def: (document_module [[module_name module] organization]) - (-> [[Text Module] Organization] (Meta [Text (Markdown Block)])) - (do meta.monad - [.let [(^slots [#types #macros #implementations #values]) organization - annotations (|> module - (value@ #.module_annotations) - (maybe.else (' {})) - annotation.documentation) - description (case annotations - (#.Some doc_text) - (md.quote (md.paragraph (md.text doc_text))) - - #.None - md.empty) - empty_block (: (Markdown Block) md.empty)] - types_documentation (if (list.empty? types) - (in empty_block) - (document_types module_name types)) - .let [documentation ($_ md.then - types_documentation - (if (list.empty? macros) empty_block (document_macros module_name macros)) - (if (list.empty? implementations) empty_block (document_implementations module_name implementations)) - (if (list.empty? values) empty_block (document_values module_name values)))]] - (in [module_name - ($_ md.then - (md.heading/1 module_name) - description - documentation)]))) - -(exception: .public (io_error {error Text}) - error) - -(def: (save_documentation! [module_name documentation]) - (-> [Text (Markdown Block)] (IO Any)) - (let [path (format (text.replaced "/" "_" module_name) ".md")] - (do io.monad - [outcome (\ file.default write (\ utf8.codec encoded (md.markdown documentation)) path)] - (in (case outcome - (#try.Failure error) - (debug.log! (exception.error io_error error)) - - (#try.Success _) - []))))) - -(macro: (gen_documentation! _) - (do {! meta.monad} - [all_modules meta.modules - .let [lux_modules (|> all_modules - (list.only (function.composite lux_module? product.left)) - (list.sorted name_sort))] - lux_exports (monad.each ! (function.composite meta.exports product.left) - lux_modules) - module_documentation (|> (list\each organize_definitions lux_exports) - (list.zipped/2 lux_modules) - (monad.each ! document_module)) - .let [_ (io.run! (monad.each io.monad save_documentation! module_documentation))]] - (in (list)))) - -(gen_documentation!) - -(program: args - (io (debug.log! "Done!"))) +... (def: (document_macros module_name names) +... (-> Text (List [Text Code]) (Markdown Block)) +... (|> names +... (list\each (: (-> [Text Code] (Markdown Block)) +... (function (_ [name def_annotations]) +... ($_ md.then +... (md.heading/3 name) +... (<| (: (Markdown Block)) +... (maybe.else md.empty) +... (do maybe.monad +... [documentation (annotation.documentation def_annotations)] +... (in (md.code documentation)))))))) +... (list\mix (function.flipped md.then) +... (md.heading/2 "Macros")))) + +... (template [<singular> <plural> <header>] +... [(def: (<singular> module type) +... (-> Text Type (Markdown Block)) +... (md.code (pprint_type (-- 0) "?" module type))) + +... (def: (<plural> module values) +... (-> Text (List Value) (Markdown Block)) +... (|> values +... (list\each (function (_ [name def_annotations value_type]) +... (let [?doc (annotation.documentation def_annotations) +... usage (case (annotation.function_arguments def_annotations) +... #.End +... name + +... args +... (format "(" (text.interposed " " (list& name args)) ")"))] +... ($_ md.then +... (md.heading/3 usage) +... (case ?doc +... (#.Some doc) +... (md.code doc) + +... _ +... md.empty) +... (<singular> module value_type))))) +... (list\mix (function.flipped md.then) +... (md.heading/2 <header>))))] + +... [document_implementation document_implementations "Implementations"] +... [document_value document_values "Values"] +... ) + +... (def: (enclose_lines pre+post block) +... (-> [Text Text] Text Text) +... (|> block +... (text.all_split_by text.new_line) +... (list\each (text.enclosed pre+post)) +... (text.interposed text.new_line))) + +... (def: (document_module [[module_name module] organization]) +... (-> [[Text Module] Organization] (Meta [Text (Markdown Block)])) +... (do meta.monad +... [.let [(^slots [#types #macros #implementations #values]) organization +... annotations (|> module +... (value@ #.module_annotations) +... (maybe.else (' {})) +... annotation.documentation) +... description (case annotations +... (#.Some doc_text) +... (md.quote (md.paragraph (md.text doc_text))) + +... #.None +... md.empty) +... empty_block (: (Markdown Block) md.empty)] +... types_documentation (if (list.empty? types) +... (in empty_block) +... (document_types module_name types)) +... .let [documentation ($_ md.then +... types_documentation +... (if (list.empty? macros) empty_block (document_macros module_name macros)) +... (if (list.empty? implementations) empty_block (document_implementations module_name implementations)) +... (if (list.empty? values) empty_block (document_values module_name values)))]] +... (in [module_name +... ($_ md.then +... (md.heading/1 module_name) +... description +... documentation)]))) + +... (exception: .public (io_error {error Text}) +... error) + +... (def: (save_documentation! [module_name documentation]) +... (-> [Text (Markdown Block)] (IO Any)) +... (let [path (format (text.replaced "/" "_" module_name) ".md")] +... (do io.monad +... [outcome (\ file.default write (\ utf8.codec encoded (md.markdown documentation)) path)] +... (in (case outcome +... (#try.Failure error) +... (debug.log! (exception.error io_error error)) + +... (#try.Success _) +... []))))) + +... (macro: (gen_documentation! _) +... (do {! meta.monad} +... [all_modules meta.modules +... .let [lux_modules (|> all_modules +... (list.only (function.composite lux_module? product.left)) +... (list.sorted name_sort))] +... lux_exports (monad.each ! (function.composite meta.exports product.left) +... lux_modules) +... module_documentation (|> (list\each organize_definitions lux_exports) +... (list.zipped/2 lux_modules) +... (monad.each ! document_module)) +... .let [_ (io.run! (monad.each io.monad save_documentation! module_documentation))]] +... (in (list)))) + +... (gen_documentation!) + +... (program: args +... (io (debug.log! "Done!"))) diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux index 70c314997..619ba5fa9 100644 --- a/stdlib/source/specification/compositor.lux +++ b/stdlib/source/specification/compositor.lux @@ -42,7 +42,7 @@ )) (def: .public (spec platform bundle expander program) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (IO (Platform IO anchor expression directive)) (Bundle anchor expression directive) Expander diff --git a/stdlib/source/specification/compositor/common.lux b/stdlib/source/specification/compositor/common.lux index f663de359..72a27804d 100644 --- a/stdlib/source/specification/compositor/common.lux +++ b/stdlib/source/specification/compositor/common.lux @@ -26,7 +26,7 @@ (-> Name Synthesis (Try Any))) (type: .public (Instancer what) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> (Platform IO anchor expression directive) (generation.State+ anchor expression directive) what))) @@ -60,7 +60,7 @@ (def: .public (executors target expander platform analysis_bundle generation_bundle directive_bundle program extender) - (All [anchor expression directive] + (All (_ anchor expression directive) (-> Text Expander (Platform IO anchor expression directive) analysis.Bundle (generation.Bundle anchor expression directive) diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux index 1e2c7b676..007e4800a 100644 --- a/stdlib/source/specification/lux/abstract/apply.lux +++ b/stdlib/source/specification/lux/abstract/apply.lux @@ -16,7 +16,7 @@ [functor (#+ Injection Comparison)]]) (def: (identity injection comparison (^open "\.")) - (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) (do {! random.monad} [sample (\ ! each injection random.nat)] (_.test "Identity." @@ -25,7 +25,7 @@ sample)))) (def: (homomorphism injection comparison (^open "\.")) - (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) (do {! random.monad} [sample random.nat increase (\ ! each n.+ random.nat)] @@ -35,7 +35,7 @@ (injection (increase sample)))))) (def: (interchange injection comparison (^open "\.")) - (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) (do {! random.monad} [sample random.nat increase (\ ! each n.+ random.nat)] @@ -46,7 +46,7 @@ (function (_ f) (f sample))))))))) (def: (composition injection comparison (^open "\.")) - (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) (do {! random.monad} [sample random.nat increase (\ ! each n.+ random.nat) @@ -62,7 +62,7 @@ (injection decrease)))))) (def: .public (spec injection comparison apply) - (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) (_.for [/.Apply] ($_ _.and (..identity injection comparison apply) diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux index 1725bbc92..bc256f66f 100644 --- a/stdlib/source/specification/lux/abstract/codec.lux +++ b/stdlib/source/specification/lux/abstract/codec.lux @@ -14,7 +14,7 @@ [equivalence (#+ Equivalence)]]]]) (def: .public (spec (^open "@//.") (^open "@//.") generator) - (All [m a] (-> (Equivalence a) (/.Codec m a) (Random a) Test)) + (All (_ m a) (-> (Equivalence a) (/.Codec m a) (Random a) Test)) (do random.monad [expected generator] (_.for [/.Codec] diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux index 785cc06fd..abcda6f0f 100644 --- a/stdlib/source/specification/lux/abstract/comonad.lux +++ b/stdlib/source/specification/lux/abstract/comonad.lux @@ -14,7 +14,7 @@ [functor (#+ Injection Comparison)]]) (def: (left_identity injection (^open "_//.")) - (All [f] (-> (Injection f) (CoMonad f) Test)) + (All (_ f) (-> (Injection f) (CoMonad f) Test)) (do {! random.monad} [sample random.nat morphism (\ ! each (function (_ diff) @@ -26,7 +26,7 @@ (|> start _//disjoint (_//each morphism) _//out))))) (def: (right_identity injection comparison (^open "_//.")) - (All [f] (-> (Injection f) (Comparison f) (CoMonad f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (CoMonad f) Test)) (do random.monad [sample random.nat .let [start (injection sample) @@ -36,7 +36,7 @@ (|> start _//disjoint (_//each _//out)))))) (def: (associativity injection comparison (^open "_//.")) - (All [f] (-> (Injection f) (Comparison f) (CoMonad f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (CoMonad f) Test)) (do {! random.monad} [sample random.nat increase (\ ! each (function (_ diff) @@ -52,7 +52,7 @@ (|> start _//disjoint (_//each increase) _//disjoint (_//each decrease)))))) (def: .public (spec injection comparison subject) - (All [f] (-> (Injection f) (Comparison f) (CoMonad f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (CoMonad f) Test)) (<| (_.for [/.CoMonad]) ($_ _.and (..left_identity injection subject) diff --git a/stdlib/source/specification/lux/abstract/enum.lux b/stdlib/source/specification/lux/abstract/enum.lux index f68ba1203..a5118918a 100644 --- a/stdlib/source/specification/lux/abstract/enum.lux +++ b/stdlib/source/specification/lux/abstract/enum.lux @@ -10,7 +10,7 @@ ["." /]]) (def: .public (spec (^open "\.") gen_sample) - (All [a] (-> (/.Enum a) (Random a) Test)) + (All (_ a) (-> (/.Enum a) (Random a) Test)) (do random.monad [sample gen_sample] (<| (_.for [/.Enum]) diff --git a/stdlib/source/specification/lux/abstract/equivalence.lux b/stdlib/source/specification/lux/abstract/equivalence.lux index e6ef85b11..9a7e3c096 100644 --- a/stdlib/source/specification/lux/abstract/equivalence.lux +++ b/stdlib/source/specification/lux/abstract/equivalence.lux @@ -10,7 +10,7 @@ ["." / (#+ Equivalence)]]) (def: .public (spec (^open "_//.") random) - (All [a] (-> (Equivalence a) (Random a) Test)) + (All (_ a) (-> (Equivalence a) (Random a) Test)) (do random.monad [left random right random] diff --git a/stdlib/source/specification/lux/abstract/functor.lux b/stdlib/source/specification/lux/abstract/functor.lux index 33c6506c5..7d280e610 100644 --- a/stdlib/source/specification/lux/abstract/functor.lux +++ b/stdlib/source/specification/lux/abstract/functor.lux @@ -15,15 +15,15 @@ ["." / (#+ Functor)]]) (type: .public (Injection f) - (All [a] (-> a (f a)))) + (All (_ a) (-> a (f a)))) (type: .public (Comparison f) - (All [a] + (All (_ a) (-> (Equivalence a) (Equivalence (f a))))) (def: (identity injection comparison (^open "@//.")) - (All [f] (-> (Injection f) (Comparison f) (Functor f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (do {! random.monad} [sample (\ ! each injection random.nat)] (_.test "Identity." @@ -32,7 +32,7 @@ sample)))) (def: (homomorphism injection comparison (^open "@//.")) - (All [f] (-> (Injection f) (Comparison f) (Functor f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (do {! random.monad} [sample random.nat increase (\ ! each n.+ random.nat)] @@ -42,7 +42,7 @@ (injection (increase sample)))))) (def: (composition injection comparison (^open "@//.")) - (All [f] (-> (Injection f) (Comparison f) (Functor f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (do {! random.monad} [sample (\ ! each injection random.nat) increase (\ ! each n.+ random.nat) @@ -53,7 +53,7 @@ (|> sample (@//each (|>> increase decrease))))))) (def: .public (spec injection comparison functor) - (All [f] (-> (Injection f) (Comparison f) (Functor f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (<| (_.for [/.Functor]) ($_ _.and (..identity injection comparison functor) diff --git a/stdlib/source/specification/lux/abstract/functor/contravariant.lux b/stdlib/source/specification/lux/abstract/functor/contravariant.lux index 9e50001c5..a2edebd54 100644 --- a/stdlib/source/specification/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/specification/lux/abstract/functor/contravariant.lux @@ -15,14 +15,14 @@ ["." / (#+ Functor)]]) (def: (identity equivalence value (^open "@//.")) - (All [f a] (-> (Equivalence (f a)) (f a) (Functor f) Test)) + (All (_ f a) (-> (Equivalence (f a)) (f a) (Functor f) Test)) (_.test "Law of identity." (equivalence (@//each function.identity value) value))) (def: .public (spec equivalence value functor) - (All [f a] (-> (Equivalence (f a)) (f a) (Functor f) Test)) + (All (_ f a) (-> (Equivalence (f a)) (f a) (Functor f) Test)) (do random.monad [sample random.nat] (<| (_.for [/.Functor]) diff --git a/stdlib/source/specification/lux/abstract/hash.lux b/stdlib/source/specification/lux/abstract/hash.lux index 4437a42a5..2f246bdab 100644 --- a/stdlib/source/specification/lux/abstract/hash.lux +++ b/stdlib/source/specification/lux/abstract/hash.lux @@ -12,7 +12,7 @@ ["." /]]) (def: .public (spec (^open "\.") random) - (All [a] (-> (/.Hash a) (Random a) Test)) + (All (_ a) (-> (/.Hash a) (Random a) Test)) (do random.monad [parameter random subject random] diff --git a/stdlib/source/specification/lux/abstract/interval.lux b/stdlib/source/specification/lux/abstract/interval.lux index 68b2204b0..eeea4a1de 100644 --- a/stdlib/source/specification/lux/abstract/interval.lux +++ b/stdlib/source/specification/lux/abstract/interval.lux @@ -11,7 +11,7 @@ ["." /]]) (def: .public (spec (^open "@//.") gen_sample) - (All [a] (-> (/.Interval a) (Random a) Test)) + (All (_ a) (-> (/.Interval a) (Random a) Test)) (<| (_.for [/.Interval]) (do random.monad [sample gen_sample] diff --git a/stdlib/source/specification/lux/abstract/mix.lux b/stdlib/source/specification/lux/abstract/mix.lux index 1097ac37f..d8960947f 100644 --- a/stdlib/source/specification/lux/abstract/mix.lux +++ b/stdlib/source/specification/lux/abstract/mix.lux @@ -14,7 +14,7 @@ ["." /]]) (def: .public (spec injection comparison (^open "@//.")) - (All [f] (-> (Injection f) (Comparison f) (/.Mix f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (/.Mix f) Test)) (do random.monad [subject random.nat parameter random.nat] diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux index 2e538db50..daded437a 100644 --- a/stdlib/source/specification/lux/abstract/monad.lux +++ b/stdlib/source/specification/lux/abstract/monad.lux @@ -12,7 +12,7 @@ [functor (#+ Injection Comparison)]]) (def: (left_identity injection comparison (^open "_//.")) - (All [f] (-> (Injection f) (Comparison f) (/.Monad f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) (do {! random.monad} [sample random.nat morphism (\ ! each (function (_ diff) @@ -24,7 +24,7 @@ (morphism sample))))) (def: (right_identity injection comparison (^open "_//.")) - (All [f] (-> (Injection f) (Comparison f) (/.Monad f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) (do random.monad [sample random.nat] (_.test "Right identity." @@ -33,7 +33,7 @@ (injection sample))))) (def: (associativity injection comparison (^open "_//.")) - (All [f] (-> (Injection f) (Comparison f) (/.Monad f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) (do {! random.monad} [sample random.nat increase (\ ! each (function (_ diff) @@ -48,7 +48,7 @@ (|> (injection sample) (_//each (|>> increase (_//each decrease) _//conjoint)) _//conjoint))))) (def: .public (spec injection comparison monad) - (All [f] (-> (Injection f) (Comparison f) (/.Monad f) Test)) + (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) (<| (_.for [/.Monad]) ($_ _.and (..left_identity injection comparison monad) diff --git a/stdlib/source/specification/lux/abstract/monoid.lux b/stdlib/source/specification/lux/abstract/monoid.lux index a9ce67fd2..b11c348ce 100644 --- a/stdlib/source/specification/lux/abstract/monoid.lux +++ b/stdlib/source/specification/lux/abstract/monoid.lux @@ -12,7 +12,7 @@ [equivalence (#+ Equivalence)]]]]) (def: .public (spec (^open "\.") (^open "\.") gen_sample) - (All [a] (-> (Equivalence a) (/.Monoid a) (Random a) Test)) + (All (_ a) (-> (Equivalence a) (/.Monoid a) (Random a) Test)) (do random.monad [sample gen_sample left gen_sample diff --git a/stdlib/source/specification/lux/abstract/order.lux b/stdlib/source/specification/lux/abstract/order.lux index 94bf6712a..2a8510721 100644 --- a/stdlib/source/specification/lux/abstract/order.lux +++ b/stdlib/source/specification/lux/abstract/order.lux @@ -10,13 +10,13 @@ ["." /]]) (def: .public (spec (^open "@//.") generator) - (All [a] (-> (/.Order a) (Random a) Test)) + (All (_ a) (-> (/.Order a) (Random a) Test)) (<| (_.for [/.Order]) ($_ _.and (do random.monad [parameter generator subject generator] - (_.test "Values are either ordered, or they are equal. All options are mutually exclusive." + (_.test "Values are either ordered, or they are equal. All options(_ are mutually exclusive." (cond (@//< parameter subject) (not (or (@//< subject parameter) (@//= parameter subject))) diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux index e91b79e1f..46eab9c88 100644 --- a/stdlib/source/test/aedifex/hash.lux +++ b/stdlib/source/test/aedifex/hash.lux @@ -26,7 +26,7 @@ ["_." binary]]]]) (def: .public (random hash) - (All [h] + (All (_ h) (-> (-> Binary (/.Hash h)) (Random (/.Hash h)))) (do {! random.monad} diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index de27a0ee8..be05cdda9 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -38,13 +38,13 @@ (random.ascii/alpha 1)) (def: (list_of random) - (All [a] (-> (Random a) (Random (List a)))) + (All (_ a) (-> (Random a) (Random (List a)))) (do {! random.monad} [size (\ ! each (n.% 5) random.nat)] (random.list size random))) (def: (dictionary_of key_hash key_random value_random) - (All [k v] (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) + (All (_ k v) (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) (\ random.functor each (dictionary.of_list key_hash) (..list_of (random.and key_random value_random)))) diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 92d755290..39aaa4fa3 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -72,19 +72,19 @@ ..developer) (def: (list_of random) - (All [a] (-> (Random a) (Random (List a)))) + (All (_ a) (-> (Random a) (Random (List a)))) (do {! random.monad} [size (\ ! each (n.% 5) random.nat)] (random.list size random))) (def: (set_of hash random) - (All [a] (-> (Hash a) (Random a) (Random (Set a)))) + (All (_ a) (-> (Hash a) (Random a) (Random (Set a)))) (\ random.functor each (set.of_list hash) (..list_of random))) (def: (dictionary_of key_hash key_random value_random) - (All [k v] (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) + (All (_ k v) (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) (\ random.functor each (dictionary.of_list key_hash) (..list_of (random.and key_random value_random)))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index df0eb2f09..b7fb2feb5 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -91,13 +91,11 @@ /locale.test /macro.test /math.test - /meta.test /program.test /static.test /target.test /test.test - /time.test ... /tool.test /type.test @@ -233,7 +231,7 @@ return))) (/.implementation: (global_returner value) - (All [a] (-> a (Returner a))) + (All (_ a) (-> a (Returner a))) (def: (return _) value)) @@ -861,24 +859,26 @@ (function (_ _) (: /.Int (undefined)))) true))) - (_.cover [/.All] - (let [identity (: (/.All [a] (-> a a)) - (|>>))] - (and (exec - (: Nat - (identity left)) - true) - (exec - (: Text - (identity right)) - true)))) - (_.cover [/.Ex] - (let [hide (: (/.Ex [a] (-> Nat a)) - (|>>))] - (exec - (: /.Any - (hide left)) - true))) + (_.for [/.__adjusted_quantified_type__] + ($_ _.and + (_.cover [/.All] + (let [identity (: (/.All (_ a) (-> a a)) + (|>>))] + (and (exec + (: Nat + (identity left)) + true) + (exec + (: Text + (identity right)) + true)))) + (_.cover [/.Ex] + (let [hide (: (/.Ex (_ a) (-> Nat a)) + (|>>))] + (exec + (: /.Any + (hide left)) + true))))) (_.cover [/.same?] (let [not_left (|> left ++ --)] (and (/.same? left left) @@ -1042,12 +1042,12 @@ )) (def: identity/constant - (All [a] (-> a a)) + (All (_ a) (-> a a)) (function (_ value) value)) (def: (identity/function value) - (All [a] (-> a a)) + (All (_ a) (-> a a)) value) (def: for_def: diff --git a/stdlib/source/test/lux/abstract/comonad/cofree.lux b/stdlib/source/test/lux/abstract/comonad/cofree.lux index 971088981..226b152bc 100644 --- a/stdlib/source/test/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/test/lux/abstract/comonad/cofree.lux @@ -24,7 +24,7 @@ [value (sequence\each injection (sequence.repeated value))]) (def: (interpret [head tail]) - (All [a] (-> (/.CoFree Sequence a) (Sequence a))) + (All (_ a) (-> (/.CoFree Sequence a) (Sequence a))) (|> tail (sequence\each (\ (/.comonad sequence.functor) out)) [head] diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index 8df494aac..15c0bd8da 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -23,7 +23,7 @@ (|>> #/.Pure)) (def: (interpret free) - (All [a] (-> (/.Free List a) (List a))) + (All (_ a) (-> (/.Free List a) (List a))) (case free (#/.Pure value) (list value) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index c5c66d2fc..a5c090476 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -51,7 +51,7 @@ Test (do {! random.monad} [initial_state random.nat - .let [as_mail (: (All [a] (-> (-> a a) (/.Mail a))) + .let [as_mail (: (All (_ a) (-> (-> a a) (/.Mail a))) (function (_ transform) (function (_ state actor) (|> state transform #try.Success async\in)))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index ad508df7b..dd018d88e 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -47,7 +47,7 @@ false)))))) (def: (take_amount amount_of_polls [channel sink]) - (All [a] (-> Nat [(/.Channel a) (/.Sink a)] (Async (List a)))) + (All (_ a) (-> Nat [(/.Channel a) (/.Sink a)] (Async (List a)))) (case amount_of_polls 0 (do async.monad [_ (async.future (\ sink close))] diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index cac3794a0..e15992e9d 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -19,7 +19,7 @@ ["." /]]) (def: injection - (All [o] (Injection (All [i] (/.Cont i o)))) + (All (_ o) (Injection (All (_ i) (/.Cont i o)))) (|>> /.pending)) (def: comparison diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index 266952896..1de41d45d 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -36,7 +36,7 @@ (in (n.+ output_1 output_2))))) (def: (time function input) - (All [i o] (-> (-> i o) i (IO [Duration o]))) + (All (_ i o) (-> (-> i o) i (IO [Duration o]))) (do io.monad [before instant.now .let [output (function input)] diff --git a/stdlib/source/test/lux/control/lazy.lux b/stdlib/source/test/lux/control/lazy.lux index bc1ed13d0..31990bc79 100644 --- a/stdlib/source/test/lux/control/lazy.lux +++ b/stdlib/source/test/lux/control/lazy.lux @@ -28,7 +28,7 @@ (\ (/.equivalence ==) =))) (def: .public lazy - (All [a] (-> (Random a) (Random (Lazy a)))) + (All (_ a) (-> (Random a) (Random (Lazy a)))) (\ random.functor each (|>> /.lazy))) (def: .public test diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index fd29bd07b..e20558de9 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -41,7 +41,7 @@ ["#." xml]]) (def: (should_fail expected input) - (All [a] (-> Text (Try a) Bit)) + (All (_ a) (-> Text (Try a) Bit)) (case input (#try.Failure actual) (text\= expected actual) @@ -50,7 +50,7 @@ #0)) (def: (enforced? parser input) - (All [s] (-> (Parser s Any) s Bit)) + (All (_ s) (-> (Parser s Any) s Bit)) (case (/.result parser input) (#try.Success [_ []]) #1 @@ -59,7 +59,7 @@ #0)) (def: (found? parser input) - (All [s] (-> (Parser s Bit) s Bit)) + (All (_ s) (-> (Parser s Bit) s Bit)) (case (/.result parser input) (#try.Success [_ #1]) #1 @@ -68,7 +68,7 @@ #0)) (def: (fails? input) - (All [a] (-> (Try a) Bit)) + (All (_ a) (-> (Try a) Bit)) (case input (#try.Failure _) #1 @@ -332,11 +332,11 @@ ))) (def: injection - (Injection (All [a i] (Parser i a))) + (Injection (All (_ a i) (Parser i a))) (\ /.monad in)) (def: comparison - (Comparison (All [a i] (Parser i a))) + (Comparison (All (_ a i) (Parser i a))) (function (_ == left right) (case [(/.result left []) (/.result right [])] [(#try.Success [_ left]) (#try.Success [_ right])] diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index 99ea38f16..2ade93b12 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -133,4 +133,22 @@ (!expect (#try.Success []))) (|> (/.result /.end! (list dummy)) (!expect (#try.Failure _)))))) + (do {! random.monad} + [expected (\ ! each code.bit random.bit)] + (_.cover [/.next] + (|> (/.result (do <>.monad + [pre /.next + post /.any] + (in (and (same? expected pre) + (same? pre post)))) + (list expected)) + (!expect (#try.Success _))))) + (do {! random.monad} + [expected (\ ! each code.bit random.bit)] + (_.cover [/.not] + (and (|> (/.result (/.not /.nat) (list expected)) + (!expect (^multi (#try.Success actual) + (same? expected actual)))) + (|> (/.result (/.not /.bit) (list expected)) + (!expect (#try.Failure _)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 3b28d2390..23d9dc897 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -40,7 +40,7 @@ false)]) (def: (should_fail' sample parser exception) - (All [a e] (-> Text (/.Parser a) (Exception e) Bit)) + (All (_ a e) (-> Text (/.Parser a) (Exception e) Bit)) (case (/.result parser sample) (#try.Failure error) (exception.match? exception error) @@ -49,7 +49,7 @@ false)) (def: (should_fail sample parser) - (All [a] (-> Text (/.Parser a) Bit)) + (All (_ a) (-> Text (/.Parser a) Bit)) (case (/.result parser sample) (#try.Failure _) true diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index 78ea0d961..14b307b94 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -18,12 +18,12 @@ ["." io (#+ IO)]]]]) (def: (injection value) - (Injection (All [a r] (Reader r a))) + (Injection (All (_ a r) (Reader r a))) (function (_ env) value)) (def: comparison - (Comparison (All [a r] (Reader r a))) + (Comparison (All (_ a r) (Reader r a))) (function (_ == left right) (== (/.result [] left) (/.result [] right)))) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 5cf65f56b..b6036672b 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -31,7 +31,7 @@ (exception: oops) (def: (success? result) - (All [a] (-> (Try a) Bit)) + (All (_ a) (-> (Try a) Bit)) (case result (#try.Success _) true @@ -40,7 +40,7 @@ false)) (def: (throws? exception result) - (All [e a] (-> (Exception e) (Try a) Bit)) + (All (_ e a) (-> (Exception e) (Try a) Bit)) (case result (#try.Success _) false @@ -49,14 +49,14 @@ (exception.match? exception error))) (def: (injection value) - (Injection (All [a] (All [! r] (Region r (Thread !) a)))) + (Injection (All (_ a) (All (_ ! r) (Region r (Thread !) a)))) (function (_ [region scope]) (function (_ !) [scope (#try.Success value)]))) (def: comparison - (Comparison (All [a] (All [! r] (Region r (Thread !) a)))) + (Comparison (All (_ a) (All (_ ! r) (Region r (Thread !) a)))) (function (_ == left right) (case [(:sharing [a] (Equivalence a) @@ -84,15 +84,15 @@ [expected_clean_ups (|> random.nat (\ ! each (|>> (n.% 100) (n.max 1))))] ($_ _.and (_.for [/.functor] - ($functor.spec ..injection ..comparison (: (All [! r] + ($functor.spec ..injection ..comparison (: (All (_ ! r) (Functor (Region r (thread.Thread !)))) (/.functor thread.functor)))) (_.for [/.apply] - ($apply.spec ..injection ..comparison (: (All [! r] + ($apply.spec ..injection ..comparison (: (All (_ ! r) (Apply (Region r (thread.Thread !)))) (/.apply thread.monad)))) (_.for [/.monad] - ($monad.spec ..injection ..comparison (: (All [! r] + ($monad.spec ..injection ..comparison (: (All (_ ! r) (Monad (Region r (thread.Thread !)))) (/.monad thread.monad)))) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index ae5240f7e..07db4bf9a 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -42,7 +42,7 @@ (#.Some focus) (list focus)))))) (def: (attempt computation) - (All [a] (-> (Meta a) (Meta (Try a)))) + (All (_ a) (-> (Meta a) (Meta (Try a)))) (function (_ compiler) (case (computation compiler) (#try.Success [compiler output]) diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index b49d04df9..ba2e62ed5 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -19,13 +19,13 @@ ["." / (#+ Context Privacy Can_Conceal Can_Reveal Privilege Private)]]) (def: (injection can_conceal) - (All [label] - (-> (Can_Conceal label) (Injection (All [value] (Private value label))))) + (All (_ label) + (-> (Can_Conceal label) (Injection (All (_ value) (Private value label))))) can_conceal) (def: (comparison can_reveal) - (All [label] - (-> (Can_Reveal label) (Comparison (All [value] (Private value label))))) + (All (_ label) + (-> (Can_Reveal label) (Comparison (All (_ value) (Private value label))))) (function (_ == left right) (== (can_reveal left) (can_reveal right)))) @@ -45,7 +45,7 @@ privilege))) (def: (policy _) - (Ex [%] (-> Any (Policy %))) + (Ex (_ %) (-> Any (Policy %))) (/.with_policy (: (Context Privacy Policy) (function (_ (^@ privilege (^open "%\."))) diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index 10bda7445..74c4ca33f 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -55,12 +55,12 @@ ))) (def: (injection value) - (All [s] (Injection (State s))) + (All (_ s) (Injection (State s))) (function (_ state) [state value])) (def: (comparison init) - (All [s] (-> s (Comparison (State s)))) + (All (_ s) (-> s (Comparison (State s)))) (function (_ == left right) (== (product.right (/.result init left)) (product.right (/.result init right))))) diff --git a/stdlib/source/test/lux/control/thread.lux b/stdlib/source/test/lux/control/thread.lux index 2f93f2349..5976ebded 100644 --- a/stdlib/source/test/lux/control/thread.lux +++ b/stdlib/source/test/lux/control/thread.lux @@ -18,11 +18,11 @@ ["." io]]]]) (def: (injection value) - (Injection (All [a !] (Thread ! a))) + (Injection (All (_ a !) (Thread ! a))) (\ /.monad in value)) (def: comparison - (Comparison (All [a !] (Thread ! a))) + (Comparison (All (_ a !) (Thread ! a))) (function (_ == left right) (== (/.result left) (/.result right)))) @@ -59,14 +59,14 @@ ($_ _.and (_.cover [/.read!] (n.= sample - (/.result (: (All [!] (Thread ! Nat)) + (/.result (: (All (_ !) (Thread ! Nat)) (do /.monad [box (/.box sample)] (/.read! box)))))) (_.cover [/.write!] (n.= factor - (/.result (: (All [!] (Thread ! Nat)) + (/.result (: (All (_ !) (Thread ! Nat)) (do /.monad [box (/.box sample) _ (/.write! factor box)] @@ -74,7 +74,7 @@ (_.cover [/.update!] (n.= (n.* factor sample) - (/.result (: (All [!] (Thread ! Nat)) + (/.result (: (All (_ !) (Thread ! Nat)) (do /.monad [box (/.box sample) old (/.update! (n.* factor) box)] diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 55bcc0b4f..1638e2351 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -31,7 +31,7 @@ (\ (/.equivalence ==) =))) (def: .public (attempt element) - (All [a] (-> (Random a) (Random (Try a)))) + (All (_ a) (-> (Random a) (Random (Try a)))) ($_ random.or (random.unicode 1) element)) diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux index 5ef2c76c4..27a7f32b7 100644 --- a/stdlib/source/test/lux/control/writer.lux +++ b/stdlib/source/test/lux/control/writer.lux @@ -23,11 +23,11 @@ ["." / (#+ Writer)]]) (def: (injection monoid value) - (All [w] (-> (Monoid w) (Injection (Writer w)))) + (All (_ w) (-> (Monoid w) (Injection (Writer w)))) [(\ monoid identity) value]) (def: comparison - (All [w] (Comparison (Writer w))) + (All (_ w) (Comparison (Writer w))) (function (_ == [_ left] [_ right]) (== left right))) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 6ee71541c..9ab46a991 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -43,7 +43,7 @@ (\ random.monad in output))))) (def: (throws? exception try) - (All [e a] (-> (Exception e) (Try a) Bit)) + (All (_ e a) (-> (Exception e) (Try a) Bit)) (case try (#try.Failure error) (exception.match? exception error) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 739756640..f409a55d9 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -24,7 +24,7 @@ ["." /]]) (def: .public (dictionary order gen_key gen_value size) - (All [k v] + (All (_ k v) (-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v)))) (case size 0 diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index f83e4cf82..a4ca3d573 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -22,7 +22,7 @@ ["." /]]) (def: .public (random size gen_key gen_value) - (All [v] + (All (_ v) (-> Nat (Random Text) (Random v) (Random (/.PList v)))) (do random.monad [keys (random.set text.hash size gen_key) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index b5ba88171..168fd9397 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -115,7 +115,7 @@ (and (/.within_bounds? sample good_index) (not (/.within_bounds? sample bad_index)))) (_.cover [/.index_out_of_bounds] - (let [fails! (: (All [a] (-> (Try a) Bit)) + (let [fails! (: (All (_ a) (-> (Try a) Bit)) (function (_ situation) (case situation (#try.Success member) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index ace5fa0cb..4c349854b 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -22,7 +22,7 @@ ["." /]]) (implementation: (equivalence super) - (All [a] (-> (Equivalence a) (Equivalence (/.Sequence a)))) + (All (_ a) (-> (Equivalence a) (Equivalence (/.Sequence a)))) (def: (= reference subject) (\ (list.equivalence super) = @@ -30,7 +30,7 @@ (/.first 100 subject)))) (def: (iterations step) - (All [a] + (All (_ a) (-> (-> a a) (-> a (/.Sequence a)))) (/.iterations diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 55928932f..6b03b9416 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -26,7 +26,7 @@ (\ random.monad each (|>> (n.% 10) ++) random.nat)) (def: .public (random size hash count element) - (All [a] (-> Nat (Hash a) (Random Nat) (Random a) (Random (/.Set a)))) + (All (_ a) (-> Nat (Hash a) (Random Nat) (Random a) (Random (/.Set a)))) (do {! random.monad} [elements (random.set hash size element) element_counts (random.list size ..count)] diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 31b8b0405..a9b171d11 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -24,7 +24,7 @@ (\ random.monad each (n.% 100) random.nat)) (def: .public (random size &order gen_value) - (All [a] (-> Nat (Order a) (Random a) (Random (Set a)))) + (All (_ a) (-> Nat (Order a) (Random a) (Random (Set a)))) (case size 0 (random\in (/.empty &order)) diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index d48a8d208..35b43bb9b 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -20,7 +20,7 @@ ["." / (#+ Tree)]]) (def: .public (tree gen_value) - (All [a] (-> (Random a) (Random [Nat (Tree a)]))) + (All (_ a) (-> (Random a) (Random [Nat (Tree a)]))) (do {! random.monad} [value gen_value num_children (\ ! each (n.% 2) random.nat) diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index 5f604f1f8..a6a9aae06 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -53,14 +53,14 @@ ["." /]]) (implementation: (equivalence example) - (All [a] (-> a (Equivalence (/.Format a)))) + (All (_ a) (-> a (Equivalence (/.Format a)))) (def: (= reference subject) (text\= (reference example) (subject example)))) (def: random_contravariant - (Random (Ex [a] [(/.Format a) - (Random a)])) + (Random (Ex (_ a) [(/.Format a) + (Random a)])) ($_ random.either (random\in [/.bit random.bit]) (random\in [/.nat random.nat]) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 1e77a7904..041f22d9e 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -43,7 +43,7 @@ false))) (def: (should_fail regex input) - (All [a] (-> (Parser a) Text Bit)) + (All (_ a) (-> (Parser a) Text Bit)) (|> input (<text>.result regex) (case> (#try.Failure _) diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux index 230fad9a9..7a3a1b3b1 100644 --- a/stdlib/source/test/lux/ffi.js.lux +++ b/stdlib/source/test/lux/ffi.js.lux @@ -71,7 +71,7 @@ (~~ (template [<type>] [(_.cover [<type>] (exec - (: (Ex [a] (/.Object a)) + (: (Ex (_ a) (/.Object a)) (: <type> (:expected []))) true))] @@ -86,7 +86,7 @@ (exec (: Nat (/.null [])) (: Text (/.null [])) - (: (All [a] (-> a a)) (/.null [])) + (: (All (_ a) (-> a a)) (/.null [])) true)) (_.cover [/.null?] (and (/.null? (/.null [])) diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 9b81d303b..9f78a75b4 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -40,7 +40,7 @@ (exec (|> [] (:as <type>) - (: (Ex [a] (/.Object a)))) + (: (Ex (_ a) (/.Object a)))) true))] [/.Nil] @@ -50,7 +50,7 @@ (exec (|> (/.closure [input/0] input/0) (: /.Function) - (: (Ex [a] (/.Object a)))) + (: (Ex (_ a) (/.Object a)))) true)) (_.cover [/.import:] (case (io.run! (..os/getenv string)) diff --git a/stdlib/source/test/lux/ffi.py.lux b/stdlib/source/test/lux/ffi.py.lux index a2f5c7444..2e5e89d5e 100644 --- a/stdlib/source/test/lux/ffi.py.lux +++ b/stdlib/source/test/lux/ffi.py.lux @@ -43,7 +43,7 @@ (exec (|> [] (:as <type>) - (: (Ex [a] (/.Object a)))) + (: (Ex (_ a) (/.Object a)))) true))] [/.None] @@ -53,7 +53,7 @@ (exec (|> (/.lambda [input/0] input/0) (: /.Function) - (: (Ex [a] (/.Object a)))) + (: (Ex (_ a) (/.Object a)))) true)) (_.cover [/.import:] (and (i.= (os::R_OK) (os::R_OK)) diff --git a/stdlib/source/test/lux/ffi.rb.lux b/stdlib/source/test/lux/ffi.rb.lux index f39893779..6e10fcce1 100644 --- a/stdlib/source/test/lux/ffi.rb.lux +++ b/stdlib/source/test/lux/ffi.rb.lux @@ -40,7 +40,7 @@ (exec (|> [] (:as <type>) - (: (Ex [a] (/.Object a)))) + (: (Ex (_ a) (/.Object a)))) true))] [/.Nil] diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 19883a827..e11595968 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -185,10 +185,10 @@ )) (def: (aggregate lens hash territories) - (All [a] (-> (-> Bundle (Set a)) - (Hash a) - (List Bundle) - [Nat (Set a)])) + (All (_ a) (-> (-> Bundle (Set a)) + (Hash a) + (List Bundle) + [Nat (Set a)])) (list\mix (function (_ bundle [amount set]) [(n.+ amount (value@ #amount bundle)) (set.union set (lens bundle))]) diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 2a225a58e..b129c333c 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -140,10 +140,10 @@ ..territories/z)) (def: (aggregate lens hash territories) - (All [a] (-> (-> Bundle (Set a)) - (Hash a) - (List Bundle) - [Nat (Set a)])) + (All (_ a) (-> (-> Bundle (Set a)) + (Hash a) + (List Bundle) + [Nat (Set a)])) (list\mix (function (_ bundle [amount set]) [(n.+ amount (value@ #amount bundle)) (set.union set (lens bundle))]) diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 666e8734c..5cacd6851 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -36,13 +36,13 @@ (random.and ..random_text ..random_text)) (def: (random_sequence random) - (All [a] (-> (Random a) (Random (List a)))) + (All (_ a) (-> (Random a) (Random (List a)))) (do {! random.monad} [size (|> random.nat (\ ! each (n.% 3)))] (random.list size random))) (def: (random_record random) - (All [a] (-> (Random a) (Random (List [a a])))) + (All (_ a) (-> (Random a) (Random (List [a a])))) (do {! random.monad} [size (|> random.nat (\ ! each (n.% 3)))] (random.list size (random.and random random)))) diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index 8d4e69ab7..037563d64 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -29,7 +29,7 @@ ["#" modulus]]]]) (def: .public (random modulus) - (All [%] (-> (//.Modulus %) (Random (/.Mod %)))) + (All (_ %) (-> (//.Modulus %) (Random (/.Mod %)))) (\ random.monad each (/.modular modulus) random.int)) diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 54ceeac1d..018fcf73a 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -26,7 +26,7 @@ _ (.int divisor))))))) (def: .public (random range) - (Ex [%] (-> Int (Random (/.Modulus %)))) + (Ex (_ %) (-> Int (Random (/.Modulus %)))) (|> random.int (\ random.monad each (i.% range)) (random.one (|>> /.modulus try.maybe)))) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 851da2db3..6b7e84972 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -135,7 +135,7 @@ .int ++)] expected (\ ! each (i.% limit) random.int) - .let [random (: (All [size] + .let [random (: (All (_ size) (-> (-> I64 (I64 size)) (Random (I64 size)))) (function (_ narrow) (\ random.functor each narrow random.i64)))]] diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux index c9a0f6946..772a403ad 100644 --- a/stdlib/source/test/lux/meta/annotation.lux +++ b/stdlib/source/test/lux/meta/annotation.lux @@ -34,13 +34,13 @@ (random.ascii/alpha 1))) (def: (random_sequence random) - (All [a] (-> (Random a) (Random (List a)))) + (All (_ a) (-> (Random a) (Random (List a)))) (do {! random.monad} [size (|> random.nat (\ ! each (nat.% 3)))] (random.list size random))) (def: (random_record random) - (All [a] (-> (Random a) (Random (List [a a])))) + (All (_ a) (-> (Random a) (Random (List [a a])))) (do {! random.monad} [size (|> random.nat (\ ! each (nat.% 3)))] (random.list size (random.and random random)))) diff --git a/stdlib/source/test/lux/static.lux b/stdlib/source/test/lux/static.lux index d54751f43..15f1ab316 100644 --- a/stdlib/source/test/lux/static.lux +++ b/stdlib/source/test/lux/static.lux @@ -2,6 +2,7 @@ [library [lux #* ["_" test (#+ Test)] + ["@" target] ["." meta] [data ["." text ("#\." equivalence) @@ -21,56 +22,57 @@ (def: .public test Test (<| (_.covering /._) - (_.for [meta.eval]) - (`` ($_ _.and - (~~ (template [<static> <random> <=> <+> <tag>] - [(_.cover [<static> <random>] - (with_expansions [<left> (<random>) - <right> (<random>) - <l+r> (<static> (<+> <left> <right>))] - (case (' <l+r>) - [_ (<tag> l+r)] - (<=> l+r (<+> <left> <right>)) + (for {@.old (_.test "PLACEHOLDER" true)} + (_.for [meta.eval] + (`` ($_ _.and + (~~ (template [<static> <random> <=> <+> <tag>] + [(_.cover [<static> <random>] + (with_expansions [<left> (<random>) + <right> (<random>) + <l+r> (<static> (<+> <left> <right>))] + (case (' <l+r>) + [_ (<tag> l+r)] + (<=> l+r (<+> <left> <right>)) - _ - false)))] + _ + false)))] - [/.nat /.random_nat n.= n.+ #.Nat] - [/.int /.random_int i.= i.+ #.Int] - [/.rev /.random_rev r.= r.+ #.Rev] - )) - (_.cover [/.frac /.random_frac] - (with_expansions [<left> (/.random_frac) - <right> (/.random_frac) - <l+r> (/.frac (f.+ <left> <right>))] - (case (' <l+r>) - [_ (#.Frac l+r)] - (or (f.= l+r (f.+ <left> <right>)) - (and (f.not_a_number? l+r) - (f.not_a_number? (f.+ <left> <right>)) - (or (f.not_a_number? <left>) - (f.not_a_number? <right>)))) + [/.nat /.random_nat n.= n.+ #.Nat] + [/.int /.random_int i.= i.+ #.Int] + [/.rev /.random_rev r.= r.+ #.Rev] + )) + (_.cover [/.frac /.random_frac] + (with_expansions [<left> (/.random_frac) + <right> (/.random_frac) + <l+r> (/.frac (f.+ <left> <right>))] + (case (' <l+r>) + [_ (#.Frac l+r)] + (or (f.= l+r (f.+ <left> <right>)) + (and (f.not_a_number? l+r) + (f.not_a_number? (f.+ <left> <right>)) + (or (f.not_a_number? <left>) + (f.not_a_number? <right>)))) - _ - false))) - (_.cover [/.text /.random] - (with_expansions [<left> (/.random code.text (random.ascii/alpha_num 1)) - <right> (/.random code.text (random.ascii/alpha_num 1)) - <l+r> (/.text (format <left> <right>))] - (case (' <l+r>) - [_ (#.Text l+r)] - (text\= l+r (format <left> <right>)) + _ + false))) + (_.cover [/.text /.random] + (with_expansions [<left> (/.random code.text (random.ascii/alpha_num 1)) + <right> (/.random code.text (random.ascii/alpha_num 1)) + <l+r> (/.text (format <left> <right>))] + (case (' <l+r>) + [_ (#.Text l+r)] + (text\= l+r (format <left> <right>)) - _ - false))) - (_.cover [/.literal] - (with_expansions [<left> (/.random code.text (random.ascii/alpha_num 1)) - <right> (/.random code.text (random.ascii/alpha_num 1)) - <l+r> (/.literal code.text (format <left> <right>))] - (case (' <l+r>) - [_ (#.Text l+r)] - (text\= l+r (format <left> <right>)) + _ + false))) + (_.cover [/.literal] + (with_expansions [<left> (/.random code.text (random.ascii/alpha_num 1)) + <right> (/.random code.text (random.ascii/alpha_num 1)) + <l+r> (/.literal code.text (format <left> <right>))] + (case (' <l+r>) + [_ (#.Text l+r)] + (text\= l+r (format <left> <right>)) - _ - false))) - )))) + _ + false))) + )))))) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 541e7c763..9494096f2 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -922,7 +922,7 @@ _ constructor _ ?length] $Long::wrap)))) - write_and_read (: (All [a] + write_and_read (: (All (_ a) (-> Nat (Bytecode Any) a (-> a (Bytecode Any)) [(Bytecode Any) (Bytecode Any) (Bytecode Any)] @@ -937,7 +937,7 @@ _ /.dup _ !index _ (literal value) _ *store _ /.dup _ !index _ *load] *wrap))))) - array (: (All [a] + array (: (All (_ a) (-> (Bytecode Any) (Random a) (-> a (Bytecode Any)) [(Bytecode Any) (Bytecode Any) (Bytecode Any)] (-> a Any Bit) @@ -1048,7 +1048,7 @@ (def: conversion Test - (let [conversion (: (All [a z] + (let [conversion (: (All (_ a z) (-> (Primitive a) (Primitive z) (Bytecode Any) (-> a z) (-> z Any Bit) (Random Bit))) (function (_ from to instruction convert test) (do random.monad @@ -1121,7 +1121,7 @@ (def: registry Test - (let [store_and_load (: (All [a] + (let [store_and_load (: (All (_ a) (-> (Random a) (-> a (Bytecode Any)) (Bytecode Any) [(-> Nat (Bytecode Any)) (-> Nat (Bytecode Any))] (-> a (-> Any Bit)) @@ -1317,7 +1317,7 @@ (def: return Test - (let [primitive_return (: (All [a] (-> (Primitive a) (Bytecode Any) (Maybe (-> a (Bytecode Any))) (-> a Any Bit) (Random Bit))) + (let [primitive_return (: (All (_ a) (-> (Primitive a) (Bytecode Any) (Maybe (-> a (Bytecode Any))) (-> a Any Bit) (Random Bit))) (function (_ primitive return substitute test) (do random.monad [class_name ..class_name 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 d87321459..57aa3ec5a 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 @@ -60,10 +60,10 @@ (<| (_.context (%.name (name_of /.function))) ($_ _.and (_.test "Can analyse function." - (and (|> (//type.with_type (All [a] (-> a outputT)) + (and (|> (//type.with_type (All (_ a) (-> a outputT)) (/.function _primitive.phase func_name arg_name archive.empty outputC)) _structure.check_succeeds) - (|> (//type.with_type (All [a] (-> a a)) + (|> (//type.with_type (All (_ a) (-> a a)) (/.function _primitive.phase func_name arg_name archive.empty g!arg)) _structure.check_succeeds))) (_.test "Generic functions can always be specialized." 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 4802c0910..6dd4bde12 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 @@ -41,7 +41,7 @@ (template [<name> <on_success> <on_error>] [(def: .public <name> - (All [a] (-> (Operation a) Bit)) + (All (_ a) (-> (Operation a) Bit)) (|>> (phase.result _primitive.state) (case> (#try.Success _) <on_success> @@ -78,7 +78,7 @@ false))) (def: (with_tags module tags type) - (All [a] (-> Text (List //module.Tag) Type (Operation a) (Operation [Module a]))) + (All (_ a) (-> Text (List //module.Tag) Type (Operation a) (Operation [Module a]))) (|>> (do phase.monad [_ (//module.declare_tags tags false type)]) (//module.with_module 0 module))) 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 f3eb32f4e..c39978c4f 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 @@ -181,7 +181,7 @@ #analysis.then (analysis.nat else)})]]))) (def: (random_five hash random_element) - (All [a] (-> (Hash a) (Random a) (Random [a a a a a]))) + (All (_ a) (-> (Hash a) (Random a) (Random [a a a a a]))) (|> random_element (random.set hash 5) (\ random.monad each (|>> set.list diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 4674890ca..57ea22d70 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -89,11 +89,11 @@ #0)) (def: injection - (Injection (All [a] (/.Check a))) + (Injection (All (_ a) (/.Check a))) (\ /.monad in)) (def: comparison - (Comparison (All [a] (/.Check a))) + (Comparison (All (_ a) (/.Check a))) (function (_ == left right) (case [(/.result /.fresh_context left) (/.result /.fresh_context right)] [(#try.Success left) (#try.Success right)] @@ -314,7 +314,7 @@ )) (def: succeeds? - (All [a] (-> (/.Check a) Bit)) + (All (_ a) (-> (/.Check a) Bit)) (|>> (/.result /.fresh_context) (case> (#try.Success _) true @@ -323,7 +323,7 @@ false))) (def: fails? - (All [a] (-> (/.Check a) Bit)) + (All (_ a) (-> (/.Check a) Bit)) (|>> ..succeeds? not)) @@ -334,14 +334,14 @@ (in (#.Primitive name (list))))) (def: (non_twins = random) - (All [a] (-> (-> a a Bit) (Random a) (Random [a a]))) + (All (_ a) (-> (-> a a Bit) (Random a) (Random [a a]))) (do random.monad [left random right (random.only (|>> (= left) not) random)] (in [left right]))) (type: Super - (Ex [sub] [Text sub])) + (Ex (_ sub) [Text sub])) (type: Sub (Super Bit)) @@ -403,7 +403,7 @@ functions_have_covariant_outputs!))) (def: (verdict check) - (All [_] (-> (/.Check _) (/.Check Bit))) + (All (_ _) (-> (/.Check _) (/.Check Bit))) (function (_ context) (#try.Success [context (case (check context) (#try.Success _) @@ -526,28 +526,28 @@ (def: (handles_quantification! nominal) (-> Type Bit) (let [universals_satisfy_themselves! - (..succeeds? (/.check (.type (All [a] (Maybe a))) - (.type (All [a] (Maybe a))))) + (..succeeds? (/.check (.type (All (_ a) (Maybe a))) + (.type (All (_ a) (Maybe a))))) existentials_satisfy_themselves! - (..succeeds? (/.check (.type (Ex [a] (Maybe a))) - (.type (Ex [a] (Maybe a))))) + (..succeeds? (/.check (.type (Ex (_ a) (Maybe a))) + (.type (Ex (_ a) (Maybe a))))) universals_satisfy_particulars! (..succeeds? (/.check (.type (Maybe nominal)) - (.type (All [a] (Maybe a))))) + (.type (All (_ a) (Maybe a))))) particulars_do_not_satisfy_universals! - (..fails? (/.check (.type (All [a] (Maybe a))) + (..fails? (/.check (.type (All (_ a) (Maybe a))) (.type (Maybe nominal)))) particulars_satisfy_existentials! - (..succeeds? (/.check (.type (Ex [a] (Maybe a))) + (..succeeds? (/.check (.type (Ex (_ a) (Maybe a))) (.type (Maybe nominal)))) existentials_do_not_satisfy_particulars! (..fails? (/.check (.type (Maybe nominal)) - (.type (Ex [a] (Maybe a)))))] + (.type (Ex (_ a) (Maybe a)))))] (and universals_satisfy_themselves! existentials_satisfy_themselves! @@ -585,26 +585,26 @@ (def: (handles_application! nominal/0 nominal/1) (-> Type Type Bit) (let [types_flow_through! - (and (..succeeds? (/.check (.type ((All [a] a) nominal/0)) + (and (..succeeds? (/.check (.type ((All (_ a) a) nominal/0)) nominal/0)) (..succeeds? (/.check nominal/0 - (.type ((All [a] a) nominal/0)))) + (.type ((All (_ a) a) nominal/0)))) - (..succeeds? (/.check (.type ((Ex [a] a) nominal/0)) + (..succeeds? (/.check (.type ((Ex (_ a) a) nominal/0)) nominal/0)) (..succeeds? (/.check nominal/0 - (.type ((Ex [a] a) nominal/0))))) + (.type ((Ex (_ a) a) nominal/0))))) multiple_parameters! - (and (..succeeds? (/.check (.type ((All [a b] [a b]) nominal/0 nominal/1)) + (and (..succeeds? (/.check (.type ((All (_ a b) [a b]) nominal/0 nominal/1)) (.type [nominal/0 nominal/1]))) (..succeeds? (/.check (.type [nominal/0 nominal/1]) - (.type ((All [a b] [a b]) nominal/0 nominal/1)))) + (.type ((All (_ a b) [a b]) nominal/0 nominal/1)))) - (..succeeds? (/.check (.type ((Ex [a b] [a b]) nominal/0 nominal/1)) + (..succeeds? (/.check (.type ((Ex (_ a b) [a b]) nominal/0 nominal/1)) (.type [nominal/0 nominal/1]))) (..succeeds? (/.check (.type [nominal/0 nominal/1]) - (.type ((Ex [a b] [a b]) nominal/0 nominal/1)))))] + (.type ((Ex (_ a b) [a b]) nominal/0 nominal/1)))))] (and types_flow_through! multiple_parameters!))) @@ -798,10 +798,10 @@ (Random Bit) (do random.monad [example ..clean_type] - (in (and (and (/.subsumes? (.type (List example)) (.type (All [a] (List a)))) - (not (/.subsumes? (.type (All [a] (List a))) (.type (List example))))) - (and (/.subsumes? (.type (Ex [a] (List a))) (.type (List example))) - (not (/.subsumes? (.type (List example)) (.type (Ex [a] (List a)))))))))) + (in (and (and (/.subsumes? (.type (List example)) (.type (All (_ a) (List a)))) + (not (/.subsumes? (.type (All (_ a) (List a))) (.type (List example))))) + (and (/.subsumes? (.type (Ex (_ a) (List a))) (.type (List example))) + (not (/.subsumes? (.type (List example)) (.type (Ex (_ a) (List a)))))))))) (def: for_subsumption|named (Random Bit) diff --git a/stdlib/source/test/lux/type/poly/json.lux b/stdlib/source/test/lux/type/poly/json.lux index 2a7c17814..9b6d5338a 100644 --- a/stdlib/source/test/lux/type/poly/json.lux +++ b/stdlib/source/test/lux/type/poly/json.lux @@ -85,7 +85,7 @@ gen_recursive))))) (def: qty - (All [unit] (Random (unit.Qty unit))) + (All (_ unit) (Random (unit.Qty unit))) (\ random.monad each (debug.private unit.in) random.int)) (def: gen_record diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux index 806187b03..dffce036a 100644 --- a/stdlib/source/test/lux/type/quotient.lux +++ b/stdlib/source/test/lux/type/quotient.lux @@ -17,7 +17,7 @@ ["." /]]) (def: .public (random class super) - (All [t c %] (-> (/.Class t c %) (Random t) (Random (/.Quotient t c %)))) + (All (_ t c %) (-> (/.Class t c %) (Random t) (Random (/.Quotient t c %)))) (\ random.monad each (/.quotient class) super)) (def: mod_10_class diff --git a/stdlib/source/test/lux/type/variance.lux b/stdlib/source/test/lux/type/variance.lux index b2a16a221..9126bd215 100644 --- a/stdlib/source/test/lux/type/variance.lux +++ b/stdlib/source/test/lux/type/variance.lux @@ -12,7 +12,7 @@ ["#." check]]]]) (type: Super - (Ex [sub] [Text sub])) + (Ex (_ sub) [Text sub])) (type: Sub (Super Bit)) |