<div dir="ltr">disclaimer: I found this e-mail thread through the jhc archives while I was not subscribed to jhc@ because I was having the same problems as Mario and Herbert. I subscribed afterwards, so I could join in on the discussion. I'm not sure how this will affect the mailing list's thread handling.<div><br></div><div>I am having the same problem with JHC, and like Mario says, it's due to a pre-mature optimization.</div><div><br></div><div>Basically, when JHC encounters a type where only one constructor has arguments, it erroneously thinks that it can store it as untagged. This is true only for types with two constructors, but not for types with more than two. I have the feeling this was written as a quick way to optimize list storage without realizing that the optimization would break types with more than two constructors.</div><div><br></div><div>The optimization works for types with two constructors because JHC specifically handles the case of scrutinizing a two-constructor type when it generates C.</div><div><br></div><div>Anyway, this can be fixed by disabling this optimization for types with more than two constructors.</div><div><br></div><div>Change the line</div><div><br></div><div><div>    tyRep k tyty | Just xs <- tySiblings tyty, all triv [ x | x <- xs, x /= k] = Just TyRepUntagged where</div></div><div><br></div><div>to</div><div><div><br></div><div>    tyRep k tyty | Just xs <- tySiblings tyty, length xs < 3 && all triv [ x | x <- xs, x /= k] = Just TyRepUntagged where</div></div><div><br></div><div>Any ideas on how to get this bug changed in the official version?</div><div><br></div><div>Travis</div></div>