[Haskell-cafe] problems with derive/TH

Thomas Hartman tphyahoo at gmail.com
Fri May 23 11:11:21 EDT 2008


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 at thartman-laptop:~/mud>cat _darcs/prefs/defaultrepo
http://cdsmith.twu.net/demos/mud

thartman at thartman-laptop:~/mud>ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.2


thartman at 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))


More information about the Haskell-Cafe mailing list