Skip to content

GitLab

  • Menu
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 4,977
    • Issues 4,977
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 482
    • Merge requests 482
  • 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 Compiler
  • GHCGHC
  • Merge requests
  • !5640

Visible type application and data constructors

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Simon Peyton Jones requested to merge wip/T18481 into master Apr 30, 2021
  • Overview 52
  • Commits 1
  • Pipelines 8
  • Changes 29

There are two patches here

One fixes #19768 (closed). There was nothing difficult here, although it touches a lot of files.

The second fixes #18481 (closed) and #19775 (closed), plus refactors HsConLikeOut so that it doesn't pollute Language.Haskell.Syntax.

    Allow visible type application for levity-poly data cons
    
    This patch was driven by #18481, to allow visible type application
    for levity-polymorphic newtypes. As so often, it started simple
    but grew:
    
    * Significant refactor: I removed HsConLikeOut from the
      client-independent Language.Haskell.Syntax.Expr, and put it where it
      belongs, as a new constructor `ConLikeTc` in the GHC-specific extension
      data type for expressions, `GHC.Hs.Expr.XXExprGhcTc`.
    
      That changed touched a lot of files in a very superficial way.
    
    * Note [Typechecking data constructors] explains the main payload.
      The eta-expansion part is no longer done by the typechecker, but
      instead deferred to the desugarer, via `ConLikeTc`
    
    * A little side benefit is that I was able to restore VTA for
      data types with a "stupid theta": #19775.  Not very important,
      but the code in GHC.Tc.Gen.Head.tcInferDataCon is is much, much
      more elegant now.
    
    * I had to refactor the levity-polymorphism checking code in
      GHC.HsToCore.Expr, see
         Note [Checking for levity-polymorphic functions]
         Note [Checking levity-polymorphic data constructors]
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: wip/T18481