<div dir="ltr">I see it as "morally wrong".  It's like a Monad instance that doesn't obey the monad laws.  The kind of ticking timebomb strong typing is supposed to protect us against.  But that only works if we do our part and don't make non-sense instances.<div><br></div><div>Can your consumer get away with using a Hashable instance?  (I.e., for use in unordered-containers).  This would be morally correct -- the graph could presumably have a valid Hashable instance.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 24, 2015 at 6:06 AM, Ivan Lazar Miljenovic <span dir="ltr"><<a href="mailto:ivan.miljenovic@gmail.com" target="_blank">ivan.miljenovic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What is the validity of defining an Ord instance for types for which<br>
mathematically the `compare` function is partially ordered?<br>
<br>
Specifically, I have a pull request for fgl [1] to add Ord instances<br>
for the graph types (based upon the Ord instances for Data.Map and<br>
Data.IntMap, which I believe are themselves partially ordered), and<br>
I'm torn as to the soundness of adding these instances.  It might be<br>
useful in Haskell code (the example given is to use graphs as keys in<br>
a Map) but mathematically-speaking it is not possible to compare two<br>
arbitrary graphs.<br>
<br>
What are people's thoughts on this?  What's more important: potential<br>
usefulness/practicality or mathematical correctness?<br>
<br>
(Of course, the correct answer is to have a function of type a -> a -><br>
Maybe Ordering :p)<br>
<br>
[1]: <a href="https://github.com/haskell/fgl/pull/11" target="_blank">https://github.com/haskell/fgl/pull/11</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" target="_blank">http://IvanMiljenovic.wordpress.com</a><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</font></span></blockquote></div><br></div>