In GHC.Prim, why can pointer operations fail with an unchecked exception?

Viewed 54

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?

1 Answers
Related