blob: 3fc66729119f0141391663fee53be34c854a1deb (
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
34
35
36
37
38
39
40
41
42
|
(.require
[library
[lux (.except i64)
[abstract
[equivalence (.only Equivalence)]]
[control
["?" parser]
["[0]" maybe]
["[0]" try]]
[meta
["@" target]
["[0]" static]
["[0]" type (.only)
["?[1]" \\parser]]]]]
[//
["[0]" i64]])
(def sub
(maybe.trusted (i64.sub 32)))
(for @.old
(def .public I32
Type
(when (type_of ..sub)
{.#Apply :size: :sub:}
(type_literal (I64 :size:))
_
(undefined)))
(`` (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) (of ..sub sub_equivalence))
(def .public width Nat (of ..sub bits))
(def .public i32 (-> I64 I32) (of ..sub narrow))
(def .public i64 (-> I32 I64) (of ..sub wide))
|