[Haskell-cafe] The weirdest error I've ever seen...

Joe Fredette jfredett at gmail.com
Thu Nov 12 04:00:04 EST 2009


Hiya Haskellers,

	So there I was, punching away at the keys, working on the Haskell  
Weekly News tools when the solution to one of my problems fell on me  
like a ton of lambdas. The solution and problem it solved are  
immaterial, but suffice to say it involved the combination of  
associated types and monad transformers, as well as some fancy  
deriving to end up with this code:

#####

type Context = ReaderT Email
type Match t = StateT t IO
type ContextMatch t a = Context (Match t) a

newtype FilterState t => Filter t a = Filter (ContextMatch t a)
        deriving (Functor, Monad, MonadReader Email, MonadState Bool,  
MonadIO)

class FilterState t where
         data FState t
         deliver :: FState t -> IO ()

#####

Again, the fine details are unimportant, but the punchline is `Filter`  
is a Monad which houses not only results, but also an internal state  
which will be used in the delivery of emails in some yet-to-be- 
determined way. Naturally, I want to use `deriving` to turn this puppy  
into a monad over it's second argument. In fact, the whole thing kind- 
checks  alright, but presents me with this, the titular 'weirdest  
error I've ever seen...'

#####

[1 of 3] Compiling Network.HackMail.Email.ParseEmail ( Network/ 
HackMail/Email/ParseEmail.hs, interpreted )
[2 of 3] Compiling Network.HackMail.Email.Email ( Network/HackMail/ 
Email/Email.hs, interpreted )
[3 of 3] Compiling Network.HackMail.Filter.Filter ( Network/HackMail/ 
Filter/Filter.hs, interpreted )
*** Exception: No match in record selector Var.tcTyVarDetails

#####

Now, there are three tickets open on the GHC trac, found for me by the  
ever-helpful `copumpkin` on #haskell -- because I didn't think to look  
-- they are numbers 3621, 3422 and 2714. But none of them are  
sufficiently close to my case for them to make sense to me, nor are  
the solutions presented suitable for entry into my feeble noggin.  
(Thats just a purty way of saying I'm not smart enough to understand  
what any of it means...) So I beseech my fellow Haskellers[1], What  
the heck did I do to anger the Var.tcTyVarDetail gods?

My guess (given what I can glean from the Trac entries) is that the  
`deriving ... MonadState ...` needs changing in some specific-yet- 
cryptic way, but I've only got my gut to go on...


For the Record, and in the event it matters...

	[jfredett at Erdos]$ ghc --version
	The Glorious Glasgow Haskell Compilation System, version 6.10.4
  	[jfredett at Erdos]$ uname -a
	Linux Erdos 2.6.31-ARCH #1 SMP PREEMPT Fri Oct 23 11:12:58 CEST 2009  
i686 Intel(R) Celeron(R) CPU 3.06GHz GenuineIntel GNU/Linux


Thanks in advance for any help offered.

  /Joe

[1] Bet you've never been beseeched before... 


More information about the Haskell-Cafe mailing list