Skip to content

"No match in record selector Var.tcTyVarDetails" with incorrect multi-parameter newtype derivation

{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Monad.State
newtype WrappedState s a = WS { runWS :: State s a }
    deriving (Monad, MonadState state)

Note that the 'deriving' for MonadState has the wrong variable name. It should be rejected with something like "not in scope: type variable 'state'" but instead this happens:

[pwb@rhuidean tmp]$ ghc bug.hs 
ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.4 for x86_64-unknown-linux):
	No match in record selector Var.tcTyVarDetails
Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information