
#9790: Produce coercion rules for derived Functor instances -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.9 Component: Compiler | Keywords: coercion Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Runtime | Related Tickets: performance bug | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): Ah -- I missed the word "derive". But, unfortunately, this still doesn't pan out in all cases: {{{ data BadFunctor a = MkBF a a deriving Show instance Functor BadFunctor where fmap f (MkBF x _) = MkBF (f x) (f x) data Wrapped f a = MkW (f a) deriving (Functor, Show) }}} `Wrapped` has a derived `Functor` instance, and yet `fmap id (MkW (MkBF True False))` is not the same as `id (MkW (MkBF True False))`. I do think your idea is sound as long as the derived `Functor` instance has no constraints. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9790#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler