view style.ur @ 32:d32fb0f7b137

Update for Ur/Web's new type class handling
author Adam Chlipala <adam@chlipala.net>
date Sun, 29 Jul 2012 12:28:46 -0400
parents 93140c5cc972
children
line wrap: on
line source
con 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