
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. On Wed, Feb 17, 2016 at 2:30 AM Henning Thielemann < lemming@henning-thielemann.de> wrote:
On Mon, 18 Jan 2016, Eric Seidel wrote:
We might be able to make this work as a type-checker plugin (which would be quite nice at least for experimentation). I don't recall off the top of my head if the constraint solver calls plugins before or after it tries to discharge the constraints on its own, but if plugins get access to constraints first we could write one that simply marks undesired instances as insoluble.
Nice to see that you have concrete suggestions how to implement such a warning. Once I proposed an extension for forbidding certain instances: https://ghc.haskell.org/trac/ghc/ticket/7775
I was forwarded to the "instance chain" proposal that would solve my problem: https://ghc.haskell.org/trac/ghc/ticket/9334
This ticket also contains a solution that requires only existing extensions. However this solution does not allow to only warn about a problematic instance or to prevent the use of such an instance only locally.
A proper solution would allow to define a set of forbidden instances and import that in other packages, but does not affect packages later in the import chain. A way for explicit import of instances was discussed every now and then. This might also provide a way to get rid of specific instances.
However, every solution seems to be a long way to go. Eventually, it looks wrong to me to add security holes first and then start to fix them, or defer that for an indefinite time.
Btw. I see that the problem was already discussed on Reddit:
https://www.reddit.com/r/haskell/comments/3qcg2d/proposal_forbidden_instance... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries