Question

I would like to start using Haskell to build web sites, and think that Happstack, Heist, and Web-routes would be a good combination.

Unfortunately, I cannot find working code. The crash course example does not compile.

I downloaded the TemplateHeist.hs file, and compiling it gives me these errors.

TemplatesHeist.hs:21:68:
    The function `emptyTemplateState' is applied to one argument,
    but its type `TemplateState m0' has none

TemplatesHeist.hs:27:5:
    No instance for (Happstack.Server.Response.ToMessage
                       happstack-server6.3.1:Happstack.Server.Internal.Types.Response)
      arising from a use of `simpleHTTP'

TemplatesHeist.hs:28:10:
     No instance for (happstack-server-6.3.1:Happstack.Server.Internal.Monads.ServerMonad
                       (Happstack.Server.Internal.Monads.ServerPartT IO))
      arising from a use of `templateServe'

I've gotten Happstack to work with Blaze, and with Web-routes. I must be missing something "obvious", but I'm not sure where to begin looking for it.

Was it helpful?

Solution

Heist is a great templating library and a pleasure to use. You are swimming against the current though using it with Happstack as it is far more commonly used with the Snap web framework.

Unless you have a particular reason for using Happstack, you will be better to look at Snap initially as you can be up and running with a sample Snap and Heist app by typing a single command once installed. Once you understand Heist, you could then set about using it with other web servers if you need to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top