diff options
author | Eduardo Julian | 2017-04-05 18:05:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-04-05 18:05:23 -0400 |
commit | adf8aeaa2a52760e294e08618e7aca5fc371fc0f (patch) | |
tree | 9247cd321dce5e2bae58d42f8ae08fe27a1a3224 | |
parent | 6f87d469fa427dbaaaa13c0ef22626801f3f03e9 (diff) |
- Moved lux/lexer and lux/lexer/regex to lux/data/text/lexer and lux/data/text/regex.
- Moved lux/pipe to lux/control/pipe.
- Moved the @pre and @post macros to lux/control/contract.
- Improved error reporting for lux/type/auto.
- Added a test for third-order type-checking for lux/type/auto.
- Fixed a bug in the tests for lux/data/coll/vector.
Diffstat (limited to '')
61 files changed, 180 insertions, 231 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 541b4bcdc..557992ba4 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -5591,36 +5591,6 @@ _ (fail "Wrong syntax for :!!"))) -(def: #hidden hack_Text/append - (-> Text Text Text) - Text/append) - -(def: get-cursor - (Lux Cursor) - (lambda [state] - (let [{#;info info #;source source #;modules modules #;scopes scopes - #;type-vars types #;host host #;seed seed - #;expected expected #;cursor cursor - #;scope-type-vars scope-type-vars} state] - (#;Right [state cursor])))) - -(macro: #export (with-cursor tokens) - {#;doc (doc "Given some text, appends to it a prefix for identifying where the text comes from." - "For example:" - (with-cursor (format "User: " user-id)) - "Would be the same as:" - (format "[the-module,the-line,the-column] " (format "User: " user-id)))} - (case tokens - (^ (list message)) - (do Monad<Lux> - [cursor get-cursor] - (let [[module line column] cursor - cursor-prefix ($_ hack_Text/append "[" module "," (Nat/encode line) "," (Nat/encode column) "] ")] - (wrap (list (` (hack_Text/append (~ (text$ cursor-prefix)) (~ message))))))) - - _ - (fail "Wrong syntax for @"))) - (macro: #export (undefined tokens) {#;doc (doc "Meant to be used as a stand-in for functions with undefined implementations." "Undefined expressions will type-check against everything, so they make good dummy implementations." @@ -5630,45 +5600,11 @@ "If an undefined expression is ever evaluated, it will raise an error.")} (case tokens #;Nil - (return (list (` (error! (with-cursor "Undefined behavior."))))) + (return (list (` (error! "Undefined behavior.")))) _ (fail "Wrong syntax for undefined"))) -(macro: #export (@pre tokens) - {#;doc (doc "Pre-conditions." - "Given a test and an expression to run, only runs the expression if the test passes." - "Otherwise, an error is raised." - (@pre (i.= 4 (i.+ 2 2)) - (foo 123 456 789)))} - (case tokens - (^ (list test expr)) - (return (list (` (if (~ test) - (~ expr) - (error! (with-cursor (~ (text$ (Text/append "Pre-condition failed: " (ast-to-text test)))))))))) - - _ - (fail "Wrong syntax for @pre"))) - -(macro: #export (@post tokens) - {#;doc (doc "Post-conditions." - "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." - "If the predicate returns true, returns the value of the expression." - "Otherwise, an error is raised." - (@post i.even? - (i.+ 2 2)))} - (case tokens - (^ (list test expr)) - (do Monad<Lux> - [g!output (gensym "")] - (wrap (list (` (let [(~ g!output) (~ expr)] - (if ((~ test) (~ g!output)) - (~ g!output) - (error! (with-cursor (~ (text$ (Text/append "Post-condition failed: " (ast-to-text test)))))))))))) - - _ - (fail "Wrong syntax for @post"))) - (macro: #export (type-of tokens) {#;doc (doc "Generates the type corresponding to a given definition or variable." (let [my-num (: Int 123)] diff --git a/stdlib/source/lux/control/contract.lux b/stdlib/source/lux/control/contract.lux new file mode 100644 index 000000000..2f347dfa5 --- /dev/null +++ b/stdlib/source/lux/control/contract.lux @@ -0,0 +1,37 @@ +(;module: + lux + (lux (control monad) + (data text/format) + [compiler #+ Monad<Lux>] + (macro [ast] + ["s" syntax #+ syntax:]))) + +(def: #export (assert! message test) + (-> Text Bool []) + (if test + [] + (error! message))) + +(syntax: #export (@pre test expr) + {#;doc (doc "Pre-conditions." + "Given a test and an expression to run, only runs the expression if the test passes." + "Otherwise, an error is raised." + (@pre (i.= 4 (i.+ 2 2)) + (foo 123 456 789)))} + (wrap (list (` (exec (assert! (~ (ast;text (format "Pre-condition failed: " (%ast test)))) + (~ test)) + (~ expr)))))) + +(syntax: #export (@post test expr) + {#;doc (doc "Post-conditions." + "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." + "If the predicate returns true, returns the value of the expression." + "Otherwise, an error is raised." + (@post i.even? + (i.+ 2 2)))} + (do @ + [g!output (compiler;gensym "")] + (wrap (list (` (let [(~ g!output) (~ expr)] + (exec (assert! (~ (ast;text (format "Post-condition failed: " (%ast test)))) + ((~ test) (~ g!output))) + (~ g!output)))))))) diff --git a/stdlib/source/lux/pipe.lux b/stdlib/source/lux/control/pipe.lux index cfb05491d..cfb05491d 100644 --- a/stdlib/source/lux/pipe.lux +++ b/stdlib/source/lux/control/pipe.lux diff --git a/stdlib/source/lux/data/coll/vector.lux b/stdlib/source/lux/data/coll/vector.lux index b0ef6aa46..1c4a1dd9d 100644 --- a/stdlib/source/lux/data/coll/vector.lux +++ b/stdlib/source/lux/data/coll/vector.lux @@ -15,7 +15,6 @@ [compiler #+ with-gensyms] (macro [ast] ["s" syntax #+ syntax: Syntax]) - [pipe] )) ## This implementation of vectors is based on Clojure's diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 066777fdf..153920700 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -10,6 +10,7 @@ (data [bool] [text "Text/" Eq<Text> Monoid<Text>] text/format + (text [lexer #+ Lexer Monad<Lexer>]) [number #* "Real/" Codec<Text,Real>] maybe [char "Char/" Eq<Char> Codec<Text,Char>] @@ -24,7 +25,7 @@ [ast] [poly #+ poly:]) [type] - [lexer #+ Lexer Monad<Lexer>])) + )) ## [Types] (do-template [<name> <type>] diff --git a/stdlib/source/lux/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index e28cb0a68..e28cb0a68 100644 --- a/stdlib/source/lux/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux diff --git a/stdlib/source/lux/lexer/regex.lux b/stdlib/source/lux/data/text/regex.lux index 616f02086..21358c9b0 100644 --- a/stdlib/source/lux/lexer/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -3,14 +3,14 @@ (lux (control monad) (data [char] [text] + ["&" text/lexer #+ Lexer Monad<Lexer>] text/format [number "Int/" Codec<Text,Int>] [product] (coll [list "" Fold<List> "List/" Monad<List>])) [compiler #- run] (macro [ast] - ["s" syntax #+ syntax:]) - ["&" lexer #+ Lexer Monad<Lexer>])) + ["s" syntax #+ syntax:]))) ## [Utils] (def: #hidden (->Text lexer^) diff --git a/stdlib/source/lux/type/auto.lux b/stdlib/source/lux/type/auto.lux index fa658ffb8..7059536c3 100644 --- a/stdlib/source/lux/type/auto.lux +++ b/stdlib/source/lux/type/auto.lux @@ -278,11 +278,7 @@ (list [alt-name =deps])))) List/join) #;Nil - (compiler;fail (format "No alternatives." - "\n" - (|> alts - (List/map product;left) - (%list %ident)))) + (compiler;fail (format "No alternatives for " (%type (type;function input-types output-type)))) found (wrap found)))) @@ -339,7 +335,7 @@ (::: = (list;n.range +1 +10) (list;n.range +1 +10)) - "Functor map" + "(Functor List) map" (::: map n.inc (list;n.range +0 +9)) "Caveat emptor: You need to make sure to import the module of any structure you want to use." "Otherwise, this macro won't find it.")} @@ -363,8 +359,8 @@ (compiler;fail (format "Too many options available: " (|> chosen-ones (List/map (. %ident product;left)) - (text;join-with ", ") - ))))) + (text;join-with ", ")) + " --- for type: " (%type sig-type))))) (#;Right [args _]) (do @ diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index 8393d459b..b8ed6ca0c 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -1,7 +1,8 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data text/format [text "Text/" Eq<Text>] [number] @@ -9,8 +10,7 @@ [sum] (coll [list])) ["&" cli] - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "CLI" diff --git a/stdlib/test/test/lux/concurrency/atom.lux b/stdlib/test/test/lux/concurrency/atom.lux index 9b6248ec8..84deafa07 100644 --- a/stdlib/test/test/lux/concurrency/atom.lux +++ b/stdlib/test/test/lux/concurrency/atom.lux @@ -6,8 +6,7 @@ (coll [list "" Functor<List>]) text/format) (concurrency ["&" atom]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Atoms" diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux index a054e5a96..7ad25fc46 100644 --- a/stdlib/test/test/lux/concurrency/promise.lux +++ b/stdlib/test/test/lux/concurrency/promise.lux @@ -1,13 +1,13 @@ (;module: lux (lux [io #- run] - (control monad) + (control monad + pipe) (data [number] text/format [error #- fail]) (concurrency ["&" promise]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Promises" diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux index d48d20a9d..d6b6c1d43 100644 --- a/stdlib/test/test/lux/concurrency/stm.lux +++ b/stdlib/test/test/lux/concurrency/stm.lux @@ -7,8 +7,7 @@ text/format) (concurrency ["&" stm] [promise]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: iterations/processes Int 100) diff --git a/stdlib/test/test/lux/control/effect.lux b/stdlib/test/test/lux/control/effect.lux index 59fc116dc..39e5afa5d 100644 --- a/stdlib/test/test/lux/control/effect.lux +++ b/stdlib/test/test/lux/control/effect.lux @@ -7,8 +7,7 @@ (data [text] text/format) [macro] - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (do-template [<effect> <op> <field>] diff --git a/stdlib/test/test/lux/control/interval.lux b/stdlib/test/test/lux/control/interval.lux index 2127ff6df..b4c48a541 100644 --- a/stdlib/test/test/lux/control/interval.lux +++ b/stdlib/test/test/lux/control/interval.lux @@ -2,14 +2,14 @@ lux lux/test (lux (control monad + pipe ["&" interval]) [io] ["R" math/random] (data text/format [number] ["S" coll/set] - ["L" coll/list]) - pipe)) + ["L" coll/list]))) (test: "Equality." [bottom R;int diff --git a/stdlib/test/test/lux/pipe.lux b/stdlib/test/test/lux/control/pipe.lux index 08866a3f4..4687a5635 100644 --- a/stdlib/test/test/lux/pipe.lux +++ b/stdlib/test/test/lux/control/pipe.lux @@ -1,14 +1,14 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data text/format [number] [product] identity [text "T/" Eq<Text>]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Pipes" diff --git a/stdlib/test/test/lux/data/char.lux b/stdlib/test/test/lux/data/char.lux index 5025a1283..dd3c0c2da 100644 --- a/stdlib/test/test/lux/data/char.lux +++ b/stdlib/test/test/lux/data/char.lux @@ -1,12 +1,12 @@ (;module: lux - (lux (control [monad]) + (lux (control [monad] + pipe) [io] (data char [text] text/format) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Char operations" diff --git a/stdlib/test/test/lux/data/coll/array.lux b/stdlib/test/test/lux/data/coll/array.lux index b5003f703..f7d09ae9a 100644 --- a/stdlib/test/test/lux/data/coll/array.lux +++ b/stdlib/test/test/lux/data/coll/array.lux @@ -1,12 +1,12 @@ (;module: lux - (lux (control [monad]) + (lux (control [monad] + pipe) [io] (data (coll ["&" array] [list]) [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: bounded-size diff --git a/stdlib/test/test/lux/data/coll/dict.lux b/stdlib/test/test/lux/data/coll/dict.lux index 3df06abcf..34e99cf58 100644 --- a/stdlib/test/test/lux/data/coll/dict.lux +++ b/stdlib/test/test/lux/data/coll/dict.lux @@ -9,8 +9,7 @@ [char] (coll ["&" dict] [list "List/" Fold<List> Functor<List>])) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Dictionaries." diff --git a/stdlib/test/test/lux/data/coll/list.lux b/stdlib/test/test/lux/data/coll/list.lux index fe381340d..bd6f78015 100644 --- a/stdlib/test/test/lux/data/coll/list.lux +++ b/stdlib/test/test/lux/data/coll/list.lux @@ -1,14 +1,14 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data (coll ["&" list]) [text "Text/" Monoid<Text>] [number] [bool] [product]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: bounded-size diff --git a/stdlib/test/test/lux/data/coll/ordered.lux b/stdlib/test/test/lux/data/coll/ordered.lux index ffc2bf309..c1f5c9944 100644 --- a/stdlib/test/test/lux/data/coll/ordered.lux +++ b/stdlib/test/test/lux/data/coll/ordered.lux @@ -7,8 +7,7 @@ [list "" Fold<List>]) [number] text/format) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: gen-nat diff --git a/stdlib/test/test/lux/data/coll/priority-queue.lux b/stdlib/test/test/lux/data/coll/priority-queue.lux index de885f1ee..3e28334db 100644 --- a/stdlib/test/test/lux/data/coll/priority-queue.lux +++ b/stdlib/test/test/lux/data/coll/priority-queue.lux @@ -4,8 +4,7 @@ (control monad) (data (coll ["&" priority-queue]) [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: (gen-queue size) diff --git a/stdlib/test/test/lux/data/coll/queue.lux b/stdlib/test/test/lux/data/coll/queue.lux index fac5cef12..44123f8e3 100644 --- a/stdlib/test/test/lux/data/coll/queue.lux +++ b/stdlib/test/test/lux/data/coll/queue.lux @@ -4,8 +4,7 @@ (control monad) (data (coll ["&" queue]) [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Queues" diff --git a/stdlib/test/test/lux/data/coll/seq.lux b/stdlib/test/test/lux/data/coll/seq.lux index 5fe3a5af1..a111ecb0e 100644 --- a/stdlib/test/test/lux/data/coll/seq.lux +++ b/stdlib/test/test/lux/data/coll/seq.lux @@ -1,7 +1,8 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data (coll ["&" seq] ["F" tree/finger] ["L" list]) @@ -10,8 +11,7 @@ [bool] [product] maybe) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: bounded-size diff --git a/stdlib/test/test/lux/data/coll/set.lux b/stdlib/test/test/lux/data/coll/set.lux index 2a4f05bb1..a91813675 100644 --- a/stdlib/test/test/lux/data/coll/set.lux +++ b/stdlib/test/test/lux/data/coll/set.lux @@ -5,8 +5,7 @@ (data (coll ["&" set] [list "" Fold<List>]) [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: gen-nat diff --git a/stdlib/test/test/lux/data/coll/stack.lux b/stdlib/test/test/lux/data/coll/stack.lux index 4c44cbf06..6d26c569d 100644 --- a/stdlib/test/test/lux/data/coll/stack.lux +++ b/stdlib/test/test/lux/data/coll/stack.lux @@ -5,8 +5,7 @@ (data (coll ["&" stack] [list "" Fold<List>]) [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: gen-nat diff --git a/stdlib/test/test/lux/data/coll/stream.lux b/stdlib/test/test/lux/data/coll/stream.lux index 2be6aa054..2ee3013e2 100644 --- a/stdlib/test/test/lux/data/coll/stream.lux +++ b/stdlib/test/test/lux/data/coll/stream.lux @@ -9,8 +9,7 @@ ["&" stream]) [number "Nat/" Codec<Text,Nat>]) (function [cont]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Streams" diff --git a/stdlib/test/test/lux/data/coll/tree/rose.lux b/stdlib/test/test/lux/data/coll/tree/rose.lux index ef43fae44..a4839c2a5 100644 --- a/stdlib/test/test/lux/data/coll/tree/rose.lux +++ b/stdlib/test/test/lux/data/coll/tree/rose.lux @@ -5,8 +5,7 @@ (data (coll (tree ["&" rose]) [list "List/" Monad<List>]) [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: gen-nat diff --git a/stdlib/test/test/lux/data/coll/tree/zipper.lux b/stdlib/test/test/lux/data/coll/tree/zipper.lux index ed0318cfe..143229dc5 100644 --- a/stdlib/test/test/lux/data/coll/tree/zipper.lux +++ b/stdlib/test/test/lux/data/coll/tree/zipper.lux @@ -1,15 +1,15 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data (coll [list "List/" Fold<List> Functor<List>] (tree ["&" zipper] [rose])) [text "Text/" Monoid<Text>] text/format [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: gen-tree diff --git a/stdlib/test/test/lux/data/coll/vector.lux b/stdlib/test/test/lux/data/coll/vector.lux index 735374c5c..6ad6934db 100644 --- a/stdlib/test/test/lux/data/coll/vector.lux +++ b/stdlib/test/test/lux/data/coll/vector.lux @@ -7,12 +7,11 @@ [text "Text/" Monoid<Text>] text/format [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Vectors" - [size (|> R;nat (:: @ map (n.% +100))) + [size (|> R;nat (:: @ map (|>. (n.% +100) (n.max +1)))) idx (|> R;nat (:: @ map (n.% size))) sample (R;vector size R;nat) other-sample (R;vector size R;nat) diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/error.lux index 34f505142..d90387c89 100644 --- a/stdlib/test/test/lux/data/error.lux +++ b/stdlib/test/test/lux/data/error.lux @@ -1,10 +1,10 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data text/format - ["&" error]) - pipe) + ["&" error])) lux/test) (test: "Errors" diff --git a/stdlib/test/test/lux/data/error/exception.lux b/stdlib/test/test/lux/data/error/exception.lux index 41d01077e..bc84df7f5 100644 --- a/stdlib/test/test/lux/data/error/exception.lux +++ b/stdlib/test/test/lux/data/error/exception.lux @@ -7,8 +7,7 @@ [text] text/format [number]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (exception: Some-Exception) diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index ad70d5c0e..37fe49786 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -3,7 +3,8 @@ (lux [io] (control monad codec - eq) + eq + pipe) (data [text "Text/" Monoid<Text>] text/format [error #- fail] @@ -21,7 +22,6 @@ [syntax #+ syntax:] [poly #+ derived:]) ["R" math/random] - pipe test) ) diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index f88693003..07aaf8d0a 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -1,12 +1,12 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data ["&" ident] [text "Text/" Eq<Text>] text/format) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: (gen-part size) diff --git a/stdlib/test/test/lux/data/log.lux b/stdlib/test/test/lux/data/log.lux index 40a124490..ea174fc6b 100644 --- a/stdlib/test/test/lux/data/log.lux +++ b/stdlib/test/test/lux/data/log.lux @@ -1,12 +1,12 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data ["&" log] [text "Text/" Monoid<Text> Eq<Text>] [number] - [product]) - pipe) + [product])) lux/test) (test: "Logs" diff --git a/stdlib/test/test/lux/data/maybe.lux b/stdlib/test/test/lux/data/maybe.lux index 07961a6d0..8cfb4c38f 100644 --- a/stdlib/test/test/lux/data/maybe.lux +++ b/stdlib/test/test/lux/data/maybe.lux @@ -1,11 +1,11 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data ["&" maybe] [text "Text/" Monoid<Text>] - [number]) - pipe) + [number])) lux/test) (test: "Maybe" diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index ad89649ba..eefbd584b 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -1,12 +1,12 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data number [text "Text/" Monoid<Text> Eq<Text>] text/format) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (do-template [category rand-gen <Eq> <Order>] diff --git a/stdlib/test/test/lux/data/number/complex.lux b/stdlib/test/test/lux/data/number/complex.lux index 8ed27680c..9555c031e 100644 --- a/stdlib/test/test/lux/data/number/complex.lux +++ b/stdlib/test/test/lux/data/number/complex.lux @@ -1,7 +1,8 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data [text "Text/" Monoid<Text>] text/format [bool "b/" Eq<Bool>] @@ -10,8 +11,7 @@ (coll [list "List/" Fold<List> Functor<List>]) [product]) [math] - ["R" math/random] - pipe) + ["R" math/random]) lux/test) ## Based on org.apache.commons.math4.complex.Complex diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux index c1f7e104f..7ae36e573 100644 --- a/stdlib/test/test/lux/data/number/ratio.lux +++ b/stdlib/test/test/lux/data/number/ratio.lux @@ -1,7 +1,8 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data [text "Text/" Monoid<Text>] text/format [bool "b/" Eq<Bool>] @@ -9,8 +10,7 @@ ["&" number/ratio "&/" Number<Ratio>] (coll [list "List/" Fold<List> Functor<List>]) [product]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (def: gen-part diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux index 8ab124c1b..389ff1b9e 100644 --- a/stdlib/test/test/lux/data/sum.lux +++ b/stdlib/test/test/lux/data/sum.lux @@ -1,12 +1,12 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data sum [text "Text/" Monoid<Text>] [number] - (coll [list])) - pipe) + (coll [list]))) lux/test) (test: "Sum operations" diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index 4563d9b12..f306778ba 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -1,14 +1,14 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data ["&" text] [char] text/format [number] (coll [list])) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Size" diff --git a/stdlib/test/test/lux/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index 0bfd8dec7..92aeca0d8 100644 --- a/stdlib/test/test/lux/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -1,15 +1,15 @@ (;module: lux - (lux (control monad) + (lux (control monad + pipe) [io] (data [error #- fail] [text "T/" Eq<Text>] text/format + ["&" text/lexer] [char "C/" Eq<Char>] (coll [list])) - ["R" math/random] - pipe - ["&" lexer]) + ["R" math/random]) lux/test) ## [Utils] diff --git a/stdlib/test/test/lux/lexer/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index 1a21111f8..e737d5ee4 100644 --- a/stdlib/test/test/lux/lexer/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -1,18 +1,18 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data [error #- fail] [product] [text "T/" Eq<Text>] - text/format) + text/format + (text [lexer] + ["&" regex])) [compiler] (macro [ast] ["s" syntax #+ syntax:]) - ["R" math/random] - pipe - [lexer] - (lexer ["&" regex])) + ["R" math/random]) lux/test) ## [Utils] diff --git a/stdlib/test/test/lux/function/cont.lux b/stdlib/test/test/lux/function/cont.lux index ba1224bb8..c2e36a06b 100644 --- a/stdlib/test/test/lux/function/cont.lux +++ b/stdlib/test/test/lux/function/cont.lux @@ -7,8 +7,7 @@ [number] [product]) (function ["&" cont]) - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "Continuations" diff --git a/stdlib/test/test/lux/function/reader.lux b/stdlib/test/test/lux/function/reader.lux index 14b95af94..602efc603 100644 --- a/stdlib/test/test/lux/function/reader.lux +++ b/stdlib/test/test/lux/function/reader.lux @@ -1,12 +1,12 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data [text "Text/" Monoid<Text>] text/format [number]) - (function ["&" reader]) - pipe) + (function ["&" reader])) lux/test) (test: "Readers" diff --git a/stdlib/test/test/lux/function/state.lux b/stdlib/test/test/lux/function/state.lux index 186b786e0..9ef61e4d3 100644 --- a/stdlib/test/test/lux/function/state.lux +++ b/stdlib/test/test/lux/function/state.lux @@ -1,13 +1,13 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data [text "Text/" Monoid<Text>] text/format [number] [product]) - (function ["&" state]) - pipe) + (function ["&" state])) lux/test) (test: "State" diff --git a/stdlib/test/test/lux/function/thunk.lux b/stdlib/test/test/lux/function/thunk.lux index e3e9aca1b..753398f77 100644 --- a/stdlib/test/test/lux/function/thunk.lux +++ b/stdlib/test/test/lux/function/thunk.lux @@ -3,7 +3,6 @@ (lux [io] (control monad) (function ["&" thunk]) - pipe ["R" math/random]) lux/test) diff --git a/stdlib/test/test/lux/host.js.lux b/stdlib/test/test/lux/host.js.lux index 7d79b2b87..b7dbe043f 100644 --- a/stdlib/test/test/lux/host.js.lux +++ b/stdlib/test/test/lux/host.js.lux @@ -4,8 +4,7 @@ (control monad) (data text/format) ["&" host] - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (test: "JavaScript operations" diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index f58b706d5..4bd96ad62 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -1,14 +1,14 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data text/format [number] [product] [text "Text/" Eq<Text>]) ["&" host #+ jvm-import class: interface: object] - ["R" math/random] - pipe) + ["R" math/random]) lux/test) (jvm-import java.lang.Exception diff --git a/stdlib/test/test/lux/macro/ast.lux b/stdlib/test/test/lux/macro/ast.lux index 768dafbf8..95ac999a0 100644 --- a/stdlib/test/test/lux/macro/ast.lux +++ b/stdlib/test/test/lux/macro/ast.lux @@ -6,7 +6,6 @@ text/format [number]) ["R" math/random] - pipe (macro ["&" ast])) lux/test) diff --git a/stdlib/test/test/lux/macro/poly/eq.lux b/stdlib/test/test/lux/macro/poly/eq.lux index c2f9c0ac1..3cd515fc6 100644 --- a/stdlib/test/test/lux/macro/poly/eq.lux +++ b/stdlib/test/test/lux/macro/poly/eq.lux @@ -9,7 +9,6 @@ [char] [text]) ["R" math/random] - pipe [macro] (macro [poly #+ derived:] ["&" poly/eq])) diff --git a/stdlib/test/test/lux/macro/poly/functor.lux b/stdlib/test/test/lux/macro/poly/functor.lux index b98d75c7a..3294556a4 100644 --- a/stdlib/test/test/lux/macro/poly/functor.lux +++ b/stdlib/test/test/lux/macro/poly/functor.lux @@ -10,7 +10,6 @@ [char] [text]) ["R" math/random] - pipe [macro] (macro [poly #+ derived:] ["&" poly/functor])) diff --git a/stdlib/test/test/lux/macro/poly/text-encoder.lux b/stdlib/test/test/lux/macro/poly/text-encoder.lux index ec312e62b..ec392fc8e 100644 --- a/stdlib/test/test/lux/macro/poly/text-encoder.lux +++ b/stdlib/test/test/lux/macro/poly/text-encoder.lux @@ -9,7 +9,6 @@ [char] [text]) ["R" math/random] - pipe [macro] (macro [poly #+ derived:] ["&" poly/text-encoder])) diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index b9dd304e1..11d456236 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -11,7 +11,6 @@ [ident] [error #- fail]) ["R" math/random] - pipe [compiler] (macro [ast] ["s" syntax #+ syntax: Syntax])) diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux index 4d8b8d12a..2b834b9cc 100644 --- a/stdlib/test/test/lux/math.lux +++ b/stdlib/test/test/lux/math.lux @@ -9,7 +9,6 @@ (coll [list "List/" Fold<List> Functor<List>]) [product]) ["R" math/random] - pipe ["&" math]) lux/test) diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux index fa08ec864..b1770c815 100644 --- a/stdlib/test/test/lux/math/logic/continuous.lux +++ b/stdlib/test/test/lux/math/logic/continuous.lux @@ -3,7 +3,6 @@ (lux [io] (control monad) ["R" math/random] - pipe ["&" math/logic/continuous]) lux/test) diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux index afcd8b731..284fffa4b 100644 --- a/stdlib/test/test/lux/math/logic/fuzzy.lux +++ b/stdlib/test/test/lux/math/logic/fuzzy.lux @@ -8,7 +8,6 @@ [number] text/format) ["R" math/random] - pipe (math/logic ["&" fuzzy] continuous)) lux/test) diff --git a/stdlib/test/test/lux/math/simple.lux b/stdlib/test/test/lux/math/simple.lux index 32f5fb20c..9aec7f1fc 100644 --- a/stdlib/test/test/lux/math/simple.lux +++ b/stdlib/test/test/lux/math/simple.lux @@ -9,7 +9,6 @@ (coll [list "List/" Fold<List> Functor<List>]) [product]) ["R" math/random] - pipe ["&" math/simple]) lux/test) diff --git a/stdlib/test/test/lux/type.lux b/stdlib/test/test/lux/type.lux index e9401c738..d1098b960 100644 --- a/stdlib/test/test/lux/type.lux +++ b/stdlib/test/test/lux/type.lux @@ -1,14 +1,14 @@ (;module: lux (lux [io] - (control monad) + (control monad + pipe) (data [text "Text/" Monoid<Text>] text/format [number] maybe (coll [list])) ["R" math/random] - pipe ["&" type]) lux/test) diff --git a/stdlib/test/test/lux/type/auto.lux b/stdlib/test/test/lux/type/auto.lux index 536e3b851..c7e321240 100644 --- a/stdlib/test/test/lux/type/auto.lux +++ b/stdlib/test/test/lux/type/auto.lux @@ -11,7 +11,6 @@ maybe (coll [list])) ["R" math/random] - pipe [type] type/auto) lux/test) @@ -32,4 +31,9 @@ (::: = (list;n.range +1 +10) (list;n.range +1 +10))) + + (assert "Can automatically select third-order structures." + (let [lln (::: map (list;n.range +1) + (list;n.range +1 +10))] + (::: = lln lln))) )) diff --git a/stdlib/test/test/lux/type/check.lux b/stdlib/test/test/lux/type/check.lux index 47904c41b..d76a53622 100644 --- a/stdlib/test/test/lux/type/check.lux +++ b/stdlib/test/test/lux/type/check.lux @@ -8,7 +8,6 @@ maybe (coll [list])) ["R" math/random] - pipe [type] ["&" type/check]) lux/test) diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux index c773b3f17..6b23caebd 100644 --- a/stdlib/test/tests.lux +++ b/stdlib/test/tests.lux @@ -9,9 +9,6 @@ (lux ["_;" cli] ["_;" host] ["_;" io] - ["_;" pipe] - ["_;" lexer] - (lexer ["_;" regex]) (function ["_;" cont] ["_;" reader] ["_;" state] @@ -22,45 +19,44 @@ ["_;" promise] ["_;" stm]) (control ["_;" effect] - ["_;" interval]) - (data [bit] - [bool] - [char] - [error] - [ident] - [identity] - [log] - [maybe] - [number] + ["_;" interval] + ["_;" pipe]) + (data ["_;" bit] + ["_;" bool] + ["_;" char] + ["_;" error] + ["_;" ident] + ["_;" identity] + ["_;" log] + ["_;" maybe] + ["_;" number] (number ["_;" ratio] ["_;" complex]) - [product] - [sum] - [text] - (error [exception]) - (format [json]) - (coll [array] - [dict] - [list] - [queue] - [set] - [ordered] - [stack] - ## [vector] - (tree [rose] - [zipper]) + ["_;" product] + ["_;" sum] + ["_;" text] + (error ["_;" exception]) + (format ["_;" json]) + (coll ["_;" array] + ["_;" dict] + ["_;" list] + ["_;" queue] + ["_;" set] + ["_;" ordered] + ["_;" stack] + ["_;" vector] + (tree ["_;" rose] + ["_;" zipper]) ["_;" seq] ["_;" priority-queue] ["_;" stream]) - (text [format]) - ) + (text ["_;" format] + ["_;" lexer] + ["_;" regex])) ["_;" math] (math ["_;" simple] (logic ["_;" continuous] - ["_;" fuzzy]) - ## ["_;" random] - ) - ## ["_;" macro] + ["_;" fuzzy])) (macro ["_;" ast] ["_;" syntax] (poly ["poly_;" eq] @@ -69,7 +65,13 @@ ["_;" type] (type ["_;" check] ["_;" auto]) - ))) + )) + (lux (control [contract]) + (data [env] + [trace] + [store]) + [macro] + (math [random]))) ## [Program] (program: args |