Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,253
    • Issues 5,253
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 562
    • Merge requests 562
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16630
Closed
Open
Issue created May 06, 2019 by Vladislav Zavialov@int-indexDeveloper

Pass separation for TyClDecl LHS and RHS

While implementing top-level kind signatures, I faced an issue related to scoped kind variables. Here's an example:

type T :: forall k. k -> Type
data T a = MkT (Proxy (a :: k))

When -XScopedTypeVariables are on, we want k in Proxy (a :: k) to refer to forall k. in the TLKS.

Now, do we rename the signature or the data declaration first?

  1. if we rename the declaration first, then k on its RHS won't be able to refer to k in the signature (k is not in scope)
  2. if we rename the signature first, then it will not be able to refer to the declaration LHS (T is not in scope)

We have the exact same issue in terms, where it is solved by doing renaming in three steps:

  1. rename the LHSs (rnValBindsLHS)
  2. rename the signatures (renameSigs)
  3. rename the RHSs (rnValBindsRHS)

In order to accommodate this design, HsValBinds and HsBind are parametrized by two separate passes:

data HsValBindsLR idL idR = ...
data HsBindLR idL idR = ...

On the other hand, renaming type/class declarations is done in one pass (rnTyClDecls), so TyClDecl is parametrized only by one pass:

data TyClDecl pass = ...

We should change this to:

data TyClDecl idL idR = ...

This is likely to be a fairly invasive change, so I'd rather do it independently from the TLKS implementation.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking