Skip to content

Instantly share code, notes, and snippets.

@michaelt michaelt/html.hs forked from LnL7/html.hs
Created Jul 28, 2012

Embed
What would you like to do?
module HTML where
class Tag a where
toHTML :: a -> String
data Attribute = Attribute {
key :: String,
value :: String
} deriving Show
instance Tag Attribute where
toHTML (Attribute {key=key, value=val}) = key ++ "=\"" ++ val ++ "\""
instance Tag [Attribute] where
toHTML (attr : attrs) = " " ++ toHTML attr ++ toHTML attrs
toHTML [] = ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.