module LWN.Article where import XHTML newtype Title = Title { getTitle :: String } newtype Byline = Byline { getByline :: Maybe String } newtype BodyHtml = BodyHtml { getBodyHtml :: String } instance Show Title where show = getTitle instance Show Byline where show (Byline (Just bl)) = bl show (Byline Nothing ) = "" instance Show BodyHtml where show = getBodyHtml instance XHTML Title where to_xhtml (Title t) = "

" ++ t ++ "

" instance XHTML Byline where to_xhtml (Byline (Just bl)) = "

" ++ bl ++ "

" to_xhtml (Byline Nothing) = "" instance XHTML BodyHtml where to_xhtml = getBodyHtml data Article = Article { title :: Title, byline :: Byline, body_html :: BodyHtml } instance XHTML Article where to_xhtml (Article t bl b) = (to_xhtml t) ++ (to_xhtml bl) ++ (to_xhtml b)