
Haskellers/Chris, As part of my quest to better understand STM and eventually build a concurrent haskell server app, I checked out an embryonic haskell mud demo from Chris Smith's repo. It seemed like a great sample app. But I ran into a build issue that seems to have to do with derive/TH. I am assuming this used to work, but something changed, either in TH itself or switching from ghc6.6 to ghc6.8. From the error message (below) I surmise either a) M.Map based values used to automagically work with derive/TH, but no longer do... in which case I need to create this instance manually or b) this should still work, more or less... but I have to import the map instance via an additional module, or something like that. Any advice? Thomas. ***** This is the error I am getting: thartman@thartman-laptop:~/mud>cat _darcs/prefs/defaultrepo http://cdsmith.twu.net/demos/mud thartman@thartman-laptop:~/mud>ghc --version The Glorious Glasgow Haskell Compilation System, version 6.8.2 thartman@thartman-laptop:~/mud>runghc Setup.lhs configure; runghc Setup.lhs build Configuring mud-0.1... Preprocessing executables for mud-0.1... Building mud-0.1... [2 of 5] Compiling World ( World.hs, dist/build/mud/mud-tmp/World.o ) World.hs:42:0: No instances for (Eq (a (M.Map String Player)), Eq (a (M.Map ItemId Item)), Eq (a (M.Map PlayerId Player)), Eq (a (M.Map RoomId Room)), Eq (a RoomId)) arising from the 'deriving' clause of a data type declaration at World.hs:(42,0)-(50,14) Possible fix: add an instance declaration for (Eq (a (M.Map String Player)), Eq (a (M.Map ItemId Item)), Eq (a (M.Map PlayerId Player)), Eq (a (M.Map RoomId Room)), Eq (a RoomId)) When deriving the instance for (Eq (World a))

On Sat, May 24, 2008 at 1:11 AM, Thomas Hartman
World.hs:42:0: No instances for (Eq (a (M.Map String Player)), Eq (a (M.Map ItemId Item)), Eq (a (M.Map PlayerId Player)), Eq (a (M.Map RoomId Room)), Eq (a RoomId)) arising from the 'deriving' clause of a data type declaration at World.hs:(42,0)-(50,14) Possible fix: add an instance declaration for (Eq (a (M.Map String Player)), Eq (a (M.Map ItemId Item)), Eq (a (M.Map PlayerId Player)), Eq (a (M.Map RoomId Room)), Eq (a RoomId)) When deriving the instance for (Eq (World a))
This error looks suspicious: notice that "a" in a type-constructor position. My guess is that you're accidentally using World's type parameter in a strange way. Perhaps you should double-check that your types and constructor definitions are using parentheses appropriately. Stuart

On Fri, May 23, 2008 at 5:11 PM, Thomas Hartman
I am assuming this used to work, but something changed, either in TH itself or switching from ghc6.6 to ghc6.8.
The "deriving" rules of 6.8 are more restrictive in some cases. However, the same result can be obtained in 6.8 byt using stand-alone deriving declarations: http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#stand-... I guess this can be the problem.

adding OPTIONS -XStandaloneDeriving made no difference
The following patch fixed the problem. (Well, at least the mud program
compiles. I haven't actually tried using it yet.)
thartman@thartman-laptop:~/mud>darcs whatsnew
{
hunk ./World.hs 50
- deriving Eq
+ -- deriving Eq
+
+instance Eq (World TVar) where
+ World a1 a2 a3 a4 a5 a6 a7 a8 == World b1 b2 b3 b4 b5 b6 b7 b8 =
+ a1 == b1 && a2 == b2 && a3 == b3 && a4 == b4 && a5 == b5 && a6
== b6 && a7 == b7 && a8 == b8
hunk ./World.hs 202
+
+
hunk ./mud.cabal 9
- network, unix, template-haskell
+ network, unix, template-haskell, containers, bytestring
}
thartman@thartman-laptop:~/mud>darcs commit
I'm posting a patch here because when I darcs pushed I got
darcs: Pushing to http URLs is not supported.
You may be able to hack this to work using DARCS_APPLY_HTTP
still very new to darcs. is there something else I should have done?
Thanks to the cafe, as always!
thomas.
2008/5/23 Alfonso Acosta
On Fri, May 23, 2008 at 5:11 PM, Thomas Hartman
wrote: I am assuming this used to work, but something changed, either in TH itself or switching from ghc6.6 to ghc6.8.
The "deriving" rules of 6.8 are more restrictive in some cases. However, the same result can be obtained in 6.8 byt using stand-alone deriving declarations:
http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#stand-...
I guess this can be the problem.

Hello Thomas, Friday, May 23, 2008, 11:29:44 PM, you wrote:
darcs: Pushing to http URLs is not supported.
of course. http is read-only media :) you have to send patches via email (in most cases). read darcs docs -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

| World.hs:42:0: | No instances for (Eq (a (M.Map String Player)), | Eq (a (M.Map ItemId Item)), | Eq (a (M.Map PlayerId Player)), | Eq (a (M.Map RoomId Room)), | Eq (a RoomId)) | arising from the 'deriving' clause of a data type declaration | at World.hs:(42,0)-(50,14) Yes, automatic 'deriving' in GHC became a little more restrictive in GHC 6.8 (I think), for very good reasons. I think that's what your problem is. The darcs repo http://cdsmith.twu.net/demos/mud seems to be offline today, so I can't look, but I think that's highly likely. The solution is invariably to add a manual instance declaration, as you have done in your subsequent message. Simon
participants (5)
-
Alfonso Acosta
-
Bulat Ziganshin
-
Simon Peyton-Jones
-
Stuart Cook
-
Thomas Hartman