Coercible class (Was: newtype wrappers)

Joachim Breitner mail at
Sun Sep 15 21:44:07 UTC 2013


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

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.

Joachim Breitner
  e-Mail: mail at
  ICQ#: 74513189
  Jabber-ID: nomeata at
-------------- 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: <>

More information about the ghc-devs mailing list