diff options
author | Eduardo Julian | 2017-06-14 17:57:04 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-06-14 17:57:04 -0400 |
commit | daa6c92c14d9b85bf3ade2b6684e3c97dcda851e (patch) | |
tree | d5937f9dcd59741f872d03e7fe8ad058c9272370 | |
parent | c7e53036704b1a89b740c023c7b4bcc74b7e956a (diff) |
- Added Hash<Bool> and as-is macro..
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux.lux | 9 | ||||
-rw-r--r-- | stdlib/source/lux/data/bool.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/host.jvm.lux | 4 |
3 files changed, 16 insertions, 5 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index f801ebebd..a225683e0 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -5573,16 +5573,16 @@ _ (fail "Wrong syntax for $"))) -(def: #export (is left right) +(def: #export (is reference sample) {#;doc (doc "Tests whether the 2 values are identical (not just \"equal\")." "This one should succeed:" (let [value 5] - (is 5 5)) + (is value value)) "This one should fail:" (is 5 (i.+ 2 3)))} (All [a] (-> a a Bool)) - (_lux_proc ["lux" "is"] [left right])) + (_lux_proc ["lux" "is"] [reference sample])) (macro: #export (^@ tokens) {#;doc (doc "Allows you to simultaneously bind and de-structure a value." @@ -5774,3 +5774,6 @@ (def: #export (assume mx) (All [a] (-> (Maybe a) a)) (default (undefined) mx)) + +(macro: #export (as-is tokens state) + (#;Right [state tokens])) diff --git a/stdlib/source/lux/data/bool.lux b/stdlib/source/lux/data/bool.lux index 2d89de635..35c00477f 100644 --- a/stdlib/source/lux/data/bool.lux +++ b/stdlib/source/lux/data/bool.lux @@ -2,6 +2,7 @@ lux (lux (control monoid eq + hash codec))) ## [Structures] @@ -11,6 +12,13 @@ y (not y)))) +(struct: #export _ (Hash Bool) + (def: eq Eq<Bool>) + (def: (hash value) + (case value + true +1 + false +0))) + (do-template [<name> <unit> <op>] [(struct: #export <name> (Monoid Bool) (def: unit <unit>) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index b31def073..b4dde1157 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -2025,7 +2025,7 @@ (syntax: #export (array-load idx array) {#;doc (doc "Loads an element from an array." - (array-load 10 my-array))} + (array-load +10 my-array))} (case array [_ (#;Symbol array-name)] (do Monad<Lux> @@ -2054,7 +2054,7 @@ (syntax: #export (array-store idx value array) {#;doc (doc "Stores an element into an array." - (array-store 10 my-object my-array))} + (array-store +10 my-object my-array))} (case array [_ (#;Symbol array-name)] (do Monad<Lux> |