<div dir="ltr">You can find a patched version of the compiler at <a href="http://github.com/m-alvarez/jhc">http://github.com/m-alvarez/jhc</a> (as long as you don't mind using an experimental branch of jhc), but I'm not sure how to go about merging this patch into the official repository. We could try telling John directly, but if he's not paying attention to the mailing list my guess is he's too busy to worry much about JHC.<div><br></div><div>I'm pretty sure the optimization could be made safe, although I'm not sure how easily, and right now I don't have the time or energy to devote to that. If anyone else volunteers, I'll be glad to accept pull requests to the github repo.</div><div><br></div><div>Cheers!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 19, 2015 at 10:24 PM, Travis Athougies <span dir="ltr"><<a href="mailto:travis@athougies.net" target="_blank">travis@athougies.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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><span class="HOEnZb"><font color="#888888"><div><br></div><div>Travis</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Now I do not know whether I was then a lambda expression emulating a Turing machine, or whether I am a Turing machine emulating a lambda expression.<br></div></div></div></div>
</div>