aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/target/jvm/magic.lux
blob: 3aab60bec29281ffcffa3700855fd0cc433ad8f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(.require
 [library
  [lux (.except)
   [control
    ["[0]" try]]
   [math
    [number (.only hex)]]]]
 ["[0]" //
  [encoding
   ["[1][0]" unsigned (.only U4)]]])

(type .public Magic
  U4)

(def .public code
  Magic
  (|> (hex "CAFEBABE")
      //unsigned.u4
      try.trusted))

(def .public writer
  //unsigned.writer/4)