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,244
    • Issues 5,244
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 568
    • Merge requests 568
  • 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
  • #22125
Closed
Open
Issue created Aug 29, 2022 by sheaf@sheafMaintainer

Record update in GHCi is confused by data family instances

:seti -XTypeFamilies -XDuplicateRecordFields
data family D a
data instance D Int  = MkD0 | MkDInt { x :: Int, y :: Bool }
data instance D Bool = MkDBool { x :: Int }
f r = r { y = True, x = 14 }
error:
    * Constructor `MkDInt' does not have field `x'
    * In the expression: r {y = True, x = 14}
      In an equation for `f': f r = r {y = True, x = 14}
  |
5 | f r = r { y = True, x = 14 }
  |       ^^^^^^^^^^^^^^^^^^^^^^

GHC can compile this program just fine, it's only in GHCi that we get this weird behaviour. I think this is due to data family instances not being correctly added to con_fields in GHC.Tc.Module.runTcInteractive. I will fix in !8686.

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