[Haskell-cafe] How to ensure optimization for large immutable vectors to be shared w.r.t. Referential Transparency
Henning Thielemann
lemming at henning-thielemann.de
Tue Apr 6 12:00:07 UTC 2021
On Tue, 6 Apr 2021, YueCompl via Haskell-Cafe wrote:
> In an attempt to determine whether two immutable vectors can be treated
> as the same one to enable specific optimizations for that case, I tried
> to use ST to determine their respective backing foreign ptrs for
> comparison. But appears it can be copied when wrapped in a newtype, I
> wonder why it is the case, and how to avoid the copy?
You compare the ForeignPtrs of the mutable vectors. What about comparing
the ForeignPtrs of the original immutable vectors?
More information about the ghc-devs
mailing list