Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the TH machinery handle PolyKinds more robustly #945

Merged
merged 1 commit into from
Dec 14, 2020
Merged

Commits on Dec 10, 2020

  1. Make the TH machinery handle PolyKinds more robustly

    This is a collection of various Template Haskell–related fixes that, when all
    put together, fixes #917. This does the following:
    
    * Rather than use `th-abstraction`'s `datatypeType` function, which strips off
      important kind information from type arguments, I defined a similar
      `datatypeTypeKinded` function that preserves kinds when reasonable.
    * `Control.Lens.Internal.{FieldTH,PrismTH}` is now more careful to use
      `freeVariablesWellScoped` (from `th-abstraction`) instead of `typeVars`
      to ensure that the resulting types are well scoped. This is particularly
      important for poly-kinded types, as the kind variables must always appear
      before the type variables.
    * I deleted the `close` function from `Control.Lens.Internal.PrismTH` in favor
      of `quantifyType` and `quantifyType'`, which I have moved to
      `Control.Lens.Internal.TH` so that they may be used by `FieldTH` and
      `PrismTH` alike. Moreover, I now use `quantifyType'` in the definition of
      `PrismTH.makeClassyPrismClass` so that any type variables bound by the class
      itself do not get requantified in any class methods. The previous code was
      not doing this at all, which was just plain wrong.
    RyanGlScott committed Dec 10, 2020
    Configuration menu
    Copy the full SHA
    c9eec67 View commit details
    Browse the repository at this point in the history