aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/format/css/id.lux
blob: 1ace956873245af22647dfe653f5ea75853cb360 (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
(.using
 [library
  [lux "*"
   ["[0]" meta]
   [abstract
    [monad {"+" do}]]
   [data
    ["[0]" text ("[1]#[0]" hash)
     ["%" format {"+" format}]]]
   [macro
    [syntax {"+" syntax:}]
    ["[0]" code]]
   [type
    [abstract {"-" pattern}]]]])

(abstract: .public ID
  Text

  (def: .public id
    (-> ID Text)
    (|>> representation))

  (def: .public custom
    (-> Text ID)
    (|>> abstraction))

  (syntax: .public (generic [])
    (do meta.monad
      [module meta.current_module_name
       id meta.seed]
      (in (list (` (..custom (~ (code.text (format "i" (%.nat/16 id)
                                                   "_" (%.nat/16 (text#hash module)))))))))))
  )