Coercible class (Was: newtype wrappers)

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


Hi,

Am Sonntag, den 15.09.2013, 17:24 -0400 schrieb Richard Eisenberg:
> Because, from a user's point of view, defining 
> 
> > newtype Age = MkAge Int
> 
> automatically creates Coercible instances
> 
> > instance Coercible Age Int
> > instance Coercible Int Age
> 
> and defining datatypes also creates instances. This looks like a
> user-visible language feature to me, and I think it should be
> documented in the manual.

not really; if you type ":info Coercible" you see that there are no
instances created. Just the type-checking of uses of coerce is a bit
special.

I think the question is rather: Where would the user search for
documentation. And given that there are identifiers related to the
feature (Coercible, coercion), the haddocks for that are the natural
place to search. And as I’d like to avoid duplication, I’d not put the
docs somewhere else again.

I don’t mind adding a pointer from the “Special built-in functions”
section to the haddock docs, though, if you think it would be helpful.

Greetings,
Joachim
-- 
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/efc85921/attachment.pgp>


More information about the ghc-devs mailing list