[Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

Carlos Camarao carlos.camarao at gmail.com
Fri May 28 15:19:47 EDT 2010


On Wed, May 26, 2010 at 7:12 PM, Max Bolingbroke <batterseapower at hotmail.com
> wrote:

> I broadly agree, but pragmatically the notion of orphans is useful for
> designing robust libraries, even if the notion is a bit horrible. ...
>
I guess that a MPTC instance (C t1 .. tn) for class C in module M1 is NOT an
> orphan if:

1) C is defined in the same module as the instance


I don't understand the motivation behind 1) (and why you want 1) to be a
part of orphan-hood). I think horrible should mean senseless,useless: if the
declaration of a class C is in a module M1, the fact that a definition of an
instance of C is in M1 or in another module M2 that imports M1 should not
make any difference for a third module M3 as long as the modules involved
are imported by M3.

In "None of the instances are reported as orphans but IMHO they should be,
because we get a conflict in the Main module.", the motivation (antecedent)
seems not enough for the conclusion, since a similar conflict happens e.g.
when you are importing any two overlapping instances, that instantiate class
variable(s) to the same type(s) and are defined in different modules.


> > A benefit of adopting our approach would be that defaulting would
> > become unnecessary (defaulting always occurring in favor of visible
> > definitions).
>
> This is something I don't understand ...
> Can you perhaps explain what you mean a bit further?
>

Sorry, I should have said that defaulting is not necessary to force
instantiation (of unreachable variables) when there are no conflicting
definitions in the current context. Defaulting should be used only to remove
ambiguity, i.e. when there exist conflicting definitions and when
unreachable type variables appear that can be instantiated to such
conflicting definitions.

Cheers,

Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100528/3824d642/attachment.html


More information about the Haskell-Cafe mailing list