Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.5k
    • Issues 5.5k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 638
    • Merge requests 638
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Analytics
    • Analytics
    • 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
  • #5712

Can't define constructors to be infix (as far as Show is concerned) with GADT syntax

Okay so, if you define a data type like this:

data Two a = a :. a deriving Show

then show (1 :. 2) == "1 :. 2". On the other hand, if you define the data type like so:

data Two a = (:.) a a deriving Show

then `show (1 :. 2) == "(:.) 1 2".

This kind of makes sense since how the constructor is defined by the user gives some hint as to how it should be used. The only problem is you can't give that hint if you're using GADT syntax, since then constructors are given without explicit arguments.

I don't see an easy way to let you give that hint, but I think it would be reasonable to just guess that any constructor with a symbol name (i.e. one starting with :\) should be considered infix.

Trac metadata
Trac field Value
Version 7.3
Type FeatureRequest
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