[GHC] #13328: Foldable, Functor, and Traversable deriving handle phantom types badly

GHC ghc-devs at haskell.org
Thu Feb 23 23:06:27 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
           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:
-------------------------------------+-------------------------------------
 Suppose we have

 {{{#!hs
 data Phantom a = Z | S (Phantom a)
 }}}

 We'd like to get something like

 {{{#!hs
 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13328>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list