#4816: DeriveFunctor should not require a functor instance for functorial data
types used invariantly
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  6.12.3            |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 This program:

 {{{
 {-# LANGUAGE DeriveFunctor #-}
 data Silly a = Sillly a

 data Baz o = Baz {
     foo :: o,
     bar :: Silly ()
   } deriving (Functor)
 }}}

 Produces this error:

 {{{
 /Users/mbolingbroke/Junk/Repro2.hs:7:14:
     No instance for (Functor Silly)
       arising from the 'deriving' clause of a data type declaration
                    at /Users/mbolingbroke/Junk/Repro2.hs:7:14-20
     Possible fix:
       add an instance declaration for (Functor Silly)
       or use a standalone 'deriving instance' declaration instead,
          so you can specify the instance context yourself
     When deriving the instance for (Functor Baz)
 }}}

 But there is absolutely no need for such an instance, because I'm not
 using "Silly a", just "Silly ()".

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4816>
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