diff style.ur @ 29:93140c5cc972

Clean up dependencies and examples; add Style module
author Adam Chlipala <adam@chlipala.net>
date Sat, 12 May 2012 10:03:44 -0400
parents
children d32fb0f7b137
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/style.ur	Sat May 12 10:03:44 2012 -0400
@@ -0,0 +1,16 @@
+class attr t = t -> css_value
+val attr_string = atom
+fun attr_int n = atom (show n)
+val attr_url = css_url
+fun valu [t] (f : attr t) (x : t) = f x
+
+fun prop1 [t] (f : attr t) (s : string) (x : t) =
+    oneProperty noStyle (value (property s) (f x))
+
+fun prop (s : string) (xs : list css_value) =
+    oneProperty noStyle (List.foldl (fn x p => value p x) (property s) xs)
+
+fun props (ls : list (string * list css_value)) =
+    List.foldl (fn (s, xs) acc =>
+                   oneProperty acc (List.foldl (fn x p => value p x) (property s) xs))
+               noStyle ls