aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/web/css/id.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/web/css/id.lux')
-rw-r--r--stdlib/source/library/lux/web/css/id.lux34
1 files changed, 34 insertions, 0 deletions
diff --git a/stdlib/source/library/lux/web/css/id.lux b/stdlib/source/library/lux/web/css/id.lux
new file mode 100644
index 000000000..fc93ec1bb
--- /dev/null
+++ b/stdlib/source/library/lux/web/css/id.lux
@@ -0,0 +1,34 @@
+(.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))))))))))))
+ )