<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>If I understand correctly, you're saying that the problem is due to my use of guards, not anything with fancy types. If that's correct, then this sort of thing might be a trap anyone could stumble into. (The code in OptCoercion is fairly routine for Haskell.) It seems like disabling checking guards by default may be best, but I'd love a flag (not with -Wall) to enable it optionally.</div><div><br></div><div>Richard</div><br><div><div>On Dec 11, 2015, at 6:27 AM, George Karachalias <<a href="mailto:george.karachalias@gmail.com">george.karachalias@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hello Ben,<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 11, 2015 at 11:58 AM, Ben Gamari <span dir="ltr"><<a href="mailto:ben@well-typed.com" target="_blank">ben@well-typed.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi George,<br>
<br>
Richard has encountered a bit of a performance cliff when merging his<br>
no-kinds work. In particular OptCoercions now results in multiple<br>
gigabytes of memory consumption during compilation due to the pattern<br>
checker. The problem seems to be the opt_trans_rule binding, which has<br>
numerous equations, each of which has patterns of various complexities<br>
and guards. Might this be another case where disabling the pattern<br>
checker is unavoidable?<br></blockquote><div><br></div><div>I am afraid so. I have just responded to the ticket about it. The essence is the<br></div><div>difference between `f` and `g` below:<br><br></div>f x = case x of<br><div> [] -> ...<br> (_:_) -> ...<br></div><div><br></div><div>g y | [] <- y = ...<br></div><div> | (_:_) <- y = ...<br></div><div><br></div><div>`f` will generate an empty uncovered set while g will generate:<br><br></div><div>uncovered =<br></div><div> { x |> { x ~ [], x ~ (_:_) }<br></div><div> , x |> { x ~ (_:_), x ~ [] } }<br></div><div><br></div><div>which is also semantically empty but this cannot be detected until we call the<br></div><div>term oracle on it to see the inconsistency. Since pattern guards can pattern match<br></div><div>against <i><b>any</b></i> variable whilst case expressions match a single expression (`x` above)<br></div><div>I can not make the check treat them the same.<br><br></div><div>From what I see, until now the pattern guards in <i><b>opt_trans_co</b></i> involved mostly<br>pattern matching with Maybe which has only two constructors. I can easily assume<br></div><div>that this is the reason we did not have such a problem until now. So many guards<br></div><div>are already a challenge for the pattern match checker but maybe changing this (by<br>this I mean to <b>not</b> use pattern guards on types with many constructors because this<br>is the most expensive thing for the whole check) is enough to make GHC bootstrap.<br></div><br></div><div class="gmail_quote">I hope this helps, I am really confident that this is the cause of the problem.<br>Nevertheless, I will look into it more to see if I can find another source.<br></div><br></div><div class="gmail_extra">George<br><br></div><div class="gmail_extra">-- <br><div><font face="'comic sans ms', sans-serif" color="#660000">things you own end up owning you</font></div>
</div></div></div>
</blockquote></div><br></body></html>