I had downloaded and was experimenting with a simple Happstack based pastebin a while ago, and was making reasonable progress in figuring out Happstack and how to go about handling various situations. I hadn't touched the code in a while and decided I wanted to eperiment with it last night, so I made a few tweaks and attempted to re-compile it. Now, I'm finding that neither my modified version, nor the original version I downloaded will compile, as they complain about not being able to find an instance of MonadIO for (ServerPartT IO). I also tried writing up a trivial server based on the documentation provided by Happstack itself, and that also fails to compile complaining about no instance found for MonadIO (ServerPartT IO). Specifically the error seems to be triggered by the use of liftIO anywhere inside a ServerPartT monad.

Looking at the source code for happstack-server, I can see in Happstack.Server.SimpleHTTP that the GeneralizedNewtypeDeriving pragma is set, and that in the newtype for ServerPartT it has deriving MonadIO. Why can't ghc seem to find the MonadIO instance for ServerPartT, when ServerPartT is declared as deriving it?

It also seems strange that this just started happening recently. I've upgraded a number of packages recently, but I can't say for sure what I changed since the last time I was able to compile something based on happstack successfully. Is it possible that some change with mtl or some other package is causing this error?

Near as I can tell, this is occurring in happstack-server-0.4.1, although since I'm away from my personal computer right now I can't provide the versions for any of the other packages. If anyone would like further details I can provide them late tonight when I get home, but till then the best I can do is provide the source of one of the programs I attempted to compile (hosted interestingly enough by a later build of the same code): http://tenletters.org/1

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.