[darcs-devel] GHC and flagging use of a given constant

Josef Svenningsson josef.svenningsson at gmail.com
Thu Jan 11 16:19:36 PST 2007


On 1/11/07, David Roundy <droundy at darcs.net> wrote:
> I think we'd really like to apply it not to the method, but to the instance
> itself.  So that use of the Show instance of Control.Exception.Exception
> would be deprecated.  This'd be more severe, since there might be classes
> that depend on a show instance, but don't actually use it.
>
> Another possibility for this particular problem would be to be able to
> rewrite the show instance.  If we could just remove the stupid "User
> error:" text from the show instance, I don't think it'd be a bug to use it
> anymore.

I did a little testing and it turns out that you can actually achieve
what you want. Just write another Show instance for C.E.Exception and
import it wherever there is a possibility that a bad show might be
lurking. GHC will only complain about duplicate instances if you
actually use a method from the Show class with the particular type
which has several instances. So GHC is doing exactly what you want!

Cheers,

Josef


More information about the darcs-devel mailing list