See https://ghc.haskell.org/trac/ghc/ticket/8745 and 
https://ghc.haskell.org/trac/ghc/ticket/8827 which discuss this problem at 
length.

The short answer: It's conceivable that a role-unaware library author would 
have abstraction expectations that are defeated through the use of `coerce`.

I would strongly welcome a proposal for how to make `coerce`, and hence 
GeneralizedNewtypeDeriving, to be considered Safe for 7.10.

Richard

On Aug 15, 2014, at 4:04 PM, Wolfgang Jeltsch <g9ks1...@acme.softbase.org> 
wrote:

> 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
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to