aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/jvm/index.lux
blob: 6d7e280f6f18816f1304fb0475af6e650080c9b9 (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
(.module:
  [lux #*
   [abstract
    ["." equivalence (#+ Equivalence)]]
   [data
    [format
     ["." binary (#+ Format)]]]
   [type
    abstract]]
  ["." // #_
   [encoding
    ["#." unsigned (#+ U2)]]])

(abstract: #export (Index kind)
  {}

  U2

  (def: #export index
    (All [kind] (-> U2 (Index kind)))
    (|>> :abstraction))

  (def: #export number
    (-> (Index Any) U2)
    (|>> :representation))

  (def: #export equivalence
    (All [kind] (Equivalence (Index kind)))
    (:: equivalence.contravariant map-1
        ..number
        //unsigned.equivalence))

  (def: #export format
    (All [kind] (Format (Index kind)))
    (binary.adapt ..index
                  ..number
                  //unsigned.u2-format))
  )