Skip to content

Instantly share code, notes, and snippets.

@ostronom
Created April 17, 2011 21:04
Show Gist options
  • Select an option

  • Save ostronom/924468 to your computer and use it in GitHub Desktop.

Select an option

Save ostronom/924468 to your computer and use it in GitHub Desktop.
module Views where
import Control.Monad
import Happstack.Server (ServerPart, Response, ok, toResponse, dir)
import Text.Blaze ((!))
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
routes = msum [ dir "smth" $ notok
, index
]
mainTpl :: H.Html
mainTpl =
H.docTypeHtml $ do
H.head $ do
H.title "A"
H.body $ do
H.p "OK!"
index :: ServerPart Response
index = ok $ toResponse $ mainTpl
notok :: ServerPart Response
notok = ok $ toResponse "NOT OK!"
Views.hs:26:14:
No instance for (Happstack.Server.Response.ToMessage H.Html)
arising from a use of `toResponse'
Possible fix:
add an instance declaration for
(Happstack.Server.Response.ToMessage H.Html)
In the expression: toResponse
In the second argument of `($)', namely `toResponse $ mainTpl'
In the expression: ok $ toResponse $ mainTpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment