data Url = Home | Img renderUrl' Home = "http://localhost/" renderUrl' Img = "http://localhost/image.png" data Obj = Obj { foo :: Url , bar :: IO String } main = myTemp renderUrl' $ Obj Img (return "some bar value") myTemp renderUrl obj = do putStr "Foo Bar Baz

Hello World

Bar Baz
Plain Content" bar obj >>= putStr putStr "
"