
Hi, Am Montag, den 16.09.2013, 05:53 +0000 schrieb Simon Peyton-Jones:
a) A newtype can be casted only if its constructor is visible. b) Casting below a type constructor (instance Coercible a b => Coercible (Maybe a) (Maybe b)) is possible if the roles allow it; the constructor does not have to be visible or exposed, except that c) in Safe Haskell code, the constructor or the typecon (and all constructors of all typecons used in the definition of the typecon) has to be visible.
Has anyone talked to David Terei about the Safe Haskell check (c) above?
No, not yet. In order to meet the deadline I put in what seems to me the safest variant to start with.
It's not clear to me whether (c) is necessary. (And it would need to recursively check those tycoons, I think. Are you doing that?)
I do check them recursively. It is necessary because, from what I understood, we really want the “could I have written this by hand” property in Safe Haskell. And with data D1 a = MkD1 a data D2 a = MkD2 (D1 a) I really need access to both MkD1 and MkD2 to be able to write coerceUnderD2 :: (a -> b) -> D2 a -> D2 b. But I’d be happy to change that check to whatever the Safe Haskell experts prefer. Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189 Jabber-ID: nomeata@joachim-breitner.de