diff options
Diffstat (limited to 'libraries/base/Unsafe/Coerce.hs')
-rw-r--r-- | libraries/base/Unsafe/Coerce.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/Unsafe/Coerce.hs b/libraries/base/Unsafe/Coerce.hs index 930514ce81..ec5b793f87 100644 --- a/libraries/base/Unsafe/Coerce.hs +++ b/libraries/base/Unsafe/Coerce.hs @@ -267,6 +267,10 @@ unsafeEqualityProof = case unsafeEqualityProof @a @b of UnsafeRefl -> UnsafeRefl -- (which have different kinds!) because it's really just a newtype. -- Note: there is /no guarantee, at all/ that this behavior will be supported -- into perpetuity. +-- +-- +-- For safe zero-cost coercions you can instead use the 'Data.Coerce.coerce' function from +-- "Data.Coerce". unsafeCoerce :: forall (a :: Type) (b :: Type) . a -> b unsafeCoerce x = case unsafeEqualityProof @a @b of UnsafeRefl -> x |