diff options
Diffstat (limited to '')
92 files changed, 468 insertions, 462 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index ecf5584d6..2f2649758 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -65,16 +65,16 @@ [dummy-cursor (+5 "A potentially empty list of values.")]] (+0)))))))]) -("lux def" Bool - (+10 ["lux" "Bool"] - (+0 "#Bool" #Nil)) +("lux def" Bit + (+10 ["lux" "Bit"] + (+0 "#Bit" #Nil)) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] [dummy-cursor (+0 true)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] [dummy-cursor (+0 true)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] - [dummy-cursor (+5 "Your standard, run-of-the-mill boolean values.")]] + [dummy-cursor (+5 "Your standard, run-of-the-mill boolean values (as bits).")]] #Nil))))]) ("lux def" I64 @@ -306,7 +306,7 @@ #Nil))))))]) ## (type: (Code' w) -## (#Bool Bool) +## (#Bit Bit) ## (#Nat Nat) ## (#Int Int) ## (#Rev Rev) @@ -322,8 +322,8 @@ ({Code ({Code-List (#UnivQ #Nil - (#Sum ## "lux.Bool" - Bool + (#Sum ## "lux.Bit" + Bit (#Sum ## "lux.Nat" Nat (#Sum ## "lux.Int" @@ -352,7 +352,7 @@ (#Parameter +1))))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "tags"])] - [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "Bool")] + [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "Bit")] (#Cons [dummy-cursor (+5 "Nat")] (#Cons [dummy-cursor (+5 "Int")] (#Cons [dummy-cursor (+5 "Rev")] @@ -383,9 +383,9 @@ (#Record (#Cons [[dummy-cursor (#Tag ["lux" "doc"])] [dummy-cursor (#Text "The type of Code nodes for Lux syntax.")]] (#Cons [[dummy-cursor (#Tag ["lux" "type?"])] - [dummy-cursor (#Bool true)]] + [dummy-cursor (#Bit true)]] (#Cons [[dummy-cursor (#Tag ["lux" "export?"])] - [dummy-cursor (#Bool true)]] + [dummy-cursor (#Bit true)]] #Nil))))]) ("lux def" _ann @@ -396,9 +396,9 @@ [dummy-cursor data])) [dummy-cursor (#Record #Nil)]) -("lux def" bool$ - ("lux check" (#Function Bool Code) - ([_ value] (_ann (#Bool value)))) +("lux def" bit$ + ("lux check" (#Function Bit Code) + ([_ value] (_ann (#Bit value)))) [dummy-cursor (#Record #Nil)]) ("lux def" nat$ @@ -459,16 +459,16 @@ ("lux def" default-def-meta-exported ("lux check" (#Apply (#Product Code Code) List) (#Cons [(tag$ ["lux" "type?"]) - (bool$ true)] + (bit$ true)] (#Cons [(tag$ ["lux" "export?"]) - (bool$ true)] + (bit$ true)] #Nil))) (record$ #Nil)) ("lux def" default-def-meta-unexported ("lux check" (#Apply (#Product Code Code) List) (#Cons [(tag$ ["lux" "type?"]) - (bool$ true)] + (bit$ true)] #Nil)) (record$ #Nil)) @@ -585,8 +585,8 @@ ## #module-aliases (List [Text Text]) ## #definitions (List [Text Definition]) ## #imports (List Text) -## #tags (List [Text [Nat (List Ident) Bool Type]]) -## #types (List [Text [(List Ident) Bool Type]]) +## #tags (List [Text [Nat (List Ident) Bit Type]]) +## #types (List [Text [(List Ident) Bit Type]]) ## #module-annotations (Maybe Code) ## #module-state Module-State}) ("lux def" Module @@ -603,13 +603,13 @@ (#Apply (#Product Text (#Product Nat (#Product (#Apply Ident List) - (#Product Bool + (#Product Bit Type)))) List) (#Product ## "lux.types" (#Apply (#Product Text (#Product (#Apply Ident List) - (#Product Bool + (#Product Bit Type))) List) (#Product ## "lux.module-annotations" @@ -808,7 +808,7 @@ ("lux def" default-macro-meta ("lux check" (#Apply (#Product Code Code) List) (#Cons [(tag$ ["lux" "macro?"]) - (bool$ true)] + (bit$ true)] #Nil)) (record$ #Nil)) @@ -878,13 +878,13 @@ ("lux check" (#Function Text Code) ([_ tag] (tuple$ (#Cons [(meta-code ["lux" "Tag"] (tuple$ (#Cons (text$ "lux") (#Cons (text$ tag) #Nil)))) - (#Cons [(meta-code ["lux" "Bool"] (bool$ true)) + (#Cons [(meta-code ["lux" "Bit"] (bit$ true)) #Nil])])))) (record$ #Nil)) ("lux def" export-meta ("lux check" (#Product Code Code) - [(tag$ ["lux" "export?"]) (bool$ true)]) + [(tag$ ["lux" "export?"]) (bit$ true)]) (record$ #Nil)) ("lux def" export?-meta @@ -1080,7 +1080,7 @@ (def:'' (text/= x y) #Nil - (#Function Text (#Function Text Bool)) + (#Function Text (#Function Text Bit)) ("lux text =" x y)) (def:'' (get-rep key env) @@ -1369,7 +1369,7 @@ (macro:' #export (& tokens) (#Cons [(tag$ ["lux" "doc"]) (text$ "## Tuple types: - (& Text Int Bool) + (& Text Int Bit) ## Any. (&)")] @@ -1386,7 +1386,7 @@ (macro:' #export (| tokens) (#Cons [(tag$ ["lux" "doc"]) (text$ "## Variant types: - (| Text Int Bool) + (| Text Int Bit) ## Nothing. (|)")] @@ -1506,7 +1506,7 @@ (def:''' (any? p xs) #Nil (All [a] - (-> (-> a Bool) ($' List a) Bool)) + (-> (-> a Bit) ($' List a) Bit)) ({#Nil false @@ -1716,7 +1716,7 @@ (macro:' #export (if tokens) (list [(tag$ ["lux" "doc"]) - (text$ "Picks which expression to evaluate based on a boolean test value. + (text$ "Picks which expression to evaluate based on a bit test value. (if true \"Oh, yeah!\" @@ -1724,8 +1724,8 @@ => \"Oh, yeah!\"")]) ({(#Cons test (#Cons then (#Cons else #Nil))) - (return (list (form$ (list (record$ (list [(bool$ true) then] - [(bool$ false) else])) + (return (list (form$ (list (record$ (list [(bit$ true) then] + [(bit$ false) else])) test)))) _ @@ -1833,7 +1833,7 @@ (def:''' (splice replace? untemplate elems) #Nil - (-> Bool (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) + (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ({true ({#Nil (return (tag$ ["lux" "Nil"])) @@ -1878,9 +1878,9 @@ (def:''' (untemplate replace? subst token) #Nil - (-> Bool Text Code ($' Meta Code)) - ({[_ [_ (#Bool value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "Bool"]) (bool$ value))))) + (-> Bit Text Code ($' Meta Code)) + ({[_ [_ (#Bit value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Bit"]) (bit$ value))))) [_ [_ (#Nat value)]] (return (wrap-meta (form$ (list (tag$ ["lux" "Nat"]) (nat$ value))))) @@ -2188,13 +2188,13 @@ (def:''' (every? p xs) #Nil (All [a] - (-> (-> a Bool) ($' List a) Bool)) + (-> (-> a Bit) ($' List a) Bit)) (list/fold (function' [_2 _1] (if _1 (p _2) false)) true xs)) (def:''' #export (n/= test subject) (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) equivalence.")]) - (-> Nat Nat Bool) + (-> Nat Nat Bit) ("lux i64 =" test subject)) (def:''' (high-bits value) @@ -2217,7 +2217,7 @@ (def:''' #export (n/< test subject) (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) less-than.")]) - (-> Nat Nat Bool) + (-> Nat Nat Bit) (let' [testH (high-bits test) subjectH (high-bits subject)] (if ("lux int <" subjectH testH) @@ -2231,7 +2231,7 @@ (def:''' #export (n/<= test subject) (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) less-than-equal.")]) - (-> Nat Nat Bool) + (-> Nat Nat Bit) (if (n/< test subject) true ("lux i64 =" test subject))) @@ -2239,13 +2239,13 @@ (def:''' #export (n/> test subject) (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) greater-than.")]) - (-> Nat Nat Bool) + (-> Nat Nat Bit) (n/< subject test)) (def:''' #export (n/>= test subject) (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) greater-than-equal.")]) - (-> Nat Nat Bool) + (-> Nat Nat Bit) (if (n/< subject test) true ("lux i64 =" test subject))) @@ -2284,20 +2284,20 @@ (def:''' #export (r/= test subject) (list [(tag$ ["lux" "doc"]) (text$ "Rev(olution) equivalence.")]) - (-> Rev Rev Bool) + (-> Rev Rev Bit) ("lux i64 =" test subject)) (def:''' #export (r/< test subject) (list [(tag$ ["lux" "doc"]) (text$ "Rev(olution) less-than.")]) - (-> Rev Rev Bool) + (-> Rev Rev Bit) (n/< ("lux coerce" Nat test) ("lux coerce" Nat subject))) (def:''' #export (r/<= test subject) (list [(tag$ ["lux" "doc"]) (text$ "Rev(olution) less-than-equal.")]) - (-> Rev Rev Bool) + (-> Rev Rev Bit) (if (n/< ("lux coerce" Nat test) ("lux coerce" Nat subject)) true @@ -2306,13 +2306,13 @@ (def:''' #export (r/> test subject) (list [(tag$ ["lux" "doc"]) (text$ "Rev(olution) greater-than.")]) - (-> Rev Rev Bool) + (-> Rev Rev Bit) (r/< subject test)) (def:''' #export (r/>= test subject) (list [(tag$ ["lux" "doc"]) (text$ "Rev(olution) greater-than-equal.")]) - (-> Rev Rev Bool) + (-> Rev Rev Bit) (if (r/< subject test) true ("lux i64 =" test subject))) @@ -2323,19 +2323,19 @@ [(def:''' #export (<eq-name> test subject) (list [(tag$ ["lux" "doc"]) (text$ <eq-doc>)]) - (-> <type> <type> Bool) + (-> <type> <type> Bit) (<eq-proc> subject test)) (def:''' #export (<lt-name> test subject) (list [(tag$ ["lux" "doc"]) (text$ <<-doc>)]) - (-> <type> <type> Bool) + (-> <type> <type> Bit) (<lt-proc> subject test)) (def:''' #export (<lte-name> test subject) (list [(tag$ ["lux" "doc"]) (text$ <<=-doc>)]) - (-> <type> <type> Bool) + (-> <type> <type> Bit) (if (<lt-proc> subject test) true (<eq-proc> subject test))) @@ -2343,13 +2343,13 @@ (def:''' #export (<gt-name> test subject) (list [(tag$ ["lux" "doc"]) (text$ <>-doc>)]) - (-> <type> <type> Bool) + (-> <type> <type> Bit) (<lt-proc> test subject)) (def:''' #export (<gte-name> test subject) (list [(tag$ ["lux" "doc"]) (text$ <>=-doc>)]) - (-> <type> <type> Bool) + (-> <type> <type> Bit) (if (<lt-proc> test subject) true (<eq-proc> subject test)))] @@ -2536,9 +2536,9 @@ [f/max Frac f/> "Frac(tion) minimum."] ) -(def:''' (bool/encode x) +(def:''' (bit/encode x) #Nil - (-> Bool Text) + (-> Bit Text) (if x "true" "false")) (def:''' (digit-to-text digit) @@ -2600,17 +2600,17 @@ (def:''' (multiple? div n) #Nil - (-> Nat Nat Bool) + (-> Nat Nat Bit) (|> n (n/% div) (n/= +0))) (def:''' #export (not x) (list [(tag$ ["lux" "doc"]) - (text$ "## Boolean negation. + (text$ "## Bit negation. (not true) => false (not false) => true")]) - (-> Bool Bool) + (-> Bit Bit) (if x false true)) (def:''' (find-macro' modules current-module module name) @@ -2623,8 +2623,8 @@ gdef (let' [{#module-hash _ #module-aliases _ #definitions bindings #imports _ #tags tags #types types #module-annotations _ #module-state _} ("lux check" Module $module)] (get name bindings))] (let' [[def-type def-meta def-value] ("lux check" Definition gdef)] - ({(#Some [_ (#Bool true)]) - ({(#Some [_ (#Bool true)]) + ({(#Some [_ (#Bit true)]) + ({(#Some [_ (#Bit true)]) (#Some ("lux coerce" Macro def-value)) _ @@ -2672,7 +2672,7 @@ (def:''' (macro? ident) #Nil - (-> Ident ($' Meta Bool)) + (-> Ident ($' Meta Bit)) (do Monad<Meta> [ident (normalize ident) output (find-macro ident)] @@ -2858,7 +2858,7 @@ (def:''' (empty? xs) #Nil - (All [a] (-> ($' List a) Bool)) + (All [a] (-> ($' List a) Bit)) ({#Nil true _ false} xs)) @@ -3030,8 +3030,8 @@ (def:' (code-to-text code) (-> Code Text) - ({[_ (#Bool value)] - (bool/encode value) + ({[_ (#Bit value)] + (bit/encode value) [_ (#Nat value)] (nat/encode value) @@ -3171,7 +3171,7 @@ #Sunday) (def: (weekend? day) - (-> Weekday Bool) + (-> Weekday Bit) (case day (^or #Saturday #Sunday) true @@ -3193,7 +3193,7 @@ (fail "Wrong syntax for ^or"))) (def:' (symbol? code) - (-> Code Bool) + (-> Code Bit) (case code [_ (#Symbol _)] true @@ -3263,8 +3263,8 @@ (def:' (process-def-meta-value code) (-> Code Code) (case code - [_ (#Bool value)] - (meta-code ["lux" "Bool"] (bool$ value)) + [_ (#Bit value)] + (meta-code ["lux" "Bit"] (bit$ value)) [_ (#Nat value)] (meta-code ["lux" "Nat"] (nat$ value)) @@ -3330,7 +3330,7 @@ args))]})) (def:' (export^ tokens) - (-> (List Code) [Bool (List Code)]) + (-> (List Code) [Bit (List Code)]) (case tokens (#Cons [_ (#Tag [_ "export"])] tokens') [true tokens'] @@ -3339,7 +3339,7 @@ [false tokens])) (def:' (export ?) - (-> Bool (List Code)) + (-> Bit (List Code)) (if ? (list (' #export)) (list))) @@ -3481,13 +3481,13 @@ (signature: #export (Ord a) (: (Equivalence a) eq) - (: (-> a a Bool) + (: (-> a a Bit) <) - (: (-> a a Bool) + (: (-> a a Bit) <=) - (: (-> a a Bool) + (: (-> a a Bit) >) - (: (-> a a Bool) + (: (-> a a Bit) >=))"} (let [[exported? tokens'] (export^ tokens) ?parts (: (Maybe [Ident (List Code) Code (List Code)]) @@ -3792,7 +3792,7 @@ (find-module module-name))) (def: (resolve-tag [module name]) - (-> Ident (Meta [Nat (List Ident) Bool Type])) + (-> Ident (Meta [Nat (List Ident) Bit Type])) (do Monad<Meta> [=module (find-module module) #let [{#module-hash _ #module-aliases _ #definitions bindings #imports _ #tags tags-table #types types #module-annotations _ #module-state _} =module]] @@ -4180,7 +4180,7 @@ (list/drop (n/- +1 amount) a+'))) (def: (clean-module nested? relative-root module) - (-> Bool Text Text (Meta Text)) + (-> Bit Text Text (Meta Text)) (case (count-ups +0 module) +0 (return (if nested? @@ -4207,7 +4207,7 @@ " Relative Root: " relative-root "\n")))))) (def: (parse-imports nested? relative-root imports) - (-> Bool Text (List Code) (Meta (List Importation))) + (-> Bit Text (List Code) (Meta (List Importation))) (do Monad<Meta> [imports' (monad/map Monad<Meta> (: (-> Code (Meta (List Importation))) @@ -4280,7 +4280,7 @@ (List Text)) (function (_ [name [def-type def-meta def-value]]) (case (get-meta ["lux" "export?"] def-meta) - (#Some [_ (#Bool true)]) + (#Some [_ (#Bit true)]) (list name) _ @@ -4294,7 +4294,7 @@ )) (def: (filter p xs) - (All [a] (-> (-> a Bool) (List a) (List a))) + (All [a] (-> (-> a Bit) (List a) (List a))) (case xs #Nil (list) @@ -4305,7 +4305,7 @@ (filter p xs')))) (def: (is-member? cases name) - (-> (List Text) Text Bool) + (-> (List Text) Text Bit) (let [output (list/fold (function (_ case prev) (or prev (text/= case name))) @@ -4730,7 +4730,7 @@ (return (list (` (function ((~ g!_) (~ g!arg)) (<| (~+ tokens) (~ g!arg)))))))) (def: (imported-by? import-name module-name) - (-> Text Text (Meta Bool)) + (-> Text Text (Meta Bit)) (do Monad<Meta> [module (find-module module-name) #let [{#module-hash _ #module-aliases _ #definitions _ #imports imports #tags _ #types _ #module-annotations _ #module-state _} module]] @@ -5154,7 +5154,7 @@ (^template [<tag>] [[_ _ column] (<tag> _)] column) - ([#Bool] + ([#Bit] [#Nat] [#Int] [#Rev] @@ -5266,7 +5266,7 @@ [(update-cursor new-cursor as-text) (text/compose (cursor-padding baseline prev-cursor new-cursor) as-text)])) - ([#Bool bool/encode] + ([#Bit bit/encode] [#Nat nat/encode] [#Int int/encode] [#Frac frac/encode] @@ -5479,7 +5479,7 @@ (def: (place-tokens label tokens target) (-> Text (List Code) Code (Maybe (List Code))) (case target - (^or [_ (#Bool _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Rev _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) + (^or [_ (#Bit _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Rev _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) (#Some (list target)) [_ (#Symbol [prefix name])] @@ -5525,16 +5525,16 @@ (compare <text> (:: Code/encode show <expr>)) (compare true (:: Equivalence<Code> = <expr> <expr>))] - [(bool true) "true" [_ (#.Bool true)]] - [(bool false) "false" [_ (#.Bool false)]] + [(bit true) "true" [_ (#.Bit true)]] + [(bit false) "false" [_ (#.Bit false)]] [(int 123) "123" [_ (#.Int 123)]] [(frac 123.0) "123.0" [_ (#.Frac 123.0)]] [(text "\n") "\"\\n\"" [_ (#.Text "\n")]] [(tag ["yolo" "lol"]) "#yolo.lol" [_ (#.Tag ["yolo" "lol"])]] [(symbol ["yolo" "lol"]) "yolo.lol" [_ (#.Symbol ["yolo" "lol"])]] - [(form (list (bool true) (int 123))) "(true 123)" (^ [_ (#.Form (list [_ (#.Bool true)] [_ (#.Int 123)]))])] - [(tuple (list (bool true) (int 123))) "[true 123]" (^ [_ (#.Tuple (list [_ (#.Bool true)] [_ (#.Int 123)]))])] - [(record (list [(bool true) (int 123)])) "{true 123}" (^ [_ (#.Record (list [[_ (#.Bool true)] [_ (#.Int 123)]]))])] + [(form (list (bit true) (int 123))) "(true 123)" (^ [_ (#.Form (list [_ (#.Bit true)] [_ (#.Int 123)]))])] + [(tuple (list (bit true) (int 123))) "[true 123]" (^ [_ (#.Tuple (list [_ (#.Bit true)] [_ (#.Int 123)]))])] + [(record (list [(bit true) (int 123)])) "{true 123}" (^ [_ (#.Record (list [[_ (#.Bit true)] [_ (#.Int 123)]]))])] [(local-tag "lol") "#lol" [_ (#.Tag ["" "lol"])]] [(local-symbol "lol") "lol" [_ (#.Symbol ["" "lol"])]] )] @@ -5569,7 +5569,7 @@ (^template [<name>] (#Named ["lux" <name>] _) type) - (["Bool"] + (["Bit"] ["Nat"] ["Int"] ["Rev"] @@ -5591,7 +5591,7 @@ (^template [<name> <type> <wrapper>] (#Named ["lux" <name>] _) (wrap (<wrapper> (:coerce <type> value)))) - (["Bool" Bool bool$] + (["Bit" Bit bit$] ["Nat" Nat nat$] ["Int" Int int$] ["Rev" Rev rev$] @@ -5690,7 +5690,7 @@ _ (#.Left (format "Static part " (%t static) " does not match URI: " uri))) - "Short-cuts can be taken when using boolean tests." + "Short-cuts can be taken when using bit tests." "The example above can be rewritten as..." (case (split (size static) uri) (^multi (#.Some [chunk uri']) (text/= static chunk)) @@ -5738,11 +5738,11 @@ (do-template [<type> <even> <odd> <%> <=> <0> <2>] [(def: #export (<even> n) - (-> <type> Bool) + (-> <type> Bit) (<=> <0> (<%> <2> n))) (def: #export (<odd> n) - (-> <type> Bool) + (-> <type> Bit) (not (<even> n)))] [Nat n/even? n/odd? n/% n/= +0 +2] @@ -5800,7 +5800,7 @@ "This one should fail:" (is? 5 (i/+ 2 3)))} - (All [a] (-> a a Bool)) + (All [a] (-> a a Bit)) ("lux is" reference sample)) (macro: #export (^@ tokens) @@ -5987,7 +5987,7 @@ (#Left "Wrong syntax for char"))) (def: #export (when test f) - (All [a] (-> Bool (-> a a) (-> a a))) + (All [a] (-> Bit (-> a a) (-> a a))) (function (_ value) (if test (f value) @@ -6114,7 +6114,7 @@ (do Monad<Meta> [g!meta (gensym "g!meta")] (wrap (` [(~ g!meta) (<tag> (~ (<gen> value)))])))) - ([#Bool "Bool" bool$] + ([#Bit "Bit" bit$] [#Nat "Nat" nat$] [#Int "Int" int$] [#Rev "Rev" rev$] diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 81e873def..570316334 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -92,7 +92,7 @@ self))) (def: #export (alive? actor) - (All [s] (-> (Actor s) Bool)) + (All [s] (-> (Actor s) Bit)) (case (promise.poll (get@ #obituary (:representation actor))) #.None true @@ -102,7 +102,7 @@ (def: #export (send message actor) {#.doc "Communicate with an actor through message passing."} - (All [s] (-> (Message s) (Actor s) (IO Bool))) + (All [s] (-> (Message s) (Actor s) (IO Bit))) (if (alive? actor) (let [entry [message (promise #.None)]] (do Monad<IO> @@ -140,7 +140,7 @@ (def: #export (poison actor) {#.doc "Kills the actor by sending a message that will kill it upon processing, but allows the actor to handle previous messages."} - (All [s] (-> (Actor s) (IO Bool))) + (All [s] (-> (Actor s) (IO Bit))) (send (function (_ state self) (task.throw poisoned [])) actor)) diff --git a/stdlib/source/lux/concurrency/atom.lux b/stdlib/source/lux/concurrency/atom.lux index 8cfc117e4..a06a93b4e 100644 --- a/stdlib/source/lux/concurrency/atom.lux +++ b/stdlib/source/lux/concurrency/atom.lux @@ -19,7 +19,7 @@ {#.doc "Only mutates an atom if you can present it's current value. That guarantees that atom was not updated since you last read from it."} - (All [a] (-> a a (Atom a) (IO Bool))) + (All [a] (-> a a (Atom a) (IO Bit))) (io ("lux atom compare-and-swap" atom current new))) (def: #export (update f atom) diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index b75e85939..2e1e10d87 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -37,7 +37,7 @@ ## [Values] (def: #export (filter predicate input) - (All [a] (-> (-> a Bool) (Channel a) (Channel a))) + (All [a] (-> (-> a Bit) (Channel a) (Channel a))) (let [output (channel [])] (exec (io.run (listen (function (_ value) (if (predicate value) diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index c76c4c013..0a03b2c9e 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -31,7 +31,7 @@ (def: #export (resolve value (^:representation promise)) {#.doc "Sets an promise's value if it has not been done yet."} - (All [a] (-> a (Promise a) (IO Bool))) + (All [a] (-> a (Promise a) (IO Bit))) (do io.Monad<IO> [(^@ old [_value _observers]) (atom.read promise)] (case _value @@ -65,7 +65,7 @@ (def: #export (resolved? promise) {#.doc "Checks whether a promise's value has already been resolved."} - (All [a] (-> (Promise a) Bool)) + (All [a] (-> (Promise a) Bit)) (case (poll promise) #.None false diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux index 0c01e9389..774acf5fa 100644 --- a/stdlib/source/lux/concurrency/semaphore.lux +++ b/stdlib/source/lux/concurrency/semaphore.lux @@ -31,7 +31,7 @@ (promise.promise #.None))] (do io.Monad<IO> [state (atom.read semaphore) - #let [[ready? state'] (: [Bool State] + #let [[ready? state'] (: [Bit State] (case (get@ #open-positions state) +0 [false (update@ #waiting-list (|>> (#.Cons signal)) state)] diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index e3c797b2d..7af73b68d 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -166,7 +166,7 @@ (wrap [a a']))) (def: (can-commit? tx) - (-> Tx Bool) + (-> Tx Bit) (list.every? (function (_ [_var _original _current]) (is? _original (read!! _var))) tx)) @@ -186,7 +186,7 @@ (atom (promise #.None))) (def: commit-processor-flag - (Atom Bool) + (Atom Bit) (atom false)) (def: (issue-commit commit) diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index af86fc527..bed6e9dd5 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -101,7 +101,7 @@ (def: (prepare command) (-> Code Code) (case command - (^or [_ (#.Bool _)] + (^or [_ (#.Bit _)] [_ (#.Nat _)] [_ (#.Int _)] [_ (#.Rev _)] [_ (#.Frac _)] [_ (#.Text _)] @@ -210,51 +210,51 @@ [Nat Nat n/* .n/*] [Nat Nat n// .n//] [Nat Nat n/% .n/%] - [Nat Bool n/= .n/=] - [Nat Bool n/< .n/<] - [Nat Bool n/<= .n/<=] - [Nat Bool n/> .n/>] - [Nat Bool n/>= .n/>=] + [Nat Bit n/= .n/=] + [Nat Bit n/< .n/<] + [Nat Bit n/<= .n/<=] + [Nat Bit n/> .n/>] + [Nat Bit n/>= .n/>=] [Int Int i/+ .i/+] [Int Int i/- .i/-] [Int Int i/* .i/*] [Int Int i// .i//] [Int Int i/% .i/%] - [Int Bool i/= .i/=] - [Int Bool i/< .i/<] - [Int Bool i/<= .i/<=] - [Int Bool i/> .i/>] - [Int Bool i/>= .i/>=] + [Int Bit i/= .i/=] + [Int Bit i/< .i/<] + [Int Bit i/<= .i/<=] + [Int Bit i/> .i/>] + [Int Bit i/>= .i/>=] [Rev Rev r/+ .r/+] [Rev Rev r/- .r/-] [Rev Rev r/* .r/*] [Rev Rev r// .r//] [Rev Rev r/% .r/%] - [Rev Bool r/= .r/=] - [Rev Bool r/< .r/<] - [Rev Bool r/<= .r/<=] - [Rev Bool r/> .r/>] - [Rev Bool r/>= .r/>=] + [Rev Bit r/= .r/=] + [Rev Bit r/< .r/<] + [Rev Bit r/<= .r/<=] + [Rev Bit r/> .r/>] + [Rev Bit r/>= .r/>=] [Frac Frac f/+ .f/+] [Frac Frac f/- .f/-] [Frac Frac f/* .f/*] [Frac Frac f// .f//] [Frac Frac f/% .f/%] - [Frac Bool f/= .f/=] - [Frac Bool f/< .f/<] - [Frac Bool f/<= .f/<=] - [Frac Bool f/> .f/>] - [Frac Bool f/>= .f/>=] + [Frac Bit f/= .f/=] + [Frac Bit f/< .f/<] + [Frac Bit f/<= .f/<=] + [Frac Bit f/> .f/>] + [Frac Bit f/>= .f/>=] ) (def: #export if (All [__a __b] (=> {then (=> __a __b) else (=> __a __b)} - __a [Bool then else] __b)) + __a [Bit then else] __b)) (function (_ [[[stack test] then] else]) (.if test (then stack) @@ -269,7 +269,7 @@ (def: #export loop (All [___] - (=> {test (=> ___ ___ [Bool])} + (=> {test (=> ___ ___ [Bit])} ___ [test] ___)) (function (loop [stack pred]) (let [[stack' verdict] (pred stack)] @@ -293,7 +293,7 @@ (def: #export do (All [__a __b] - (=> {pred (=> __a __b [Bool]) + (=> {pred (=> __a __b [Bit]) body (=> __b __a)} __b [pred body] __a [pred body])) @@ -302,7 +302,7 @@ (def: #export while (All [__a __b] - (=> {pred (=> __a __b [Bool]) + (=> {pred (=> __a __b [Bit]) body (=> __b __a)} __a [pred body] __b)) @@ -330,11 +330,11 @@ (word: #export when (All [___] (=> {body (=> ___ ___)} - ___ [Bool body] + ___ [Bit body] ___)) swap [call] [drop] if) (word: #export ? (All [a] - (=> [Bool a a] [a])) + (=> [Bit a a] [a])) rotL [drop] [nip] if) diff --git a/stdlib/source/lux/control/contract.lux b/stdlib/source/lux/control/contract.lux index 1b4939cb6..9b7427190 100644 --- a/stdlib/source/lux/control/contract.lux +++ b/stdlib/source/lux/control/contract.lux @@ -8,7 +8,7 @@ ["s" syntax (#+ syntax:)]]]) (def: #export (assert! message test) - (-> Text Bool []) + (-> Text Bit []) (if test [] (error! message))) diff --git a/stdlib/source/lux/control/enum.lux b/stdlib/source/lux/control/enum.lux index b153beede..4dc825508 100644 --- a/stdlib/source/lux/control/enum.lux +++ b/stdlib/source/lux/control/enum.lux @@ -12,7 +12,7 @@ ## [Functions] (def: (range' <= succ from to) - (All [a] (-> (-> a a Bool) (-> a a) a a (List a))) + (All [a] (-> (-> a a Bit) (-> a a) a a (List a))) (if (<= to from) (#.Cons from (range' <= succ (succ from) to)) #.Nil)) diff --git a/stdlib/source/lux/control/equivalence.lux b/stdlib/source/lux/control/equivalence.lux index cddf72542..eb869a81c 100644 --- a/stdlib/source/lux/control/equivalence.lux +++ b/stdlib/source/lux/control/equivalence.lux @@ -2,7 +2,7 @@ (signature: #export (Equivalence a) {#.doc "Equivalence for a type's instances."} - (: (-> a a Bool) + (: (-> a a Bit) =)) (def: #export (product left right) diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index 41dd22b88..296513718 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -26,7 +26,7 @@ ## [Values] (def: #export (match? exception error) - (All [e] (-> (Exception e) Text Bool)) + (All [e] (-> (Exception e) Text Bit)) (text.starts-with? (get@ #label exception) error)) (def: #export (catch exception then try) @@ -76,7 +76,7 @@ (#/.Error (construct exception message))) (def: #export (assert exception message test) - (All [e] (-> (Exception e) e Bool (Error Any))) + (All [e] (-> (Exception e) e Bit (Error Any))) (if test (#/.Success []) (..throw exception message))) diff --git a/stdlib/source/lux/control/interval.lux b/stdlib/source/lux/control/interval.lux index ae8c6ce30..a1084290a 100644 --- a/stdlib/source/lux/control/interval.lux +++ b/stdlib/source/lux/control/interval.lux @@ -31,7 +31,7 @@ (do-template [<name> <comp>] [(def: #export (<name> interval) - (All [a] (-> (Interval a) Bool)) + (All [a] (-> (Interval a) Bit)) (let [(^open) interval] (<comp> bottom top)))] @@ -41,7 +41,7 @@ ) (def: #export (within? interval elem) - (All [a] (-> (Interval a) a Bool)) + (All [a] (-> (Interval a) a Bit)) (let [(^open) interval] (cond (inner? interval) (and (>= bottom elem) @@ -57,7 +57,7 @@ (do-template [<name> <limit>] [(def: #export (<name> elem interval) - (All [a] (-> a (Interval a) Bool)) + (All [a] (-> a (Interval a) Bit)) (let [(^open) interval] (= <limit> elem)))] @@ -66,7 +66,7 @@ ) (def: #export (borders? interval elem) - (All [a] (-> (Interval a) a Bool)) + (All [a] (-> (Interval a) a Bit)) (or (starts-with? elem interval) (ends-with? elem interval))) @@ -90,31 +90,31 @@ (def: top (pred bottom))))) (def: #export (precedes? reference sample) - (All [a] (-> (Interval a) (Interval a) Bool)) + (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open) reference limit (:: reference bottom)] (and (< limit (:: sample bottom)) (< limit (:: sample top))))) (def: #export (succeeds? reference sample) - (All [a] (-> (Interval a) (Interval a) Bool)) + (All [a] (-> (Interval a) (Interval a) Bit)) (precedes? sample reference)) (def: #export (meets? reference sample) - (All [a] (-> (Interval a) (Interval a) Bool)) + (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open) reference limit (:: reference bottom)] (and (<= limit (:: sample bottom)) (= limit (:: sample top))))) (def: #export (touches? reference sample) - (All [a] (-> (Interval a) (Interval a) Bool)) + (All [a] (-> (Interval a) (Interval a) Bit)) (or (meets? reference sample) (meets? sample reference))) (do-template [<name> <eq-side> <ineq> <ineq-side>] [(def: #export (<name> reference sample) - (All [a] (-> (Interval a) (Interval a) Bool)) + (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open) reference] (and (= (:: reference <eq-side>) (:: sample <eq-side>)) (<ineq> (:: reference <ineq-side>) (:: sample <ineq-side>)))))] @@ -125,7 +125,7 @@ (do-template [<name> <comp>] [(def: #export (<name> reference sample) - (All [a] (-> a (Interval a) Bool)) + (All [a] (-> a (Interval a) Bit)) (let [(^open) sample] (and (<comp> reference bottom) (<comp> reference top))))] @@ -141,7 +141,7 @@ (= top (:: sample top)))))) (def: #export (nested? reference sample) - (All [a] (-> (Interval a) (Interval a) Bool)) + (All [a] (-> (Interval a) (Interval a) Bit)) (cond (or (singleton? sample) (and (inner? reference) (inner? sample)) (and (outer? reference) (outer? sample))) @@ -162,7 +162,7 @@ )) (def: #export (overlaps? reference sample) - (All [a] (-> (Interval a) (Interval a) Bool)) + (All [a] (-> (Interval a) (Interval a) Bit)) (let [(^open) reference] (and (not (:: Equivalence<Interval> = reference sample)) (cond (singleton? sample) diff --git a/stdlib/source/lux/control/order.lux b/stdlib/source/lux/control/order.lux index 6a801392d..7b07325a1 100644 --- a/stdlib/source/lux/control/order.lux +++ b/stdlib/source/lux/control/order.lux @@ -11,7 +11,7 @@ eq) (do-template [<name>] - [(: (-> a a Bool) <name>)] + [(: (-> a a Bit) <name>)] [<] [<=] [>] [>=] ) @@ -20,7 +20,7 @@ ## [Values] (def: #export (order eq <) (All [a] - (-> (Equivalence a) (-> a a Bool) (Order a))) + (-> (Equivalence a) (-> a a Bit) (Order a))) (let [> (flip <)] (structure (def: eq eq) (def: < <) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index 4c5e827f9..7ad46dba8 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -61,7 +61,7 @@ ## [Parsers] (def: #export (assert message test) {#.doc "Fails with the given message if the test is false."} - (All [s] (-> Text Bool (Parser s Any))) + (All [s] (-> Text Bit (Parser s Any))) (function (_ input) (if test (#e.Success [input []]) @@ -254,7 +254,7 @@ (wrap output))) (def: #export (filter test parser) - (All [s a] (-> (-> a Bool) (Parser s a) (Parser s a))) + (All [s a] (-> (-> a Bit) (Parser s a) (Parser s a))) (do Monad<Parser> [output parser _ (assert "Constraint failed." (test output))] diff --git a/stdlib/source/lux/control/predicate.lux b/stdlib/source/lux/control/predicate.lux index 9af533a8f..383d1b907 100644 --- a/stdlib/source/lux/control/predicate.lux +++ b/stdlib/source/lux/control/predicate.lux @@ -5,7 +5,7 @@ [function]]) (type: #export (Predicate a) - (-> a Bool)) + (-> a Bit)) (do-template [<identity-name> <identity-value> <composition-name> <composition>] [(def: #export <identity-name> diff --git a/stdlib/source/lux/control/state.lux b/stdlib/source/lux/control/state.lux index 03965f498..94330ff96 100644 --- a/stdlib/source/lux/control/state.lux +++ b/stdlib/source/lux/control/state.lux @@ -135,7 +135,7 @@ (wrap [state a])))) (def: #export (while condition body) - (All [s] (-> (State s Bool) (State s Any) (State s Any))) + (All [s] (-> (State s Bit) (State s Any) (State s Any))) (do Monad<State> [execute? condition] (if execute? @@ -145,7 +145,7 @@ (wrap [])))) (def: #export (do-while condition body) - (All [s] (-> (State s Bool) (State s Any) (State s Any))) + (All [s] (-> (State s Bit) (State s Any) (State s Any))) (do Monad<State> [_ body] (while condition body))) diff --git a/stdlib/source/lux/data/bool.lux b/stdlib/source/lux/data/bit.lux index b75663ad5..60cef178b 100644 --- a/stdlib/source/lux/data/bool.lux +++ b/stdlib/source/lux/data/bit.lux @@ -8,30 +8,30 @@ function]) ## [Structures] -(structure: #export _ (Equivalence Bool) +(structure: #export _ (Equivalence Bit) (def: (= x y) (if x y (not y)))) -(structure: #export _ (Hash Bool) - (def: eq Equivalence<Bool>) +(structure: #export _ (Hash Bit) + (def: eq Equivalence<Bit>) (def: (hash value) (case value true +1 false +0))) (do-template [<name> <identity> <op>] - [(structure: #export <name> (Monoid Bool) + [(structure: #export <name> (Monoid Bit) (def: identity <identity>) (def: (compose x y) (<op> x y)))] - [ Or@Monoid<Bool> false or] - [And@Monoid<Bool> true and] + [ Or@Monoid<Bit> false or] + [And@Monoid<Bit> true and] ) -(structure: #export _ (Codec Text Bool) +(structure: #export _ (Codec Text Bit) (def: (encode x) (if x "true" @@ -41,11 +41,11 @@ (case input "true" (#.Right true) "false" (#.Right false) - _ (#.Left "Wrong syntax for Bool.")))) + _ (#.Left "Wrong syntax for Bit.")))) ## [Values] (def: #export complement {#.doc "Generates the complement of a predicate. That is a predicate that returns the oposite of the original predicate."} - (All [a] (-> (-> a Bool) (-> a Bool))) + (All [a] (-> (-> a Bit) (-> a Bit))) (compose not)) diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index 684988954..d8d4ce5fa 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -69,7 +69,7 @@ (def: #export (filter p xs) (All [a] - (-> (-> a Bool) (Array a) (Array a))) + (-> (-> a Bit) (Array a) (Array a))) (list/fold (function (_ idx xs') (case (read idx xs) #.None @@ -84,7 +84,7 @@ (def: #export (find p xs) (All [a] - (-> (-> a Bool) (Array a) (Maybe a))) + (-> (-> a Bit) (Array a) (Maybe a))) (let [arr-size (size xs)] (loop [idx +0] (if (n/< arr-size idx) @@ -101,7 +101,7 @@ (def: #export (find+ p xs) {#.doc "Just like 'find', but with access to the index of each value."} (All [a] - (-> (-> Nat a Bool) (Array a) (Maybe [Nat a]))) + (-> (-> Nat a Bit) (Array a) (Maybe [Nat a]))) (let [arr-size (size xs)] (loop [idx +0] (if (n/< arr-size idx) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index b0e506cde..24eaa44a6 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -36,11 +36,11 @@ (|> bits array.size (n/* chunk-size))) (def: #export empty? - (-> Bits Bool) + (-> Bits Bit) (|>> size (n/= +0))) (def: #export (get index bits) - (-> Nat Bits Bool) + (-> Nat Bits Bit) (let [[chunk-index bit-index] (n//% chunk-size index)] (.and (n/< (array.size bits) chunk-index) (|> (array.read chunk-index bits) @@ -88,7 +88,7 @@ ) (def: #export (intersects? reference sample) - (-> Bits Bits Bool) + (-> Bits Bits Bit) (let [chunks (n/min (array.size reference) (array.size sample))] (loop [idx +0] diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 8e967b768..5add5c74a 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -177,12 +177,12 @@ (->bit-position (level-index level hash))) (def: (bit-position-is-set? bit bitmap) - (-> BitPosition BitMap Bool) + (-> BitPosition BitMap Bit) (not (n/= clean-bitmap (i64.and bit bitmap)))) ## Figures out whether a bitmap only contains a single bit-position. (def: only-bit-position? - (-> BitPosition BitMap Bool) + (-> BitPosition BitMap Bit) n/=) (def: (set-bit-position bit bitmap) @@ -272,7 +272,7 @@ ## used). ## So, this test is introduced to detect them. (def: (empty?' node) - (All [k v] (-> (Node k v) Bool)) + (All [k v] (-> (Node k v) Bit)) (`` (case node (#Base (~~ (static ..clean-bitmap)) _) true @@ -569,7 +569,7 @@ (get' root-level (:: Hash<k> hash key) key Hash<k> node))) (def: #export (contains? key dict) - (All [k v] (-> k (Dictionary k v) Bool)) + (All [k v] (-> k (Dictionary k v) Bit)) (case (get key dict) #.None false (#.Some _) true)) @@ -604,7 +604,7 @@ (|>> product.right size')) (def: #export empty? - (All [k v] (-> (Dictionary k v) Bool)) + (All [k v] (-> (Dictionary k v) Bit)) (|>> size (n/= +0))) (def: #export (entries dict) diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index 963f178b3..153c17a69 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -71,7 +71,7 @@ )))) (def: #export (contains? key dict) - (All [k v] (-> k (Dictionary k v) Bool)) + (All [k v] (-> k (Dictionary k v) Bit)) (let [## (^open "T/") (get@ #order dict) ] (loop [node (get@ #root dict)] diff --git a/stdlib/source/lux/data/collection/dictionary/plist.lux b/stdlib/source/lux/data/collection/dictionary/plist.lux index f1a6dff7e..050185307 100644 --- a/stdlib/source/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/lux/data/collection/dictionary/plist.lux @@ -18,7 +18,7 @@ (get key properties')))) (def: #export (contains? key properties) - (All [a] (-> Text (PList a) Bool)) + (All [a] (-> Text (PList a) Bit)) (case (get key properties) (#.Some _) true diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index b3089a01e..c734c140b 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -8,7 +8,7 @@ [equivalence (#+ Equivalence)] [fold]] [data - bool + bit [product]]]) ## [Types] @@ -37,7 +37,7 @@ (def: #export (filter p xs) (All [a] - (-> (-> a Bool) (List a) (List a))) + (-> (-> a Bit) (List a) (List a))) (case xs #.Nil #.Nil @@ -49,7 +49,7 @@ (def: #export (partition p xs) {#.doc "Divide the list into all elements that satisfy a predicate, and all elements that do not."} - (All [a] (-> (-> a Bool) (List a) [(List a) (List a)])) + (All [a] (-> (-> a Bit) (List a) [(List a) (List a)])) [(filter p xs) (filter (complement p) xs)]) (def: #export (as-pairs xs) @@ -84,7 +84,7 @@ (do-template [<name> <then> <else>] [(def: #export (<name> p xs) (All [a] - (-> (-> a Bool) (List a) (List a))) + (-> (-> a Bit) (List a) (List a))) (case xs #.Nil #.Nil @@ -113,7 +113,7 @@ (def: (split-with' p ys xs) (All [a] - (-> (-> a Bool) (List a) (List a) [(List a) (List a)])) + (-> (-> a Bit) (List a) (List a) [(List a) (List a)])) (case xs #.Nil [ys xs] @@ -126,7 +126,7 @@ (def: #export (split-with p xs) {#.doc "Segment the list by using a predicate to tell when to cut."} (All [a] - (-> (-> a Bool) (List a) [(List a) (List a)])) + (-> (-> a Bit) (List a) [(List a) (List a)])) (let [[ys' xs'] (split-with' p #.Nil xs)] [(reverse ys') xs'])) @@ -173,7 +173,7 @@ (def: #export (find p xs) {#.doc "Returns the first value in the list for which the predicate is true."} (All [a] - (-> (-> a Bool) (List a) (Maybe a))) + (-> (-> a Bit) (List a) (Maybe a))) (case xs #.Nil #.None @@ -234,7 +234,7 @@ (do-template [<name> <init> <op>] [(def: #export (<name> p xs) (All [a] - (-> (-> a Bool) (List a) Bool)) + (-> (-> a Bit) (List a) Bit)) (loop [xs xs] (case xs #.Nil @@ -320,7 +320,7 @@ ## [Functions] (def: #export (sort < xs) - (All [a] (-> (-> a a Bool) (List a) (List a))) + (All [a] (-> (-> a a Bit) (List a) (List a))) (case xs #.Nil (list) @@ -352,13 +352,13 @@ ) (def: #export (empty? xs) - (All [a] (-> (List a) Bool)) + (All [a] (-> (List a) Bit)) (case xs #.Nil true _ false)) (def: #export (member? eq xs x) - (All [a] (-> (Equivalence a) (List a) a Bool)) + (All [a] (-> (Equivalence a) (List a) a Bit)) (case xs #.Nil false (#.Cons x' xs') (or (:: eq = x x') diff --git a/stdlib/source/lux/data/collection/queue.lux b/stdlib/source/lux/data/collection/queue.lux index cf3587ece..864dfb67d 100644 --- a/stdlib/source/lux/data/collection/queue.lux +++ b/stdlib/source/lux/data/collection/queue.lux @@ -35,11 +35,11 @@ (list.size rear)))) (def: #export empty? - (All [a] (-> (Queue a) Bool)) + (All [a] (-> (Queue a) Bit)) (|>> (get@ #front) list.empty?)) (def: #export (member? Equivalence<a> queue member) - (All [a] (-> (Equivalence a) (Queue a) a Bool)) + (All [a] (-> (Equivalence a) (Queue a) a Bit)) (let [(^slots [#front #rear]) queue] (or (list.member? Equivalence<a> front member) (list.member? Equivalence<a> rear member)))) diff --git a/stdlib/source/lux/data/collection/queue/priority.lux b/stdlib/source/lux/data/collection/queue/priority.lux index 6765c6708..dbf6dec75 100644 --- a/stdlib/source/lux/data/collection/queue/priority.lux +++ b/stdlib/source/lux/data/collection/queue/priority.lux @@ -42,7 +42,7 @@ (n/+ (recur left) (recur right)))))) (def: #export (member? Equivalence<a> queue member) - (All [a] (-> (Equivalence a) (Queue a) a Bool)) + (All [a] (-> (Equivalence a) (Queue a) a Bit)) (case queue #.None false diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index 3b3b080eb..197e596e6 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -333,11 +333,11 @@ list)) (def: #export (member? a/Equivalence vec val) - (All [a] (-> (Equivalence a) (Row a) a Bool)) + (All [a] (-> (Equivalence a) (Row a) a Bit)) (list.member? a/Equivalence (to-list vec) val)) (def: #export empty? - (All [a] (-> (Row a) Bool)) + (All [a] (-> (Row a) Bit)) (|>> (get@ #size) (n/= +0))) ## [Syntax] diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index dc8f4a802..0a2350324 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -10,7 +10,7 @@ [code] ["s" syntax (#+ syntax: Syntax)]] [data - bool + bit [collection [list ("list/" Monad<List>)]]]]) ## [Types] @@ -91,8 +91,8 @@ [(#.Cons [x tail]) next]) [(list) xs])))] - [take-while drop-while split-while (-> a Bool) (pred x) pred] - [take drop split Nat (n/> +0 pred) (dec pred)] + [take-while drop-while split-while (-> a Bit) (pred x) pred] + [take drop split Nat (n/> +0 pred) (dec pred)] ) (def: #export (unfold step init) @@ -103,7 +103,7 @@ (pending [x (unfold step next)]))) (def: #export (filter p xs) - (All [a] (-> (-> a Bool) (Sequence a) (Sequence a))) + (All [a] (-> (-> a Bit) (Sequence a) (Sequence a))) (let [[x xs'] (continuation.run xs)] (if (p x) (pending [x (filter p xs')]) @@ -115,7 +115,7 @@ The left side contains all entries for which the predicate is true. The right side contains all entries for which the predicate is false."} - (All [a] (-> (-> a Bool) (Sequence a) [(Sequence a) (Sequence a)])) + (All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) [(filter p xs) (filter (complement p) xs)]) ## [Structures] diff --git a/stdlib/source/lux/data/collection/set.lux b/stdlib/source/lux/data/collection/set.lux index 5fa774e9e..11381c683 100644 --- a/stdlib/source/lux/data/collection/set.lux +++ b/stdlib/source/lux/data/collection/set.lux @@ -31,7 +31,7 @@ (|> set :representation (dict.remove elem) :abstraction)) (def: #export (member? set elem) - (All [a] (-> (Set a) a Bool)) + (All [a] (-> (Set a) a Bit)) (|> set :representation (dict.contains? elem))) (def: #export to-list @@ -68,7 +68,7 @@ ) (def: #export empty? - (All [a] (-> (Set a) Bool)) + (All [a] (-> (Set a) Bit)) (|>> ..size (n/= +0))) (def: #export (from-list Hash<a> xs) @@ -76,9 +76,9 @@ (list/fold ..add (..new Hash<a>) xs)) (def: #export (sub? super sub) - (All [a] (-> (Set a) (Set a) Bool)) + (All [a] (-> (Set a) (Set a) Bit)) (list.every? (..member? super) (..to-list sub))) (def: #export (super? sub super) - (All [a] (-> (Set a) (Set a) Bool)) + (All [a] (-> (Set a) (Set a) Bit)) (sub? super sub)) diff --git a/stdlib/source/lux/data/collection/set/multi.lux b/stdlib/source/lux/data/collection/set/multi.lux index 5aff87021..314c0423c 100644 --- a/stdlib/source/lux/data/collection/set/multi.lux +++ b/stdlib/source/lux/data/collection/set/multi.lux @@ -96,7 +96,7 @@ subject))) (def: #export (sub? reference subject) - (All [a] (-> (Set a) (Set a) Bool)) + (All [a] (-> (Set a) (Set a) Bit)) (|> subject :representation dictionary.entries @@ -138,11 +138,11 @@ ) (def: #export (member? set elem) - (All [a] (-> (Set a) a Bool)) + (All [a] (-> (Set a) a Bit)) (|> set (..multiplicity elem) (n/> +0))) (def: #export empty? - (All [a] (-> (Set a) Bool)) + (All [a] (-> (Set a) Bit)) (|>> ..size (n/= +0))) (def: #export (from-list Hash<a> subject) @@ -150,5 +150,5 @@ (list/fold ..add/1 (..new Hash<a>) subject)) (def: #export super? - (All [a] (-> (Set a) (Set a) Bool)) + (All [a] (-> (Set a) (Set a) Bit)) (function.flip sub?)) diff --git a/stdlib/source/lux/data/collection/set/ordered.lux b/stdlib/source/lux/data/collection/set/ordered.lux index 7e43d2a4e..b9fff0680 100644 --- a/stdlib/source/lux/data/collection/set/ordered.lux +++ b/stdlib/source/lux/data/collection/set/ordered.lux @@ -19,7 +19,7 @@ (|>> //.new :abstraction)) (def: #export (member? set elem) - (All [a] (-> (Set a) a Bool)) + (All [a] (-> (Set a) a Bit)) (|> set :representation (//.contains? elem))) (do-template [<name> <alias>] @@ -79,11 +79,11 @@ ) (def: #export (sub? super sub) - (All [a] (-> (Set a) (Set a) Bool)) + (All [a] (-> (Set a) (Set a) Bit)) (|> sub ..to-list (list.every? (..member? super)))) (def: #export (super? sub super) - (All [a] (-> (Set a) (Set a) Bool)) + (All [a] (-> (Set a) (Set a) Bit)) (sub? super sub)) diff --git a/stdlib/source/lux/data/collection/stack.lux b/stdlib/source/lux/data/collection/stack.lux index 409993ef1..8a24010e7 100644 --- a/stdlib/source/lux/data/collection/stack.lux +++ b/stdlib/source/lux/data/collection/stack.lux @@ -18,7 +18,7 @@ (list.size stack)) (def: #export (empty? stack) - (All [a] (-> (Stack a) Bool)) + (All [a] (-> (Stack a) Bit)) (list.empty? stack)) (def: #export (peek stack) diff --git a/stdlib/source/lux/data/collection/tree/finger.lux b/stdlib/source/lux/data/collection/tree/finger.lux index 1ce6d63fc..b77fca2ec 100644 --- a/stdlib/source/lux/data/collection/tree/finger.lux +++ b/stdlib/source/lux/data/collection/tree/finger.lux @@ -35,7 +35,7 @@ (get@ #node right))})) (def: #export (search pred tree) - (All [m a] (-> (-> m Bool) (Tree m a) (Maybe a))) + (All [m a] (-> (-> m Bit) (Tree m a) (Maybe a))) (let [tag/compose (get@ [#monoid #m.compose] tree)] (if (pred (tag tree)) (loop [_tag (get@ [#monoid #m.identity] tree) @@ -52,7 +52,7 @@ #.None))) (def: #export (found? pred tree) - (All [m a] (-> (-> m Bool) (Tree m a) Bool)) + (All [m a] (-> (-> m Bit) (Tree m a) Bit)) (case (search pred tree) (#.Some _) true diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux index f9a33ce0e..cdaba29fc 100644 --- a/stdlib/source/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/rose/zipper.lux @@ -44,20 +44,20 @@ (|> zipper (get@ [#node #rose.children]))) (def: #export (branch? zipper) - (All [a] (-> (Zipper a) Bool)) + (All [a] (-> (Zipper a) Bit)) (|> zipper children list.empty? not)) (def: #export (leaf? zipper) - (All [a] (-> (Zipper a) Bool)) + (All [a] (-> (Zipper a) Bit)) (|> zipper branch? not)) (def: #export (end? zipper) - (All [a] (-> (Zipper a) Bool)) + (All [a] (-> (Zipper a) Bit)) (and (list.empty? (get@ #rights zipper)) (list.empty? (children zipper)))) (def: #export (root? zipper) - (All [a] (-> (Zipper a) Bool)) + (All [a] (-> (Zipper a) Bit)) (case (get@ #parent zipper) #.None true diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index 4503f21dd..a5dcde900 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -148,14 +148,14 @@ (Binary Any) (ignore [])) -(def: #export bool - (Binary Bool) +(def: #export bit + (Binary Bit) {#read (function (_ [offset blob]) (case (blob.read/8 offset blob) (#error.Success data) (case (: Nat data) - (^template [<nat> <bool>] - <nat> (#error.Success [(inc offset) blob] <bool>)) + (^template [<nat> <bit>] + <nat> (#error.Success [(inc offset) blob] <bit>)) ([+0 false] [+1 true]) @@ -264,8 +264,8 @@ (function (_ code) (let [sequence (..list code) code' ($_ ..alt - ## #Bool - ..bool + ## #Bit + ..bit ## #Nat ..nat ## #Int diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 0316b5a9b..4dfa6cb7d 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -8,7 +8,7 @@ codec ["p" parser ("parser/" Monad<Parser>)]] [data - [bool] + [bit] [text ("text/" Equivalence<Text> Monoid<Text>) ["l" lexer]] [number ("frac/" Codec<Text,Frac>) ("nat/" Codec<Text,Nat>)] @@ -28,7 +28,7 @@ [(type: #export <name> <type>)] [Null Any] - [Boolean Bool] + [Boolean Bit] [Number Frac] [String Text] ) @@ -67,9 +67,9 @@ (^template [<ast-tag> <ctor> <json-tag>] [_ (<ast-tag> value)] (wrap (list (` (: JSON (<json-tag> (~ (<ctor> value)))))))) - ([#.Bool code.bool #Boolean] - [#.Frac code.frac #Number] - [#.Text code.text #String]) + ([#.Bit code.bit #Boolean] + [#.Frac code.frac #Number] + [#.Text code.text #String]) [_ (#.Tag ["" "null"])] (wrap (list (` (: JSON #Null)))) @@ -159,7 +159,7 @@ (^template [<tag> <struct>] [(<tag> x') (<tag> y')] (:: <struct> = x' y')) - ([#Boolean bool.Equivalence<Bool>] + ([#Boolean bit.Equivalence<Bit>] [#Number number.Equivalence<Frac>] [#String text.Equivalence<Text>]) @@ -237,16 +237,22 @@ _ (fail ($_ text/compose "JSON value is not " <desc> ".")))))] - [null Any #Null "null"] - [boolean Bool #Boolean "boolean"] + [null Any #Null "null"] + [boolean Bit #Boolean "boolean"] [number Frac #Number "number"] [string Text #String "string"] ) +(def: (encode-boolean value) + (-> Bit Text) + (if value + "true" + "false")) + (do-template [<test> <check> <type> <eq> <encoder> <tag> <desc> <pre>] [(def: #export (<test> test) {#.doc (code.text ($_ text/compose "Asks whether a JSON value is a " <desc> "."))} - (-> <type> (Reader Bool)) + (-> <type> (Reader Bit)) (do p.Monad<Parser> [head any] (case head @@ -271,7 +277,7 @@ _ (fail ($_ text/compose "JSON value is not a " <desc> ".")))))] - [boolean? boolean! Bool bool.Equivalence<Bool> (:: bool.Codec<Text,Bool> encode) #Boolean "boolean" id] + [boolean? boolean! Bit bit.Equivalence<Bit> encode-boolean #Boolean "boolean" id] [number? number! Frac number.Equivalence<Frac> (:: number.Codec<Text,Frac> encode) #Number "number" id] [string? string! Text text.Equivalence<Text> text.encode #String "string" id] ) @@ -360,7 +366,7 @@ (do-template [<name> <type> <codec>] [(def: <name> (-> <type> Text) <codec>)] - [show-boolean Boolean (:: bool.Codec<Text,Bool> encode)] + [show-boolean Boolean encode-boolean] [show-number Number (:: number.Codec<Text,Frac> encode)] [show-string String text.encode]) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 773300f31..cb322299c 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -149,11 +149,11 @@ (def: #export (not-a-number? number) {#.doc "Tests whether a frac is actually not-a-number."} - (-> Frac Bool) + (-> Frac Bit) (not (f/= number number))) (def: #export (frac? value) - (-> Frac Bool) + (-> Frac Bit) (not (or (not-a-number? value) (f/= positive-infinity value) (f/= negative-infinity value)))) @@ -574,7 +574,7 @@ (do-template [<from> <from-translator> <to> <to-translator> <base-bits>] [(def: (<from> on-left? input) - (-> Bool Text Text) + (-> Bit Text Text) (let [max-num-chars (n// <base-bits> +64) input-size ("lux text size" input) zero-padding (let [num-digits-that-need-padding (n/% <base-bits> input-size)] @@ -669,7 +669,7 @@ (#e.Error "Wrong syntax for \"encoding-doc\"."))) (def: (underscore-prefixed? number) - (-> Text Bool) + (-> Text Bit) (case ("lux text index" number "_" +0) (#.Some +0) true @@ -827,7 +827,7 @@ #.None))) (def: (digits-lt param subject) - (-> Digits Digits Bool) + (-> Digits Digits Bit) (loop [idx +0] (and (n/< i64.width idx) (let [pd (digits-get idx param) diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index 134801015..5c9c97d46 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -40,7 +40,7 @@ (number.not-a-number? (get@ #imaginary complex)))) (def: #export (= param input) - (-> Complex Complex Bool) + (-> Complex Complex Bit) (and (f/= (get@ #real param) (get@ #real input)) (f/= (get@ #imaginary param) diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index 353a1237a..32b9df2e3 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -67,7 +67,7 @@ ) (def: #export (set? idx input) - (-> Nat (I64 Any) Bool) + (-> Nat (I64 Any) Bit) (|> input (:coerce I64) (..and (flag idx)) (n/= +0) .not)) (do-template [<name> <main> <comp>] diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index b1aed0cba..2aa332dc6 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -71,7 +71,7 @@ input))) (def: #export (= param input) - (-> Ratio Ratio Bool) + (-> Ratio Ratio Bit) (and (n/= (get@ #numerator param) (get@ #numerator input)) (n/= (get@ #denominator param) @@ -79,7 +79,7 @@ (do-template [<name> <op>] [(def: #export (<name> param input) - (-> Ratio Ratio Bool) + (-> Ratio Ratio Bit) (and (<op> (n/* (get@ #denominator input) (get@ #numerator param)) (n/* (get@ #denominator param) diff --git a/stdlib/source/lux/data/tainted.lux b/stdlib/source/lux/data/tainted.lux index 903b777d6..7ff754081 100644 --- a/stdlib/source/lux/data/tainted.lux +++ b/stdlib/source/lux/data/tainted.lux @@ -17,7 +17,7 @@ (|>> :representation))) (def: #export (validate pred tainted) - (All [a] (-> (-> a Bool) (Tainted a) (Maybe a))) + (All [a] (-> (-> a Bit) (Tainted a) (Maybe a))) (let [value (trust tainted)] (if (pred value) (#.Some value) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 3a9e6ab3b..8120f19d5 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -60,7 +60,7 @@ #.None)) (def: #export (starts-with? prefix x) - (-> Text Text Bool) + (-> Text Text Bit) (case (index-of prefix x) (#.Some +0) true @@ -69,7 +69,7 @@ false)) (def: #export (ends-with? postfix x) - (-> Text Text Bool) + (-> Text Text Bit) (case (last-index-of postfix x) (#.Some n) (n/= (size x) @@ -79,7 +79,7 @@ false)) (def: #export (contains? sub text) - (-> Text Text Bool) + (-> Text Text Bit) (case ("lux text index" text sub +0) (#.Some _) true @@ -200,7 +200,7 @@ (|> texts (list.interpose sep) concat)) (def: #export (empty? text) - (-> Text Bool) + (-> Text Bit) (case text "" true _ false)) @@ -234,7 +234,7 @@ (def: #export (space? char) {#.doc "Checks whether the character is white-space."} - (-> Nat Bool) + (-> Nat Bit) (case char (^or (^ (char "\t")) (^ (char "\v")) (^ (char " ")) (^ (char "\n")) diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index d32862024..4b9717fab 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -4,7 +4,7 @@ [monad (#+ do Monad)] ["p" parser]] [data - [bool] + [bit] [number] [text] [ident] @@ -39,7 +39,7 @@ (Format <type>) <formatter>)] - [%b Bool (:: bool.Codec<Text,Bool> encode)] + [%b Bit (:: bit.Codec<Text,Bit> encode)] [%n Nat (:: number.Codec<Text,Nat> encode)] [%i Int (:: number.Codec<Text,Int> encode)] [%r Rev (:: number.Codec<Text,Rev> encode)] diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index 13c49ef8f..d9b07db1e 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -78,7 +78,7 @@ (def: #export (this? reference) {#.doc "Lex a text if it matches the given sample."} - (-> Text (Lexer Bool)) + (-> Text (Lexer Bit)) (function (_ (^@ input [offset tape])) (case (text.index-of' reference offset tape) (^multi (#.Some where) (n/= offset where)) @@ -97,7 +97,7 @@ (def: #export end? {#.doc "Ask if the lexer's input is empty."} - (Lexer Bool) + (Lexer Bit) (function (_ (^@ input [offset tape])) (#e.Success [input (n/= offset (text.size tape))]))) @@ -190,7 +190,7 @@ (def: #export (satisfies p) {#.doc "Only lex characters that satisfy a predicate."} - (-> (-> Nat Bool) (Lexer Text)) + (-> (-> Nat Bit) (Lexer Text)) (function (_ [offset tape]) (case (text.nth offset tape) (#.Some output) diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 8b35b770c..107270225 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -260,7 +260,7 @@ (#Capturing [(Maybe Text) Nat])) (def: (re-sequential^ capturing? re-scoped^ current-module) - (-> Bool + (-> Bit (-> Text (l.Lexer [Re-Group Code])) Text (l.Lexer [Nat Code])) @@ -351,7 +351,7 @@ (` ((~! unflatten^) (~ alt))))) (def: (re-alternative^ capturing? re-scoped^ current-module) - (-> Bool + (-> Bit (-> Text (l.Lexer [Re-Group Code])) Text (l.Lexer [Nat Code])) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 10b9692ee..11c69be84 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -50,7 +50,7 @@ (|> end (n/- start) inc))) (def: #export (within? segment char) - (All [a] (-> Segment Char Bool)) + (All [a] (-> Segment Char Bit)) (interval.within? (:representation segment) char)) ) diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux index b3758e3b5..022394f21 100644 --- a/stdlib/source/lux/host.js.lux +++ b/stdlib/source/lux/host.js.lux @@ -23,7 +23,7 @@ [String Text] [Number Frac] - [Boolean Bool] + [Boolean Bit] ) ## [Syntax] diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 8639ea2c5..927f16c7d 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -13,7 +13,7 @@ [product] [text ("text/" Equivalence<Text> Monoid<Text>) format] - [bool ("bool/" Codec<Text,Bool>)]] + [bit ("bit/" Codec<Text,Bit>)]] [macro (#+ with-gensyms Functor<Meta> Monad<Meta>) [code] ["s" syntax (#+ syntax: Syntax)]] @@ -147,27 +147,27 @@ [GenericType Code]) (type: Method-Definition - (#ConstructorMethod [Bool + (#ConstructorMethod [Bit (List Type-Paramameter) (List ArgDecl) (List ConstructorArg) Code (List GenericType)]) - (#VirtualMethod [Bool - Bool + (#VirtualMethod [Bit + Bit (List Type-Paramameter) (List ArgDecl) GenericType Code (List GenericType)]) - (#OverridenMethod [Bool + (#OverridenMethod [Bit Class-Declaration (List Type-Paramameter) (List ArgDecl) GenericType Code (List GenericType)]) - (#StaticMethod [Bool + (#StaticMethod [Bit (List Type-Paramameter) (List ArgDecl) GenericType @@ -195,10 +195,10 @@ #import-member-alias Text #import-member-kind ImportMethodKind #import-member-tvars (List Type-Paramameter) - #import-member-args (List [Bool GenericType]) - #import-member-maybe? Bool - #import-member-try? Bool - #import-member-io? Bool}) + #import-member-args (List [Bit GenericType]) + #import-member-maybe? Bit + #import-member-try? Bit + #import-member-io? Bit}) (type: ImportConstructorDecl {}) @@ -210,9 +210,9 @@ (type: ImportFieldDecl {#import-field-mode Primitive-Mode #import-field-name Text - #import-field-static? Bool - #import-field-maybe? Bool - #import-field-setter? Bool + #import-field-static? Bit + #import-field-maybe? Bit + #import-field-setter? Bit #import-field-type GenericType}) (type: Import-Member-Declaration @@ -259,7 +259,7 @@ (^template [<prim> <type>] <prim> (#.Some (' <type>))) - (["boolean" .Bool] + (["boolean" .Bit] ["byte" .Int] ["short" .Int] ["int" .Int] @@ -277,8 +277,8 @@ (def: (generic-class->type' mode type-params in-array? name+params class->type') - (-> Primitive-Mode (List Type-Paramameter) Bool [Text (List GenericType)] - (-> Primitive-Mode (List Type-Paramameter) Bool GenericType Code) + (-> Primitive-Mode (List Type-Paramameter) Bit [Text (List GenericType)] + (-> Primitive-Mode (List Type-Paramameter) Bit GenericType Code) Code) (case [name+params mode in-array?] (^multi [[prim #.Nil] #ManualPrM false] @@ -295,7 +295,7 @@ (` (primitive (~ (code.text name)) [(~+ =params)]))))) (def: (class->type' mode type-params in-array? class) - (-> Primitive-Mode (List Type-Paramameter) Bool GenericType Code) + (-> Primitive-Mode (List Type-Paramameter) Bit GenericType Code) (case class (#GenericTypeVar name) (case (list.find (function (_ [pname pbounds]) @@ -977,11 +977,11 @@ s.local-symbol))) (def: (import-member-args^ imports type-vars) - (-> Class-Imports (List Type-Paramameter) (Syntax (List [Bool GenericType]))) + (-> Class-Imports (List Type-Paramameter) (Syntax (List [Bit GenericType]))) (s.tuple (p.some (p.seq (s.this? (' #?)) (generic-type^ imports type-vars))))) (def: import-member-return-flags^ - (Syntax [Bool Bool Bool]) + (Syntax [Bit Bit Bit]) ($_ p.seq (s.this? (' #io)) (s.this? (' #try)) (s.this? (' #?)))) (def: primitive-mode^ @@ -1181,7 +1181,7 @@ (with-parens (spaced (list "init" (privacy-modifier$ pm) - (bool/encode strict-fp?) + (bit/encode strict-fp?) (with-brackets (spaced (list/map annotation$ anns))) (with-brackets (spaced (list/map type-param$ type-vars))) (with-brackets (spaced (list/map generic-type$ exs))) @@ -1195,8 +1195,8 @@ (spaced (list "virtual" name (privacy-modifier$ pm) - (bool/encode final?) - (bool/encode strict-fp?) + (bit/encode final?) + (bit/encode strict-fp?) (with-brackets (spaced (list/map annotation$ anns))) (with-brackets (spaced (list/map type-param$ type-vars))) (with-brackets (spaced (list/map generic-type$ exs))) @@ -1216,7 +1216,7 @@ (spaced (list "override" (class-decl$ class-decl) name - (bool/encode strict-fp?) + (bit/encode strict-fp?) (with-brackets (spaced (list/map annotation$ anns))) (with-brackets (spaced (list/map type-param$ type-vars))) (with-brackets (spaced (list/map generic-type$ exs))) @@ -1233,7 +1233,7 @@ (spaced (list "static" name (privacy-modifier$ pm) - (bool/encode strict-fp?) + (bit/encode strict-fp?) (with-brackets (spaced (list/map annotation$ anns))) (with-brackets (spaced (list/map type-param$ type-vars))) (with-brackets (spaced (list/map generic-type$ exs))) @@ -1398,7 +1398,7 @@ (null? "YOLO") "=>" false)} - (-> (primitive "java.lang.Object") Bool) + (-> (primitive "java.lang.Object") Bit) ("jvm object null?" obj)) (syntax: #export (??? expr) @@ -1454,7 +1454,7 @@ (do @ [g!_ (macro.gensym "_") g!obj (macro.gensym "obj")] - (wrap (list (` (: (-> (primitive "java.lang.Object") Bool) + (wrap (list (` (: (-> (primitive "java.lang.Object") Bit) (function ((~ g!_) (~ g!obj)) ((~ (code.text (format "jvm instanceof" ":" (simple-class$ (list) class)))) (~ g!obj)))))))) )) @@ -1480,7 +1480,7 @@ (~ g!obj)))))))) (def: (class-import$ long-name? [full-name params]) - (-> Bool Class-Declaration Code) + (-> Bit Class-Declaration Code) (let [def-name (if long-name? full-name (short-class-name full-name)) @@ -1517,7 +1517,7 @@ (let [(^slots [#import-member-tvars #import-member-args]) commons] (do Monad<Meta> [arg-inputs (monad.map @ - (: (-> [Bool GenericType] (Meta [Code Code])) + (: (-> [Bit GenericType] (Meta [Code Code])) (function (_ [maybe? _]) (with-gensyms [arg-name] (wrap [arg-name (if maybe? @@ -1527,7 +1527,7 @@ #let [arg-classes (: (List Text) (list/map (|>> product.right (simple-class$ (list/compose type-params import-member-tvars))) import-member-args)) - arg-types (list/map (: (-> [Bool GenericType] Code) + arg-types (list/map (: (-> [Bit GenericType] Code) (function (_ [maybe? arg]) (let [arg-type (class->type (get@ #import-member-mode commons) type-params arg)] (if maybe? @@ -1588,7 +1588,7 @@ ) (def: (free-type-param? [name bounds]) - (-> Type-Paramameter Bool) + (-> Type-Paramameter Bit) (case bounds #.Nil true _ false)) @@ -1621,7 +1621,7 @@ body))) (def: (auto-conv-class? class) - (-> Text Bool) + (-> Text Bit) (case class (^or "byte" "short" "int" "float") true @@ -1828,7 +1828,7 @@ ))) (def: (member-import$ type-params long-name? kind class member) - (-> (List Type-Paramameter) Bool Class-Kind Class-Declaration Import-Member-Declaration (Meta (List Code))) + (-> (List Type-Paramameter) Bit Class-Kind Class-Declaration Import-Member-Declaration (Meta (List Code))) (let [[full-name _] class method-prefix (if long-name? full-name @@ -1838,7 +1838,7 @@ (member-def-interop type-params kind class =args member method-prefix)))) (def: (interface? class) - (All [a] (-> (primitive "java.lang.Class" [a]) Bool)) + (All [a] (-> (primitive "java.lang.Class" [a]) Bit)) ("jvm invokevirtual:java.lang.Class:isInterface:" class)) (def: (load-class class-name) diff --git a/stdlib/source/lux/language/compiler/analysis.lux b/stdlib/source/lux/language/compiler/analysis.lux index 0ca620e42..e9eb3b921 100644 --- a/stdlib/source/lux/language/compiler/analysis.lux +++ b/stdlib/source/lux/language/compiler/analysis.lux @@ -13,7 +13,7 @@ (type: #export #rec Primitive #Unit - (#Bool Bool) + (#Bit Bit) (#Nat Nat) (#Int Int) (#Rev Rev) @@ -80,7 +80,7 @@ (-> <type> Analysis) (|>> <tag> #Primitive))] - [bool Bool #Bool] + [bit Bit #Bit] [nat Nat #Nat] [int Int #Int] [rev Rev #Rev] @@ -90,7 +90,7 @@ (type: #export (Variant a) {#lefts Nat - #right? Bool + #right? Bit #value a}) (type: #export (Tuple a) (List a)) @@ -102,7 +102,7 @@ (type: #export (Application c) [c (List c)]) (def: (last? size tag) - (-> Nat Tag Bool) + (-> Nat Tag Bit) (n/= (dec size) tag)) (template: #export (no-op value) @@ -215,7 +215,7 @@ [(template: #export (<name> content) (#..Simple (<tag> content)))] - [pattern/bool #..Bool] + [pattern/bit #..Bit] [pattern/nat #..Nat] [pattern/int #..Int] [pattern/rev #..Rev] diff --git a/stdlib/source/lux/language/compiler/analysis/case.lux b/stdlib/source/lux/language/compiler/analysis/case.lux index 760ea3b03..2f5162fbd 100644 --- a/stdlib/source/lux/language/compiler/analysis/case.lux +++ b/stdlib/source/lux/language/compiler/analysis/case.lux @@ -163,7 +163,7 @@ (^template [<type> <input> <output>] [cursor <input>] (analyse-primitive <type> inputT cursor (#//.Simple <output>) next)) - ([Bool (#.Bool pattern-value) (#//.Bool pattern-value)] + ([Bit (#.Bit pattern-value) (#//.Bit pattern-value)] [Nat (#.Nat pattern-value) (#//.Nat pattern-value)] [Int (#.Int pattern-value) (#//.Int pattern-value)] [Rev (#.Rev pattern-value) (#//.Rev pattern-value)] diff --git a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux index bce8512e5..b718c382d 100644 --- a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux @@ -5,7 +5,7 @@ ["ex" exception (#+ exception:)] equivalence] [data - [bool ("bool/" Equivalence<Bool>)] + [bit ("bit/" Equivalence<Bit>)] [number] ["e" error ("error/" Monad<Error>)] [maybe] @@ -50,18 +50,18 @@ ## as insuficient (since it could lead to runtime errors due to values ## not being handled by any pattern). ## The #Partial tag covers arbitrary partial coverages in a general -## way, while the other tags cover more specific cases for booleans +## way, while the other tags cover more specific cases for bits ## and variants. (type: #export #rec Coverage #Partial - (#Bool Bool) + (#Bit Bit) (#Variant (Maybe Nat) (Dictionary Nat Coverage)) (#Seq Coverage Coverage) (#Alt Coverage Coverage) #Exhaustive) (def: #export (exhaustive? coverage) - (-> Coverage Bool) + (-> Coverage Bit) (case coverage (#Exhaustive _) true @@ -87,11 +87,11 @@ [#///.Frac] [#///.Text]) - ## Bools are the exception, since there is only "true" and - ## "false", which means it is possible for boolean + ## Bits are the exception, since there is only "true" and + ## "false", which means it is possible for bit ## pattern-matching to become exhaustive if complementary parts meet. - (#///.Simple (#///.Bool value)) - (operation/wrap (#Bool value)) + (#///.Simple (#///.Bit value)) + (operation/wrap (#Bit value)) ## Tuple patterns can be exhaustive if there is exhaustiveness for all of ## their sub-patterns. @@ -122,7 +122,7 @@ (dict.put variant-idx value-coverage)))))))) (def: (xor left right) - (-> Bool Bool Bool) + (-> Bit Bit Bit) (or (and left (not right)) (and (not left) right))) @@ -151,8 +151,8 @@ [#Exhaustive #Exhaustive] true - [(#Bool sideR) (#Bool sideS)] - (bool/= sideR sideS) + [(#Bit sideR) (#Bit sideS)] + (bit/= sideR sideS) [(#Variant allR casesR) (#Variant allS casesS)] (and (n/= (cases allR) @@ -194,8 +194,8 @@ [#Partial #Partial] (error/wrap #Partial) - ## 2 boolean coverages are exhaustive if they compliment one another. - (^multi [(#Bool sideA) (#Bool sideSF)] + ## 2 bit coverages are exhaustive if they complement one another. + (^multi [(#Bit sideA) (#Bit sideSF)] (xor sideA sideSF)) (error/wrap #Exhaustive) diff --git a/stdlib/source/lux/language/compiler/analysis/expression.lux b/stdlib/source/lux/language/compiler/analysis/expression.lux index 1c5c8794c..f413b8077 100644 --- a/stdlib/source/lux/language/compiler/analysis/expression.lux +++ b/stdlib/source/lux/language/compiler/analysis/expression.lux @@ -44,7 +44,7 @@ (^template [<tag> <analyser>] (<tag> value) (<analyser> value)) - ([#.Bool primitive.bool] + ([#.Bit primitive.bit] [#.Nat primitive.nat] [#.Int primitive.int] [#.Rev primitive.rev] diff --git a/stdlib/source/lux/language/compiler/analysis/module.lux b/stdlib/source/lux/language/compiler/analysis/module.lux index 2a2aef5c3..bdc4abf05 100644 --- a/stdlib/source/lux/language/compiler/analysis/module.lux +++ b/stdlib/source/lux/language/compiler/analysis/module.lux @@ -102,7 +102,7 @@ []]))))) (def: #export (exists? module) - (-> Text (Operation Bool)) + (-> Text (Operation Bit)) (extension.lift (function (_ state) (|> state @@ -173,7 +173,7 @@ ((///.throw unknown-module module-name) state))))) (def: #export (<asker> module-name) - (-> Text (Operation Bool)) + (-> Text (Operation Bit)) (extension.lift (function (_ state) (case (|> state (get@ #.modules) (plist.get module-name)) @@ -203,8 +203,8 @@ #.None ((///.throw unknown-module module-name) state)))))] - [tags #.tags (List [Text [Nat (List Ident) Bool Type]])] - [types #.types (List [Text [(List Ident) Bool Type]])] + [tags #.tags (List [Text [Nat (List Ident) Bit Type]])] + [types #.types (List [Text [(List Ident) Bit Type]])] [hash #.module-hash Nat] ) @@ -224,7 +224,7 @@ (wrap []))) (def: #export (declare-tags tags exported? type) - (-> (List Tag) Bool Type (Operation Any)) + (-> (List Tag) Bit Type (Operation Any)) (do ///.Monad<Operation> [self-name (extension.lift macro.current-module-name) [type-module type-name] (case type diff --git a/stdlib/source/lux/language/compiler/analysis/primitive.lux b/stdlib/source/lux/language/compiler/analysis/primitive.lux index eabbcb7d8..346906909 100644 --- a/stdlib/source/lux/language/compiler/analysis/primitive.lux +++ b/stdlib/source/lux/language/compiler/analysis/primitive.lux @@ -14,7 +14,7 @@ [_ (typeA.infer <type>)] (wrap (#//.Primitive (<tag> value)))))] - [bool Bool #//.Bool] + [bit Bit #//.Bit] [nat Nat #//.Nat] [int Int #//.Int] [rev Rev #//.Rev] diff --git a/stdlib/source/lux/language/compiler/analysis/scope.lux b/stdlib/source/lux/language/compiler/analysis/scope.lux index 2468ede27..3ee0499e8 100644 --- a/stdlib/source/lux/language/compiler/analysis/scope.lux +++ b/stdlib/source/lux/language/compiler/analysis/scope.lux @@ -21,7 +21,7 @@ (type: Foreign (Bindings Text [Type Variable])) (def: (local? name scope) - (-> Text Scope Bool) + (-> Text Scope Bit) (|> scope (get@ [#.locals #.mappings]) (plist.contains? name))) @@ -35,7 +35,7 @@ [type (#reference.Local value)])))) (def: (captured? name scope) - (-> Text Scope Bool) + (-> Text Scope Bit) (|> scope (get@ [#.captured #.mappings]) (plist.contains? name))) @@ -54,7 +54,7 @@ (recur (inc idx) mappings'))))) (def: (reference? name scope) - (-> Text Scope Bool) + (-> Text Scope Bit) (or (local? name scope) (captured? name scope))) diff --git a/stdlib/source/lux/language/compiler/default/repl/type.lux b/stdlib/source/lux/language/compiler/default/repl/type.lux index 84f063e0c..c9b68c06e 100644 --- a/stdlib/source/lux/language/compiler/default/repl/type.lux +++ b/stdlib/source/lux/language/compiler/default/repl/type.lux @@ -40,7 +40,7 @@ [_ (poly.similar <type>)] (wrap (|>> (:coerce <type>) <formatter>)))] - [Bool %b] + [Bit %b] [Nat %n] [Int %i] [Rev %r] diff --git a/stdlib/source/lux/language/compiler/extension/analysis/common.lux b/stdlib/source/lux/language/compiler/extension/analysis/common.lux index 55d479052..9616f2533 100644 --- a/stdlib/source/lux/language/compiler/extension/analysis/common.lux +++ b/stdlib/source/lux/language/compiler/extension/analysis/common.lux @@ -63,7 +63,7 @@ (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] - ((binary varT varT Bool extension-name) + ((binary varT varT Bit extension-name) analyse args)))) ## "lux try" provides a simple way to interact with the host platform's @@ -167,8 +167,8 @@ (bundle.install "*" (binary Int Int Int)) (bundle.install "/" (binary Int Int Int)) (bundle.install "%" (binary Int Int Int)) - (bundle.install "=" (binary Int Int Bool)) - (bundle.install "<" (binary Int Int Bool)) + (bundle.install "=" (binary Int Int Bit)) + (bundle.install "<" (binary Int Int Bit)) (bundle.install "to-frac" (unary Int Frac)) (bundle.install "char" (unary Int Text))))) @@ -181,8 +181,8 @@ (bundle.install "*" (binary Frac Frac Frac)) (bundle.install "/" (binary Frac Frac Frac)) (bundle.install "%" (binary Frac Frac Frac)) - (bundle.install "=" (binary Frac Frac Bool)) - (bundle.install "<" (binary Frac Frac Bool)) + (bundle.install "=" (binary Frac Frac Bit)) + (bundle.install "<" (binary Frac Frac Bit)) (bundle.install "smallest" (nullary Frac)) (bundle.install "min" (nullary Frac)) (bundle.install "max" (nullary Frac)) @@ -195,8 +195,8 @@ Bundle (<| (bundle.prefix "text") (|> bundle.empty - (bundle.install "=" (binary Text Text Bool)) - (bundle.install "<" (binary Text Text Bool)) + (bundle.install "=" (binary Text Text Bit)) + (bundle.install "<" (binary Text Text Bit)) (bundle.install "concat" (binary Text Text Text)) (bundle.install "index" (trinary Text Text Nat (type (Maybe Nat)))) (bundle.install "size" (unary Text Nat)) @@ -289,7 +289,7 @@ (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] - ((trinary (type (Atom varT)) varT varT Bool extension-name) + ((trinary (type (Atom varT)) varT varT Bit extension-name) analyse args)))) (def: bundle::atom diff --git a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux index d25be6e40..876448b5b 100644 --- a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux @@ -167,8 +167,8 @@ (bundle.install "*" (common.binary <type> <type> <type>)) (bundle.install "/" (common.binary <type> <type> <type>)) (bundle.install "%" (common.binary <type> <type> <type>)) - (bundle.install "=" (common.binary <type> <type> Boolean)) - (bundle.install "<" (common.binary <type> <type> Boolean)) + (bundle.install "=" (common.binary <type> <type> Bit)) + (bundle.install "<" (common.binary <type> <type> Bit)) (bundle.install "and" (common.binary <type> <type> <type>)) (bundle.install "or" (common.binary <type> <type> <type>)) (bundle.install "xor" (common.binary <type> <type> <type>)) @@ -191,8 +191,8 @@ (bundle.install "*" (common.binary <type> <type> <type>)) (bundle.install "/" (common.binary <type> <type> <type>)) (bundle.install "%" (common.binary <type> <type> <type>)) - (bundle.install "=" (common.binary <type> <type> Boolean)) - (bundle.install "<" (common.binary <type> <type> Boolean)) + (bundle.install "=" (common.binary <type> <type> Bit)) + (bundle.install "<" (common.binary <type> <type> Bit)) )))] [bundle::float "float" Float] @@ -203,8 +203,8 @@ Bundle (<| (bundle.prefix "char") (|> bundle.empty - (bundle.install "=" (common.binary Character Character Boolean)) - (bundle.install "<" (common.binary Character Character Boolean)) + (bundle.install "=" (common.binary Character Character Bit)) + (bundle.install "<" (common.binary Character Character Bit)) ))) (def: #export boxes @@ -398,7 +398,7 @@ (case args (^ (list objectC)) (do ////.Monad<Operation> - [_ (typeA.infer Bool) + [_ (typeA.infer Bit) [objectT objectA] (typeA.with-inference (analyse objectC)) _ (check-object objectT)] @@ -493,7 +493,7 @@ (////.throw unknown-class name)))) (def: (sub-class? super sub) - (-> Text Text (Operation Bool)) + (-> Text Text (Operation Bit)) (do ////.Monad<Operation> [super (load-class super) sub (load-class sub)] @@ -545,7 +545,7 @@ (case classC [_ (#.Text class)] (do ////.Monad<Operation> - [_ (typeA.infer Bool) + [_ (typeA.infer Bit) [objectT objectA] (typeA.with-inference (analyse objectC)) object-class (check-object objectT) @@ -674,7 +674,7 @@ [valueT valueA] (typeA.with-inference (analyse valueC)) from-name (check-jvm valueT) - can-cast? (: (Operation Bool) + can-cast? (: (Operation Bit) (case [from-name to-name] (^template [<primitive> <object>] (^or [<primitive> <object>] @@ -773,7 +773,7 @@ (////.throw unknown-field (format class-name "#" field-name))))) (def: (static-field class-name field-name) - (-> Text Text (Operation [Type Bool])) + (-> Text Text (Operation [Type Bit])) (do ////.Monad<Operation> [[class fieldJ] (find-field class-name field-name) #let [modifiers (Field::getModifiers [] fieldJ)]] @@ -785,7 +785,7 @@ (////.throw not-a-static-field (format class-name "#" field-name))))) (def: (virtual-field class-name field-name objectT) - (-> Text Text Type (Operation [Type Bool])) + (-> Text Text Type (Operation [Type Bit])) (do ////.Monad<Operation> [[class fieldJ] (find-field class-name field-name) #let [modifiers (Field::getModifiers [] fieldJ)]] @@ -927,7 +927,7 @@ #Interface) (def: (check-method class method-name method-style arg-classes method) - (-> (Class Object) Text Method-Style (List Text) Method (Operation Bool)) + (-> (Class Object) Text Method-Style (List Text) Method (Operation Bit)) (do ////.Monad<Operation> [parameters (|> (Method::getGenericParameterTypes [] method) array.to-list @@ -956,7 +956,7 @@ (list.zip2 arg-classes parameters)))))) (def: (check-constructor class arg-classes constructor) - (-> (Class Object) (List Text) (Constructor Object) (Operation Bool)) + (-> (Class Object) (List Text) (Constructor Object) (Operation Bit)) (do ////.Monad<Operation> [parameters (|> (Constructor::getGenericParameterTypes [] constructor) array.to-list diff --git a/stdlib/source/lux/language/compiler/meta/cache.lux b/stdlib/source/lux/language/compiler/meta/cache.lux index 753a66e89..4a35d81d4 100644 --- a/stdlib/source/lux/language/compiler/meta/cache.lux +++ b/stdlib/source/lux/language/compiler/meta/cache.lux @@ -5,7 +5,7 @@ ["ex" exception (#+ exception:)] pipe] [data - [bool ("bool/" Equivalence<Bool>)] + [bit ("bit/" Equivalence<Bit>)] [maybe] [error] [product] @@ -82,7 +82,7 @@ (do @ [_ (..delete System<m> file)] (wrap true))))))] - [(list.every? (bool/= true)) + [(list.every? (bit/= true)) (if> [(..delete System<m> document)] [(wrap [])])])))) @@ -91,7 +91,7 @@ (|> root (do> (:: System<m> &monad) [(..cached System<m>)] - [(list.filter (bool.complement (set.member? wanted-modules))) + [(list.filter (bit.complement (set.member? wanted-modules))) (monad.map @ (un-install System<m> root))]))) ## Load diff --git a/stdlib/source/lux/language/compiler/synthesis.lux b/stdlib/source/lux/language/compiler/synthesis.lux index 05be98f3c..202260fa2 100644 --- a/stdlib/source/lux/language/compiler/synthesis.lux +++ b/stdlib/source/lux/language/compiler/synthesis.lux @@ -15,7 +15,7 @@ (type: #export State {#scope-arity Arity #resolver Resolver - #direct? Bool + #direct? Bit #locals Nat}) (def: #export fresh-resolver @@ -30,7 +30,7 @@ #locals +0}) (type: #export Primitive - (#Bool Bool) + (#Bit Bit) (#I64 I64) (#F64 Frac) (#Text Text)) @@ -110,7 +110,7 @@ [(template: #export (<name> content) (#..Test (<tag> content)))] - [path/bool #..Bool] + [path/bit #..Bit] [path/i64 #..I64] [path/f64 #..F64] [path/text #..Text] @@ -187,7 +187,7 @@ [scope-arity #scope-arity Arity] [resolver #resolver Resolver] - [direct? #direct? Bool] + [direct? #direct? Bit] [locals #locals Nat] ) @@ -201,7 +201,7 @@ [(template: #export (<name> content) (#..Primitive (<tag> content)))] - [bool #..Bool] + [bit #..Bit] [i64 #..I64] [f64 #..F64] [text #..Text] diff --git a/stdlib/source/lux/language/compiler/synthesis/case.lux b/stdlib/source/lux/language/compiler/synthesis/case.lux index de7a4f9fd..0c23d1f52 100644 --- a/stdlib/source/lux/language/compiler/synthesis/case.lux +++ b/stdlib/source/lux/language/compiler/synthesis/case.lux @@ -6,7 +6,7 @@ [monad (#+ do)]] [data [product] - [bool ("bool/" Equivalence<Bool>)] + [bit ("bit/" Equivalence<Bit>)] [text ("text/" Equivalence<Text>) format] [number ("frac/" Equivalence<Frac>)] @@ -30,7 +30,7 @@ (<from> value) (operation/map (|>> (#//.Seq (#//.Test (|> value <to>)))) bodyC)) - ([#analysis.Bool #//.Bool] + ([#analysis.Bit #//.Bit] [#analysis.Nat (<| #//.I64 .i64)] [#analysis.Int (<| #//.I64 .i64)] [#analysis.Rev (<| #//.I64 .i64)] @@ -101,7 +101,7 @@ (if (<eq> leftV rightV) rightP <default>)) - ([#//.Bool bool/=] + ([#//.Bit bit/=] [#//.I64 (:coerce (Equivalence I64) i/=)] [#//.F64 frac/=] [#//.Text text/=]) @@ -152,10 +152,10 @@ headB/bodyS]))))) <if> - (as-is (^or (^ [[(analysis.pattern/bool true) thenA] - (list [(analysis.pattern/bool false) elseA])]) - (^ [[(analysis.pattern/bool false) elseA] - (list [(analysis.pattern/bool true) thenA])])) + (as-is (^or (^ [[(analysis.pattern/bit true) thenA] + (list [(analysis.pattern/bit false) elseA])]) + (^ [[(analysis.pattern/bit false) elseA] + (list [(analysis.pattern/bit true) thenA])])) (do @ [thenS (synthesize^ thenA) elseS (synthesize^ elseA)] diff --git a/stdlib/source/lux/language/compiler/synthesis/expression.lux b/stdlib/source/lux/language/compiler/synthesis/expression.lux index 80480de68..0d780d444 100644 --- a/stdlib/source/lux/language/compiler/synthesis/expression.lux +++ b/stdlib/source/lux/language/compiler/synthesis/expression.lux @@ -29,7 +29,7 @@ (^template [<analysis> <synthesis>] (<analysis> value) (<synthesis> value)) - ([#analysis.Bool #//.Bool] + ([#analysis.Bit #//.Bit] [#analysis.Frac #//.F64] [#analysis.Text #//.Text]) diff --git a/stdlib/source/lux/language/compiler/synthesis/function.lux b/stdlib/source/lux/language/compiler/synthesis/function.lux index 92e75dc94..67f0dda46 100644 --- a/stdlib/source/lux/language/compiler/synthesis/function.lux +++ b/stdlib/source/lux/language/compiler/synthesis/function.lux @@ -19,11 +19,11 @@ [analysis (#+ Environment Arity Analysis)]]]]) (def: #export nested? - (-> Arity Bool) + (-> Arity Bit) (n/> +1)) (def: #export (adjust up-arity after? var) - (-> Arity Bool Variable Variable) + (-> Arity Bit Variable Variable) (case var (#reference.Local register) (if (and after? (n/>= up-arity register)) diff --git a/stdlib/source/lux/language/compiler/synthesis/loop.lux b/stdlib/source/lux/language/compiler/synthesis/loop.lux index 564fe5421..eeb1adcc7 100644 --- a/stdlib/source/lux/language/compiler/synthesis/loop.lux +++ b/stdlib/source/lux/language/compiler/synthesis/loop.lux @@ -19,7 +19,7 @@ (-> a (Maybe a))) (def: (some? maybe) - (All [a] (-> (Maybe a) Bool)) + (All [a] (-> (Maybe a) Bit)) (case maybe (#.Some _) true #.None false)) @@ -30,11 +30,11 @@ (template: (recursive-apply args) (#//.Apply (self) args)) -(def: proper Bool true) -(def: improper Bool false) +(def: proper Bit true) +(def: improper Bit false) (def: (proper? exprS) - (-> Synthesis Bool) + (-> Synthesis Bit) (case exprS (^ (self)) improper diff --git a/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux index 3ef368c18..f7b1adb7a 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux @@ -28,7 +28,7 @@ bodyO)))) (def: #export (record-get translate valueS pathP) - (-> Compiler Synthesis (List [Nat Bool]) + (-> Compiler Synthesis (List [Nat Bit]) (Operation Expression)) (do compiler.Monad<Operation> [valueO (translate valueS)] @@ -118,7 +118,7 @@ (^ (<tag> value)) (operation/wrap (_.when (|> value <format> (<=> cursor-top) _.not/1) fail-pm!))) - ([synthesis.path/bool _.bool _.eqv?/2] + ([synthesis.path/bit _.bool _.eqv?/2] [synthesis.path/i64 _.int _.=/2] [synthesis.path/f64 _.float _.=/2] [synthesis.path/text _.string _.eqv?/2]) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux index d7ef01e61..3cbefbf69 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux @@ -19,7 +19,7 @@ (^template [<tag> <generator>] (^ (<tag> value)) (<generator> value)) - ([synthesis.bool primitive.bool] + ([synthesis.bit primitive.bit] [synthesis.i64 primitive.i64] [synthesis.f64 primitive.f64] [synthesis.text primitive.text]) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux index fea12c6c3..6ff146393 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux @@ -6,8 +6,8 @@ [host ["_" scheme (#+ Expression)]]] [//runtime (#+ Operation)]) -(def: #export bool - (-> Bool (Operation Expression)) +(def: #export bit + (-> Bit (Operation Expression)) (|>> _.bool operation/wrap)) (def: #export i64 diff --git a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux index a1ce941d2..a84677144 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux @@ -33,7 +33,7 @@ (def: #export variant-tag "lux-variant") (def: (flag value) - (-> Bool Computation) + (-> Bit Computation) (if value (_.string "") _.nil)) diff --git a/stdlib/source/lux/language/host/scheme.lux b/stdlib/source/lux/language/host/scheme.lux index f93f3b671..d2edd6fac 100644 --- a/stdlib/source/lux/language/host/scheme.lux +++ b/stdlib/source/lux/language/host/scheme.lux @@ -62,7 +62,7 @@ (:abstraction "'()")) (def: #export bool - (-> Bool Computation) + (-> Bit Computation) (|>> (case> true "#t" false "#f") :abstraction)) diff --git a/stdlib/source/lux/language/reference.lux b/stdlib/source/lux/language/reference.lux index 0e66497a1..0f4ee03a5 100644 --- a/stdlib/source/lux/language/reference.lux +++ b/stdlib/source/lux/language/reference.lux @@ -58,7 +58,7 @@ (def: #export self Reference (..local +0)) (def: #export self? - (-> Variable Bool) + (-> Variable Bit) (|>> ..variable (case> (^ (..local +0)) true diff --git a/stdlib/source/lux/language/syntax.lux b/stdlib/source/lux/language/syntax.lux index e924694c3..e31356dcb 100644 --- a/stdlib/source/lux/language/syntax.lux +++ b/stdlib/source/lux/language/syntax.lux @@ -580,7 +580,7 @@ [where (case value (^template [<name> <value>] ["" <name>] - (#.Bool <value>)) + (#.Bit <value>)) (["true" true] ["false" false]) @@ -591,9 +591,9 @@ module) (exception: #export (unrecognized-input {[file line column] Cursor}) - (format " File: " file "\n" - " Line: " (%n line) "\n" - "Column: " (%n column) "\n")) + (ex.report ["File" file] + ["Line" (%n line)] + ["Column" (%n column)])) (def: (ast current-module aliases) (-> Text Aliases Cursor (l.Lexer [Cursor Code])) diff --git a/stdlib/source/lux/language/type.lux b/stdlib/source/lux/language/type.lux index 09c30fd03..cdb43422d 100644 --- a/stdlib/source/lux/language/type.lux +++ b/stdlib/source/lux/language/type.lux @@ -313,7 +313,7 @@ ) (def: #export (quantified? type) - (-> Type Bool) + (-> Type Bit) (case type (#.Named [module name] _type) (quantified? _type) diff --git a/stdlib/source/lux/language/type/check.lux b/stdlib/source/lux/language/type/check.lux index 60864008f..3308c497b 100644 --- a/stdlib/source/lux/language/type/check.lux +++ b/stdlib/source/lux/language/type/check.lux @@ -39,7 +39,7 @@ (type: #export Assumption {#subsumption [Type Type] - #verdict Bool}) + #verdict Bit}) (type: #export (Check a) (-> Type-Context (e.Error [Type-Context a]))) @@ -186,7 +186,7 @@ #.None (ex.throw unknown-type-var id))))] - [bound? Bool false true] + [bound? Bit false true] [read (Maybe Type) #.None (#.Some bound)] ) @@ -320,7 +320,7 @@ (#e.Error message))) (def: #export (assert message test) - (-> Text Bool (Check Any)) + (-> Text Bit (Check Any)) (function (_ context) (if test (#e.Success [context []]) @@ -337,7 +337,7 @@ (right context)))) (def: (assumed? [e a] assumptions) - (-> [Type Type] (List Assumption) (Maybe Bool)) + (-> [Type Type] (List Assumption) (Maybe Bit)) (:: maybe.Monad<Maybe> map product.right (list.find (function (_ [[fe fa] status]) (and (type/= e fe) @@ -345,7 +345,7 @@ assumptions))) (def: (assume! ea status assumptions) - (-> [Type Type] Bool (List Assumption) (List Assumption)) + (-> [Type Type] Bit (List Assumption) (List Assumption)) (#.Cons [ea status] assumptions)) (def: (on id type then else) @@ -633,7 +633,7 @@ (def: #export (checks? expected actual) {#.doc "A simple type-checking function that just returns a yes/no answer."} - (-> Type Type Bool) + (-> Type Type Bit) (case (run fresh-context (check expected actual)) (#e.Error error) false diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index a39168fa7..d063f1ab2 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -98,7 +98,7 @@ (def: #export (assert message test) {#.doc "Fails with the given message if the test is false."} - (-> Text Bool (Meta Any)) + (-> Text Bit (Meta Any)) (function (_ compiler) (if test (#e.Success [compiler []]) @@ -171,7 +171,7 @@ _ #.None))] - [get-bool-ann #.Bool Bool] + [get-bit-ann #.Bit Bit] [get-int-ann #.Int Int] [get-frac-ann #.Frac Frac] [get-text-ann #.Text Text] @@ -189,13 +189,13 @@ (def: #export (flag-set? flag-name anns) {#.doc "Finds out whether an annotation-as-a-flag is set (has value 'true')."} - (-> Ident Code Bool) - (maybe.default false (get-bool-ann flag-name anns))) + (-> Ident Code Bit) + (maybe.default false (get-bit-ann flag-name anns))) (do-template [<name> <tag> <desc>] [(def: #export <name> {#.doc (code.text ($_ text/compose "Checks whether a definition is " <desc> "."))} - (-> Code Bool) + (-> Code Bit) (flag-set? (ident-for <tag>)))] [export? #.export? "exported"] @@ -207,7 +207,7 @@ ) (def: #export (aliased? annotations) - (-> Code Bool) + (-> Code Bit) (case (get-symbol-ann (ident-for #.alias) annotations) (#.Some _) true @@ -417,7 +417,7 @@ (fail "Macro expanded to more than 1 element.")))) (def: #export (module-exists? module) - (-> Text (Meta Bool)) + (-> Text (Meta Bit)) (function (_ compiler) (#e.Success [compiler (case (get module (get@ #.modules compiler)) (#.Some _) @@ -465,7 +465,7 @@ {#.doc "Looks-up the type of a local variable somewhere in the environment."} (-> Text (Meta Type)) (function (_ compiler) - (let [test (: (-> [Text [Type Any]] Bool) + (let [test (: (-> [Text [Type Any]] Bit) (|>> product.left (text/= name)))] (case (do maybe.Monad<Maybe> [scope (list.find (function (_ env) @@ -607,13 +607,13 @@ (wrap imports))) (def: #export (imported-by? import module) - (-> Text Text (Meta Bool)) + (-> Text Text (Meta Bit)) (do Monad<Meta> [(^slots [#.imports]) (find-module module)] (wrap (list.any? (text/= import) imports)))) (def: #export (imported? import) - (-> Text (Meta Bool)) + (-> Text (Meta Bit)) (let [(^open) Monad<Meta>] (|> current-module-name (map find-module) join @@ -697,7 +697,7 @@ (def: (foo bar baz) (-> Int Int Int) (i/+ bar baz))))} - (case (: (Maybe [Bool Code]) + (case (: (Maybe [Bit Code]) (case tokens (^ (list [_ (#.Tag ["" "omit"])] token)) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index d8763c3e5..67be6ce56 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -1,17 +1,18 @@ (.module: [lux (#- nat int rev) - [control [equivalence (#+ Equivalence)]] + [control + [equivalence (#+ Equivalence)]] [data - bool + bit number [text (#+ Equivalence<Text>) ("text/" Monoid<Text>)] ident - [collection [list #* ("list/" Functor<List> Fold<List>)]] + [collection [list ("list/" Functor<List> Fold<List>)]] ]]) ## [Types] ## (type: (Code' w) -## (#.Bool Bool) +## (#.Bit Bit) ## (#.Nat Nat) ## (#.Int Int) ## (#.Frac Frac) @@ -34,7 +35,7 @@ (-> <type> Code) [_cursor (<tag> x)])] - [bool Bool #.Bool] + [bit Bit #.Bit] [nat Nat #.Nat] [int Int #.Int] [rev Rev #.Rev] @@ -63,7 +64,7 @@ (^template [<tag> <eq>] [[_ (<tag> x')] [_ (<tag> y')]] (:: <eq> = x' y')) - ([#.Bool Equivalence<Bool>] + ([#.Bit Equivalence<Bit>] [#.Nat Equivalence<Nat>] [#.Int Equivalence<Int>] [#.Rev Equivalence<Rev>] @@ -74,20 +75,13 @@ (^template [<tag>] [[_ (<tag> xs')] [_ (<tag> ys')]] - (and (:: Equivalence<Nat> = (size xs') (size ys')) - (list/fold (function (_ [x' y'] old) - (and old (= x' y'))) - true - (zip2 xs' ys')))) + (:: (list.Equivalence<List> =) = xs' ys')) ([#.Form] [#.Tuple]) [[_ (#.Record xs')] [_ (#.Record ys')]] - (and (:: Equivalence<Nat> = (size xs') (size ys')) - (list/fold (function (_ [[xl' xr'] [yl' yr']] old) - (and old (= xl' yl') (= xr' yr'))) - true - (zip2 xs' ys'))) + (:: (list.Equivalence<List> (equivalence.product = =)) + = xs' ys') _ false))) @@ -99,7 +93,7 @@ (^template [<tag> <struct>] [_ (<tag> value)] (:: <struct> encode value)) - ([#.Bool Codec<Text,Bool>] + ([#.Bit Codec<Text,Bit>] [#.Nat Codec<Text,Nat>] [#.Int Codec<Text,Int>] [#.Rev Codec<Text,Rev>] @@ -114,12 +108,19 @@ (^template [<tag> <open> <close>] [_ (<tag> members)] - ($_ text/compose <open> (|> members (list/map to-text) (interpose " ") (text.join-with "")) <close>)) + ($_ text/compose <open> (|> members (list/map to-text) (list.interpose " ") (text.join-with "")) <close>)) ([#.Form "(" ")"] [#.Tuple "[" "]"]) [_ (#.Record pairs)] - ($_ text/compose "{" (|> pairs (list/map (function (_ [left right]) ($_ text/compose (to-text left) " " (to-text right)))) (interpose " ") (text.join-with "")) "}") + ($_ text/compose + "{" + (|> pairs + (list/map (function (_ [left right]) + ($_ text/compose (to-text left) " " (to-text right)))) + (list.interpose " ") + (text.join-with "")) + "}") )) (def: #export (replace original substitute ast) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 7a7375e12..7c86a952a 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -13,7 +13,7 @@ ["dict" dictionary (#+ Dictionary)]] [number ("nat/" Codec<Text,Nat>)] [product] - [bool] + [bit] [maybe] [ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)] ["e" error]] @@ -354,7 +354,7 @@ ((~' wrap) (.list (~ g!output)))))))))))) (def: (common-poly-name? poly-func) - (-> Text Bool) + (-> Text Bit) (text.contains? "?" poly-func)) (def: (derivation-name poly args) diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux index 189179e13..66bc621ca 100644 --- a/stdlib/source/lux/macro/poly/equivalence.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -17,7 +17,7 @@ [tree [rose]]] [number ("nat/" Codec<Text,Nat>)] [product] - [bool] + [bit] [maybe]] [time ["du" duration] @@ -50,7 +50,7 @@ <eq>))))] [(poly.exactly Any) (function ((~ g!_) (~ g!_) (~ g!_)) true)] - [(poly.similar Bool) bool.Equivalence<Bool>] + [(poly.similar Bit) bit.Equivalence<Bit>] [(poly.similar Nat) number.Equivalence<Nat>] [(poly.similar Int) number.Equivalence<Int>] [(poly.similar Rev) number.Equivalence<Rev>] diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 0474c3d4b..1f5b4aab6 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -6,7 +6,7 @@ codec ["p" parser]] [data - [bool] + [bit] maybe ["e" error] [sum] @@ -91,7 +91,7 @@ <encoder>))))] [(poly.exactly Any) (function ((~ g!_) (~ (code.symbol ["" "0"]))) #//.Null)] - [(poly.similar Bool) (|>> #//.Boolean)] + [(poly.similar Bit) (|>> #//.Boolean)] [(poly.similar Nat) (:: (~! ..Codec<JSON,Nat>) (~' encode))] [(poly.similar Int) (:: (~! ..Codec<JSON,Int>) (~' encode))] [(poly.similar Frac) (|>> #//.Number)] @@ -206,8 +206,8 @@ (wrap (` (: (~ (@JSON//decode inputT)) <decoder>))))] - [(poly.exactly Any) //.null] - [(poly.similar Bool) //.boolean] + [(poly.exactly Any) //.null] + [(poly.similar Bit) //.boolean] [(poly.similar Nat) (p.codec (~! ..Codec<JSON,Nat>) //.any)] [(poly.similar Int) (p.codec (~! ..Codec<JSON,Int>) //.any)] [(poly.similar Frac) //.number] @@ -296,18 +296,18 @@ (syntax: #export (Codec<JSON,?> inputT) {#.doc (doc "A macro for automatically producing JSON codecs." (type: Variant - (#Case0 Bool) + (#Case0 Bit) (#Case1 Text) (#Case2 Frac)) (type: Record - {#bool Bool + {#bit Bit #frac Frac #text Text #maybe (Maybe Frac) #list (List Frac) #variant Variant - #tuple [Bool Frac Text] + #tuple [Bit Frac Text] #dict (Dictionary Text Frac)}) (derived: (Codec<JSON,?> Record)))} diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 3b6623b3e..630dd5a0e 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -6,7 +6,7 @@ [equivalence (#+ Equivalence)] ["p" parser]] [data - [bool] + [bit] [number] [text ("text/" Monoid<Text>)] [ident] @@ -54,7 +54,7 @@ _ (#error.Error ($_ text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] - [ bool Bool #.Bool bool.Equivalence<Bool> "bool"] + [ bit Bit #.Bit bit.Equivalence<Bit> "bit"] [ nat Nat #.Nat number.Equivalence<Nat> "nat"] [ int Int #.Int number.Equivalence<Int> "int"] [ rev Rev #.Rev number.Equivalence<Rev> "rev"] @@ -66,7 +66,7 @@ (def: #export (this? ast) {#.doc "Asks if the given Code is the next input."} - (-> Code (Syntax Bool)) + (-> Code (Syntax Bit)) (function (_ tokens) (case tokens (#.Cons [token tokens']) @@ -152,7 +152,7 @@ (def: #export end? {#.doc "Checks whether there are no more inputs."} - (Syntax Bool) + (Syntax Bit) (function (_ tokens) (case tokens #.Nil (#error.Success [tokens true]) @@ -212,7 +212,7 @@ (with-brackets (spaced (list/map constructor-arg$ constructor-args))) (with-brackets (spaced (list/map (method-def$ id) methods))))))] (wrap (list (` ((~ (code.text def-code)))))))))} - (let [[exported? tokens] (: [Bool (List Code)] + (let [[exported? tokens] (: [Bit (List Code)] (case tokens (^ (list& [_ (#.Tag ["" "export"])] tokens')) [true tokens'] diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index 58a502c56..408edae91 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -14,7 +14,7 @@ ## Exports (def: #export export - (Syntax Bool) + (Syntax Bit) (p.either (p.after (s.this (' #export)) (parser/wrap true)) (parser/wrap false))) diff --git a/stdlib/source/lux/macro/syntax/common/writer.lux b/stdlib/source/lux/macro/syntax/common/writer.lux index d482bc2c3..7a7416894 100644 --- a/stdlib/source/lux/macro/syntax/common/writer.lux +++ b/stdlib/source/lux/macro/syntax/common/writer.lux @@ -8,7 +8,7 @@ [//]) (def: #export (export exported?) - (-> Bool (List Code)) + (-> Bit (List Code)) (if exported? (list (' #export)) (list))) diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index c04f31c73..d90db4a33 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -192,7 +192,7 @@ (<| p.rec (function (_ infix^)) ($_ p.alt ($_ p.either - (parser/map code.bool s.bool) + (parser/map code.bit s.bit) (parser/map code.nat s.nat) (parser/map code.int s.int) (parser/map code.rev s.rev) diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux index cef3cbf6f..bb15adac1 100644 --- a/stdlib/source/lux/math/modular.lux +++ b/stdlib/source/lux/math/modular.lux @@ -48,7 +48,7 @@ " Sample: " (int/encode (to-int sample)) "\n")) (def: #export (congruent? modulus reference sample) - (All [m] (-> (Modulus m) Int Int Bool)) + (All [m] (-> (Modulus m) Int Int Bit)) (|> sample (i/- reference) (i/% (to-int modulus)) @@ -116,7 +116,7 @@ (do-template [<name> <op>] [(def: #export (<name> reference sample) - (All [m] (-> (Mod m) (Mod m) Bool)) + (All [m] (-> (Mod m) (Mod m) Bit)) (let [[reference _] (:representation reference) [sample _] (:representation sample)] (<op> reference sample)))] diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 2ddb64f32..86c7d9efd 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -63,7 +63,7 @@ (def: #export (filter pred gen) {#.doc "Retries the generator until the output satisfies a predicate."} - (All [a] (-> (-> a Bool) (Random a) (Random a))) + (All [a] (-> (-> a Bit) (Random a) (Random a))) (do Monad<Random> [sample gen] (if (pred sample) @@ -82,8 +82,8 @@ #.None (refine refiner gen)))) -(def: #export bool - (Random Bool) +(def: #export bit + (Random Bit) (function (_ prng) (let [[prng output] (prng [])] [prng (|> output (i64.and +1) (n/= +1))]))) @@ -164,7 +164,7 @@ {#.doc "Heterogeneous alternative combinator."} (All [a b] (-> (Random a) (Random b) (Random (| a b)))) (do Monad<Random> - [? bool] + [? bit] (if ? (do @ [=left left] @@ -177,7 +177,7 @@ {#.doc "Homogeneous alternative combinator."} (All [a] (-> (Random a) (Random a) (Random a))) (do Monad<Random> - [? bool] + [? bit] (if ? left right))) @@ -192,7 +192,7 @@ (def: #export (maybe value-gen) (All [a] (-> (Random a) (Random (Maybe a)))) (do Monad<Random> - [some? bool] + [some? bit] (if some? (do @ [value value-gen] diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 00cbcca91..d4fb7108f 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -49,7 +49,7 @@ (def: #export (assert message condition) {#.doc "Check that a condition is true, and fail with the given message otherwise."} - (-> Text Bool (Promise [Counters Text])) + (-> Text Bit (Promise [Counters Text])) (<| (:: promise.Monad<Promise> wrap) (if condition [success (format "[Success] " message)] @@ -57,7 +57,7 @@ (def: #export (test message condition) {#.doc "Check that a condition is true, and fail with the given message otherwise."} - (-> Text Bool Test) + (-> Text Bit Test) (:: r.Monad<Random> wrap (assert message condition))) (def: (run' tests) @@ -83,7 +83,7 @@ (wrap (list/fold add-counters start test-runs)))) (def: failed? - (-> Counters Bool) + (-> Counters Bit) (|>> product.right (n/> +0))) (def: #export (seed value test) diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index 068936f47..e80db8bac 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -198,7 +198,7 @@ (get@ #day sample))))) (def: (date/< reference sample) - (-> Date Date Bool) + (-> Date Date Bit) (or (i/< (get@ #year reference) (get@ #year sample)) (:: Order<Month> < @@ -265,11 +265,11 @@ (row.update [+1] inc normal-months)) (def: (divisible? factor input) - (-> Int Int Bool) + (-> Int Int Bit) (|> input (i/% factor) (i/= 0))) (def: (leap-year? year) - (-> Int Bool) + (-> Int Bit) (and (divisible? 4 year) (or (not (divisible? 100 year)) (divisible? 400 year)))) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index 92e35a7fb..b9300b7c3 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -61,7 +61,7 @@ (do-template [<name> <op>] [(def: #export (<name> duration) - (-> Duration Bool) + (-> Duration Bit) (<op> 0 (:representation duration)))] [positive? i/>] diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index ce97cecea..9002ff9ef 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -80,11 +80,11 @@ ## Codec::encode (def: (divisible? factor input) - (-> Int Int Bool) + (-> Int Int Bit) (|> input (i/% factor) (i/= 0))) (def: (leap-year? year) - (-> Int Bool) + (-> Int Bit) (and (divisible? 4 year) (or (not (divisible? 100 year)) (divisible? 400 year)))) diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 8e1c92f84..b2c747028 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -9,7 +9,6 @@ [number] [collection [list ("list/" Monad<List> Fold<List>)] ["dict" dictionary (#+ Dictionary)]] - [bool] [product] [maybe]] [macro (#+ Monad<Meta>) @@ -285,7 +284,7 @@ (do Monad<Meta> [alts import-structs] (test alts))))) (def: (var? input) - (-> Code Bool) + (-> Code Bit) (case input [_ (#.Symbol _)] true diff --git a/stdlib/source/lux/type/object/interface.lux b/stdlib/source/lux/type/object/interface.lux index c90965c2d..42284b4b3 100644 --- a/stdlib/source/lux/type/object/interface.lux +++ b/stdlib/source/lux/type/object/interface.lux @@ -98,7 +98,7 @@ (~ g!method))))) (def: (definition export [interface parameters] g!self-object g!ext g!states (^open)) - (-> Bool Declaration Code Code (List Code) Method Code) + (-> Bit Declaration Code Code (List Code) Method Code) (let [g!method (code.local-symbol name) g!parameters (list/map code.local-symbol parameters) g!type-vars (list/map code.local-symbol type-vars) @@ -125,7 +125,7 @@ (def: no-parent Ident ["" ""]) (def: (no-parent? parent) - (-> Ident Bool) + (-> Ident Bit) (ident/= no-parent parent)) (def: (with-interface parent interface) @@ -247,7 +247,7 @@ ) (def: (getterN export interface g!parameters g!ext g!child ancestors) - (-> Bool Text (List Code) Code Code (List Ident) + (-> Bit Text (List Code) Code Code (List Ident) Code) (let [g!get (code.local-symbol (getN interface)) g!interface (code.local-symbol interface) @@ -266,7 +266,7 @@ (~ g!_state)))))) (def: (setterN export interface g!parameters g!ext g!child ancestors) - (-> Bool Text (List Code) Code Code (List Ident) + (-> Bit Text (List Code) Code Code (List Ident) Code) (let [g!set (code.local-symbol (setN interface)) g!interface (code.local-symbol interface) @@ -289,7 +289,7 @@ (~ g!build-up)))))) (def: (updaterN export interface g!parameters g!ext g!child ancestors) - (-> Bool Text (List Code) Code Code (List Ident) + (-> Bit Text (List Code) Code Code (List Ident) Code) (let [g!update (code.local-symbol (updateN interface)) g!interface (code.local-symbol interface) diff --git a/stdlib/source/lux/type/object/protocol.lux b/stdlib/source/lux/type/object/protocol.lux index 495aaebd4..ebbf9cc4b 100644 --- a/stdlib/source/lux/type/object/protocol.lux +++ b/stdlib/source/lux/type/object/protocol.lux @@ -78,7 +78,7 @@ (Method (~ inputC) (~ outputC) (~ g!return))))))) (def: (method|c export protocol method) - (-> Bool cs.Declaration Method-Syntax (Meta Code)) + (-> Bit cs.Declaration Method-Syntax (Meta Code)) (let [methodC (code.local-symbol (get@ #method-name method)) tagC (code.local-tag (get@ #method-name method)) protocolC (code.local-symbol (get@ #cs.declaration-name protocol)) @@ -110,7 +110,7 @@ (` ((~ tagC) ((~ protocolC) (~ g!return)))))) (def: (class|c export protocol class) - (-> Bool cs.Declaration Class-Syntax (Meta Code)) + (-> Bit cs.Declaration Class-Syntax (Meta Code)) (let [classC (code.local-symbol (get@ #class-name class)) tagC (code.local-tag (get@ #class-name class)) protocolC (code.local-symbol (get@ #cs.declaration-name protocol)) @@ -138,7 +138,7 @@ (class|w g!return))) (def: (super|c export protocol) - (-> Bool cs.Declaration (| Method-Syntax Class-Syntax) (Meta Code)) + (-> Bit cs.Declaration (| Method-Syntax Class-Syntax) (Meta Code)) (sum.either (method|c export protocol) (class|c export protocol))) diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index d62c77182..6630f8a60 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -52,14 +52,14 @@ [last-modified Instant]) (do-template [<name>] - [(: (-> File (m Bool)) + [(: (-> File (m Bit)) <name>)] [file?] [directory?] ) - (: (-> Permission File (m Bool)) + (: (-> Permission File (m Bit)) can?) (do-template [<name>] @@ -240,7 +240,7 @@ })) (def: #export (exists? System<m> file) - (All [m] (-> (System m) File (m Bool))) + (All [m] (-> (System m) File (m Bit))) (|> file (do> (:: System<m> &monad) [(:: System<m> file?)] |