Skip to content
  • Simon Peyton Jones's avatar
    Re-implement unsafe coercions in terms of unsafe equality proofs · 74ad75e8
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    (Commit message written by Omer, most of the code is written by Simon
    and Richard)
    
    See Note [Implementing unsafeCoerce] for how unsafe equality proofs and
    the new unsafeCoerce# are implemented.
    
    New notes added:
    
    - [Checking for levity polymorphism] in CoreLint.hs
    - [Implementing unsafeCoerce] in base/Unsafe/Coerce.hs
    - [Patching magic definitions] in Desugar.hs
    - [Wiring in unsafeCoerce#] in Desugar.hs
    
    Only breaking change in this patch is unsafeCoerce# is not exported from
    GHC.Exts, instead of GHC.Prim.
    
    Fixes #17443
    Fixes #16893
    
    NoFib
    -----
    
    --------------------------------------------------------------------------------
            Program           Size    Allocs    Instrs     Reads    Writes
    --------------------------------------------------------------------------------
                 CS          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                CSD          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                 FS          -...
    74ad75e8