Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 378
    • Merge Requests 378
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17443

Closed
Open
Opened Nov 06, 2019 by Simon Peyton Jones@simonpjDeveloper

Mechanism for hand-written, but not wired-in, Ids

We got into terrible trouble trying to make unsafeCoerce# into a wired-in Id. We needed to make unsafeEqualityProof and UnsafeEquality wired in -- and the lattter is a GADT which is hugely painful to wire in.

New idea. Implement

patchMagicDefns :: [(Name, DsM (Id, CoreExpr))]
                -> [(Id,CoreExpr)]
                -> DsM [(Id,CoreExpr)]

and use it in the desugarer, here

        ; (msgs, mb_res) <- initDs hsc_env tcg_env $
                       do { ds_ev_binds <- dsEvBinds ev_binds
                          ; core_prs <- dsTopLHsBinds binds_cvr
--->  here --->           ; core_prs <- patchMagicDefns magicDefns core_prs
                          ; (spec_prs, spec_rules) <- dsImpSpecs imp_specs

So now we could have

mmagicDefns :: [(Name, DsM (Id,CoreExpr))]
magicDefns
  [ ( unsafeCoerceName, do { unsafe_eq_proof <- dsLookupGlobal unsafeEqualityProofName
        ... )
  ]

The big thing is having access to dsLookupGlobal which means you don't need to wire in the trnansitive closure.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#17443