On Sat, Dec 12, 2015 at 12:01 AM, Simon Peyton Jones <simonpj@microsoft.com> wrote:`f` will generate an empty uncovered set while g will generate:
uncovered =
{ x |> { x ~ [], x ~ (_:_) }
, x |> { x ~ (_:_), x ~ [] } }
which is also semantically empty but this cannot be detected until we call the
term oracle on it to see the inconsistency.
So, why not call the term oracle more aggressively (at every node of the tree), to prune empty sets? It should not be hard to spot common cases; in what you show above it’s very easy.
Yes, we've been tempted to do this before but it didn't work. Since the sets can be reallybig, we have relied on laziness a lot to save space and time. By calling the oracle moreoften we will evaluate more eagerly parts of the sets which may lead to more space leaks.you can find another example for which solving the constraints eagerly does not necessarilyimprove the situation. Sometimes the sets are big and consistent. So checking eagerly doesnot actually prune anything. I can see now that my `f` and `g` above were bad examples for this.Last but not least, the term oracle is not the most performant part of the checker. I wouldcertainly avoid calling it more often than we already do.Nevertheless, I do not want to drop the work we have done on pattern guards either so Ithink that the flag solution is a very good and realistic option for now. If we really manage tofind a nice way to do better we can always update the code which will not be removed fromGHC. I will certainly keep thinking about it :)George
--things you own end up owning you