[GHC] #13731: DeriveFunctor and friends don't understand type families
GHC
ghc-devs at haskell.org
Tue May 23 21:55:18 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 simonpj):
Consider the instance we want:
{{{
instance Functor (Test ListExtension) where
fmap f (Extend x) = Extend (fmap f x)
}}}
> Am I missing something?
From the inner `fmap` we get `[W] Functor (ExtensionType ListExtension)`.
If `ExtensionType` has arity 2, that would be an un-saturated type family.
But if it has arity 1 it is saturated, and reduces to `[]`, so all is
well.
> ... the field of `Extend` will have type `ExtensionType ListExtension
a`. This is a fully saturated type family application
Yes, it's saturated in the field, but the use of `fmap` requires us to
decompose the type application, we it must be decomposable. It's only
decomposable if `ExtensionType` has arity 1.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13731#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list