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,362
    • Issues 5,362
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 566
    • Merge requests 566
  • 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
  • #1401
Closed
Open
Issue created Jun 01, 2007 by g9ks157k@acme.softbase.org@trac-g9ks157k

otherwise ambiguous field names shouldn’t be treated as ambiguous when the data constructor is known

Consider these three module definitions:

module A where
    data A = A { label :: Char }
module B where
    data B = B { label :: Char }
module X where
    import A
    import B

    a = A { label = 'a' }

    b = B { label = 'b' }

    f (A { label = a }) (B { label = b }) = (a,b)

GHC currently treats all the occurences of label in module C as ambiguous thereby conforming to the Haskell 98 standard. However, in all these cases there is only one field to which label can refer since the data constructor is known. So it should be possible to let GHC treat the above code as legal by using a certain compiler option. This would make the use of Haskell 98 records much more comfortable in certain cases. Fields in different data types could be named equally if they denote similar concepts without forcing the user of the data types to qualify the field names over and over again.

Edited Mar 09, 2019 by Ian Lynagh <igloo@earth.li>
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking