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

(def: .public length
  //unsigned.bytes/2)

(abstract: .public (Index kind)
  {}
  
  U2

  (def: .public index
    (All [kind] (-> U2 (Index kind)))
    (|>> :abstraction))

  (def: .public value
    (-> (Index Any) U2)
    (|>> :representation))

  (def: .public equivalence
    (All [kind] (Equivalence (Index kind)))
    (\ equivalence.functor each
       ..value
       //unsigned.equivalence))

  (def: .public writer
    (All [kind] (Writer (Index kind)))
    (|>> :representation //unsigned.writer/2))
  )