diff options
Diffstat (limited to '')
24 files changed, 183 insertions, 183 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 6470e5c3b..0087a8d89 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -2095,7 +2095,7 @@ _ (fail "Wrong syntax for <|")})) -(def:''' #export (. f g) +(def:''' (compose f g) (list [(tag$ ["lux" "doc"]) (text$ "Function composition.")]) (All [a b c] @@ -2208,7 +2208,7 @@ (if (every? (function' [sample] ("lux nat =" num-bindings sample)) (map list/size data')) (|> data' - (join-map (. apply (make-env bindings'))) + (join-map (compose apply (make-env bindings'))) return) (fail "Irregular arguments tuples for do-template."))) @@ -5011,7 +5011,7 @@ (let [apply (: (-> RepEnv (List Code)) (function [env] (map (apply-template env) templates)))] (|> data' - (join-map (. apply (make-env bindings'))) + (join-map (compose apply (make-env bindings'))) wrap)) #;None))) (#Some output) @@ -5055,8 +5055,8 @@ [[_ _ column] (#Record pairs)] (list/fold n/min column - (list/compose (map (. find-baseline-column first) pairs) - (map (. find-baseline-column second) pairs))) + (list/compose (map (|>> first find-baseline-column) pairs) + (map (|>> second find-baseline-column) pairs))) )) (type: Doc-Fragment @@ -5100,7 +5100,7 @@ (def: tag/encode (-> Ident Text) - (. (text/compose "#") ident/encode)) + (|>> ident/encode (text/compose "#"))) (do-template [<name> <op> <from> <to>] [(def: #export (<name> input) @@ -5141,7 +5141,7 @@ (def: rejoin-all-pairs (-> (List [Code Code]) (List Code)) - (. list/join (map rejoin-pair))) + (|>> (map rejoin-pair) list/join)) (def: (doc-example->Text prev-cursor baseline example) (-> Cursor Nat Code [Cursor Text]) @@ -5212,7 +5212,7 @@ x)))"} (return (list (` [(~ cursor-code) (#;Text (~ (|> tokens - (map (. doc-fragment->Text identify-doc-fragment)) + (map (|>> identify-doc-fragment doc-fragment->Text)) text/join text$)))])))) diff --git a/stdlib/source/lux/control/codec.lux b/stdlib/source/lux/control/codec.lux index fdd571a10..6af4fda10 100644 --- a/stdlib/source/lux/control/codec.lux +++ b/stdlib/source/lux/control/codec.lux @@ -1,14 +1,14 @@ (;module: lux (lux (control monad) - (data ["E" error]))) + (data ["e" error]))) ## [Signatures] (sig: #export (Codec m a) {#;doc "A way to move back-and-forth between a type and an alternative representation for it."} (: (-> a m) encode) - (: (-> m (E;Error a)) + (: (-> m (e;Error a)) decode)) ## [Values] @@ -22,7 +22,7 @@ (:: Codec<c,b> encode))) (def: (decode cy) - (do E;Monad<Error> + (do e;Monad<Error> [by (:: Codec<c,b> decode cy)] (:: Codec<b,a> decode by))) ) diff --git a/stdlib/source/lux/control/cont.lux b/stdlib/source/lux/control/cont.lux index 81f62eccb..1d5576ca0 100644 --- a/stdlib/source/lux/control/cont.lux +++ b/stdlib/source/lux/control/cont.lux @@ -1,7 +1,7 @@ (;module: lux - (lux (control ["F" functor] - ["A" applicative] + (lux (control [functor #+ Functor] + [applicative #+ Applicative] monad) function [macro #+ with-gensyms] @@ -22,11 +22,11 @@ (All [a] (-> (Cont a a) a)) (cont id)) -(struct: #export Functor<Cont> (All [o] (F;Functor (All [i] (Cont i o)))) +(struct: #export Functor<Cont> (All [o] (Functor (All [i] (Cont i o)))) (def: (map f fv) - (function [k] (fv (. k f))))) + (function [k] (fv (compose k f))))) -(struct: #export Applicative<Cont> (All [o] (A;Applicative (All [i] (Cont i o)))) +(struct: #export Applicative<Cont> (All [o] (Applicative (All [i] (Cont i o)))) (def: functor Functor<Cont>) (def: (wrap value) diff --git a/stdlib/source/lux/control/functor.lux b/stdlib/source/lux/control/functor.lux index 3c1f33eb8..756cec583 100644 --- a/stdlib/source/lux/control/functor.lux +++ b/stdlib/source/lux/control/functor.lux @@ -14,7 +14,7 @@ (type: #export (<|> f g) (All [a] (| (f a) (g a)))) -(type: #export (<.> f g) +(type: #export (<$> f g) (All [a] (f (g a)))) (struct: #export (compose Functor<F> Functor<G>) diff --git a/stdlib/source/lux/data/bool.lux b/stdlib/source/lux/data/bool.lux index c5b345ce1..e737c6118 100644 --- a/stdlib/source/lux/data/bool.lux +++ b/stdlib/source/lux/data/bool.lux @@ -3,7 +3,8 @@ (lux (control [monoid #+ Monoid] [eq #+ Eq] hash - codec))) + [codec #+ Codec]) + function)) ## [Structures] (struct: #export _ (Eq Bool) @@ -46,4 +47,4 @@ {#;doc "Generates the complement of a predicate. That is a predicate that returns the oposite of the original predicate."} (All [a] (-> (-> a Bool) (-> a Bool))) - (. not)) + (compose not)) diff --git a/stdlib/source/lux/data/coll/array.lux b/stdlib/source/lux/data/coll/array.lux index 1eeb1342c..ac15bfe9d 100644 --- a/stdlib/source/lux/data/coll/array.lux +++ b/stdlib/source/lux/data/coll/array.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monoid + (lux (control [monoid #+ Monoid] [functor #+ Functor] [eq #+ Eq] fold) diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux index 6de9eeaa2..28deea034 100644 --- a/stdlib/source/lux/data/coll/list.lux +++ b/stdlib/source/lux/data/coll/list.lux @@ -1,12 +1,12 @@ (;module: lux (lux (control [monoid #+ Monoid] - ["F" functor] - ["A" applicative] - ["M" monad #+ do Monad] + [functor #+ Functor] + [applicative #+ Applicative] + [monad #+ do Monad] [eq #+ Eq] [fold]) - (data [number "Nat/" Codec<Text,Nat>] + (data [number "nat/" Codec<Text,Nat>] bool [product]))) @@ -260,7 +260,7 @@ (open Monoid<List>) -(struct: #export _ (F;Functor List) +(struct: #export _ (Functor List) (def: (map f ma) (case ma #;Nil #;Nil @@ -268,7 +268,7 @@ (open Functor<List>) -(struct: #export _ (A;Applicative List) +(struct: #export _ (Applicative List) (def: functor Functor<List>) (def: (wrap a) @@ -358,7 +358,7 @@ (if (n/> +0 num-lists) (let [(^open) Functor<List> indices (n/range +0 (n/dec num-lists)) - type-vars (: (List Code) (map (. symbol$ Nat/encode) indices)) + type-vars (: (List Code) (map (|>> nat/encode symbol$) indices)) zip-type (` (All [(~@ type-vars)] (-> (~@ (map (: (-> Code Code) (function [var] (` (List (~ var))))) type-vars)) @@ -366,7 +366,7 @@ vars+lists (|> indices (map n/inc) (map (function [idx] - (let [base (Nat/encode idx)] + (let [base (nat/encode idx)] [(symbol$ base) (symbol$ ("lux text concat" base "'"))])))) pattern (` [(~@ (map (function [[v vs]] (` (#;Cons (~ v) (~ vs)))) @@ -404,7 +404,7 @@ indices (n/range +0 (n/dec num-lists)) g!return-type (symbol$ "\treturn-type\t") g!func (symbol$ "\tfunc\t") - type-vars (: (List Code) (map (. symbol$ Nat/encode) indices)) + type-vars (: (List Code) (map (|>> nat/encode symbol$) indices)) zip-type (` (All [(~@ type-vars) (~ g!return-type)] (-> (-> (~@ type-vars) (~ g!return-type)) (~@ (map (: (-> Code Code) (function [var] (` (List (~ var))))) @@ -413,7 +413,7 @@ vars+lists (|> indices (map n/inc) (map (function [idx] - (let [base (Nat/encode idx)] + (let [base (nat/encode idx)] [(symbol$ base) (symbol$ ("lux text concat" base "'"))])))) pattern (` [(~@ (map (function [[v vs]] (` (#;Cons (~ v) (~ vs)))) @@ -478,19 +478,19 @@ (struct: #export (ListT Monad<M>) (All [M] (-> (Monad M) (Monad (All [a] (M (List a)))))) - (def: applicative (A;compose (get@ #M;applicative Monad<M>) Applicative<List>)) + (def: applicative (applicative;compose (get@ #monad;applicative Monad<M>) Applicative<List>)) (def: (join MlMla) (do Monad<M> [lMla MlMla lla (: (($ +0) (List (List ($ +1)))) - (M;seq @ lMla)) - ## lla (M;seq @ lMla) + (monad;seq @ lMla)) + ## lla (monad;seq @ lMla) ] (wrap (concat lla))))) (def: #export (lift Monad<M>) (All [M a] (-> (Monad M) (-> (M a) (M (List a))))) - (M;lift Monad<M> (:: Monad<List> wrap))) + (monad;lift Monad<M> (:: Monad<List> wrap))) (def: (enumerate' idx xs) (All [a] (-> Nat (List a) (List [Nat a]))) diff --git a/stdlib/source/lux/data/coll/ordered/set.lux b/stdlib/source/lux/data/coll/ordered/set.lux index 376624033..a8f5ed45d 100644 --- a/stdlib/source/lux/data/coll/ordered/set.lux +++ b/stdlib/source/lux/data/coll/ordered/set.lux @@ -69,7 +69,7 @@ (def: #export (difference param subject) (All [a] (-> (Set a) (Set a) (Set a))) (|> (to-list subject) - (list;filter (. not (member? param))) + (list;filter (|>> (member? param) not)) (from-list (get@ #d;order subject)))) (def: #export (sub? super sub) diff --git a/stdlib/source/lux/data/ident.lux b/stdlib/source/lux/data/ident.lux index 24fe97221..57e742433 100644 --- a/stdlib/source/lux/data/ident.lux +++ b/stdlib/source/lux/data/ident.lux @@ -1,9 +1,9 @@ (;module: lux (lux (control [eq #+ Eq] - codec + [codec #+ Codec] hash) - (data [text "Text/" Monoid<Text> Eq<Text>]))) + (data [text "text/" Monoid<Text> Eq<Text>]))) ## [Types] ## (type: Ident @@ -22,18 +22,18 @@ ## [Structures] (struct: #export _ (Eq Ident) (def: (= [xmodule xname] [ymodule yname]) - (and (Text/= xmodule ymodule) - (Text/= xname yname)))) + (and (text/= xmodule ymodule) + (text/= xname yname)))) (struct: #export _ (Codec Text Ident) (def: (encode [module name]) (case module "" name - _ ($_ Text/compose module ";" name))) + _ ($_ text/compose module ";" name))) (def: (decode input) - (if (Text/= "" input) - (#;Left (Text/compose "Invalid format for Ident: " input)) + (if (text/= "" input) + (#;Left (text/compose "Invalid format for Ident: " input)) (case (text;split-all-with ";" input) (^ (list name)) (#;Right ["" name]) @@ -42,7 +42,7 @@ (#;Right [module name]) _ - (#;Left (Text/compose "Invalid format for Ident: " input)))))) + (#;Left (text/compose "Invalid format for Ident: " input)))))) (struct: #export _ (Hash Ident) (def: eq Eq<Ident>) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 8e330e9d5..de8ba5242 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -7,7 +7,7 @@ [order] enum interval - codec) + [codec #+ Codec]) (data ["e" error] [maybe] [bit]))) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 534901e98..bf05df201 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -3,8 +3,8 @@ (lux (control [monoid #+ Monoid] [eq #+ Eq] [order] - ["M" monad #+ do Monad] - codec + [monad #+ do Monad] + [codec #+ Codec] hash) (data (coll [list]) [maybe]))) diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 37cb091ee..4dccf7855 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -5,11 +5,11 @@ (data [text] ["l" text/lexer] text/format - [number "Int/" Codec<Text,Int>] + [number "int/" Codec<Text,Int>] [product] - ["E" error] + ["e" error] [maybe] - (coll [list "L/" Fold<List> Monad<List>])) + (coll [list "list/" Fold<List> Monad<List>])) [macro #- run] (macro [code] ["s" syntax #+ syntax:]))) @@ -112,10 +112,10 @@ [_ (wrap []) init re-user-class^' rest (p;some (p;after (l;this "&&") (l;enclosed ["[" "]"] re-user-class^')))] - (wrap (L/fold (function [refinement base] - (` (refine^ (~ refinement) (~ base)))) - init - rest)))) + (wrap (list/fold (function [refinement base] + (` (refine^ (~ refinement) (~ base)))) + init + rest)))) (def: #hidden blank^ (l;Lexer Text) @@ -188,7 +188,7 @@ (p;either (do p;Monad<Parser> [_ (l;this "\\") id number^] - (wrap (` (;;copy (~ (code;symbol ["" (Int/encode (nat-to-int id))])))))) + (wrap (` (;;copy (~ (code;symbol ["" (int/encode (nat-to-int id))])))))) (do p;Monad<Parser> [_ (l;this "\\k<") captured-name identifier-part^ @@ -253,7 +253,7 @@ (re-quantified^ current-module) (re-simple^ current-module))) -(def: #hidden _Text/compose_ +(def: #hidden _text/compose_ (-> Text Text Text) (:: text;Monoid<Text> compose)) @@ -271,44 +271,44 @@ (re-scoped^ current-module))) #let [g!total (code;symbol ["" "0total"]) g!temp (code;symbol ["" "0temp"]) - [_ names steps] (L/fold (: (-> (Either Code [Re-Group Code]) - [Int (List Code) (List (List Code))] - [Int (List Code) (List (List Code))]) - (function [part [idx names steps]] - (case part - (^or (#E;Error complex) (#E;Success [#Non-Capturing complex])) - [idx - names - (list& (list g!temp complex - (' #let) (` [(~ g!total) (_Text/compose_ (~ g!total) (~ g!temp))])) - steps)] - - (#E;Success [(#Capturing [?name num-captures]) scoped]) - (let [[idx! name!] (case ?name - (#;Some _name) - [idx (code;symbol ["" _name])] - - #;None - [(i/inc idx) (code;symbol ["" (Int/encode idx)])]) - access (if (n/> +0 num-captures) - (` (product;left (~ name!))) - name!)] - [idx! - (list& name! names) - (list& (list name! scoped - (' #let) (` [(~ g!total) (_Text/compose_ (~ g!total) (~ access))])) - steps)]) - ))) - [0 - (: (List Code) (list)) - (: (List (List Code)) (list))] - parts)]] + [_ names steps] (list/fold (: (-> (Either Code [Re-Group Code]) + [Int (List Code) (List (List Code))] + [Int (List Code) (List (List Code))]) + (function [part [idx names steps]] + (case part + (^or (#e;Error complex) (#e;Success [#Non-Capturing complex])) + [idx + names + (list& (list g!temp complex + (' #let) (` [(~ g!total) (_text/compose_ (~ g!total) (~ g!temp))])) + steps)] + + (#e;Success [(#Capturing [?name num-captures]) scoped]) + (let [[idx! name!] (case ?name + (#;Some _name) + [idx (code;symbol ["" _name])] + + #;None + [(i/inc idx) (code;symbol ["" (int/encode idx)])]) + access (if (n/> +0 num-captures) + (` (product;left (~ name!))) + name!)] + [idx! + (list& name! names) + (list& (list name! scoped + (' #let) (` [(~ g!total) (_text/compose_ (~ g!total) (~ access))])) + steps)]) + ))) + [0 + (: (List Code) (list)) + (: (List (List Code)) (list))] + parts)]] (wrap [(if capturing? (list;size names) +0) (` (do p;Monad<Parser> [(~ (' #let)) [(~ g!total) ""] - (~@ (|> steps list;reverse L/join))] + (~@ (|> steps list;reverse list/join))] ((~ (' wrap)) [(~ g!total) (~@ (list;reverse names))])))]) )) @@ -320,31 +320,31 @@ (All [l r] (-> (l;Lexer [Text l]) (l;Lexer [Text r]) (l;Lexer [Text (| l r)]))) (function [input] (case (left input) - (#E;Success [input' [lt lv]]) - (#E;Success [input' [lt (+0 lv)]]) + (#e;Success [input' [lt lv]]) + (#e;Success [input' [lt (+0 lv)]]) - (#E;Error _) + (#e;Error _) (case (right input) - (#E;Success [input' [rt rv]]) - (#E;Success [input' [rt (+1 rv)]]) + (#e;Success [input' [rt rv]]) + (#e;Success [input' [rt (+1 rv)]]) - (#E;Error error) - (#E;Error error))))) + (#e;Error error) + (#e;Error error))))) (def: #hidden (|||_^ left right) (All [l r] (-> (l;Lexer [Text l]) (l;Lexer [Text r]) (l;Lexer Text))) (function [input] (case (left input) - (#E;Success [input' [lt lv]]) - (#E;Success [input' lt]) + (#e;Success [input' [lt lv]]) + (#e;Success [input' lt]) - (#E;Error _) + (#e;Error _) (case (right input) - (#E;Success [input' [rt rv]]) - (#E;Success [input' rt]) + (#e;Success [input' [rt rv]]) + (#e;Success [input' rt]) - (#E;Error error) - (#E;Error error))))) + (#e;Error error) + (#e;Error error))))) (def: (prep-alternative [num-captures alt]) (-> [Nat Code] Code) @@ -366,8 +366,8 @@ (` |||_^))]] (if (list;empty? tail) (wrap head) - (wrap [(L/fold n/max (product;left head) (L/map product;left tail)) - (` ($_ (~ g!op) (~ (prep-alternative head)) (~@ (L/map prep-alternative tail))))])))) + (wrap [(list/fold n/max (product;left head) (list/map product;left tail)) + (` ($_ (~ g!op) (~ (prep-alternative head)) (~@ (list/map prep-alternative tail))))])))) (def: (re-scoped^ current-module) (-> Text (l;Lexer [Re-Group Code])) @@ -462,11 +462,11 @@ (case (|> (regex^ current-module) (p;before l;end) (l;run pattern)) - (#E;Error error) + (#e;Error error) (macro;fail (format "Error while parsing regular-expression:\n" error)) - (#E;Success regex) + (#e;Success regex) (wrap (list regex)) ))) @@ -488,7 +488,7 @@ [g!temp (macro;gensym "temp")] (wrap (list& (` (^multi (~ g!temp) [(l;run (~ g!temp) (regex (~ (code;text pattern)))) - (#E;Success (~ (maybe;default g!temp + (#e;Success (~ (maybe;default g!temp bindings)))])) body branches)))) diff --git a/stdlib/source/lux/data/trace.lux b/stdlib/source/lux/data/trace.lux index acb059dc0..d34ab0a0a 100644 --- a/stdlib/source/lux/data/trace.lux +++ b/stdlib/source/lux/data/trace.lux @@ -1,23 +1,24 @@ (;module: lux - (lux (control ["m" monoid] - ["F" functor] - comonad))) + (lux (control [monoid #+ Monoid] + [functor #+ Functor] + comonad) + function)) (type: #export (Trace t a) - {#monoid (m;Monoid t) + {#monoid (Monoid t) #trace (-> t a)}) -(struct: #export Functor<Trace> (All [t] (F;Functor (Trace t))) +(struct: #export Functor<Trace> (All [t] (Functor (Trace t))) (def: (map f fa) - (update@ #trace (. f) fa))) + (update@ #trace (compose f) fa))) (struct: #export CoMonad<Trace> (All [t] (CoMonad (Trace t))) (def: functor Functor<Trace>) (def: (unwrap wa) ((get@ #trace wa) - (get@ [#monoid #m;identity] wa))) + (get@ [#monoid #monoid;identity] wa))) (def: (split wa) (let [monoid (get@ #monoid wa)] diff --git a/stdlib/source/lux/function.lux b/stdlib/source/lux/function.lux index 1872b3085..a6df64891 100644 --- a/stdlib/source/lux/function.lux +++ b/stdlib/source/lux/function.lux @@ -1,8 +1,13 @@ (;module: lux - (lux (control monoid))) + (lux (control [monoid #+ Monoid]))) + +(def: #export (compose f g) + {#;doc "Function composition."} + (All [a b c] + (-> (-> b c) (-> a b) (-> a c))) + (|>> g f)) -## [Functions] (def: #export (const c) {#;doc "Create constant functions."} (All [a b] (-> a (-> b a))) @@ -14,7 +19,6 @@ (-> (-> a b c) (-> b a c))) (function [x y] (f y x))) -## [Structures] (struct: #export Monoid<Function> (Monoid (All [a] (-> a a))) (def: identity id) - (def: compose .)) + (def: compose ;;compose)) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 200ae1ec3..de67b2a64 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -4,6 +4,7 @@ [enum] ["p" parser]) [io #+ IO Monad<IO> io] + function (data (coll [list "list/" Monad<List> Fold<List> Monoid<List>]) number [maybe] @@ -576,7 +577,7 @@ (do p;Monad<Parser> [[_ args] (: (Syntax [Unit (List Code)]) (s;form ($_ p;seq (s;this (' ::new!)) (s;tuple (p;exactly (list;size arg-decls) s;any))))) - #let [arg-decls' (: (List Text) (list/map (. (simple-class$ params) product;right) arg-decls))]] + #let [arg-decls' (: (List Text) (list/map (|>> product;right (simple-class$ params)) arg-decls))]] (wrap (` ((~ (code;text (format "jvm new" ":" class-name ":" (text;join-with "," arg-decls')))) (~@ args)))))) @@ -586,7 +587,7 @@ [#let [dotted-name (format "::" method-name "!")] [_ args] (: (Syntax [Unit (List Code)]) (s;form ($_ p;seq (s;this (code;symbol ["" dotted-name])) (s;tuple (p;exactly (list;size arg-decls) s;any))))) - #let [arg-decls' (: (List Text) (list/map (. (simple-class$ params) product;right) arg-decls))]] + #let [arg-decls' (: (List Text) (list/map (|>> product;right (simple-class$ params)) arg-decls))]] (wrap (`' ((~ (code;text (format "jvm invokestatic" ":" class-name ":" method-name ":" (text;join-with "," arg-decls')))) (~@ args)))))) @@ -597,7 +598,7 @@ [#let [dotted-name (format "::" method-name "!")] [_ args] (: (Syntax [Unit (List Code)]) (s;form ($_ p;seq (s;this (code;symbol ["" dotted-name])) (s;tuple (p;exactly (list;size arg-decls) s;any))))) - #let [arg-decls' (: (List Text) (list/map (. (simple-class$ params) product;right) arg-decls))]] + #let [arg-decls' (: (List Text) (list/map (|>> product;right (simple-class$ params)) arg-decls))]] (wrap (`' ((~ (code;text (format <jvm-op> ":" class-name ":" method-name ":" (text;join-with "," arg-decls')))) (~' _jvm_this) (~@ args))))))] @@ -1202,7 +1203,7 @@ (let [super-replacer (parser->replacer (s;form (do p;Monad<Parser> [_ (s;this (' ::super!)) args (s;tuple (p;exactly (list;size arg-decls) s;any)) - #let [arg-decls' (: (List Text) (list/map (. (simple-class$ (list)) product;right) + #let [arg-decls' (: (List Text) (list/map (|>> product;right (simple-class$ (list))) arg-decls))]] (wrap (`' ((~ (code;text (format "jvm invokespecial" ":" (get@ #super-class-name super-class) ":" name ":" (text;join-with "," arg-decls')))) (~' _jvm_this) (~@ args)))))))] diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 8040d6ea5..dcf509e65 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -656,14 +656,14 @@ token)) (do Monad<Meta> [output (<func> token) - #let [_ (list/map (. log! code;to-text) + #let [_ (list/map (|>> code;to-text log!) output)]] (wrap (list))) (^ (list token)) (do Monad<Meta> [output (<func> token) - #let [_ (list/map (. log! code;to-text) + #let [_ (list/map (|>> code;to-text log!) output)]] (wrap output)) diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 4e3c9e161..fd772c103 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -1,12 +1,12 @@ (;module: lux - (lux (control ["M" monad #+ do Monad] + (lux (control [monad #+ do Monad] [eq] ["p" parser]) - (data [text "Text/" Eq<Text>] + (data [text "text/" Eq<Text>] text/format [number] - (coll [list "List/" Monad<List> Fold<List>] + (coll [list "list/" Monad<List> Fold<List>] [dict]) [bool] [product] @@ -84,9 +84,9 @@ (do Monad<Meta> [this-module-name macro;current-module-name imp-mods (macro;imported-modules this-module-name) - tag-lists (M;map @ macro;tag-lists imp-mods) - #let [tag-lists (|> tag-lists List/join (List/map product;left) List/join) - candidates (list;filter (. (Text/= simple-name) product;right) + tag-lists (monad;map @ macro;tag-lists imp-mods) + #let [tag-lists (|> tag-lists list/join (list/map product;left) list/join) + candidates (list;filter (|>> product;right (text/= simple-name)) tag-lists)]] (case candidates #;Nil @@ -113,21 +113,21 @@ (|> defs (list;filter (function [[name [def-type def-anns def-value]]] (macro;struct? def-anns))) - (List/map (function [[name [def-type def-anns def-value]]] + (list/map (function [[name [def-type def-anns def-value]]] [[this-module-name name] def-type])))) (def: local-env (Meta (List [Ident Type])) (do Monad<Meta> [local-batches macro;locals - #let [total-locals (List/fold (function [[name type] table] + #let [total-locals (list/fold (function [[name type] table] (dict;put~ name type table)) (: (dict;Dict Text Type) (dict;new text;Hash<Text>)) - (List/join local-batches))]] + (list/join local-batches))]] (wrap (|> total-locals dict;entries - (List/map (function [[name type]] [["" name] type])))))) + (list/map (function [[name type]] [["" name] type])))))) (def: local-structs (Meta (List [Ident Type])) @@ -141,12 +141,12 @@ (do Monad<Meta> [this-module-name macro;current-module-name imp-mods (macro;imported-modules this-module-name) - export-batches (M;map @ (function [imp-mod] - (do @ - [exports (macro;exports imp-mod)] - (wrap (prepare-defs imp-mod exports)))) - imp-mods)] - (wrap (List/join export-batches)))) + export-batches (monad;map @ (function [imp-mod] + (do @ + [exports (macro;exports imp-mod)] + (wrap (prepare-defs imp-mod exports)))) + imp-mods)] + (wrap (list/join export-batches)))) (def: (apply-function-type func arg) (-> Type Type (Check Type)) @@ -184,11 +184,11 @@ (def: (check-apply member-type input-types output-type) (-> Type (List Type) Type (Check [])) (do Monad<Check> - [member-type' (M;fold Monad<Check> - (function [input member] - (apply-function-type member input)) - member-type - input-types)] + [member-type' (monad;fold Monad<Check> + (function [input member] + (apply-function-type member input)) + member-type + input-types)] (tc;check output-type member-type'))) (type: #rec Instance @@ -202,21 +202,21 @@ (do Monad<Meta> [compiler macro;get-compiler] (case (|> alts - (List/map (function [[alt-name alt-type]] + (list/map (function [[alt-name alt-type]] (case (tc;run context (do Monad<Check> [[tvars alt-type] (concrete-type alt-type) #let [[deps alt-type] (type;flatten-function alt-type)] _ (tc;check dep alt-type) context' tc;get-context - =deps (M;map @ (provision compiler context') deps)] + =deps (monad;map @ (provision compiler context') deps)] (wrap =deps))) (#;Left error) (list) (#;Right =deps) (list [alt-name =deps])))) - List/join) + list/join) #;Nil (macro;fail (format "No candidates for provisioning: " (%type dep))) @@ -242,7 +242,7 @@ (:: Monad<Check> wrap winner) _ - (tc;fail (format "Too many candidates for provisioning: " (%type dep) " --- " (%list (. %ident product;left) candidates)))) + (tc;fail (format "Too many candidates for provisioning: " (%type dep) " --- " (%list (|>> product;left %ident) candidates)))) )) (def: (test-alternatives sig-type member-idx input-types output-type alts) @@ -251,7 +251,7 @@ [compiler macro;get-compiler context macro;type-context] (case (|> alts - (List/map (function [[alt-name alt-type]] + (list/map (function [[alt-name alt-type]] (case (tc;run context (do Monad<Check> [[tvars alt-type] (concrete-type alt-type) @@ -260,14 +260,14 @@ member-type (find-member-type member-idx alt-type) _ (check-apply member-type input-types output-type) context' tc;get-context - =deps (M;map @ (provision compiler context') deps)] + =deps (monad;map @ (provision compiler context') deps)] (wrap =deps))) (#;Left error) (list) (#;Right =deps) (list [alt-name =deps])))) - List/join) + list/join) #;Nil (macro;fail (format "No alternatives for " (%type (type;function input-types output-type)))) @@ -302,7 +302,7 @@ (code;symbol constructor) _ - (` ((~ (code;symbol constructor)) (~@ (List/map instance$ dependencies)))))) + (` ((~ (code;symbol constructor)) (~@ (list/map instance$ dependencies)))))) (syntax: #export (::: [member s;symbol] [args (p;alt (p;seq (p;some s;symbol) s;end!) @@ -334,7 +334,7 @@ (#;Left [args _]) (do @ [[member-idx sig-type] (resolve-member member) - input-types (M;map @ resolve-type args) + input-types (monad;map @ resolve-type args) output-type macro;expected-type chosen-ones (find-alternatives sig-type member-idx input-types output-type)] (case chosen-ones @@ -344,20 +344,20 @@ (#;Cons chosen #;Nil) (wrap (list (` (:: (~ (instance$ chosen)) (~ (code;local-symbol (product;right member))) - (~@ (List/map code;symbol args)))))) + (~@ (list/map code;symbol args)))))) _ (macro;fail (format "Too many options available: " (|> chosen-ones - (List/map (. %ident product;left)) + (list/map (|>> product;left %ident)) (text;join-with ", ")) " --- for type: " (%type sig-type))))) (#;Right [args _]) (do @ - [labels (M;seq @ (list;repeat (list;size args) - (macro;gensym ""))) - #let [retry (` (let [(~@ (|> (list;zip2 labels args) (List/map join-pair) List/join))] + [labels (monad;seq @ (list;repeat (list;size args) + (macro;gensym ""))) + #let [retry (` (let [(~@ (|> (list;zip2 labels args) (list/map join-pair) list/join))] (;;::: (~ (code;symbol member)) (~@ labels))))]] (wrap (list retry))) )) diff --git a/stdlib/test/test/lux/data/coll/queue.lux b/stdlib/test/test/lux/data/coll/queue.lux index 1a6f884cf..4e9d00093 100644 --- a/stdlib/test/test/lux/data/coll/queue.lux +++ b/stdlib/test/test/lux/data/coll/queue.lux @@ -13,7 +13,7 @@ [size (:: @ map (n/% +100) r;nat) sample (r;queue size r;nat) non-member (|> r;nat - (r;filter (. not (&;member? number;Eq<Nat> sample))))] + (r;filter (|>> (&;member? number;Eq<Nat> sample) not)))] ($_ seq (test "I can query the size of a queue (and empty queues have size 0)." (if (n/= +0 size) diff --git a/stdlib/test/test/lux/data/coll/sequence.lux b/stdlib/test/test/lux/data/coll/sequence.lux index 222feeacc..28660cc6f 100644 --- a/stdlib/test/test/lux/data/coll/sequence.lux +++ b/stdlib/test/test/lux/data/coll/sequence.lux @@ -3,9 +3,7 @@ (lux [io] (control [monad #+ do Monad]) (data (coll ["&" sequence] - [list "List/" Fold<List> Functor<List>]) - [text "Text/" Monoid<Text>] - text/format + [list "list/" Fold<List>]) [number] [maybe]) ["r" math/random]) @@ -18,7 +16,7 @@ idx (|> r;nat (:: @ map (n/% size))) sample (r;sequence size r;nat) other-sample (r;sequence size r;nat) - non-member (|> r;nat (r;filter (. not (&;member? number;Eq<Nat> sample)))) + non-member (|> r;nat (r;filter (|>> (&;member? number;Eq<Nat> sample) not))) #let [(^open "&/") (&;Eq<Sequence> number;Eq<Nat>) (^open "&/") &;Monad<Sequence> (^open "&/") &;Fold<Sequence> @@ -55,7 +53,7 @@ (&;member? number;Eq<Nat> (&;add non-member sample) non-member))) (test "Can fold over elements of sequence." - (n/= (List/fold n/+ +0 (&;to-list sample)) + (n/= (list/fold n/+ +0 (&;to-list sample)) (&/fold n/+ +0 sample))) (test "Functor goes over every element." diff --git a/stdlib/test/test/lux/data/coll/set.lux b/stdlib/test/test/lux/data/coll/set.lux index 48b0905fa..e4a0b2ad1 100644 --- a/stdlib/test/test/lux/data/coll/set.lux +++ b/stdlib/test/test/lux/data/coll/set.lux @@ -21,7 +21,7 @@ setL (r;set number;Hash<Nat> sizeL gen-nat) setR (r;set number;Hash<Nat> sizeR gen-nat) non-member (|> gen-nat - (r;filter (. not (&;member? setL)))) + (r;filter (|>> (&;member? setL) not))) #let [(^open "&/") &;Eq<Set>]] ($_ seq (test "I can query the size of a set." diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index a096892ca..1f0554832 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -1,17 +1,17 @@ (;module: lux (lux [io] - (control ["M" monad #+ do Monad] + (control [monad #+ do Monad] pipe) (data ["&" ident] - [text "Text/" Eq<Text>] + [text "text/" Eq<Text>] text/format) ["r" math/random]) lux/test) (def: (gen-part size) (-> Nat (r;Random Text)) - (|> (r;text size) (r;filter (. not (text;contains? ";"))))) + (|> (r;text size) (r;filter (|>> (text;contains? ";") not)))) (context: "Idents" (<| (times +100) @@ -38,10 +38,10 @@ (test "Can compare idents for equality." (and (&/= ident1 ident1) (if (&/= ident1 ident2) - (and (Text/= module1 module2) - (Text/= name1 name2)) - (or (not (Text/= module1 module2)) - (not (Text/= name1 name2)))))) + (and (text/= module1 module2) + (text/= name1 name2)) + (or (not (text/= module1 module2)) + (not (text/= name1 name2)))))) (test "Can encode idents as text." (|> ident1 @@ -51,7 +51,7 @@ (test "Encoding an ident without a module component results in text equal to the name of the ident." (if (text;empty? module1) - (Text/= name1 (&/encode ident1)) + (text/= name1 (&/encode ident1)) true)) )))) diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux index cd6657f8a..c6fb2ac68 100644 --- a/stdlib/test/test/lux/data/number/ratio.lux +++ b/stdlib/test/test/lux/data/number/ratio.lux @@ -3,12 +3,7 @@ (lux [io] (control [monad #+ do Monad] pipe) - (data [text "Text/" Monoid<Text>] - text/format - [bool "b/" Eq<Bool>] - ["&" number/ratio "&/" Number<Ratio>] - (coll [list "List/" Fold<List> Functor<List>]) - [product]) + (data ["&" number/ratio "&/" Number<Ratio>]) ["r" math/random]) lux/test) @@ -22,7 +17,7 @@ [numerator gen-part denominator (|> gen-part (r;filter (|>> (n/= +0) not)) - (r;filter (. not (n/= numerator))))] + (r;filter (|>> (n/= numerator) not)))] (wrap (&;ratio numerator denominator)))) (context: "Normalization" diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index 2091bf8ba..ea6c1185b 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -108,7 +108,7 @@ sep1 (r;text' normal-char-gen +1) sep2 (r;text' normal-char-gen +1) #let [part-gen (|> (r;text' normal-char-gen sizeP) - (r;filter (. not (&;contains? sep1))))] + (r;filter (|>> (&;contains? sep1) not)))] parts (r;list sizeL part-gen) #let [sample1 (&;concat (list;interpose sep1 parts)) sample2 (&;concat (list;interpose sep2 parts)) diff --git a/stdlib/test/test/lux/lang/type/check.lux b/stdlib/test/test/lux/lang/type/check.lux index c0cd5ac1e..188c73823 100644 --- a/stdlib/test/test/lux/lang/type/check.lux +++ b/stdlib/test/test/lux/lang/type/check.lux @@ -139,7 +139,7 @@ (<| (times +100) (do @ [nameL gen-name - nameR (|> gen-name (r;filter (. not (text/= nameL)))) + nameR (|> gen-name (r;filter (|>> (text/= nameL) not))) paramL gen-type paramR (|> gen-type (r;filter (|>> (@;checks? paramL) not)))] ($_ seq |