Coercible class (Was: newtype wrappers)

Joachim Breitner mail at joachim-breitner.de
Sun Sep 15 21:13:52 UTC 2013


Hi,

Am Sonntag, den 15.09.2013, 16:48 -0400 schrieb Richard Eisenberg:
> What was the end result of the discussion on abstraction? Can a
> library control how its types are coerced?

there is no end result, as this is just a language feature. But the
current state of affairs is that:
 * A newtype can be casted only if its constructor is visible.
 * 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
 * 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.

So once you know your syntax for role annotations it would make sense to
annotate the arguments of Set and Map (first one only) in base before we
release 7.8.

Greetings,
Joachim

PS: Do we have regular builds of master, including users’ guide and
haddock, somewhere that I can link to in such a mail?

-- 
Joachim Breitner
  e-Mail: mail at joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  ICQ#: 74513189
  Jabber-ID: nomeata at joachim-breitner.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130915/9b9c87d6/attachment.pgp>


More information about the ghc-devs mailing list