Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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,842
    • Issues 4,842
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17643

Closed
Open
Created Jan 06, 2020 by Ryan Scott@RyanGlScottMaintainer

-ddump-simpl prints type applications with trailing whitespace

If you compile the following code with -ddump-simpl enabled:

{-# LANGUAGE TypeApplications #-}

true :: Bool
true = id @Bool True

You'll get something like this:

-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
true :: Bool
true = id @ Bool True

There's one key difference between the original code and the dumped Core: the latter puts an extra space between the @ and Bool, whereas the former does not. This used to be just a minor curiosity, but now that GHC Proposal 229 is implemented, id @ Bool True is no longer code that will even parse correctly.

Granted, Core is not exactly the same as source Haskell, but the @ syntax in Core has enough similarities to source Haskell's TypeApplications that it seems reasonable that we should try to make the two notations coincide. In light of this, I propose that we change -ddump-simpl's pretty-printer to display true like this:

-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
true :: Bool
true = id @Bool True

That is, do not put any space between the @ and Bool, just as TypeApplications now requires. Does this sound like a reasonable suggestion?

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