[GHC] #4185: Deriving higher-arity instances for newtype family instances fails

GHC cvs-ghc at haskell.org
Mon Apr 15 15:37:11 CEST 2013


#4185: Deriving higher-arity instances for newtype family instances fails
---------------------------------+------------------------------------------
    Reporter:  LouisWasserman    |       Owner:  simonpj         
        Type:  bug               |      Status:  new             
    Priority:  low               |   Milestone:  7.6.2           
   Component:  Compiler          |     Version:  6.12.3          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:                    |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by sjoerd_visscher):

 DeriveFunctor has the same problem:

 {{{
 data family D x :: * -> *
 data instance D () a = X a
   deriving Functor
 }}}

 gives

 {{{
     Derived instance `Functor (D ())'
       requires illegal partial application of data type family D
     In the data instance declaration for `D'
 }}}

 While implementing the instance by hand works fine:

 {{{
 instance Functor (D ()) where
   fmap f (X a) = X (f a)
 }}}

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



More information about the ghc-tickets mailing list