module Factis.Haskoon.WebHsp
(HSPT, XML, Child, asChild, genElement, genEElement, asAttr, Attr((:=))
,webHspHtml, webToHsp
)
where
import Control.Monad.Trans (lift)
import qualified Data.ByteString.Lazy.UTF8 as BSLU
import qualified HSP
import HSP (HSPT, XML)
import HSX.XMLGenerator (Child,asChild,genElement,genEElement,asAttr,Attr((:=)))
import Factis.Haskoon.Web (Web, WebRes, WebIO, webSendBSL, webSetHeader)
webToHsp :: Web m => m a -> HSPT m a
webToHsp = lift . lift
webHspHtml :: WebIO m => HSPT m XML -> m (WebRes m)
webHspHtml page =
do let env = undefined
(_, xml) <- HSP.runHSPT HSP.html4Strict page env
webSetHeader "Content-Type" "text/html; charset=UTF-8"
webSendBSL (BSLU.fromString (HSP.renderAsHTML xml))