<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2017, at 3:57 AM, Alejandro Serrano Mena <<a href="mailto:trupill@gmail.com" class="">trupill@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I would like to advise against this idea of apartness guards. I've tried myself some years ago, and I remember them being quite complicated to describe. The main problem is that apartness may end up introducing some sort of backtracking in the type checking process -- something completely undesirable. Furthermore, they make the work of the overlapping checks much harder.</span></div></blockquote></div><br class=""><div class="">Do you recall an example of where things went wrong? It seems to me that GHC does this today. If I have</div><div class=""><br class=""></div><div class="">> instance C (Maybe a) where ...</div><div class="">> instance {-# OVERLAPPING #-} C (Maybe Int) where ...</div><div class=""><br class=""></div><div class="">then GHC won't choose the first instance unless it knows that `a` is apart from Int. Indeed, it is possible to write a program that is accepted with only the first instance in scope but is rejected when the second one is, too. Under instance guards, this could be written</div><div class=""><br class=""></div><div class="">> instance C (Maybe a) | a /~ Int where ...</div><div class="">> instance C (Maybe Int) where ...</div><div class=""><br class=""></div><div class="">and then both instances stand alone and make sense independent of one another.</div><div class=""><br class=""></div><div class="">Richard</div></body></html>