<div dir="auto">On Thurs, Jul 26, 2018 at 05:39:00, Emil Axelsson wrote:</div><div dir="auto"><br></div><div dir="auto">>> <span style="white-space:pre-wrap;background-color:rgb(255,255,255)">Den 2018-07-26 kl. 01:02, skrev Anthony Clayden:</span></div><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)"><div dir="auto">>></div><i> 
</i><div dir="auto">>>></div><i> On Tue, Jul 24, 2018 at 5:52 AM,Ryan Reich wrote:
</i>><i>>> This seems like the canonical illustration of the dangers of 
</i><div dir="auto">>>><i style="font-family:-apple-system,HelveticaNeue"> UndecidableInstances.</i></div><div dir="auto">>><i style="font-family:-apple-system,HelveticaNeue"> </i></div><div dir="auto">>><i style="font-family:-apple-system,HelveticaNeue"> No I don't buy that explanation. The worst UndecidableInstances can do </i></div><div dir="auto">>><i style="font-family:-apple-system,HelveticaNeue"> is send the type checker into a loop.</i></div><div dir="auto">
> I used to have a counter-example to that claim:
 </div><a href="https://mail.haskell.org/pipermail/haskell-cafe/2010-January/072357.html">https://mail.haskell.org/pipermail/haskell-cafe/2010-January/072357.html</a><div dir="auto">
> That example was causing looping dictionaries at run time on GHC 6.10. 
> But now, on GHC 8.2, the program terminates.</div><div dir="auto"><br></div><div dir="auto">6.10 was rather a long time ago. The whole type inference/improvement engine has had several overhauls since 2010.</div><div dir="auto"><br></div><div dir="auto">To be clear: you can write looping programs without type classes at all -- such as mutually recursive functions. You can write looping programs with type classes -- by turning those functions into methods in classes. You can write looping programs with type classes that need `UndecidableInstances` -- by making those classes mutual superclasses or mutual constraints on instances.</div><div dir="auto"><br></div><div dir="auto">That doesn't mean the `UndecidableInstances` are to 'blame' for the looping. I would blame the functions/method calls for not reducing the problem.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">> But one wonders if there are other ways to create looping dictionaries?</div><div dir="auto"><br></div><div dir="auto">With `UndecidableInstances`, yes there's plenty. And I expect that'll make the typechecker loop at compile time.

The O.P. here is not getting typechecker looping, so I think the explanation is to do with method calls -- for which we need to see what's going on in the imports.</div><div dir="auto"><br></div><div dir="auto">AntC</div></pre>