<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 4, 2015 at 2:02 PM, frantisek kocun <span dir="ltr"><<a href="mailto:frantisek.kocun@gmail.com" target="_blank">frantisek.kocun@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">--  (I know I can implement my own Eq, but I want to use both forms)</blockquote></div><br>The two computations are very different. Since the type of a value determines which "Eq" computation to run, it is not advisable to try to get two different computations to work for the same type. </div><div class="gmail_extra"><br></div><div class="gmail_extra">What you can do instead is use a newtype:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">-- | A variant that ignores the LispVal in NumArgs for Eq</div><div class="gmail_extra">newtype LispErrorI = LispErrorI LispError</div><div class="gmail_extra"><br></div><div class="gmail_extra">instance Eq LispErrorI where</div><div class="gmail_extra">    (LispErrorI (NumArgs n _)) == (LispErrorI (NumArgs n' _)) = n == n'</div><div class="gmail_extra">    (LispErrorI e) == (LispErrorI e') = e == e'</div><div><br></div></div><div class="gmail_extra">Anytime you want to compare two LispError:s using the second computation, you can wrap / unwrap the values in the newtype. It creates some extra syntax noise, but it makes the intent very clear, and there's no runtime cost.</div></div>