[Haskell-cafe] Fundeps and overlapping instances
illissius at gmail.com
Fri May 25 17:11:28 CEST 2012
On Fri, May 25, 2012 at 7:06 AM, AntC <anthony_clayden at clear.net.nz> wrote:
> But it looks like the work SPJ pointed to is using closed style. If all
> they're trying to do is support HList and similar, I guess that's good enough.
> I tried to explain all this the best part of a year ago. (Admittedly my
> explanation was a bit turgid, re-reading it today. And not that I was saying
> anything that hadn't been said by others -- it's resurfaced several times.)
> Funny how GHC-central just barrels ahead and ignores all those ideas,
> apparently without explaining why.
If you're referring to the NewAxioms work Simon linked to in the other
thread, I don't see it explicitly stated that all instances have to be
within a single module. Especially section 3.3 (Translation) of the
pdf seems to suggest otherwise. Though it also doesn't seem to be
the same as what you're asking for. As far as I can tell, with
NewAxioms, wherever you could currently have a type instance, you
could instead have a type instance group. Within a group you could
have unrestricted overlap with the first matching instance being
selected, while between groups overlap would continue to be forbidden.
Relative to explicit disequality guards it seems both more and less
powerful: you couldn't have overlap between modules (but could still
split instances among modules as long as they *don't* overlap), but
overlap within a module would be more powerful (or at least more
convenient). It seems vaguely similar to a paper on instance chains
I saw once.
(Apologies in advance if any of this is inaccurate, I'm just going by
what I can see.)
More information about the Haskell-Cafe