• 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, austin, hvr, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1646
    
    GHC Trac Issues: #10716
    ee6fba89
TcGenGenerics.hs 34.4 KB