aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/math/number/i32.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/math/number/i32.lux')
-rw-r--r--stdlib/source/library/lux/math/number/i32.lux34
1 files changed, 14 insertions, 20 deletions
diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux
index af4d6d592..e2bce4938 100644
--- a/stdlib/source/library/lux/math/number/i32.lux
+++ b/stdlib/source/library/lux/math/number/i32.lux
@@ -4,31 +4,25 @@
[abstract
[equivalence (.only Equivalence)]]
[control
- ["[0]" maybe]]
+ ["?" parser]
+ ["[0]" maybe]
+ ["[0]" try]]
[meta
- [type (.only by_example)]]]]
+ ["[0]" static]
+ ["[0]" type (.only)
+ ["?[1]" \\parser]]]]]
[//
- ["[0]" i64 (.only Sub)]])
+ ["[0]" i64]])
(def sub
- ... TODO: Stop needing this coercion.
- (as (Sub (I64 (Nominal "#I32")))
- (maybe.trusted (i64.sub 32))))
+ (maybe.trusted (i64.sub 32)))
-(def .public I32
- Type
- ... TODO: Switch to the cleaner approach ASAP.
- (when (type_of ..sub)
- {.#Apply :size: :sub:}
- (type_literal (I64 :size:))
-
- _
- (undefined))
- ... (by_example [size]
- ... (is (Sub size)
- ... ..sub)
- ... (I64 size))
- )
+(`` (type .public I32
+ (I64 (,, (|> (type_of ..sub)
+ (?type.result (?type.applied (?.after (?type.exactly i64.Sub)
+ ?type.any)))
+ try.trusted
+ (static.literal type.code))))))
(def .public equivalence (Equivalence I32) (at ..sub sub_equivalence))
(def .public width Nat (at ..sub bits))