Coercible class (Was: newtype wrappers)

Richard Eisenberg eir at
Sun Sep 15 21:49:51 UTC 2013

On Sep 15, 2013, at 5:44 PM, Joachim Breitner <mail at> wrote:

> 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.

Even stranger, I think. I understand that there aren't really any instances of Coercible, but it certainly looks like there is, to users.

> foo :: Coercible a b => a -> b -> ()
> foo = undefined
> bar = foo 'a' 'b'

will certainly compile. For an ordinary class, that would mean that we should expect Coercible Char Char to exist (or perhaps Coercible a a, or something similar). But it won't. This would appear to be quite strange.

To be clear, I'm not asking for an explanation for me -- I think I know what's going on here. I just think that this behavior requires a small section in the user manual, because it's a user-visible change to the language that GHC compiles. I would say the haddock docs could point to the user manual, to avoid the duplication (which I similarly dislike, for sure!)


> 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
>  Homepage:
>  ICQ#: 74513189
>  Jabber-ID: nomeata at
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list