<div dir="ltr">Sadly Bart,<div><br></div><div>Once you do allow explicit qualification of what imports you get you lose the global coherence property that we have about the uniqueness of instances.<div><br></div><div>This isn't just an academic concern. Little libraries like Data.Set cease be well behaved, because nothing ensures that the instance you pass to the call to lookup is the same as was used to build the library. It then forces you to start carrying all sorts of instances around inside of data, and use one off methods to manipulate structures rather than use many of the classes and tools we can use today.</div><div><br></div><div>Haskell is the only language in wide use that has this property (modulo some incoherent instance / orphan instance concerns). It'd be a damn shame to lose it.</div><div><br></div><div>-Edward</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 17, 2016 at 12:38 PM, Bart Massey <span dir="ltr"><<a href="mailto:bart.massey@gmail.com" target="_blank">bart.massey@gmail.com</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">IMHO managing import of instances using the normal module import mechanisms is the only sane way to go. I seem to recall SPJ wanting to do this many years ago: I don't remember the details of the discussion or why it wasn't actually done. It does seem hard, but would be so worth it.</div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 17, 2016 at 2:30 AM Henning Thielemann <<a href="mailto:lemming@henning-thielemann.de" target="_blank">lemming@henning-thielemann.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On Mon, 18 Jan 2016, Eric Seidel wrote:<br>
<br>
> We might be able to make this work as a type-checker plugin (which would<br>
> be quite nice at least for experimentation). I don't recall off the top<br>
> of my head if the constraint solver calls plugins before or after it<br>
> tries to discharge the constraints on its own, but if plugins get access<br>
> to constraints first we could write one that simply marks undesired<br>
> instances as insoluble.<br>
<br>
Nice to see that you have concrete suggestions how to implement such a<br>
warning. Once I proposed an extension for forbidding certain instances:<br>
   <a href="https://ghc.haskell.org/trac/ghc/ticket/7775" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/7775</a><br>
<br>
I was forwarded to the "instance chain" proposal that would solve my<br>
problem:<br>
   <a href="https://ghc.haskell.org/trac/ghc/ticket/9334" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/9334</a><br>
<br>
This ticket also contains a solution that requires only existing<br>
extensions. However this solution does not allow to only warn about a<br>
problematic instance or to prevent the use of such an instance only<br>
locally.<br>
<br>
A proper solution would allow to define a set of forbidden instances and<br>
import that in other packages, but does not affect packages later in the<br>
import chain. A way for explicit import of instances was discussed every<br>
now and then. This might also provide a way to get rid of specific<br>
instances.<br>
<br>
<br>
However, every solution seems to be a long way to go. Eventually, it looks<br>
wrong to me to add security holes first and then start to fix them, or<br>
defer that for an indefinite time.<br>
<br>
<br>
Btw. I see that the problem was already discussed on Reddit:<br>
<a href="https://www.reddit.com/r/haskell/comments/3qcg2d/proposal_forbidden_instances/" rel="noreferrer" target="_blank">https://www.reddit.com/r/haskell/comments/3qcg2d/proposal_forbidden_instances/</a><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div>