Personally, I came much less against UndecidableInstances when I was trying to do OOP in Haskell than when I was trying do Prolog-like things at the type level.<br>Things like transitive relations: (If a type B contains an A, and if C contains B, then C contains A, and so on).<br>

I kind of abandonned quickly that way of reasoning ^^.<br><br><br><div class="gmail_quote">2011/6/7 Yitzchak Gale <span dir="ltr">&lt;<a href="mailto:gale@sefer.org">gale@sefer.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">I wrote:<br>
&gt;&gt;&gt; You almost never want to use UndecidableInstances<br>
&gt;&gt;&gt; when writing practical programs in Haskell.<br>
&gt;&gt;&gt; When GHC tells you that you need them, it almost<br>
&gt;&gt;&gt; always means that your types are poorly designed,<br>
&gt;&gt;&gt; usually due to influence from previous experience<br>
&gt;&gt;&gt; with OOP.<br>
<br>
</div><div class="im">wren ng thornton wrote:<br>
&gt;&gt; That&#39;s a bit unfair. There are many kinds of type-level<br>
&gt;&gt; hackery which require UndecidableInstances but are<br>
&gt;&gt; (a) perfectly safe for practical use, and<br>
&gt;&gt; (b) have nothing to do with OOP.<br>
&gt;&gt; One particularly trivial example that comes to mind is:<br>
&gt;&gt;    newtype Mu f = Mu (f (Mu f))<br>
<br>
</div>I agree. I&#39;ve even used that one (well, something similar<br>
anyway).<br>
<div class="im"><br>
Oleg wrote:<br>
&gt; It seems that UndercidableInstances keep getting a bad rap.<br>
&gt; There are legitimate and decidable applications of<br>
&gt; UndercidableInstances. These applications have nothing to do<br>
</div>&gt; with OOP, or HList for that matter... That extension should not<br>
&gt; be categorically stigmatized.<br>
<br>
I&#39;m sorry if I came across as giving it a bad rap, or<br>
stigmatizing it. That was certainly not my intention. There<br>
are plenty of excellent techniques that use this and other<br>
GHC extensions; accomplished Haskellers should have<br>
them in their toolbox.<br>
<br>
But I stand by my statement, which is coming from my<br>
perspective as a professional Haskell software developer,<br>
not a PL researcher. Perhaps I should clarify it though.<br>
<br>
I am making two claims:<br>
<br>
1. In everyday practical Haskell programming, it is very<br>
unusual that a technique requiring direct use of<br>
UndecidableInstances is the right tool for the job. Of course,<br>
that observation is colored by my own experience, but I<br>
believe that it is generally true.<br>
<br>
2. If a person is surprised by the GHC error suggesting<br>
that UndecidableInstances is needed and is struggling with<br>
understanding it, then it is almost certain that person has<br>
inappropriately used OOP thinking in trying to design a<br>
Haskell program.<br>
<br>
Experienced Haskellers familiar with those techniques<br>
do not get the error. Or they get it and say, &quot;Oops, forgot<br>
the UndecidableInstances.&quot;<br>
<br>
Whereas most programmers coming to Haskell have had<br>
OOP experience. The first thing that happens when they<br>
try to write a program in Haskell of any significant complexity<br>
is the &quot;UndecidableInstances&quot; error. It happened to me, too.<br>
<br>
Thanks,<br>
Yitz<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>