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,249
    • Issues 5,249
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 578
    • Merge requests 578
  • 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
  • #13364
Closed
Open
Issue created Mar 02, 2017 by Richard Eisenberg@raeDeveloper

Remove checkValidTelescope

All of this new TypeInType nonsense has provided a number of ways that we can arrive at ill-scoped kinds. Let's assume we have

data SameKind :: k -> k -> Type

and then here are three subtly ill-scoped kinds:

forall a (b :: a) (c :: Proxy d). SameKind b d
forall a. forall (b :: a). forall (c :: Proxy d). SameKind b d
forall d. forall a (b :: a). SameKind b d

Despite the close similarity between these cases, they are all handled separately. See Note [Bad telescopes] in !TcValidity for an overview, but these are spread between tcImplicitTKBndrsX, tcExplicitTKBndrsX, and those functions' calls to checkValidTelescope, checkZonkValidTelescope, and checkValidInferredKinds.

While I am unaware of a concrete bug this all causes, it's a mess.

Better would be to use the existing machinery to prevent skolem-escape: TcLevels and implication constraints. Specifically, it's quite plausible that all this can be avoided by a simple rule: bump the TcLevel (and create an implication constraint) for every new type variable brought into scope (including implicitly). (Actually, implicit variables have an implicit ordering that GHC is free to decide, so all implicitly bound variables should be brought into scope at once, with just one bump in the TcLevel.)

It might all just work! And then we can delete gobs of hairy code. Hooray!

Trac metadata
Trac field Value
Version 8.0.1
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking