[jhc] bug or feature: generated constraints of derived Show instance

Felipe Lessa felipe.lessa at gmail.com
Sat Nov 14 14:36:44 EST 2009


On Sat, Nov 14, 2009 at 07:05:00PM +0100, Henning Thielemann wrote:
> With the patch about unqualified methods in instance declarations I
> can compile most of my xml-basic package. However it stops at
>
> data ProcessingInstruction name string =
>      Known [Attr.T name string]
>    | Unknown String
>      deriving (Eq, Ord, Show )
>
> since the Show instance of Attr.T needs an (Name.Attribute name)
> constraint. JHC does not seem to generate that automatically. GHC
> does so, but I do not know, whether this is Haskell 98. I can fix
> this by writing a custom Show instance, but there are more types
> with that problem.

Probably a bug, otherwise

    data T a = T [a] deriving (Show)

wouldn't work because

    instance Show a => Show [a] where ...

--
Felipe.


More information about the jhc mailing list