#3621: "No match in record selector Var.tcTyVarDetails" with incorrect multi-
parameter newtype derivation
-------------------------------------------+--------------------------------
    Reporter:  pwb                         |        Owner:                  
        Type:  bug                         |       Status:  closed          
    Priority:  normal                      |    Milestone:                  
   Component:  Compiler                    |      Version:  6.10.4          
    Severity:  minor                       |   Resolution:  fixed           
    Keywords:                              |   Difficulty:  Unknown         
    Testcase:  deriving/should_fail/T3621  |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple            |  
-------------------------------------------+--------------------------------
Changes (by simonpj):

  * testcase:  => deriving/should_fail/T3621
  * difficulty:  => Unknown
  * status:  new => closed
  * resolution:  => fixed

Comment:

 Actually it shouldn't be rejected.  For example
 {{{
 class C a b
 data S = MkS
 instance C a S
 newtype T = MkT S deriving( C a )
 }}}
 Here, the derived instance declaration looks like
 {{{
 instance C a T
 }}}
 which is fine, although 'a' is not a parameter of T.

 However the compiler should not crash.  And, happily, here's what the HEAD
 says (and hence 6.12):
 {{{
 T3621.hs:11:21:
     Couldn't match expected type `state' against inferred type `s'
       `state' is a rigid type variable bound by
               the instance declaration at T3621.hs:11:32
       `s' is a rigid type variable bound by
           the instance declaration at T3621.hs:10:21
     When using functional dependencies to combine
       MonadState s (State s),
         arising from the dependency `m -> s'
         in the instance declaration at T3621.hs:8:9
       MonadState state (State s),
         arising from the instance declaration at T3621.hs:11:21-36
     When checking the super-classes of an instance declaration
     In the instance declaration for `MonadState state (WrappedState s)'
 }}}
 Which seems plausible.

 I'll add your program to our regression tests though.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3621#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to