
Including list.
---------- Forwarded message ----------
From: Antoine Latter
Hey Antoine,
thank you for answering. Your strategy is quite similar to the one I prefer. I misunderstood the behaviour of serveDirectory. The problem with external javascript files is solved. The other problem I had, was, that the argument 'msum' is a list, which has elements with the same type, so I needed a conversion from m [Char] to m Response. In Happstack.Server.Response there is a function, which actually does that: flatten:
module Main where
import Happstack.Server import Control.Monad
main :: IO () main = simpleHTTP nullConf $ msum [ flatten $ dir "ok" $ ok "jeahh!" , serveDirectory DisableBrowsing ["index.html"] "static" ]
I would likely write that particular example:
dir "ok" $ ok $ toResponse "jeahh!"
I find it convenient to convert to a 'Response' as close to the 'bottom' of the stack as possible. Antoine
participants (1)
-
Antoine Latter