aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux.lux12
-rw-r--r--stdlib/source/lux/control/equality.lux4
-rw-r--r--stdlib/source/lux/control/predicate.lux18
-rw-r--r--stdlib/source/lux/data/bit.lux16
-rw-r--r--stdlib/source/lux/lang/reference.lux6
-rw-r--r--stdlib/source/lux/type/refinement.lux10
6 files changed, 24 insertions, 42 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 6ec614fb5..d2d39783a 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -6330,18 +6330,6 @@
(-> Rev Frac)
(|>> to-significand (f// rev-denominator)))
-(macro: #export (alias: tokens)
- (case tokens
- (^ (list [_meta (#Symbol ["" alias])] [_meta (#Symbol aliased)]))
- (let [alias (symbol$ ["" alias])
- aliased (symbol$ aliased)]
- (return (list (` (def: #export (~ alias)
- {#.doc (doc "Alias for:" (~ aliased))}
- (~ aliased))))))
-
- _
- (fail "Wrong syntax for alias:")))
-
(def: #export (cursor-description [file line column])
(-> Cursor Text)
(let [separator ", "
diff --git a/stdlib/source/lux/control/equality.lux b/stdlib/source/lux/control/equality.lux
index 3750312e0..f75a78fdd 100644
--- a/stdlib/source/lux/control/equality.lux
+++ b/stdlib/source/lux/control/equality.lux
@@ -1,12 +1,10 @@
(.module: lux)
-(sig: #export (Equality a)
+(sig: #export (Eq a)
{#.doc "Equality for a type's instances."}
(: (-> a a Bool)
=))
-(alias: Eq Equality)
-
(def: #export (product left right)
(All [l r] (-> (Eq l) (Eq r) (Eq [l r])))
(struct (def: (= [a b] [x y])
diff --git a/stdlib/source/lux/control/predicate.lux b/stdlib/source/lux/control/predicate.lux
index f237f2e64..44e273dee 100644
--- a/stdlib/source/lux/control/predicate.lux
+++ b/stdlib/source/lux/control/predicate.lux
@@ -7,15 +7,13 @@
(type: #export (Predicate a)
(-> a Bool))
-(alias: Pred Predicate)
-
(do-template [<identity-name> <identity-value> <composition-name> <composition>]
[(def: #export <identity-name>
- (All [a] (Pred a))
+ (All [a] (Predicate a))
(function.constant <identity-value>))
(def: #export (<composition-name> left right)
- (All [a] (-> (Pred a) (Pred a) (Pred a)))
+ (All [a] (-> (Predicate a) (Predicate a) (Predicate a)))
(function (_ value)
(<composition> (left value)
(right value))))]
@@ -25,7 +23,7 @@
)
(do-template [<name> <identity> <composition>]
- [(struct: #export <name> (All [a] (Monoid (Pred a)))
+ [(struct: #export <name> (All [a] (Monoid (Predicate a)))
(def: identity <identity>)
(def: compose <composition>))]
@@ -34,21 +32,21 @@
)
(def: #export (complement predicate)
- (All [a] (-> (Pred a) (Pred a)))
+ (All [a] (-> (Predicate a) (Predicate a)))
(|>> predicate not))
(def: #export (difference sub base)
- (All [a] (-> (Pred a) (Pred a) (Pred a)))
+ (All [a] (-> (Predicate a) (Predicate a) (Predicate a)))
(function (_ value)
(and (base value)
(not (sub value)))))
(def: #export (set set)
- (All [a] (-> (Set a) (Pred a)))
+ (All [a] (-> (Set a) (Predicate a)))
(set.member? set))
(def: #export (rec predicate)
(All [a]
- (-> (-> (Pred a) (Pred a))
- (Pred a)))
+ (-> (-> (Predicate a) (Predicate a))
+ (Predicate a)))
(|>> (predicate (rec predicate))))
diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux
index 22ac6522a..d5c312f14 100644
--- a/stdlib/source/lux/data/bit.lux
+++ b/stdlib/source/lux/data/bit.lux
@@ -25,24 +25,22 @@
[arithmetic-right-shift "lux i64 arithmetic-right-shift" "Signed bitwise arithmetic-right-shift."]
)
-(alias: right-shift logical-right-shift)
-
(def: (add-shift shift value)
(-> Nat Nat Nat)
- (|> value (right-shift shift) (n/+ value)))
+ (|> value (logical-right-shift shift) (n/+ value)))
(def: #export (count subject)
{#.doc "Count the number of 1s in a bit-map."}
(-> (I64 Any) Nat)
- (let [count' (n/- (|> subject (right-shift +1) (and +6148914691236517205) i64)
+ (let [count' (n/- (|> subject (logical-right-shift +1) (..and +6148914691236517205) i64)
(i64 subject))]
(|> count'
- (right-shift +2) (and +3689348814741910323) (n/+ (and +3689348814741910323 count'))
- (add-shift +4) (and +1085102592571150095)
+ (logical-right-shift +2) (..and +3689348814741910323) (n/+ (..and +3689348814741910323 count'))
+ (add-shift +4) (..and +1085102592571150095)
(add-shift +8)
(add-shift +16)
(add-shift +32)
- (and +127))))
+ (..and +127))))
(def: #export not
{#.doc "Bitwise negation."}
@@ -80,8 +78,8 @@
(<comp> backwards-distance)
(..or (<main> distance input)))))]
- [rotate-left left-shift right-shift]
- [rotate-right right-shift left-shift]
+ [rotate-left left-shift logical-right-shift]
+ [rotate-right logical-right-shift left-shift]
)
(def: #export (region size offset)
diff --git a/stdlib/source/lux/lang/reference.lux b/stdlib/source/lux/lang/reference.lux
index 98756aa08..0f7438345 100644
--- a/stdlib/source/lux/lang/reference.lux
+++ b/stdlib/source/lux/lang/reference.lux
@@ -1,6 +1,6 @@
(.module:
lux
- (lux (control [equality #+ Equality]
+ (lux (control [equality #+ Eq]
[hash #+ Hash]
pipe)))
@@ -14,7 +14,7 @@
(#Variable Variable)
(#Constant Ident))
-(struct: #export _ (Equality Variable)
+(struct: #export _ (Eq Variable)
(def: (= reference sample)
(case [reference sample]
(^template [<tag>]
@@ -26,7 +26,7 @@
false)))
(struct: #export _ (Hash Variable)
- (def: eq Equality<Variable>)
+ (def: eq Eq<Variable>)
(def: (hash var)
(case var
(#Local register)
diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux
index 2d05d5882..afc190c4f 100644
--- a/stdlib/source/lux/type/refinement.lux
+++ b/stdlib/source/lux/type/refinement.lux
@@ -1,6 +1,6 @@
(.module:
[lux #- type]
- (lux (control [predicate #+ Pred]
+ (lux (control [predicate #+ Predicate]
[monad #+ do]
["p" parser])
(data ["e" error #+ Error])
@@ -14,7 +14,7 @@
{#.doc "A refined type 'r' of base type 't' using a predicate."}
{#value t
- #predicate (Pred t)}
+ #predicate (Predicate t)}
(type: #export (Refiner t r)
(-> t (Maybe (Refined t r))))
@@ -22,7 +22,7 @@
(def: #export (refinement predicate)
(All [t]
(Ex [r]
- (-> (Pred t) (Refiner t r))))
+ (-> (Predicate t) (Refiner t r))))
(function (_ un-refined)
(if (predicate un-refined)
(#.Some (:abstraction {#value un-refined
@@ -34,8 +34,8 @@
(All [t r] (-> (Refined t r) <output>))
(|> refined :representation (get@ <slot>)))]
- [un-refine t #value]
- [predicate (Pred t) #predicate]
+ [un-refine t #value]
+ [predicate (Predicate t) #predicate]
)
(def: #export (lift transform)