I'm doing a literature review about the use of pointers in functional languages and I came across the following comment in the GHC.Prim
documentation:
reallyUnsafePtrEquality# :: a -> a -> Int#
Returns 1# if the given pointers are equal and 0# otherwise.
Warning: this can fail with an unchecked exception.
I understand that there are a lot of ways to misuse this function but why does it throw an exception?
Found the answer in the GHC source code: https://github.com/ghc/ghc/blob/master/compiler/prelude/primops.txt.pp#L3199-L3233
It turns out that it cannot throw an exception but the function is marked as throwing so that GHC won't move it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With