[GHC] #13328: Foldable, Functor, and Traversable deriving handle phantom types badly
GHC
ghc-devs at haskell.org
Tue Mar 7 01:32:21 UTC 2017
#13328: Foldable, Functor, and Traversable deriving handle phantom types badly
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.4.1
Component: Compiler | Version: 8.1
Resolution: | Keywords: deriving-perf
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
> The question about `fmap` strictness looks like a red herring to me.
There's no real difference between the empty case definition and the
`coerce` definition.
Sure, I just wanted to note the "conflict".
> The illegitimate `fmap` is of very little interest to me. Someone who
cares about preserving their map count or whatever just won't be able to
use `Functor` deriving for types explicitly mentioning their bogus one.
That's also fine, just make sure we note this if this gets implemented.
Luckily, `Functor`/`Foldable`/`Traversable` happen to be pretty rigid,
law-abiding classes, so this restriction won't really hurt anyone in
practice.
What is your opinion on the `RoleAnnotations` example above? This is the
only thing that genuinely concerns me, since I think having the strictness
of a derived `Foldable` instance change depending on whether a type
parameter is phantom or non-phantom is quite unintuitive. I'm not sure of
a good workaround, however.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13328#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list