1. 18 Jun, 2016 1 commit
    • Ryan Scott's avatar
      Refactor derived Generic instances to reduce allocations · 9649fc0a
      Ryan Scott authored
      Previously, derived implementations of `to`/`from` in `Generic`
      instances were wastefully putting extra `M1`s in every case, which led
      to an O(n) increase in the number of coercions, resulting in a slowdown
      during the typechecker phase.
      
      This factors out the common `M1` in every case of a `to`/`from`
      definition so that the typechecker has far fewer coercions to deal with.
      For a datatype with 300 constructors, this change has been observed to
      save almost 3 seconds of compilation time.
      
      This is one step towards coming up with a solution for #5642.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin, simonpj, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: basvandijk, carter, thomie, osa1
      
      Differential Revision: https://phabricator.haskell.org/D2304
      
      GHC Trac Issues: #5642
      9649fc0a
  2. 21 Dec, 2015 1 commit
    • Ryan Scott's avatar
      Encode strictness in GHC generics metadata · ee6fba89
      Ryan Scott authored
      This augments `MetaSel` with a `Bang` field, which gives generic
      programmers access to the following information about each field
      selector:
      
      * `SourceUnpackedness`: whether a field was marked `{-# NOUNPACK #-}`,
        `{-# UNPACK #-}`, or not
      * `SourceStrictness`: whether a field was given a strictness (`!`) or
        laziness (`~`) annotation
      * `DecidedStrictness`: what strictness GHC infers for a field during
        compilation, which may be influenced by optimization levels,
        `-XStrictData`, `-funbox-strict-fields`, etc.
      
      Unlike in Phab:D1603, generics does not grant a programmer the ability
      to "splice" in metadata, so there is no issue including
      `DecidedStrictness` with `Bang` (whereas in Template Haskell, it had to
      be split off).
      
      One consequence of this is that `MetaNoSel` had to be removed, since it
      became redundant. The `NoSelector` empty data type was also removed for
      similar reasons.
      
      Fixes #10716.
      
      Test Plan: ./validate
      
      Reviewers: dreixel, goldfire, kosmikus, aust...
      ee6fba89
  3. 07 Dec, 2015 1 commit
  4. 24 Sep, 2015 1 commit
    • Ömer Sinan Ağacan's avatar
      Fix DeriveGeneric for types with same OccName (#10487) · b08a533d
      Ömer Sinan Ağacan authored
      Summary:
      DeriveGeneric generates some data types (for data type constructors and for
      selectors of those constructors) and instances for those types. This patch
      changes name generation for these new types to make it working with data types
      with same names imported from different modules and with data types with same
      names imported from same modules(using module imports).
      
      Bonus content:
      
      - Some refactoring in `TcGenGenerics.metaTyConsToDerivStuff` to remove some
        redundant partial function applications and to remove a duplicated function.
      - Remove some unused names from `OccName`. (those were used for an old
        implementation of `DeriveGeneric`)
      
      Reviewers: kosmikus, simonpj, dreixel, ezyang, bgamari, austin
      
      Reviewed By: bgamari, austin
      
      Subscribers: ezyang, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1081
      
      GHC Trac Issues: #10487
      b08a533d
  5. 05 Feb, 2015 1 commit
  6. 21 Apr, 2013 1 commit
  7. 07 Jan, 2013 1 commit
  8. 21 Jun, 2012 1 commit
  9. 04 Jan, 2012 2 commits
  10. 16 Nov, 2011 1 commit
  11. 04 Nov, 2011 1 commit
  12. 07 Oct, 2011 1 commit