[GHC] #13731: DeriveFunctor and friends don't understand type families
GHC
ghc-devs at haskell.org
Mon May 22 18:58:42 UTC 2017
#13731: DeriveFunctor and friends don't understand type families
-------------------------------------+-------------------------------------
Reporter: spacekitteh | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1-rc2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
That instance becomes writable if we mark `ExtensionType` injective
{{{#!hs
data Test :: Type -> Type -> Type where
Foo :: a -> Test ext a
Extend :: ExtensionType ext a -> Test ext a
type family ExtensionType a = (res :: Type -> Type) | res -> a
data ListExtension
type instance ExtensionType ListExtension = []
instance Functor (ExtensionType ext) => Functor (Test ext) where
fmap :: (a -> a') -> (Test ext a -> Test ext a')
fmap f = \case
Foo a -> Foo (f a)
Extend ex -> Extend (fmap f ex)
}}}
We need to bump the arity of `ExtensionType` down to one, given that we
don't have #10832.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13731#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list