Overlapping, undecidable, incoherent -- or worse?

Alex Ferguson abf at cs.ucc.ie
Thu May 20 17:46:45 EDT 2004

On Thu, May 20, 2004 at 03:52:49PM +0100, MR K P SCHUPKE wrote:
> I don't know whether this was apparent, but only the instance
> pattern is used in determining which instance to use, so 
> "PO a" is the same as "PO a" ... you need to make them different
> otherwise they don;t just overlap they are identical. 
> the left-hand-side of the "=>" play no part in instance selection.
> That is why I suggested using new types. (infact it is your only option)

I see what you're getting at, but I'm not gone on it.  It adds another
constructor (and the instances will generally have at least one to start
with), and it obscures the 'subclass' relationship.  It'd probably be
preferable to code each PO instance 'by hand' (i.e. a separate instance
for each base type selecting the general semiring, c-semi-ring, or some
yet more specialised (as will often be the case anyway)) definition of 
the partial order).  I was just hoping I could avoid doing that, too...

> Even priority would not help here, as the instances are identical.
> (there is a priority, in that if the instances are overlapping
> the most specific is used, IE choosing between (PO a) and (PO Int)
> PO Int wins is 'a' is an Int.

That's not the notion of priority I was referring to.


More information about the Glasgow-haskell-users mailing list