aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/math/number/i32.lux
blob: 3f10bf2542a4f71472b1de8d38eee27bfe1f59a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(.module:
  [library
   [lux {"-" [i64]}
    [type {"+" [:by_example]}]
    [abstract
     [equivalence {"+" [Equivalence]}]]
    [control
     ["[0]" maybe]]]]
  [//
   ["[0]" i64 {"+" [Sub]}]])

(def: sub
  (maybe.trusted (i64.sub 32)))

(def: .public I32
  Type
  (:by_example [size]
               (Sub size)
               ..sub
               
               (I64 size)))

(def: .public equivalence (Equivalence I32) (# ..sub &equivalence))
(def: .public width Nat (# ..sub bits))
(def: .public i32 (-> I64 I32) (# ..sub narrow))
(def: .public i64 (-> I32 I64) (# ..sub wide))