Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#8141 closed feature request (fixed)

Liberalising IncoherentInstances

Reported by: nomeata Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

As argued, -XIncoherentInstances could be even more liberal. This ticket is to give the proposal a number; I am currently preparing a patch for this.

Change History (14)

comment:1 Changed 6 years ago by nomeata

I wanted to write: “As SPJ argued” (stupid Wiki syntax guessing...)

comment:3 Changed 6 years ago by simonpj

Thanks. But shouldn't there be some carefully-written text (along the lines of my email) in the overlapping-instances section of the manual?

And likewise, the comments in Note [Incoherent Instances] currently cover only the narrow question of your email, not the broader issue of my original post. Could you combine the two. (Also the Note needs a cross-ref from BasicTypes.)

Ta

Simon

comment:4 Changed 6 years ago by nomeata

Thanks for the review; I have reworked the documentation and the notes.

comment:5 Changed 6 years ago by nomeata

Status: newpatch

comment:6 Changed 6 years ago by thoughtpolice

This looks good to me. Thanks for the doc updates - I'll get to this shortly...

comment:7 Changed 6 years ago by Austin Seipp <aseipp@…>

In 099f9542e8ad2e38196de2be928ccbfaee545b44/ghc:

Liberalising IncoherentInstances

(Almost) as suggested by SPJ on
http://www.haskell.org/pipermail/glasgow-haskell-users/2013-July/022651.html
(fixes #8141)

Signed-off-by: Austin Seipp <aseipp@pobox.com>

comment:8 Changed 6 years ago by Austin Seipp <aseipp@…>

In f9fb338d46cb9c4462d58b7527da547683341c61/testsuite:

Test cases for new IncoherentInstances behaviour

(related to #8141)

Signed-off-by: Austin Seipp <aseipp@pobox.com>

comment:9 Changed 6 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

Merged with a release note blurb. Thank you Joachim!

comment:10 Changed 6 years ago by simonpj

Resolution: fixed
Status: closednew

I can't quite see from the diffs, but I would like the user manual to pretty much give the specification in my email:

More precisely, when trying to find an instance matching a target constraint (C tys),

a) Find all instances matching (C tys); these are the candidates

b) Eliminate any candidate X for which another candidate Y is
  strictly more specific (ie Y is a substitution instance of X),
  if either X or Y was complied with -XOverlappingInstances

c) Check that any non-candidate instances that *unify* with (C tys)
   were compiled with -XIncoherentInstances

d) If only one candidate remains, pick it.
    Otherwise if all remaining candidates were compiled with
    -XInccoherentInstances, pick an arbitrary candidate

I don't think it yet does. I'll take a look.

comment:11 Changed 6 years ago by nomeata

I couldn’t quite fit it in the existing docs without adding various redundancies or rewriting it completely. I tried to make sure that all the information from your quote was present, although possibly in a different shape. Maybe I should have edited it more boldly; if you want me to try again I can do that (next week, after my holidays).

comment:12 Changed 6 years ago by simonpj

Don't worry; I've done it. Will push on Monday

comment:13 Changed 6 years ago by simonpj

Resolution: fixed
Status: newclosed

Documentation done.

Simon

comment:14 Changed 5 years ago by carter

for posterity, a working link to the associated cafe discussion is http://www.haskell.org/pipermail/glasgow-haskell-users/2013-July/024131.html

(the old links didn't work)

Note: See TracTickets for help on using tickets.