aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2020-08-09 07:12:33 -0400
committerEduardo Julian2020-08-09 07:12:33 -0400
commitb2cec28f75239fd11ab13a6ff896fb0bf0f7a19c (patch)
treed8e53e9d95d47efeeb290a04e0a839b175367f7b /stdlib/source
parentbed794b36967e3096c73db0067bac5bb4ffdf814 (diff)
"abstract:" macro now takes annotations after representation type.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/control/concurrency/actor.lux4
-rw-r--r--stdlib/source/lux/control/concurrency/atom.lux4
-rw-r--r--stdlib/source/lux/control/concurrency/promise.lux3
-rw-r--r--stdlib/source/lux/control/concurrency/semaphore.lux12
-rw-r--r--stdlib/source/lux/control/concurrency/stm.lux4
-rw-r--r--stdlib/source/lux/control/io.lux3
-rw-r--r--stdlib/source/lux/control/parser/type.lux69
-rw-r--r--stdlib/source/lux/control/parser/xml.lux24
-rw-r--r--stdlib/source/lux/control/security/capability.lux4
-rw-r--r--stdlib/source/lux/control/security/policy.lux3
-rw-r--r--stdlib/source/lux/control/thread.lux4
-rw-r--r--stdlib/source/lux/data/collection/set/multi.lux2
-rw-r--r--stdlib/source/lux/data/collection/set/ordered.lux2
-rw-r--r--stdlib/source/lux/data/collection/tree/finger.lux15
-rw-r--r--stdlib/source/lux/data/color.lux2
-rw-r--r--stdlib/source/lux/data/format/css.lux6
-rw-r--r--stdlib/source/lux/data/format/css/property.lux2
-rw-r--r--stdlib/source/lux/data/format/css/query.lux6
-rw-r--r--stdlib/source/lux/data/format/css/selector.lux14
-rw-r--r--stdlib/source/lux/data/format/css/style.lux4
-rw-r--r--stdlib/source/lux/data/format/css/value.lux14
-rw-r--r--stdlib/source/lux/data/format/html.lux8
-rw-r--r--stdlib/source/lux/data/format/markdown.lux6
-rw-r--r--stdlib/source/lux/data/format/tar.lux14
-rw-r--r--stdlib/source/lux/data/text/buffer.lux4
-rw-r--r--stdlib/source/lux/data/text/encoding.lux2
-rw-r--r--stdlib/source/lux/data/text/unicode.lux345
-rw-r--r--stdlib/source/lux/debug.lux4
-rw-r--r--stdlib/source/lux/host.js.lux4
-rw-r--r--stdlib/source/lux/locale.lux2
-rw-r--r--stdlib/source/lux/locale/language.lux4
-rw-r--r--stdlib/source/lux/locale/territory.lux2
-rw-r--r--stdlib/source/lux/macro/poly.lux11
-rw-r--r--stdlib/source/lux/math/modular.lux8
-rw-r--r--stdlib/source/lux/math/random.lux12
-rw-r--r--stdlib/source/lux/target/common-lisp.lux6
-rw-r--r--stdlib/source/lux/target/js.lux6
-rw-r--r--stdlib/source/lux/target/jvm/bytecode/address.lux2
-rw-r--r--stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux2
-rw-r--r--stdlib/source/lux/target/jvm/bytecode/environment/limit/stack.lux2
-rw-r--r--stdlib/source/lux/target/jvm/bytecode/instruction.lux2
-rw-r--r--stdlib/source/lux/target/jvm/constant.lux5
-rw-r--r--stdlib/source/lux/target/jvm/constant/tag.lux2
-rw-r--r--stdlib/source/lux/target/jvm/encoding/name.lux2
-rw-r--r--stdlib/source/lux/target/jvm/encoding/signed.lux3
-rw-r--r--stdlib/source/lux/target/jvm/encoding/unsigned.lux3
-rw-r--r--stdlib/source/lux/target/jvm/index.lux2
-rw-r--r--stdlib/source/lux/target/jvm/modifier.lux1
-rw-r--r--stdlib/source/lux/target/jvm/modifier/inner.lux2
-rw-r--r--stdlib/source/lux/target/jvm/type.lux2
-rw-r--r--stdlib/source/lux/target/jvm/type/category.lux16
-rw-r--r--stdlib/source/lux/target/jvm/type/descriptor.lux2
-rw-r--r--stdlib/source/lux/target/jvm/type/lux.lux2
-rw-r--r--stdlib/source/lux/target/jvm/type/reflection.lux2
-rw-r--r--stdlib/source/lux/target/jvm/type/signature.lux2
-rw-r--r--stdlib/source/lux/target/lua.lux6
-rw-r--r--stdlib/source/lux/target/php.lux6
-rw-r--r--stdlib/source/lux/target/python.lux8
-rw-r--r--stdlib/source/lux/target/ruby.lux12
-rw-r--r--stdlib/source/lux/target/scheme.lux6
-rw-r--r--stdlib/source/lux/time/duration.lux3
-rw-r--r--stdlib/source/lux/time/instant.lux3
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive/artifact.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive/document.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive/key.lux2
-rw-r--r--stdlib/source/lux/type/abstract.lux2
-rw-r--r--stdlib/source/lux/type/dynamic.lux4
-rw-r--r--stdlib/source/lux/type/quotient.lux4
-rw-r--r--stdlib/source/lux/type/refinement.lux4
-rw-r--r--stdlib/source/lux/type/resource.lux9
-rw-r--r--stdlib/source/lux/type/unit.lux1
-rw-r--r--stdlib/source/lux/world/db/sql.lux4
-rw-r--r--stdlib/source/lux/world/net/http/mime.lux4
-rw-r--r--stdlib/source/test/lux/control.lux4
-rw-r--r--stdlib/source/test/lux/control/parser/text.lux19
-rw-r--r--stdlib/source/test/lux/control/parser/type.lux197
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux6
78 files changed, 543 insertions, 460 deletions
diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux
index a790fa89c..660b6a9a0 100644
--- a/stdlib/source/lux/control/concurrency/actor.lux
+++ b/stdlib/source/lux/control/concurrency/actor.lux
@@ -62,12 +62,12 @@
(wrap #.Nil))))
(abstract: #export (Actor s)
- {#.doc "An actor, defined as all the necessities it requires."}
-
{#obituary [(Promise <Obituary>)
(Resolver <Obituary>)]
#mailbox (Atom <Mailbox>)}
+ {#.doc "An actor, defined as all the necessities it requires."}
+
## TODO: Delete after new-luxc becomes the new standard compiler.
(def: (actor mailbox obituary)
(All [s]
diff --git a/stdlib/source/lux/control/concurrency/atom.lux b/stdlib/source/lux/control/concurrency/atom.lux
index 6abe4e756..8da6b0935 100644
--- a/stdlib/source/lux/control/concurrency/atom.lux
+++ b/stdlib/source/lux/control/concurrency/atom.lux
@@ -27,8 +27,6 @@
(as-is))
(abstract: #export (Atom a)
- {#.doc "Atomic references that are safe to mutate concurrently."}
-
(for {@.old
(java/util/concurrent/atomic/AtomicReference a)
@@ -39,6 +37,8 @@
(array.Array a)
})
+ {#.doc "Atomic references that are safe to mutate concurrently."}
+
(def: #export (atom value)
(All [a] (-> a (Atom a)))
(:abstraction (for {@.old
diff --git a/stdlib/source/lux/control/concurrency/promise.lux b/stdlib/source/lux/control/concurrency/promise.lux
index a0461e2c1..e396b0769 100644
--- a/stdlib/source/lux/control/concurrency/promise.lux
+++ b/stdlib/source/lux/control/concurrency/promise.lux
@@ -17,9 +17,10 @@
["." atom (#+ Atom atom)]])
(abstract: #export (Promise a)
- {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."}
(Atom [(Maybe a) (List (-> a (IO Any)))])
+ {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."}
+
(type: #export (Resolver a)
(-> a (IO Bit)))
diff --git a/stdlib/source/lux/control/concurrency/semaphore.lux b/stdlib/source/lux/control/concurrency/semaphore.lux
index c69859138..3edcbd332 100644
--- a/stdlib/source/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/lux/control/concurrency/semaphore.lux
@@ -28,10 +28,10 @@
#waiting-list (Queue (Resolver Any))})
(abstract: #export Semaphore
- {#.doc "A tool for controlling access to resources by multiple concurrent processes."}
-
(Atom State)
+ {#.doc "A tool for controlling access to resources by multiple concurrent processes."}
+
(def: most-positions-possible
(.nat (:: i.interval top)))
@@ -114,10 +114,10 @@
)
(abstract: #export Mutex
- {#.doc "A mutual-exclusion lock that can only be acquired by one process at a time."}
-
Semaphore
+ {#.doc "A mutual-exclusion lock that can only be acquired by one process at a time."}
+
(def: #export (mutex _)
(-> Any Mutex)
(:abstraction (semaphore 1)))
@@ -143,13 +143,13 @@
(type: #export Limit (:~ (refinement.type limit)))
(abstract: #export Barrier
- {#.doc "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier."}
-
{#limit Limit
#count (Atom Nat)
#start-turnstile Semaphore
#end-turnstile Semaphore}
+ {#.doc "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier."}
+
(def: #export (barrier limit)
(-> Limit Barrier)
(:abstraction {#limit limit
diff --git a/stdlib/source/lux/control/concurrency/stm.lux b/stdlib/source/lux/control/concurrency/stm.lux
index 9c82788ad..0743a0720 100644
--- a/stdlib/source/lux/control/concurrency/stm.lux
+++ b/stdlib/source/lux/control/concurrency/stm.lux
@@ -23,10 +23,10 @@
(-> a (IO Any)))
(abstract: #export (Var a)
- {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."}
-
(Atom [a (List (Sink a))])
+ {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."}
+
(def: #export (var value)
{#.doc "Creates a new STM var, with a default value."}
(All [a] (-> a (Var a)))
diff --git a/stdlib/source/lux/control/io.lux b/stdlib/source/lux/control/io.lux
index ed28b338e..24b1c2e61 100644
--- a/stdlib/source/lux/control/io.lux
+++ b/stdlib/source/lux/control/io.lux
@@ -14,9 +14,10 @@
["." template]]])
(abstract: #export (IO a)
- {#.doc "A type that represents synchronous, effectful computations that may interact with the outside world."}
(-> Any a)
+ {#.doc "A type that represents synchronous, effectful computations that may interact with the outside world."}
+
(def: label
(All [a] (-> (-> Any a) (IO a)))
(|>> :abstraction))
diff --git a/stdlib/source/lux/control/parser/type.lux b/stdlib/source/lux/control/parser/type.lux
index d95c1c115..d541ecec4 100644
--- a/stdlib/source/lux/control/parser/type.lux
+++ b/stdlib/source/lux/control/parser/type.lux
@@ -1,5 +1,5 @@
(.module:
- [lux (#- function log!)
+ [lux (#- function)
[abstract
["." monad (#+ do)]]
[control
@@ -48,7 +48,9 @@
[wrong-parameter]
)
-(exception: #export (unconsumed {remaining (List Type)})
+(exception: #export empty-input)
+
+(exception: #export (unconsumed-input {remaining (List Type)})
(exception.report
["Types" (|> remaining
(list@map (|>> %.type (format text.new-line "* ")))
@@ -60,10 +62,12 @@
(type: #export (Parser a)
(//.Parser [Env (List Type)] a))
-(def: #export fresh Env (dictionary.new n.hash))
+(def: #export fresh
+ Env
+ (dictionary.new n.hash))
-(def: (run' env types poly)
- (All [a] (-> Env (List Type) (Parser a) (Try a)))
+(def: (run' env poly types)
+ (All [a] (-> Env (Parser a) (List Type) (Try a)))
(case (//.run poly [env types])
(#try.Failure error)
(#try.Failure error)
@@ -74,11 +78,11 @@
(#try.Success output)
_
- (exception.throw unconsumed remaining))))
+ (exception.throw ..unconsumed-input remaining))))
-(def: #export (run type poly)
- (All [a] (-> Type (Parser a) (Try a)))
- (run' fresh (list type) poly))
+(def: #export (run poly type)
+ (All [a] (-> (Parser a) Type (Try a)))
+ (run' ..fresh poly (list type)))
(def: #export env
(Parser Env)
@@ -100,7 +104,7 @@
(.function (_ [env inputs])
(case inputs
#.Nil
- (#try.Failure "Empty stream of types.")
+ (exception.throw ..empty-input [])
(#.Cons headT tail)
(#try.Success [[env inputs] headT]))))
@@ -110,7 +114,7 @@
(.function (_ [env inputs])
(case inputs
#.Nil
- (#try.Failure "Empty stream of types.")
+ (exception.throw ..empty-input [])
(#.Cons headT tail)
(#try.Success [[env tail] headT]))))
@@ -118,7 +122,7 @@
(def: #export (local types poly)
(All [a] (-> (List Type) (Parser a) (Parser a)))
(.function (_ [env pass-through])
- (case (run' env types poly)
+ (case (run' env poly types)
(#try.Failure error)
(#try.Failure error)
@@ -147,14 +151,14 @@
[(def: #export (<name> poly)
(All [a] (-> (Parser a) (Parser a)))
(do //.monad
- [headT any]
+ [headT ..any]
(let [members (<flattener> (type.un-name headT))]
(if (n.> 1 (list.size members))
(local members poly)
(//.fail (exception.construct <exception> headT))))))]
- [variant type.flatten-variant #.Sum not-variant]
- [tuple type.flatten-tuple #.Product not-tuple]
+ [variant type.flatten-variant #.Sum ..not-variant]
+ [tuple type.flatten-tuple #.Product ..not-tuple]
)
(def: polymorphic'
@@ -163,7 +167,7 @@
[headT any
#let [[num-arg bodyT] (type.flatten-univ-q (type.un-name headT))]]
(if (n.= 0 num-arg)
- (//.fail (exception.construct not-polymorphic headT))
+ (//.fail (exception.construct ..not-polymorphic headT))
(wrap [num-arg bodyT]))))
(def: #export (polymorphic poly)
@@ -211,7 +215,7 @@
(if (n.> 0 (list.size inputsT))
(//.and (local inputsT in-poly)
(local (list outputT) out-poly))
- (//.fail (exception.construct not-function headT)))))
+ (//.fail (exception.construct ..not-function headT)))))
(def: #export (apply poly)
(All [a] (-> (Parser a) (Parser a)))
@@ -219,8 +223,8 @@
[headT any
#let [[funcT paramsT] (type.flatten-application (type.un-name headT))]]
(if (n.= 0 (list.size paramsT))
- (//.fail (exception.construct not-application headT))
- (local (#.Cons funcT paramsT) poly))))
+ (//.fail (exception.construct ..not-application headT))
+ (..local (#.Cons funcT paramsT) poly))))
(template [<name> <test>]
[(def: #export (<name> expected)
@@ -229,7 +233,7 @@
[actual any]
(if (<test> expected actual)
(wrap [])
- (//.fail (exception.construct types-do-not-match [expected actual])))))]
+ (//.fail (exception.construct ..types-do-not-match [expected actual])))))]
[exactly type@=]
[sub check.checks?]
@@ -255,10 +259,10 @@
(wrap poly-code)
#.None
- (//.fail (exception.construct unknown-parameter headT)))
+ (//.fail (exception.construct ..unknown-parameter headT)))
_
- (//.fail (exception.construct not-parameter headT)))))
+ (//.fail (exception.construct ..not-parameter headT)))))
(def: #export (parameter! id)
(-> Nat (Parser Any))
@@ -269,10 +273,10 @@
(#.Parameter idx)
(if (n.= id (adjusted-idx env idx))
(wrap [])
- (//.fail (exception.construct wrong-parameter [(#.Parameter id) headT])))
+ (//.fail (exception.construct ..wrong-parameter [(#.Parameter id) headT])))
_
- (//.fail (exception.construct not-parameter headT)))))
+ (//.fail (exception.construct ..not-parameter headT)))))
(def: #export existential
(Parser Nat)
@@ -283,7 +287,7 @@
(wrap ex-id)
_
- (//.fail (exception.construct not-existential headT)))))
+ (//.fail (exception.construct ..not-existential headT)))))
(def: #export named
(Parser [Name Type])
@@ -294,7 +298,7 @@
(wrap [name anonymousT])
_
- (//.fail (exception.construct not-named inputT)))))
+ (//.fail (exception.construct ..not-named inputT)))))
(def: #export (recursive poly)
(All [a] (-> (Parser a) (Parser [Code a])))
@@ -310,7 +314,7 @@
(wrap [recT output]))
_
- (//.fail (exception.construct not-recursive headT)))))
+ (//.fail (exception.construct ..not-recursive headT)))))
(def: #export recursive-self
(Parser Code)
@@ -324,7 +328,7 @@
(wrap self-call)
_
- (//.fail (exception.construct not-recursive headT)))))
+ (//.fail (exception.construct ..not-recursive headT)))))
(def: #export recursive-call
(Parser Code)
@@ -337,12 +341,3 @@
(monad.map @ (function.constant ..parameter))
(local allT)))]
(wrap (` ((~+ allC))))))
-
-(def: #export log!
- (All [a] (Parser a))
- (do //.monad
- [current any
- #let [_ (.log! ($_ text@compose
- "{" (name@encode (name-of ..log)) "} "
- (%.type current)))]]
- (//.fail "LOGGING")))
diff --git a/stdlib/source/lux/control/parser/xml.lux b/stdlib/source/lux/control/parser/xml.lux
index f9ac14f8f..da21c1dfb 100644
--- a/stdlib/source/lux/control/parser/xml.lux
+++ b/stdlib/source/lux/control/parser/xml.lux
@@ -38,7 +38,7 @@
(function (_ docs)
(case docs
#.Nil
- (exception.throw empty-input [])
+ (exception.throw ..empty-input [])
(#.Cons head tail)
(case head
@@ -46,24 +46,24 @@
(#try.Success [tail value])
(#/.Node _)
- (exception.throw unexpected-input [])))))
+ (exception.throw ..unexpected-input [])))))
(def: #export (attr name)
(-> Name (Parser Text))
(function (_ docs)
(case docs
#.Nil
- (exception.throw empty-input [])
+ (exception.throw ..empty-input [])
(#.Cons head _)
(case head
(#/.Text _)
- (exception.throw unexpected-input [])
+ (exception.throw ..unexpected-input [])
(#/.Node tag attrs children)
(case (dictionary.get name attrs)
#.None
- (exception.throw unknown-attribute [])
+ (exception.throw ..unknown-attribute [])
(#.Some value)
(#try.Success [docs value]))))))
@@ -74,7 +74,7 @@
(#try.Success [remaining output])
(if (list.empty? remaining)
(#try.Success output)
- (exception.throw unconsumed-inputs remaining))
+ (exception.throw ..unconsumed-inputs remaining))
(#try.Failure error)
(#try.Failure error)))
@@ -84,29 +84,29 @@
(function (_ docs)
(case docs
#.Nil
- (exception.throw empty-input [])
+ (exception.throw ..empty-input [])
(#.Cons head _)
(case head
(#/.Text _)
- (exception.throw unexpected-input [])
+ (exception.throw ..unexpected-input [])
(#/.Node _tag _attrs _children)
(if (name@= tag _tag)
(#try.Success [docs []])
- (exception.throw wrong-tag tag))))))
+ (exception.throw ..wrong-tag tag))))))
(def: #export (children reader)
(All [a] (-> (Parser a) (Parser a)))
(function (_ docs)
(case docs
#.Nil
- (exception.throw empty-input [])
+ (exception.throw ..empty-input [])
(#.Cons head tail)
(case head
(#/.Text _)
- (exception.throw unexpected-input [])
+ (exception.throw ..unexpected-input [])
(#/.Node _tag _attrs _children)
(do try.monad
@@ -118,7 +118,7 @@
(function (_ docs)
(case docs
#.Nil
- (exception.throw empty-input [])
+ (exception.throw ..empty-input [])
(#.Cons head tail)
(#try.Success [tail []]))))
diff --git a/stdlib/source/lux/control/security/capability.lux b/stdlib/source/lux/control/security/capability.lux
index 69cea5b19..df875b1e9 100644
--- a/stdlib/source/lux/control/security/capability.lux
+++ b/stdlib/source/lux/control/security/capability.lux
@@ -24,11 +24,11 @@
["." writer]]]]])
(abstract: #export (Capability brand input output)
+ (-> input output)
+
{#.doc (doc "Represents the capability to perform an operation."
"This operation is assumed to have security implications.")}
- (-> input output)
-
(def: forge
(All [brand input output]
(-> (-> input output)
diff --git a/stdlib/source/lux/control/security/policy.lux b/stdlib/source/lux/control/security/policy.lux
index 69489b0da..fac867520 100644
--- a/stdlib/source/lux/control/security/policy.lux
+++ b/stdlib/source/lux/control/security/policy.lux
@@ -10,8 +10,6 @@
["!" capability (#+ capability:)]])
(abstract: #export (Policy brand value label)
- {}
-
value
(capability: #export (Can-Upgrade brand label value)
@@ -84,7 +82,6 @@
(template [<brand> <value> <upgrade> <downgrade>]
[(abstract: #export <brand>
- {}
Any
(type: #export <value> (Policy <brand>))
diff --git a/stdlib/source/lux/control/thread.lux b/stdlib/source/lux/control/thread.lux
index 31845e9c4..28466fc05 100644
--- a/stdlib/source/lux/control/thread.lux
+++ b/stdlib/source/lux/control/thread.lux
@@ -17,10 +17,10 @@
(-> ! a))
(abstract: #export (Box t v)
- {#.doc "A mutable box holding a value."}
-
(Array v)
+ {#.doc "A mutable box holding a value."}
+
(def: #export (box init)
(All [a] (-> a (All [!] (Thread ! (Box ! a)))))
(function (_ !)
diff --git a/stdlib/source/lux/data/collection/set/multi.lux b/stdlib/source/lux/data/collection/set/multi.lux
index 4f3f02276..9cfd9e4b1 100644
--- a/stdlib/source/lux/data/collection/set/multi.lux
+++ b/stdlib/source/lux/data/collection/set/multi.lux
@@ -17,8 +17,6 @@
["n" nat]]]]])
(abstract: #export (Set a)
- {}
-
(Dictionary a Nat)
(def: #export new
diff --git a/stdlib/source/lux/data/collection/set/ordered.lux b/stdlib/source/lux/data/collection/set/ordered.lux
index 4f814c1ea..8cafd922e 100644
--- a/stdlib/source/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/lux/data/collection/set/ordered.lux
@@ -12,8 +12,6 @@
abstract]])
(abstract: #export (Set a)
- {}
-
(/.Dictionary a a)
(def: #export new
diff --git a/stdlib/source/lux/data/collection/tree/finger.lux b/stdlib/source/lux/data/collection/tree/finger.lux
index 03c23702c..3a6e52948 100644
--- a/stdlib/source/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/lux/data/collection/tree/finger.lux
@@ -1,21 +1,22 @@
(.module:
[lux #*
[abstract
- ["m" monoid]
- [predicate (#+ Predicate)]]])
+ [predicate (#+ Predicate)]
+ ["." monoid (#+ Monoid)]]])
(type: #export (Node m a)
(#Leaf m a)
(#Branch m (Node m a) (Node m a)))
(type: #export (Tree m a)
- {#monoid (m.Monoid m)
+ {#monoid (Monoid m)
#node (Node m a)})
(def: #export (tag tree)
(All [m a] (-> (Tree m a) m))
(case (get@ #node tree)
- (^or (#Leaf tag _) (#Branch tag _ _))
+ (^or (#Leaf tag _)
+ (#Branch tag _ _))
tag))
(def: #export (value tree)
@@ -37,16 +38,16 @@
(def: #export (search pred tree)
(All [m a] (-> (-> m Bit) (Tree m a) (Maybe a)))
- (let [tag;compose (get@ [#monoid #m.compose] tree)]
+ (let [tag@compose (get@ [#monoid #monoid.compose] tree)]
(if (pred (tag tree))
- (loop [_tag (get@ [#monoid #m.identity] tree)
+ (loop [_tag (get@ [#monoid #monoid.identity] tree)
_node (get@ #node tree)]
(case _node
(#Leaf _ value)
(#.Some value)
(#Branch _ left right)
- (let [shifted-tag (tag;compose _tag (tag (set@ #node left tree)))]
+ (let [shifted-tag (tag@compose _tag (tag (set@ #node left tree)))]
(if (pred shifted-tag)
(recur _tag left)
(recur shifted-tag right)))))
diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux
index 11da105cf..36b9fdf6d 100644
--- a/stdlib/source/lux/data/color.lux
+++ b/stdlib/source/lux/data/color.lux
@@ -45,8 +45,6 @@
[Frac Frac Frac])
(abstract: #export Color
- {}
-
RGB
(def: #export (from-rgb [red green blue])
diff --git a/stdlib/source/lux/data/format/css.lux b/stdlib/source/lux/data/format/css.lux
index 2b09140f6..aef22816a 100644
--- a/stdlib/source/lux/data/format/css.lux
+++ b/stdlib/source/lux/data/format/css.lux
@@ -20,12 +20,10 @@
["#." style (#+ Style)]
["#." query (#+ Query)]])
-(abstract: #export Common {} Any)
-(abstract: #export Special {} Any)
+(abstract: #export Common Any)
+(abstract: #export Special Any)
(abstract: #export (CSS brand)
- {}
-
Text
(def: #export css (-> (CSS Any) Text) (|>> :representation))
diff --git a/stdlib/source/lux/data/format/css/property.lux b/stdlib/source/lux/data/format/css/property.lux
index 29e919501..bbfdd1930 100644
--- a/stdlib/source/lux/data/format/css/property.lux
+++ b/stdlib/source/lux/data/format/css/property.lux
@@ -55,8 +55,6 @@
(wrap (list (code.local-identifier identifier))))
(abstract: #export (Property brand)
- {}
-
Text
(def: #export name
diff --git a/stdlib/source/lux/data/format/css/query.lux b/stdlib/source/lux/data/format/css/query.lux
index 31f5bee21..6b1e57554 100644
--- a/stdlib/source/lux/data/format/css/query.lux
+++ b/stdlib/source/lux/data/format/css/query.lux
@@ -24,8 +24,6 @@
(wrap (list (code.local-identifier identifier))))
(abstract: #export Media
- {}
-
Text
(def: #export media
@@ -44,8 +42,6 @@
))
(abstract: #export Feature
- {}
-
Text
(def: #export feature
@@ -106,8 +102,6 @@
)
(abstract: #export Query
- {}
-
Text
(def: #export query
diff --git a/stdlib/source/lux/data/format/css/selector.lux b/stdlib/source/lux/data/format/css/selector.lux
index dd99a98c4..1c0f4b566 100644
--- a/stdlib/source/lux/data/format/css/selector.lux
+++ b/stdlib/source/lux/data/format/css/selector.lux
@@ -18,23 +18,21 @@
(type: #export Class Label)
(type: #export Attribute Label)
-(abstract: #export (Generic brand) {} Any)
+(abstract: #export (Generic brand) Any)
(template [<generic> <brand>]
- [(abstract: <brand> {} Any)
+ [(abstract: <brand> Any)
(type: #export <generic> (Generic <brand>))]
[Can-Chain Can-Chain']
[Cannot-Chain Cannot-Chain']
)
-(abstract: #export Unique {} Any)
-(abstract: #export Specific {} Any)
-(abstract: #export Composite {} Any)
+(abstract: #export Unique Any)
+(abstract: #export Specific Any)
+(abstract: #export Composite Any)
(abstract: #export (Selector kind)
- {}
-
Text
(def: #export selector
@@ -164,8 +162,6 @@
:abstraction))
(abstract: #export Index
- {}
-
Text
(def: #export index
diff --git a/stdlib/source/lux/data/format/css/style.lux b/stdlib/source/lux/data/format/css/style.lux
index 5264fb0f9..fbcab6700 100644
--- a/stdlib/source/lux/data/format/css/style.lux
+++ b/stdlib/source/lux/data/format/css/style.lux
@@ -10,10 +10,10 @@
["#." property (#+ Property)]])
(abstract: #export Style
- {#.doc "The style associated with a CSS selector."}
-
Text
+ {#.doc "The style associated with a CSS selector."}
+
(def: #export empty Style (:abstraction ""))
(def: #export separator " ")
diff --git a/stdlib/source/lux/data/format/css/value.lux b/stdlib/source/lux/data/format/css/value.lux
index 4b3f3b1ba..d6aee7813 100644
--- a/stdlib/source/lux/data/format/css/value.lux
+++ b/stdlib/source/lux/data/format/css/value.lux
@@ -32,8 +32,6 @@
(template: (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+)
(abstract: #export <abstraction>
- {}
-
<representation>
(def: #export <out>
@@ -63,8 +61,6 @@
(|> raw (text.split 1) maybe.assume product.right))))
(abstract: #export (Value brand)
- {}
-
Text
(def: #export value
@@ -80,7 +76,7 @@
)
(template [<brand> <alias>+ <value>+]
- [(abstract: #export <brand> {} Any)
+ [(abstract: #export <brand> Any)
(`` (template [<name> <value>]
[(def: #export <name>
@@ -893,8 +889,6 @@
(%.nat vertical))))
(abstract: #export Stop
- {}
-
Text
(def: #export stop
@@ -915,8 +909,6 @@
(:representation Value end))))
(abstract: #export Hint
- {}
-
Text
(def: #export hint
@@ -936,8 +928,6 @@
[a (List a)])
(abstract: #export Angle
- {}
-
Text
(def: #export angle
@@ -977,8 +967,6 @@
)
(abstract: #export Percentage
- {}
-
Text
(def: #export percentage
diff --git a/stdlib/source/lux/data/format/html.lux b/stdlib/source/lux/data/format/html.lux
index 92d1b22e4..a5fbce4d7 100644
--- a/stdlib/source/lux/data/format/html.lux
+++ b/stdlib/source/lux/data/format/html.lux
@@ -76,12 +76,10 @@
(text.enclose ["</" ">"]))
(abstract: #export (HTML brand)
- {}
-
Text
(template [<name> <brand>]
- [(abstract: #export <brand> {} Any)
+ [(abstract: #export <brand> Any)
(type: #export <name> (HTML <brand>))]
[Meta Meta']
@@ -99,11 +97,11 @@
)
(template [<super> <super-raw> <sub>+]
- [(abstract: #export (<super-raw> brand) {} Any)
+ [(abstract: #export (<super-raw> brand) Any)
(type: #export <super> (HTML (<super-raw> Any)))
(`` (template [<sub> <sub-raw>]
- [(abstract: #export <sub-raw> {} Any)
+ [(abstract: #export <sub-raw> Any)
(type: #export <sub> (HTML (<super-raw> <sub-raw>)))]
(~~ (template.splice <sub>+))))]
diff --git a/stdlib/source/lux/data/format/markdown.lux b/stdlib/source/lux/data/format/markdown.lux
index fe20f30b2..bb9a86b46 100644
--- a/stdlib/source/lux/data/format/markdown.lux
+++ b/stdlib/source/lux/data/format/markdown.lux
@@ -30,12 +30,10 @@
(text.replace-all "." "\.")
(text.replace-all "!" "\!")))
-(abstract: #export Span {} Any)
-(abstract: #export Block {} Any)
+(abstract: #export Span Any)
+(abstract: #export Block Any)
(abstract: #export (Markdown brand)
- {}
-
Text
(def: #export empty
diff --git a/stdlib/source/lux/data/format/tar.lux b/stdlib/source/lux/data/format/tar.lux
index 544540418..ca5037a65 100644
--- a/stdlib/source/lux/data/format/tar.lux
+++ b/stdlib/source/lux/data/format/tar.lux
@@ -65,8 +65,6 @@
["Maximum" (%.nat (dec <limit>))]))
(abstract: #export <type>
- {}
-
Nat
(def: #export (<in> value)
@@ -152,8 +150,6 @@
(..big value)))))
(abstract: Checksum
- {}
-
Text
(def: from-checksum
@@ -245,8 +241,6 @@
(template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>]
[(abstract: #export <type>
- {}
-
<representation>
(exception: #export (<exception> {value Text})
@@ -302,8 +296,6 @@
(def: magic-size Size 7)
(abstract: Magic
- {}
-
Text
(def: ustar (:abstraction "ustar "))
@@ -390,8 +382,6 @@
(..small-number ..device-size)))
(abstract: Link-Flag
- {}
-
Char
(def: link-flag
@@ -440,8 +430,6 @@
)
(abstract: #export Mode
- {}
-
Nat
(def: #export mode
@@ -530,8 +518,6 @@
(list@fold n.* 1)))
(abstract: #export Content
- {}
-
[Big Binary]
(def: #export (content content)
diff --git a/stdlib/source/lux/data/text/buffer.lux b/stdlib/source/lux/data/text/buffer.lux
index e14013a29..c3f35f7f5 100644
--- a/stdlib/source/lux/data/text/buffer.lux
+++ b/stdlib/source/lux/data/text/buffer.lux
@@ -26,13 +26,13 @@
(toString [] String)))}))
(`` (abstract: #export Buffer
- {#.doc "Immutable text buffer for efficient text concatenation."}
-
(for {(~~ (static _.old))
[Nat (-> StringBuilder StringBuilder)]}
## default
(Row Text))
+ {#.doc "Immutable text buffer for efficient text concatenation."}
+
(def: #export empty
Buffer
(:abstraction (for {(~~ (static _.old))
diff --git a/stdlib/source/lux/data/text/encoding.lux b/stdlib/source/lux/data/text/encoding.lux
index ae1e11021..88b04c00c 100644
--- a/stdlib/source/lux/data/text/encoding.lux
+++ b/stdlib/source/lux/data/text/encoding.lux
@@ -14,8 +14,6 @@
## https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
(abstract: #export Encoding
- {}
-
Text
(template [<name> <encoding>]
diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux
index 6a4192b4c..8faf56789 100644
--- a/stdlib/source/lux/data/text/unicode.lux
+++ b/stdlib/source/lux/data/text/unicode.lux
@@ -1,13 +1,13 @@
(.module:
[lux #*
[abstract
- ["." interval (#+ Interval)]
- [monoid (#+ Monoid)]]
+ [monoid (#+ Monoid)]
+ ["." interval (#+ Interval)]]
[data
[number (#+ hex)
["n" nat ("#@." interval)]]
[collection
- ["." list]
+ ["." list ("#@." fold functor)]
[tree
["." finger (#+ Tree)]]]]
[type
@@ -15,13 +15,13 @@
[// (#+ Char)])
(abstract: #export Segment
- {}
(Interval Char)
- (def: empty (:abstraction (interval.between n.enum n@top n@bottom)))
-
- (structure: monoid (Monoid Segment)
- (def: identity ..empty)
+ (structure: monoid
+ (Monoid Segment)
+
+ (def: identity
+ (:abstraction (interval.between n.enum n@top n@bottom)))
(def: (compose left right)
(let [left (:representation left)
right (:representation right)]
@@ -189,171 +189,182 @@
[basic-latin/lower-alpha "0061" "007A"]
)
-(type: #export Set (Tree Segment []))
+(abstract: #export Set
+ (Tree Segment [])
-(def: (singleton segment)
- (-> Segment Set)
- {#finger.monoid ..monoid
- #finger.node (#finger.Leaf segment [])})
+ (def: #export (compose left right)
+ (-> Set Set Set)
+ (:abstraction
+ (finger.branch (:representation left)
+ (:representation right))))
-(def: #export (set segments)
- (-> (List Segment) Set)
- (case segments
- (^ (list))
- (..singleton (:: ..monoid identity))
-
- (^ (list singleton))
- (..singleton singleton)
-
- (^ (list left right))
- (..singleton (:: ..monoid compose left right))
-
- _
- (let [[sides extra] (n./% 2 (list.size segments))
- [left+ right+] (list.split (n.+ sides extra) segments)]
- (finger.branch (set left+)
- (set right+)))))
+ (def: (singleton segment)
+ (-> Segment Set)
+ (:abstraction
+ {#finger.monoid ..monoid
+ #finger.node (#finger.Leaf segment [])}))
-(def: half/0
- (List Segment)
- (list basic-latin
- latin-1-supplement
- latin-extended-a
- latin-extended-b
- ipa-extensions
- spacing-modifier-letters
- combining-diacritical-marks
- greek-and-coptic
- cyrillic
- cyrillic-supplementary
- armenian
- hebrew
- arabic
- syriac
- thaana
- devanagari
- bengali
- gurmukhi
- gujarati
- oriya
- tamil
- telugu
- kannada
- malayalam
- sinhala
- thai
- lao
- tibetan
- myanmar
- georgian
- hangul-jamo
- ethiopic
- cherokee
- unified-canadian-aboriginal-syllabics
- ogham
- runic
- tagalog
- hanunoo
- buhid
- tagbanwa
- khmer
- mongolian
- limbu
- tai-le
- khmer-symbols
- phonetic-extensions
- latin-extended-additional
- greek-extended
- general-punctuation
- superscripts-and-subscripts
- currency-symbols
- combining-diacritical-marks-for-symbols
- letterlike-symbols
- number-forms
- arrows
- mathematical-operators
- miscellaneous-technical
- control-pictures
- optical-character-recognition
- enclosed-alphanumerics
- box-drawing
- ))
+ (def: #export (set [head tail])
+ (-> [Segment (List Segment)] Set)
+ (list@fold ..compose (..singleton head) (list@map ..singleton tail)))
-(def: half/1
- (List Segment)
- (list block-elements
- geometric-shapes
- miscellaneous-symbols
- dingbats
- miscellaneous-mathematical-symbols-a
- supplemental-arrows-a
- braille-patterns
- supplemental-arrows-b
- miscellaneous-mathematical-symbols-b
- supplemental-mathematical-operators
- miscellaneous-symbols-and-arrows
- cjk-radicals-supplement
- kangxi-radicals
- ideographic-description-characters
- cjk-symbols-and-punctuation
- hiragana
- katakana
- bopomofo
- hangul-compatibility-jamo
- kanbun
- bopomofo-extended
- katakana-phonetic-extensions
- enclosed-cjk-letters-and-months
- cjk-compatibility
- cjk-unified-ideographs-extension-a
- yijing-hexagram-symbols
- cjk-unified-ideographs
- yi-syllables
- yi-radicals
- hangul-syllables
- high-surrogates
- high-private-use-surrogates
- low-surrogates
- private-use-area
- cjk-compatibility-ideographs
- alphabetic-presentation-forms
- arabic-presentation-forms-a
- variation-selectors
- combining-half-marks
- cjk-compatibility-forms
- small-form-variants
- arabic-presentation-forms-b
- halfwidth-and-fullwidth-forms
- specials
- linear-b-syllabary
- linear-b-ideograms
- aegean-numbers
- old-italic
- gothic
- ugaritic
- deseret
- shavian
- osmanya
- cypriot-syllabary
- byzantine-musical-symbols
- musical-symbols
- tai-xuan-jing-symbols
- mathematical-alphanumeric-symbols
- cjk-unified-ideographs-extension-b
- cjk-compatibility-ideographs-supplement
- tags
- ))
+ (def: half/0
+ (..set [basic-latin
+ (list latin-1-supplement
+ latin-extended-a
+ latin-extended-b
+ ipa-extensions
+ spacing-modifier-letters
+ combining-diacritical-marks
+ greek-and-coptic
+ cyrillic
+ cyrillic-supplementary
+ armenian
+ hebrew
+ arabic
+ syriac
+ thaana
+ devanagari
+ bengali
+ gurmukhi
+ gujarati
+ oriya
+ tamil
+ telugu
+ kannada
+ malayalam
+ sinhala
+ thai
+ lao
+ tibetan
+ myanmar
+ georgian
+ hangul-jamo
+ ethiopic
+ cherokee
+ unified-canadian-aboriginal-syllabics
+ ogham
+ runic
+ tagalog
+ hanunoo
+ buhid
+ tagbanwa
+ khmer
+ mongolian
+ limbu
+ tai-le
+ khmer-symbols
+ phonetic-extensions
+ latin-extended-additional
+ greek-extended
+ general-punctuation
+ superscripts-and-subscripts
+ currency-symbols
+ combining-diacritical-marks-for-symbols
+ letterlike-symbols
+ number-forms
+ arrows
+ mathematical-operators
+ miscellaneous-technical
+ control-pictures
+ optical-character-recognition
+ enclosed-alphanumerics
+ box-drawing
+ )]))
-(def: #export full
- Set
- (finger.branch (set half/0) (set half/1)))
+ (def: half/1
+ (..set [block-elements
+ (list geometric-shapes
+ miscellaneous-symbols
+ dingbats
+ miscellaneous-mathematical-symbols-a
+ supplemental-arrows-a
+ braille-patterns
+ supplemental-arrows-b
+ miscellaneous-mathematical-symbols-b
+ supplemental-mathematical-operators
+ miscellaneous-symbols-and-arrows
+ cjk-radicals-supplement
+ kangxi-radicals
+ ideographic-description-characters
+ cjk-symbols-and-punctuation
+ hiragana
+ katakana
+ bopomofo
+ hangul-compatibility-jamo
+ kanbun
+ bopomofo-extended
+ katakana-phonetic-extensions
+ enclosed-cjk-letters-and-months
+ cjk-compatibility
+ cjk-unified-ideographs-extension-a
+ yijing-hexagram-symbols
+ cjk-unified-ideographs
+ yi-syllables
+ yi-radicals
+ hangul-syllables
+ high-surrogates
+ high-private-use-surrogates
+ low-surrogates
+ private-use-area
+ cjk-compatibility-ideographs
+ alphabetic-presentation-forms
+ arabic-presentation-forms-a
+ variation-selectors
+ combining-half-marks
+ cjk-compatibility-forms
+ small-form-variants
+ arabic-presentation-forms-b
+ halfwidth-and-fullwidth-forms
+ specials
+ linear-b-syllabary
+ linear-b-ideograms
+ aegean-numbers
+ old-italic
+ gothic
+ ugaritic
+ deseret
+ shavian
+ osmanya
+ cypriot-syllabary
+ byzantine-musical-symbols
+ musical-symbols
+ tai-xuan-jing-symbols
+ mathematical-alphanumeric-symbols
+ cjk-unified-ideographs-extension-b
+ cjk-compatibility-ideographs-supplement
+ tags
+ )]))
+
+ (def: #export full
+ (..compose ..half/0 ..half/1))
+
+ (def: #export (range set)
+ (-> Set [Char Char])
+ (let [tag (finger.tag (:representation set))]
+ [(..start tag)
+ (..end tag)]))
+
+ (def: #export (member? set character)
+ (-> Set Char Bit)
+ (let [[_monoid node] (:representation set)]
+ (loop [node node]
+ (case node
+ (#finger.Leaf segment _)
+ (..within? segment character)
+
+ (#finger.Branch _ left right)
+ (or (recur left)
+ (recur right))))))
+ )
(template [<name> <segments>]
- [(def: #export <name> Set (set <segments>))]
+ [(def: #export <name>
+ (..set <segments>))]
- [ascii (list basic-latin)]
- [ascii/alpha (list basic-latin/upper-alpha basic-latin/lower-alpha)]
- [ascii/alpha-num (list basic-latin/upper-alpha basic-latin/lower-alpha basic-latin/decimal)]
- [ascii/upper-alpha (list basic-latin/upper-alpha)]
- [ascii/lower-alpha (list basic-latin/lower-alpha)]
+ [ascii [basic-latin (list)]]
+ [ascii/alpha [basic-latin/upper-alpha (list basic-latin/lower-alpha)]]
+ [ascii/alpha-num [basic-latin/upper-alpha (list basic-latin/lower-alpha basic-latin/decimal)]]
+ [ascii/upper-alpha [basic-latin/upper-alpha (list)]]
+ [ascii/lower-alpha [basic-latin/lower-alpha (list)]]
)
diff --git a/stdlib/source/lux/debug.lux b/stdlib/source/lux/debug.lux
index d4f12e9fe..47e104842 100644
--- a/stdlib/source/lux/debug.lux
+++ b/stdlib/source/lux/debug.lux
@@ -278,9 +278,9 @@
(def: #export (represent type value)
(-> Type Any (Try Text))
- (case (<type>.run type ..representation)
+ (case (<type>.run ..representation type)
(#try.Success representation)
(#try.Success (representation value))
(#try.Failure _)
- (exception.throw cannot-represent-value type)))
+ (exception.throw ..cannot-represent-value type)))
diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux
index 3f43b8948..6be66f0a6 100644
--- a/stdlib/source/lux/host.js.lux
+++ b/stdlib/source/lux/host.js.lux
@@ -20,11 +20,11 @@
["." code]
["." template]]])
-(abstract: #export (Object brand) {} Any)
+(abstract: #export (Object brand) Any)
(template [<name>]
[(with-expansions [<brand> (template.identifier [<name> "'"])]
- (abstract: #export <brand> {} Any)
+ (abstract: #export <brand> Any)
(type: #export <name> (Object <brand>)))]
[Function]
diff --git a/stdlib/source/lux/locale.lux b/stdlib/source/lux/locale.lux
index 69920aba9..0fe688e43 100644
--- a/stdlib/source/lux/locale.lux
+++ b/stdlib/source/lux/locale.lux
@@ -16,8 +16,6 @@
["." territory (#+ Territory)]])
(abstract: #export Locale
- {}
-
Text
(def: territory-separator "_")
diff --git a/stdlib/source/lux/locale/language.lux b/stdlib/source/lux/locale/language.lux
index 1b09d4ddf..75b4c53a8 100644
--- a/stdlib/source/lux/locale/language.lux
+++ b/stdlib/source/lux/locale/language.lux
@@ -12,8 +12,6 @@
## https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
(abstract: #export Language
- {}
-
Text
(def: #export code
@@ -168,7 +166,7 @@
["fin" finnish []]
["fiu" finno-ugrian []]
["fon" fon []]
- ["fra" French []]
+ ["fra" french []]
["frm" middle-french []]
["fro" old-french []]
["frr" northern-frisian []]
diff --git a/stdlib/source/lux/locale/territory.lux b/stdlib/source/lux/locale/territory.lux
index dfd06f8c8..40a2a0c31 100644
--- a/stdlib/source/lux/locale/territory.lux
+++ b/stdlib/source/lux/locale/territory.lux
@@ -12,8 +12,6 @@
## https://en.wikipedia.org/wiki/ISO_3166-1
(abstract: #export Territory
- {}
-
{#name Text
#short Text
#long Text
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index 98a3a0d47..033a06e84 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -31,12 +31,11 @@
(wrap (.list (` (syntax: (~+ (csw.export export)) ((~ g!name) {(~ g!type) s.identifier})
(do macro.monad
[(~ g!type) (macro.find-type-def (~ g!type))]
- (case (|> (~ body)
- (function ((~ g!_) (~ g!name)))
- p.rec
- (do p.monad [])
- ((~! <type>.run) (~ g!type))
- (: (.Either .Text .Code)))
+ (case (: (.Either .Text .Code)
+ ((~! <type>.run) (p.rec
+ (function ((~ g!_) (~ g!name))
+ (~ body)))
+ (~ g!type)))
(#.Left (~ g!output))
(macro.fail (~ g!output))
diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux
index 882162d5d..c00fceb0c 100644
--- a/stdlib/source/lux/math/modular.lux
+++ b/stdlib/source/lux/math/modular.lux
@@ -22,10 +22,10 @@
(exception: #export zero-cannot-be-a-modulus)
(abstract: #export (Modulus m)
+ Int
+
{#.doc (doc "A number used as a modulus in modular arithmetic."
"It cannot be 0.")}
-
- Int
(def: #export (from-int value)
(Ex [m] (-> Int (Try (Modulus m))))
@@ -69,11 +69,11 @@
(l.and (l.one-of "-+") (l.many l.decimal))))
(abstract: #export (Mod m)
- {#.doc "A number under a modulus."}
-
{#remainder Int
#modulus (Modulus m)}
+ {#.doc "A number under a modulus."}
+
(def: #export (mod modulus)
(All [m] (-> (Modulus m) (-> Int (Mod m))))
(function (_ value)
diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux
index 4e94ba5bb..c26bd7c38 100644
--- a/stdlib/source/lux/math/random.lux
+++ b/stdlib/source/lux/math/random.lux
@@ -139,17 +139,13 @@
(def: #export (char set)
(-> unicode.Set (Random Char))
- (let [summary (finger.tag set)
- start (unicode.start summary)
- size (unicode.size summary)
+ (let [[start end] (unicode.range set)
+ size (n.- start end)
in-range (: (-> Char Char)
(|>> (n.% size) (n.+ start)))]
- (|> nat
+ (|> ..nat
(:: ..monad map in-range)
- (..filter (function (_ char)
- (finger.found? (function (_ segment)
- (unicode.within? segment char))
- set))))))
+ (..filter (unicode.member? set)))))
(def: #export (text char-gen size)
(-> (Random Char) Nat (Random Text))
diff --git a/stdlib/source/lux/target/common-lisp.lux b/stdlib/source/lux/target/common-lisp.lux
index 15330928d..b38ec0fee 100644
--- a/stdlib/source/lux/target/common-lisp.lux
+++ b/stdlib/source/lux/target/common-lisp.lux
@@ -19,8 +19,6 @@
(text.enclose ["(" ")"]))
(abstract: #export (Code brand)
- {}
-
Text
(def: #export manual
@@ -33,7 +31,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export (<brand> brand) {} Any))
+ (`` (abstract: #export (<brand> brand) Any))
(`` (type: #export (<type> brand)
(<super> (<brand> brand)))))]
@@ -47,7 +45,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export <brand> {} Any))
+ (`` (abstract: #export <brand> Any))
(`` (type: #export <type> (<super> <brand>))))]
[Label Code]
diff --git a/stdlib/source/lux/target/js.lux b/stdlib/source/lux/target/js.lux
index 7ba1c6851..16a6d77da 100644
--- a/stdlib/source/lux/target/js.lux
+++ b/stdlib/source/lux/target/js.lux
@@ -24,8 +24,6 @@
(text.replace-all text.new-line (format text.new-line text.tab))))
(abstract: #export (Code brand)
- {}
-
Text
(def: #export code
@@ -33,7 +31,7 @@
(|>> :representation))
(template [<type> <brand> <super>+]
- [(abstract: #export (<brand> brand) {} Any)
+ [(abstract: #export (<brand> brand) Any)
(`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+)))))]
[Expression Expression' [Code]]
@@ -43,7 +41,7 @@
)
(template [<type> <brand> <super>+]
- [(abstract: #export <brand> {} Any)
+ [(abstract: #export <brand> Any)
(`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+)))))]
[Var Var' [Location' Computation' Expression' Code]]
diff --git a/stdlib/source/lux/target/jvm/bytecode/address.lux b/stdlib/source/lux/target/jvm/bytecode/address.lux
index 0af06f9e9..be848db29 100644
--- a/stdlib/source/lux/target/jvm/bytecode/address.lux
+++ b/stdlib/source/lux/target/jvm/bytecode/address.lux
@@ -22,8 +22,6 @@
["#." signed (#+ S4)]]]])
(abstract: #export Address
- {}
-
U2
(def: #export value
diff --git a/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux
index 660f6c85c..8156c46c0 100644
--- a/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux
+++ b/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux
@@ -26,8 +26,6 @@
(def: wide 2)
(abstract: #export Registry
- {}
-
U2
(def: #export registry
diff --git a/stdlib/source/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/lux/target/jvm/bytecode/environment/limit/stack.lux
index 18ca09fb0..9d9822e5b 100644
--- a/stdlib/source/lux/target/jvm/bytecode/environment/limit/stack.lux
+++ b/stdlib/source/lux/target/jvm/bytecode/environment/limit/stack.lux
@@ -17,8 +17,6 @@
["#." unsigned (#+ U2)]]])
(abstract: #export Stack
- {}
-
U2
(template [<frames> <name>]
diff --git a/stdlib/source/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/lux/target/jvm/bytecode/instruction.lux
index 366f65cfc..dcb74b539 100644
--- a/stdlib/source/lux/target/jvm/bytecode/instruction.lux
+++ b/stdlib/source/lux/target/jvm/bytecode/instruction.lux
@@ -206,8 +206,6 @@
(|>> mutation ((trinary/211' opcode input0 input1 input2)))])])
(abstract: #export Primitive-Array-Type
- {}
-
U1
(def: code
diff --git a/stdlib/source/lux/target/jvm/constant.lux b/stdlib/source/lux/target/jvm/constant.lux
index 2d90e618d..68641bcd9 100644
--- a/stdlib/source/lux/target/jvm/constant.lux
+++ b/stdlib/source/lux/target/jvm/constant.lux
@@ -37,8 +37,6 @@
binaryF.utf8/16)
(abstract: #export Class
- {}
-
(Index UTF8)
(def: #export index
@@ -79,9 +77,6 @@
(#static doubleToRawLongBits [double] long))
(abstract: #export (Value kind)
-
- {}
-
kind
(def: #export value
diff --git a/stdlib/source/lux/target/jvm/constant/tag.lux b/stdlib/source/lux/target/jvm/constant/tag.lux
index 1771bfd19..ce1b7d20a 100644
--- a/stdlib/source/lux/target/jvm/constant/tag.lux
+++ b/stdlib/source/lux/target/jvm/constant/tag.lux
@@ -14,8 +14,6 @@
["#." unsigned (#+ U1) ("u1@." equivalence)]]])
(abstract: #export Tag
- {}
-
U1
(structure: #export equivalence
diff --git a/stdlib/source/lux/target/jvm/encoding/name.lux b/stdlib/source/lux/target/jvm/encoding/name.lux
index cda98e0a0..3d0287b26 100644
--- a/stdlib/source/lux/target/jvm/encoding/name.lux
+++ b/stdlib/source/lux/target/jvm/encoding/name.lux
@@ -12,8 +12,6 @@
(type: #export External Text)
(abstract: #export Internal
- {}
-
Text
(def: #export internal
diff --git a/stdlib/source/lux/target/jvm/encoding/signed.lux b/stdlib/source/lux/target/jvm/encoding/signed.lux
index 8455d2dba..cef82ae7e 100644
--- a/stdlib/source/lux/target/jvm/encoding/signed.lux
+++ b/stdlib/source/lux/target/jvm/encoding/signed.lux
@@ -21,7 +21,6 @@
abstract]])
(abstract: #export (Signed brand)
- {}
Int
(def: #export value
@@ -48,7 +47,7 @@
(template [<bytes> <name> <size> <constructor> <maximum> <+> <->]
[(with-expansions [<raw> (template.identifier [<name> "'"])]
- (abstract: #export <raw> {} Any)
+ (abstract: #export <raw> Any)
(type: #export <name> (Signed <raw>)))
(def: #export <size> <bytes>)
diff --git a/stdlib/source/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/lux/target/jvm/encoding/unsigned.lux
index 65e3632f7..5abc79468 100644
--- a/stdlib/source/lux/target/jvm/encoding/unsigned.lux
+++ b/stdlib/source/lux/target/jvm/encoding/unsigned.lux
@@ -20,7 +20,6 @@
abstract]])
(abstract: #export (Unsigned brand)
- {}
Nat
(def: #export value
@@ -60,7 +59,7 @@
(template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>]
[(with-expansions [<raw> (template.identifier [<name> "'"])]
- (abstract: #export <raw> {} Any)
+ (abstract: #export <raw> Any)
(type: #export <name> (Unsigned <raw>)))
(def: #export <size> <bytes>)
diff --git a/stdlib/source/lux/target/jvm/index.lux b/stdlib/source/lux/target/jvm/index.lux
index 2922c74b1..eb0357b66 100644
--- a/stdlib/source/lux/target/jvm/index.lux
+++ b/stdlib/source/lux/target/jvm/index.lux
@@ -15,8 +15,6 @@
//unsigned.bytes/2)
(abstract: #export (Index kind)
- {}
-
U2
(def: #export index
diff --git a/stdlib/source/lux/target/jvm/modifier.lux b/stdlib/source/lux/target/jvm/modifier.lux
index 71e5c61bc..c849e9020 100644
--- a/stdlib/source/lux/target/jvm/modifier.lux
+++ b/stdlib/source/lux/target/jvm/modifier.lux
@@ -24,7 +24,6 @@
["#." unsigned]]])
(abstract: #export (Modifier of)
- {}
//unsigned.U2
(def: #export code
diff --git a/stdlib/source/lux/target/jvm/modifier/inner.lux b/stdlib/source/lux/target/jvm/modifier/inner.lux
index eec9221fb..ff6f5d50e 100644
--- a/stdlib/source/lux/target/jvm/modifier/inner.lux
+++ b/stdlib/source/lux/target/jvm/modifier/inner.lux
@@ -4,7 +4,7 @@
abstract]]
[// (#+ modifiers:)])
-(abstract: #export Inner {} Any)
+(abstract: #export Inner Any)
(modifiers: Inner
["0001" public]
diff --git a/stdlib/source/lux/target/jvm/type.lux b/stdlib/source/lux/target/jvm/type.lux
index 1dd5af027..613c8f5c3 100644
--- a/stdlib/source/lux/target/jvm/type.lux
+++ b/stdlib/source/lux/target/jvm/type.lux
@@ -23,8 +23,6 @@
["#." reflection (#+ Reflection)]])
(abstract: #export (Type category)
- {}
-
[(Signature category) (Descriptor category) (Reflection category)]
(type: #export Argument
diff --git a/stdlib/source/lux/target/jvm/type/category.lux b/stdlib/source/lux/target/jvm/type/category.lux
index f635d3e86..cd75fa592 100644
--- a/stdlib/source/lux/target/jvm/type/category.lux
+++ b/stdlib/source/lux/target/jvm/type/category.lux
@@ -5,24 +5,24 @@
[type
abstract]])
-(abstract: #export Void' {} Any)
-(abstract: #export (Value' kind) {} Any)
-(abstract: #export (Return' kind) {} Any)
-(abstract: #export Method {} Any)
+(abstract: #export Void' Any)
+(abstract: #export (Value' kind) Any)
+(abstract: #export (Return' kind) Any)
+(abstract: #export Method Any)
(type: #export Return (<| Return' Any))
(type: #export Value (<| Return' Value' Any))
(type: #export Void (<| Return' Void'))
-(abstract: #export (Object' brand) {} Any)
+(abstract: #export (Object' brand) Any)
(type: #export Object (<| Return' Value' Object' Any))
-(abstract: #export (Parameter' brand) {} Any)
+(abstract: #export (Parameter' brand) Any)
(type: #export Parameter (<| Return' Value' Object' Parameter' Any))
(template [<parents> <child>]
[(with-expansions [<raw> (template.identifier [<child> "'"])]
- (abstract: #export <raw> {} Any)
+ (abstract: #export <raw> Any)
(type: #export <child>
(`` (<| Return' Value' (~~ (template.splice <parents>)) <raw>))))]
@@ -32,4 +32,4 @@
[[Object'] Array]
)
-(abstract: #export Declaration {} Any)
+(abstract: #export Declaration Any)
diff --git a/stdlib/source/lux/target/jvm/type/descriptor.lux b/stdlib/source/lux/target/jvm/type/descriptor.lux
index 53d7eb1b8..abcbfbbb9 100644
--- a/stdlib/source/lux/target/jvm/type/descriptor.lux
+++ b/stdlib/source/lux/target/jvm/type/descriptor.lux
@@ -19,8 +19,6 @@
["#." name (#+ Internal External)]]]])
(abstract: #export (Descriptor category)
- {}
-
Text
(def: #export descriptor
diff --git a/stdlib/source/lux/target/jvm/type/lux.lux b/stdlib/source/lux/target/jvm/type/lux.lux
index 8c5d78de3..0ac0d013c 100644
--- a/stdlib/source/lux/target/jvm/type/lux.lux
+++ b/stdlib/source/lux/target/jvm/type/lux.lux
@@ -28,7 +28,7 @@
["#." name]]]])
(template [<name>]
- [(abstract: #export (<name> class) {} Any)]
+ [(abstract: #export (<name> class) Any)]
[Lower] [Upper]
)
diff --git a/stdlib/source/lux/target/jvm/type/reflection.lux b/stdlib/source/lux/target/jvm/type/reflection.lux
index 1d6162838..4ad2caf70 100644
--- a/stdlib/source/lux/target/jvm/type/reflection.lux
+++ b/stdlib/source/lux/target/jvm/type/reflection.lux
@@ -15,8 +15,6 @@
["#." name (#+ External)]]]])
(abstract: #export (Reflection category)
- {}
-
Text
(def: #export reflection
diff --git a/stdlib/source/lux/target/jvm/type/signature.lux b/stdlib/source/lux/target/jvm/type/signature.lux
index b88d3f610..5fd3c3487 100644
--- a/stdlib/source/lux/target/jvm/type/signature.lux
+++ b/stdlib/source/lux/target/jvm/type/signature.lux
@@ -18,8 +18,6 @@
["#." name (#+ External)]]]])
(abstract: #export (Signature category)
- {}
-
Text
(def: #export signature
diff --git a/stdlib/source/lux/target/lua.lux b/stdlib/source/lux/target/lua.lux
index c969cc790..37db0694f 100644
--- a/stdlib/source/lux/target/lua.lux
+++ b/stdlib/source/lux/target/lua.lux
@@ -28,8 +28,6 @@
(text.replace-all text.new-line (format text.new-line text.tab))))
(abstract: #export (Code brand)
- {}
-
Text
(def: #export manual
@@ -42,7 +40,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export (<brand> brand) {} Any))
+ (`` (abstract: #export (<brand> brand) Any))
(`` (type: #export (<type> brand)
(<super> (<brand> brand)))))]
@@ -53,7 +51,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export <brand> {} Any))
+ (`` (abstract: #export <brand> Any))
(`` (type: #export <type> (<super> <brand>))))]
[Literal Computation]
diff --git a/stdlib/source/lux/target/php.lux b/stdlib/source/lux/target/php.lux
index 577b202f1..308183868 100644
--- a/stdlib/source/lux/target/php.lux
+++ b/stdlib/source/lux/target/php.lux
@@ -31,8 +31,6 @@
(text.enclose ["(" ")"]))
(abstract: #export (Code brand)
- {}
-
Text
(def: #export manual
@@ -45,7 +43,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export (<brand> brand) {} Any))
+ (`` (abstract: #export (<brand> brand) Any))
(`` (type: #export (<type> brand)
(<super> (<brand> brand)))))]
@@ -56,7 +54,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export <brand> {} Any))
+ (`` (abstract: #export <brand> Any))
(`` (type: #export <type> (<super> <brand>))))]
[Literal Computation]
diff --git a/stdlib/source/lux/target/python.lux b/stdlib/source/lux/target/python.lux
index ef1098095..2f0438f8f 100644
--- a/stdlib/source/lux/target/python.lux
+++ b/stdlib/source/lux/target/python.lux
@@ -26,8 +26,6 @@
(text.replace-all text.new-line (format text.new-line text.tab))))
(abstract: #export (Code brand)
- {}
-
Text
(def: #export manual
@@ -40,7 +38,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export (<brand> brand) {} Any))
+ (`` (abstract: #export (<brand> brand) Any))
(`` (type: #export (<type> brand)
(<super> (<brand> brand)))))]
@@ -53,7 +51,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export <brand> {} Any))
+ (`` (abstract: #export <brand> Any))
(`` (type: #export <type> (<super> <brand>))))]
[Literal Computation]
@@ -63,7 +61,7 @@
)
(template [<var> <brand>]
- [(abstract: #export <brand> {} Any)
+ [(abstract: #export <brand> Any)
(type: #export <var> (Var <brand>))]
diff --git a/stdlib/source/lux/target/ruby.lux b/stdlib/source/lux/target/ruby.lux
index 9a0617204..9ac60c6c0 100644
--- a/stdlib/source/lux/target/ruby.lux
+++ b/stdlib/source/lux/target/ruby.lux
@@ -23,8 +23,6 @@
(text.replace-all text.new-line (format text.new-line text.tab))))
(abstract: #export (Code brand)
- {}
-
Text
(def: #export manual
@@ -37,7 +35,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export (<brand> brand) {} Any))
+ (`` (abstract: #export (<brand> brand) Any))
(`` (type: #export (<type> brand)
(<super> (<brand> brand)))))]
@@ -50,7 +48,7 @@
(template [<type> <super>]
[(with-expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export <brand> {} Any))
+ (`` (abstract: #export <brand> Any))
(`` (type: #export <type> (<super> <brand>))))]
[Literal Computation]
@@ -58,7 +56,7 @@
)
(template [<var> <brand> <prefix> <constructor>]
- [(abstract: #export <brand> {} Any)
+ [(abstract: #export <brand> Any)
(type: #export <var> (Var <brand>))
@@ -71,7 +69,7 @@
[SVar Static "@@" static]
)
- (abstract: #export (Local brand) {} Any)
+ (abstract: #export (Local brand) Any)
(type: #export LVar (Var (Local Any)))
(def: #export local
@@ -79,7 +77,7 @@
(|>> :abstraction))
(template [<var> <brand> <prefix> <modifier> <unpacker>]
- [(abstract: #export <brand> {} Any)
+ [(abstract: #export <brand> Any)
(type: #export <var> (Var (Local <brand>)))
diff --git a/stdlib/source/lux/target/scheme.lux b/stdlib/source/lux/target/scheme.lux
index 0d70aeb58..c218367fa 100644
--- a/stdlib/source/lux/target/scheme.lux
+++ b/stdlib/source/lux/target/scheme.lux
@@ -15,19 +15,17 @@
abstract]])
(abstract: #export (Code k)
- {}
-
Text
(template [<type> <brand> <super>+]
- [(abstract: #export (<brand> brand) {} Any)
+ [(abstract: #export (<brand> brand) Any)
(`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+)))))]
[Expression Expression' [Code]]
)
(template [<type> <brand> <super>+]
- [(abstract: #export <brand> {} Any)
+ [(abstract: #export <brand> Any)
(`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+)))))]
[Global Global' [Expression' Code]]
diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux
index b87c2e2d3..550d6ba0e 100644
--- a/stdlib/source/lux/time/duration.lux
+++ b/stdlib/source/lux/time/duration.lux
@@ -19,9 +19,10 @@
abstract]])
(abstract: #export Duration
- {#.doc "Durations have a resolution of milli-seconds."}
Int
+ {#.doc "Durations have a resolution of milli-seconds."}
+
(def: #export from-millis
(-> Int Duration)
(|>> :abstraction))
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux
index ab7fe6953..ba451ef18 100644
--- a/stdlib/source/lux/time/instant.lux
+++ b/stdlib/source/lux/time/instant.lux
@@ -29,9 +29,10 @@
["." day (#+ Day)]])
(abstract: #export Instant
- {#.doc "Instant is defined as milliseconds since the epoch."}
Int
+ {#.doc "Instant is defined as milliseconds since the epoch."}
+
(def: #export from-millis
(-> Int Instant)
(|>> :abstraction))
diff --git a/stdlib/source/lux/tool/compiler/meta/archive.lux b/stdlib/source/lux/tool/compiler/meta/archive.lux
index ffd6e65ea..172bb4d13 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive.lux
@@ -67,8 +67,6 @@
"")
(abstract: #export Archive
- {}
-
{#next ID
#resolver (Dictionary Module [ID (Maybe [Descriptor (Document Any)])])}
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
index d597541c9..4a9d8605b 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
@@ -36,8 +36,6 @@
#category Category})
(abstract: #export Registry
- {}
-
{#artifacts (Row Artifact)
#resolver (Dictionary Text ID)}
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/lux/tool/compiler/meta/archive/document.lux
index 825436999..bc6fc5288 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive/document.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive/document.lux
@@ -25,8 +25,6 @@
["Actual" (signature.description actual)]))
(abstract: #export (Document d)
- {}
-
{#signature Signature
#content d}
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/key.lux b/stdlib/source/lux/tool/compiler/meta/archive/key.lux
index 50c10ac01..1f30e105b 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive/key.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive/key.lux
@@ -6,8 +6,6 @@
[signature (#+ Signature)]])
(abstract: #export (Key k)
- {}
-
Signature
(def: #export signature
diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux
index f3631ea93..227cfb3be 100644
--- a/stdlib/source/lux/type/abstract.lux
+++ b/stdlib/source/lux/type/abstract.lux
@@ -187,8 +187,8 @@
(syntax: #export (abstract:
{export csr.export}
{[name type-vars] declaration}
- {annotations (<>.default cs.empty-annotations csr.annotations)}
representation-type
+ {annotations (<>.default cs.empty-annotations csr.annotations)}
{primitives (<>.some <c>.any)})
(do macro.monad
[current-module macro.current-module-name
diff --git a/stdlib/source/lux/type/dynamic.lux b/stdlib/source/lux/type/dynamic.lux
index bd72e30b3..1031f8f41 100644
--- a/stdlib/source/lux/type/dynamic.lux
+++ b/stdlib/source/lux/type/dynamic.lux
@@ -18,10 +18,10 @@
["Actual" (%.type actual)]))
(abstract: #export Dynamic
- {#.doc "A value coupled with its type, so it can be checked later."}
-
[Type Any]
+ {#.doc "A value coupled with its type, so it can be checked later."}
+
(def: dynamic-abstraction (-> [Type Any] Dynamic) (|>> :abstraction))
(def: dynamic-representation (-> Dynamic [Type Any]) (|>> :representation))
diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux
index e5eac8280..fd5480bc6 100644
--- a/stdlib/source/lux/type/quotient.lux
+++ b/stdlib/source/lux/type/quotient.lux
@@ -4,8 +4,6 @@
abstract]])
(abstract: #export (Class t c q)
- {}
-
(-> t c)
(def: #export class
@@ -15,8 +13,6 @@
(|>> :abstraction))
(abstract: #export (Quotient t c q)
- {}
-
{#value t
#label c}
diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux
index 3a9b8cfd2..210dd18d3 100644
--- a/stdlib/source/lux/type/refinement.lux
+++ b/stdlib/source/lux/type/refinement.lux
@@ -8,11 +8,11 @@
abstract]])
(abstract: #export (Refined t r)
- {#.doc "A refined type 'r' of base type 't' using a predicate."}
-
{#value t
#predicate (Predicate t)}
+ {#.doc "A refined type 'r' of base type 't' using a predicate."}
+
(type: #export (Refiner t r)
(-> t (Maybe (Refined t r))))
diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux
index 1e81d37c1..16bb08f50 100644
--- a/stdlib/source/lux/type/resource.lux
+++ b/stdlib/source/lux/type/resource.lux
@@ -78,11 +78,11 @@
[async Promise promise.monad run-async lift-async]
)
-(abstract: #export Ordered {} [])
+(abstract: #export Ordered [])
-(abstract: #export Commutative {} [])
+(abstract: #export Commutative [])
-(abstract: #export (Key mode key) {}
+(abstract: #export (Key mode key)
[]
(template [<name> <mode>]
@@ -98,9 +98,10 @@
(type: #export CK (Key Commutative))
(abstract: #export (Res key value)
- {#.doc "A value locked by a key."}
value
+ {#.doc "A value locked by a key."}
+
(template [<name> <m> <monad> <mode> <key>]
[(def: #export (<name> value)
(All [v] (Ex [k] (-> v (Affine <m> (Key <mode> k) (Res k v)))))
diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux
index caf510403..ef954441a 100644
--- a/stdlib/source/lux/type/unit.lux
+++ b/stdlib/source/lux/type/unit.lux
@@ -25,7 +25,6 @@
abstract]])
(abstract: #export (Qty unit)
- {}
Int
(def: #export in
diff --git a/stdlib/source/lux/world/db/sql.lux b/stdlib/source/lux/world/db/sql.lux
index f9b6c1e1d..2d2c55c6a 100644
--- a/stdlib/source/lux/world/db/sql.lux
+++ b/stdlib/source/lux/world/db/sql.lux
@@ -18,7 +18,7 @@
## Kind
(template [<declaration>]
- [(abstract: #export <declaration> {} Any)]
+ [(abstract: #export <declaration> Any)]
[Literal']
[Column']
@@ -59,8 +59,6 @@
(def: #export no-alias Alias "")
(abstract: #export (SQL kind)
- {}
-
Text
## SQL
diff --git a/stdlib/source/lux/world/net/http/mime.lux b/stdlib/source/lux/world/net/http/mime.lux
index f3f795a13..1029e6bb9 100644
--- a/stdlib/source/lux/world/net/http/mime.lux
+++ b/stdlib/source/lux/world/net/http/mime.lux
@@ -8,10 +8,10 @@
abstract]])
(abstract: #export MIME
- {#doc "Multipurpose Internet Mail Extensions"}
-
Text
+ {#doc "Multipurpose Internet Mail Extensions"}
+
(def: #export mime
(-> Text MIME)
(|>> :abstraction))
diff --git a/stdlib/source/test/lux/control.lux b/stdlib/source/test/lux/control.lux
index 9beb884b4..fe35c0500 100644
--- a/stdlib/source/test/lux/control.lux
+++ b/stdlib/source/test/lux/control.lux
@@ -26,7 +26,8 @@
["#/." json]
["#/." synthesis]
["#/." text]
- ["#/." tree]]
+ ["#/." tree]
+ ["#/." type]]
["#." pipe]
["#." reader]
["#." region]
@@ -71,6 +72,7 @@
/parser/synthesis.test
/parser/text.test
/parser/tree.test
+ /parser/type.test
))
(def: security
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux
index 30ebe0cad..08dddb051 100644
--- a/stdlib/source/test/lux/control/parser/text.lux
+++ b/stdlib/source/test/lux/control/parser/text.lux
@@ -16,7 +16,9 @@
["n" nat]]
[collection
["." set]
- ["." list ("#@." functor)]]]
+ ["." list ("#@." functor)]
+ [tree
+ ["." finger]]]]
[math
["." random]]
[macro
@@ -93,19 +95,19 @@
(..should-fail (text.from-code invalid) /.lower))))
(do {@ random.monad}
[expected (:: @ map (n.% 10) random.nat)
- invalid (random.char (unicode.set (list unicode.aegean-numbers)))]
+ invalid (random.char (unicode.set [unicode.aegean-numbers (list)]))]
(_.cover [/.decimal]
(and (..should-pass (:: n.decimal encode expected) /.decimal)
(..should-fail (text.from-code invalid) /.decimal))))
(do {@ random.monad}
[expected (:: @ map (n.% 8) random.nat)
- invalid (random.char (unicode.set (list unicode.aegean-numbers)))]
+ invalid (random.char (unicode.set [unicode.aegean-numbers (list)]))]
(_.cover [/.octal]
(and (..should-pass (:: n.octal encode expected) /.octal)
(..should-fail (text.from-code invalid) /.octal))))
(do {@ random.monad}
[expected (:: @ map (n.% 16) random.nat)
- invalid (random.char (unicode.set (list unicode.aegean-numbers)))]
+ invalid (random.char (unicode.set [unicode.aegean-numbers (list)]))]
(_.cover [/.hexadecimal]
(and (..should-pass (:: n.hex encode expected) /.hexadecimal)
(..should-fail (text.from-code invalid) /.hexadecimal))))
@@ -315,14 +317,9 @@
(exception.match? /.cannot-match error)))))))
(_.cover [/.Slice /.slice /.cannot-slice]
(|> ""
- (/.run (do <>.monad
- [#let [_ (log! " PRE SLICE")]
- slice (/.slice /.any!)
- #let [_ (log! "POST SLICE")]]
- (wrap slice)))
+ (/.run (/.slice /.any!))
(!expect (^multi (#try.Failure error)
- (exec (log! (format "error = " error))
- (exception.match? /.cannot-slice error))))))
+ (exception.match? /.cannot-slice error)))))
(do {@ random.monad}
[expected (random.unicode 1)]
(_.cover [/.any /.any!]
diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux
new file mode 100644
index 000000000..99e995f2d
--- /dev/null
+++ b/stdlib/source/test/lux/control/parser/type.lux
@@ -0,0 +1,197 @@
+(.module:
+ [lux (#- primitive)
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try]
+ ["." exception]]
+ [data
+ ["." name ("#@." equivalence)]
+ [number
+ ["n" nat]]]
+ [math
+ ["." random (#+ Random)]]
+ ["." type ("#@." equivalence)]]
+ {1
+ ["." /
+ ["/#" //]]})
+
+(template: (!expect <pattern> <value>)
+ (case <value>
+ <pattern>
+ true
+
+ _
+ false))
+
+(def: primitive
+ (Random Type)
+ (|> (random.ascii/alpha-num 1)
+ (:: random.monad map (function (_ name)
+ (#.Primitive name (list))))))
+
+(def: matches
+ Test
+ (<| (_.with-cover [/.types-do-not-match])
+ (do {@ random.monad}
+ [expected ..primitive
+ dummy (random.filter (|>> (type@= expected) not)
+ ..primitive)])
+ ($_ _.and
+ (_.cover [/.exactly]
+ (and (|> (/.run (/.exactly expected) expected)
+ (!expect (#try.Success [])))
+ (|> (/.run (/.exactly expected) dummy)
+ (!expect (^multi (#try.Failure error)
+ (exception.match? /.types-do-not-match error))))))
+ (_.cover [/.sub]
+ (and (|> (/.run (/.sub expected) expected)
+ (!expect (#try.Success [])))
+ (|> (/.run (/.sub Any) expected)
+ (!expect (#try.Success [])))
+ (|> (/.run (/.sub expected) Nothing)
+ (!expect (#try.Success [])))
+ (|> (/.run (/.sub expected) dummy)
+ (!expect (^multi (#try.Failure error)
+ (exception.match? /.types-do-not-match error))))))
+ (_.cover [/.super]
+ (and (|> (/.run (/.super expected) expected)
+ (!expect (#try.Success [])))
+ (|> (/.run (/.super expected) Any)
+ (!expect (#try.Success [])))
+ (|> (/.run (/.super Nothing) expected)
+ (!expect (#try.Success [])))
+ (|> (/.run (/.super expected) dummy)
+ (!expect (^multi (#try.Failure error)
+ (exception.match? /.types-do-not-match error))))))
+ )))
+
+(def: aggregate
+ Test
+ (do {@ random.monad}
+ [expected-left ..primitive
+ expected-middle ..primitive
+ expected-right ..primitive]
+ (`` ($_ _.and
+ (~~ (template [<parser> <exception> <good-constructor> <bad-constructor>]
+ [(_.cover [<parser> <exception>]
+ (and (|> (/.run (<parser> ($_ //.and /.any /.any /.any))
+ (<good-constructor> (list expected-left expected-middle expected-right)))
+ (!expect (^multi (#try.Success [actual-left actual-middle actual-right])
+ (and (type@= expected-left actual-left)
+ (type@= expected-middle actual-middle)
+ (type@= expected-right actual-right)))))
+ (|> (/.run (<parser> ($_ //.and /.any /.any /.any))
+ (<bad-constructor> (list expected-left expected-middle expected-right)))
+ (!expect (^multi (#try.Failure error)
+ (exception.match? <exception> error))))))]
+
+ [/.variant /.not-variant type.variant type.tuple]
+ [/.tuple /.not-tuple type.tuple type.variant]
+ ))
+
+ (_.cover [/.function /.not-function]
+ (and (|> (/.run (/.function ($_ //.and /.any /.any) /.any)
+ (type.function (list expected-left expected-middle) expected-right))
+ (!expect (^multi (#try.Success [[actual-left actual-middle] actual-right])
+ (and (type@= expected-left actual-left)
+ (type@= expected-middle actual-middle)
+ (type@= expected-right actual-right)))))
+ (|> (/.run (/.function ($_ //.and /.any /.any) /.any)
+ (type.variant (list expected-left expected-middle expected-right)))
+ (!expect (^multi (#try.Failure error)
+ (exception.match? /.not-function error))))))
+ (_.cover [/.apply /.not-application]
+ (and (|> (/.run (/.apply ($_ //.and /.any /.any /.any))
+ (type.application (list expected-middle expected-right) expected-left))
+ (!expect (^multi (#try.Success [actual-left actual-middle actual-right])
+ (and (type@= expected-left actual-left)
+ (type@= expected-middle actual-middle)
+ (type@= expected-right actual-right)))))
+ (|> (/.run (/.apply ($_ //.and /.any /.any /.any))
+ (type.variant (list expected-left expected-middle expected-right)))
+ (!expect (^multi (#try.Failure error)
+ (exception.match? /.not-application error))))))
+ ))))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.with-cover [/.Parser])
+ ($_ _.and
+ (do {@ random.monad}
+ [expected ..primitive]
+ (_.cover [/.run /.any]
+ (|> (/.run /.any expected)
+ (!expect (^multi (#try.Success actual)
+ (type@= expected actual))))))
+ (do {@ random.monad}
+ [expected ..primitive]
+ (_.cover [/.peek /.unconsumed-input]
+ (and (|> (/.run (do //.monad
+ [actual /.peek
+ _ /.any]
+ (wrap actual))
+ expected)
+ (!expect (^multi (#try.Success actual)
+ (type@= expected actual))))
+ (|> (/.run /.peek expected)
+ (!expect (^multi (#try.Failure error)
+ (exception.match? /.unconsumed-input error)))))))
+ (do {@ random.monad}
+ [expected ..primitive]
+ (_.cover [/.empty-input]
+ (`` (and (~~ (template [<parser>]
+ [(|> (/.run (do //.monad
+ [_ /.any]
+ <parser>)
+ expected)
+ (!expect (^multi (#try.Failure error)
+ (exception.match? /.empty-input error))))]
+
+ [/.any]
+ [/.peek]
+ ))))))
+ (do {@ random.monad}
+ [expected ..primitive]
+ (_.cover [/.Env /.env /.fresh]
+ (|> (/.run (do //.monad
+ [env /.env
+ _ /.any]
+ (wrap env))
+ expected)
+ (!expect (^multi (#try.Success environment)
+ (is? /.fresh environment))))))
+ (do {@ random.monad}
+ [expected ..primitive
+ dummy (random.filter (|>> (type@= expected) not)
+ ..primitive)]
+ (_.cover [/.local]
+ (|> (/.run (do //.monad
+ [_ /.any]
+ (/.local (list expected)
+ /.any))
+ dummy)
+ (!expect (^multi (#try.Success actual)
+ (type@= expected actual))))))
+ (do {@ random.monad}
+ [expected random.nat]
+ (_.cover [/.existential /.not-existential]
+ (|> (/.run /.existential
+ (#.Ex expected))
+ (!expect (^multi (#try.Success actual)
+ (n.= expected actual))))))
+ (do {@ random.monad}
+ [expected-name (random.and (random.ascii/alpha-num 1)
+ (random.ascii/alpha-num 1))
+ expected-type ..primitive]
+ (_.cover [/.named /.not-named]
+ (|> (/.run /.named
+ (#.Named expected-name expected-type))
+ (!expect (^multi (#try.Success [actual-name actual-type])
+ (and (name@= expected-name actual-name)
+ (type@= expected-type actual-type)))))))
+ ..aggregate
+ ..matches
+ )))
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index ebbdd8f1e..17f18e005 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -38,7 +38,7 @@
(do {@ random.monad}
[expected (random.ascii/lower-alpha /.path-size)
invalid (random.ascii/lower-alpha (inc /.path-size))
- not-ascii (random.text (random.char (unicode.set (list unicode.katakana)))
+ not-ascii (random.text (random.char (unicode.set [unicode.katakana (list)]))
/.path-size)]
(`` ($_ _.and
(_.cover [/.path /.from-path]
@@ -71,7 +71,7 @@
(do {@ random.monad}
[expected (random.ascii/lower-alpha /.name-size)
invalid (random.ascii/lower-alpha (inc /.name-size))
- not-ascii (random.text (random.char (unicode.set (list unicode.katakana)))
+ not-ascii (random.text (random.char (unicode.set [unicode.katakana (list)]))
/.name-size)]
(`` ($_ _.and
(_.cover [/.name /.from-name]
@@ -312,7 +312,7 @@
[path (random.ascii/lower-alpha /.path-size)
expected (random.ascii/lower-alpha /.name-size)
invalid (random.ascii/lower-alpha (inc /.name-size))
- not-ascii (random.text (random.char (unicode.set (list unicode.katakana)))
+ not-ascii (random.text (random.char (unicode.set [unicode.katakana (list)]))
/.name-size)]
(_.with-cover [/.Ownership /.Owner /.ID]
($_ _.and