[GHC] #12367: Commit adding instances to GHC.Generics regression compiler performance

GHC ghc-devs at haskell.org
Mon Jul 11 14:20:15 UTC 2016


#12367: Commit adding instances to GHC.Generics regression compiler performance
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  bgamari
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.0.2
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 It turns out that the problem is actually a fair bit worse than described
 above. While `Foldable` imports `GHC.Generics` in order to provide
 instances for types in the latter (which should be fairly easy to fix with
 some reorganization), the other modules import `GHC.Generics merely to
 derive `Generic` instances for types they themselves define. One example
 of this is `Data.Monoid`, which defines a number of `newtype`s resembling,
 {{{#!hs
 newtype All = All { getAll :: Bool }
         deriving (Eq, Ord, Read, Show, Bounded, Generic)
 }}}

 It seems to me like we may want to consider moving the data types defined
 in `GHC.Generics` to a new `GHC.Generic.Internal` module. They could then
 be re-exported in `GHC.Generics`, which could also derive instances for
 these types. This would also allow us to move the `Foldable` instances for
 the generics types to `GHC.Generics`, since the latter could likely import
 `Data.Foldable` without fear of cycles.

 Really, though, this arguably leaves a large portion of the problem
 unsolved: users who use `GHC.Generics` (which is increasingly popular)
 still need to pay the full cost of importing it.

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


More information about the ghc-tickets mailing list