module Yesod.Lucid where
import Control.Monad.Identity
import Data.Text (Text)
import Lucid
import Yesod.Core (ToTypedContent, MonadHandler, ToContent, Route,
HandlerSite, HasContentType(..))
import qualified Yesod.Core as Y
type LucidHtml = Html ()
type LucidGen a = (Route a -> Text) -> LucidHtml
lucid :: MonadHandler m => LucidGen (HandlerSite m) -> m LucidHtml
lucid cont = fmap cont Y.getUrlRender
instance ToTypedContent (Html ()) where
toTypedContent m = Y.TypedContent (getContentType (Just m)) (Y.toContent m)
instance ToContent (Html ()) where
toContent html = Y.ContentBuilder (runIdentity (execHtmlT html)) Nothing
instance HasContentType (Html ()) where
getContentType _ = "text/html"