Foldable, Functor, and Traversable deriving handle phantom types badly
Suppose we have
data Phantom a = Z | S (Phantom a)
We'd like to get something like
foldMap _ _ = mempty
fmap = coerce
traverse _ m = pure (coerce m)
But instead we actually pattern match all the way down! Basically, we want to treat "has a phantom role" and "does not occur" similarly.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | RyanGlScott |
| Operating system | |
| Architecture |