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 582
    • Merge requests 582
  • 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
  • #15898
Closed
Open
Issue created Nov 15, 2018 by Simon Peyton Jones@simonpjDeveloper

Promoted type constructors don't print right in HsType

Consider this

ghci> import Data.Proxy
ghci> undefined :: '() -> Int

<interactive>:11:14: error:
    • Expected a type, but ‘ '()’ has kind ‘()’
    • In an expression type signature:  '() -> Int

What is that strange space doing before the '()?

Similarly

undefined :: Proxy '() Int

<interactive>:12:14: error:
    • Expected kind ‘* -> *’, but ‘Proxy  '()’ has kind ‘*’
    • In an expression type signature: Proxy  '() Int

Again, the strange space.

It comes from the HsType pretty printer, which is worried about printing the type

     '['K]

That is, a promoted list with one element K. The trouble is that looks like a character literal '['.

So we add an extra space, thus '[ 'K]. ''But we add it before every promoded data constructor!" Hence the spurious spaces.

In IfaceType exactly the same thing happens, but we are more clever, and only print the leading space if the promoted data con immediately follows '[ or '(. We should do the same thing for HsType.

Trac metadata
Trac field Value
Version 8.6.2
Type Bug
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