
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.

On Apr 20, 2010, at 9:02 AM, Kyle Murphy wrote:
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?
I am guessing that some of the libraries you depend on are compiled against one version of mtl, and some are compiled against another version. This is not an error in itself. However, you will run into issues similar to what you have described when GHC tries to use version of MonadIO from different versions of the mtl library. Does "ghc-pkg describe mtl" show more than one version of mtl installed? What happens if you try to unregister the older version? This seems like an issues with the state of your installed system, and not something happstack specific.. - jeremy

I fixed the issue by installing GHC 6.12, and the latest version of
haskell-platform. It worries me that when building against two different
versions of the same library ghc more or less fails silently. Near as I can
tell, it attempts to link against a new version of mtl, records the symbol
for MonadIO, then links in happstack, notices that there's no definition for
the MonadIO symbol referenced in happstack, and silently ignore the class
instance defined in happstack. This seems depressingly non-deterministic,
and makes me wonder how hard it would be to create some sort of check when
linking to see if two libraries define/reference different classes that have
the same name and at least print some sort of warning about it. The fact
that mtl defines MonadIO, but a different version than is referenced in
happstack should have been enough to at least generate a warning. Of course,
for all I know there is an option for GHC that provides such a warning, but
I've no idea what it is and it probably should be enabled by default anyway.
At this point I think anything remotely web-devel related has been covered,
so I think I'll take further discussion of this apparent disconnect between
class versions to either the #haskell channel, or maybe the haskell-cafe
mailing list.
-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.
On Tue, Apr 20, 2010 at 15:24, Jeremy Shaw
On Apr 20, 2010, at 9:02 AM, Kyle Murphy wrote:
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?
I am guessing that some of the libraries you depend on are compiled against one version of mtl, and some are compiled against another version. This is not an error in itself. However, you will run into issues similar to what you have described when GHC tries to use version of MonadIO from different versions of the mtl library.
Does "ghc-pkg describe mtl" show more than one version of mtl installed? What happens if you try to unregister the older version?
This seems like an issues with the state of your installed system, and not something happstack specific..
- jeremy
participants (2)
-
Jeremy Shaw
-
Kyle Murphy