aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/math/number/i16.lux
blob: 446e5f71bf1ce05ac35ac3b2ae747658fc9e0542 (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
27
28
29
30
31
32
33
(.require
 [library
  [lux (.except i64)
   [abstract
    [equivalence (.only Equivalence)]]
   [control
    ["[0]" maybe]]
   [type (.only by_example)]]]
 [//
  ["[0]" i64 (.only Sub)]])

(def sub
  (maybe.trusted (i64.sub 16)))

(def .public I16
  Type
  ... TODO: Switch to the cleaner approach ASAP.
  (case (type_of ..sub)
    {.#Apply :size: :sub:}
    (type_literal (I64 :size:))

    _
    (undefined))
  ... (by_example [size]
  ...   (is (Sub size)
  ...       ..sub)
  ...   (I64 size))
  )

(def .public equivalence (Equivalence I16) (at ..sub sub_equivalence))
(def .public width Nat (at ..sub bits))
(def .public i16 (-> I64 I16) (at ..sub narrow))
(def .public i64 (-> I16 I64) (at ..sub wide))