Are safe coercions safe in the sense of Safe Haskell?

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Fri Aug 15 20:04:29 UTC 2014


Hi,

I would expect the function

    coerce :: Coercible a b => a -> b

to be safe in the sense of Safe Haskell. However, the Data.Coerce module
is marked “Unsafe”. The coerce function is also available via GHC.Exts
and GHC.Prim. The former module is marked “Unsafe”, but the latter is
(surprisingly) marked “Safe-Inferred”.

What are the reasons behind this?

All the best,
Wolfgang



More information about the Glasgow-haskell-users mailing list