aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/format/css/id.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/data/format/css/id.lux')
-rw-r--r--stdlib/source/library/lux/data/format/css/id.lux33
1 files changed, 33 insertions, 0 deletions
diff --git a/stdlib/source/library/lux/data/format/css/id.lux b/stdlib/source/library/lux/data/format/css/id.lux
new file mode 100644
index 000000000..c5a6f5862
--- /dev/null
+++ b/stdlib/source/library/lux/data/format/css/id.lux
@@ -0,0 +1,33 @@
+(.using
+ [library
+ [lux "*"
+ ["[0]" meta]
+ [abstract
+ [monad {"+" do}]]
+ [data
+ ["[0]" text ("[1]#[0]" hash)
+ ["%" format {"+" format}]]]
+ [macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [type
+ abstract]]])
+
+(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)))))))))))
+ )