[GHC] #1133: auto-derivation of Enum is disallowed with recursive imports

GHC trac at galois.com
Fri Mar 16 10:28:15 EDT 2007


#1133: auto-derivation of Enum is disallowed with recursive imports
----------------------+-----------------------------------------------------
 Reporter:  heatsink  |          Owner:  simonpj
     Type:  bug       |         Status:  new    
 Priority:  lowest    |      Milestone:  _|_    
Component:  Compiler  |        Version:  6.6    
 Severity:  normal    |     Resolution:         
 Keywords:            |     Difficulty:  Unknown
 Testcase:            |   Architecture:  Unknown
       Os:  Unknown   |  
----------------------+-----------------------------------------------------
Changes (by simonpj):

  * milestone:  6.6.1 => _|_
  * priority:  normal => lowest

Comment:

 The error message is certainly misleading. It now says:
 {{{
     Can't make a derived instance of `Enum X'
       (even with cunning newtype deriving:
        the newtype may be recursive)
     In the newtype declaration for `X'
 }}}
 The problem is this.  Generally, the "newtype deriving" mechanism is
 cautious about recursive newtypes.  Consider
 {{{
 newtype A = MkA [A]
 }}}
 We do not want to generate the instance
 {{{
 instance Eq [A] => Eq A
 }}}
 In this case the newtype patently isn't recursive; but in that case why is
 it being declared in a hs-boot file?  Generally GHC treats all hs-boot
 file types as recursive, because generally it can't see their definitions.

 The whole deal about recursive types is an unsatisfactory aspect of GHC.
 I'm going to treat this one as fixed for 6.6.1 (via the error message
 improvement).  But I'll leave it open at low priority for later versions.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1133>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list