[Haskell-cafe] Show instances for error messages (Was: Refactoring status)

Henning Thielemann lemming at henning-thielemann.de
Mon Jan 7 06:06:21 EST 2008

On Mon, 7 Jan 2008, Emil Axelsson wrote:

> One approach to programming in Haskell, which I use all the time, is to write
> the type signature before the function body. This means that if I'm trying to do
> something strange, I will often be warned by the type checker even before I've
> written the strange code.
> But I've also been bitten by the problem of having to change a lot of type
> signatures just because I want to e.g. show an overloaded variable.

... which is especially annoying if you need the Show instance for an
'error'.  Since 'error' denotes a programming error it should never be
evaluated and thus the Show instance is only for cases which must not
happen. Paradoxical. It would be interesting if it is possible to tunnel
Show class dictionaries through to an 'error' like IO is tunneled to

More information about the Haskell-Cafe mailing list