aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/web/css/id.lux
blob: 491064ca90a6bf83cf68742e65488f1d718b1e7e (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
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]]
   [data
    ["[0]" text (.use "[1]#[0]" hash)
     ["%" \\format (.only format)]]]
   ["[0]" meta (.only)
    ["[0]" code]
    [macro
     [syntax (.only syntax)]]
    [type
     ["[0]" nominal (.except def)]]]]])

(nominal.def .public ID
  Text

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

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

  (def .public generic
    (syntax (_ [])
      (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))))))))))))
  )