<div dir="ltr"><div>I would be hesitant about adding an Ord instance normally, because there's no clear semantics for it. If we just pass it through to the underlying data structure, it might behave differently depending on how you implement the graph, which is something fgl should ideally abstract over.<br><br></div>Maybe you could provide them in a newtype yourself, in the library? You could call it something like GrKey to make it clear that it has an Ord instance for practical reasons rather than because graphs are meaningfully orderable. This just forces people who need the capability to be a bit more explicit about it.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 24, 2015 at 7:47 AM, Andreas Abel <span dir="ltr"><<a href="mailto:andreas.abel@ifi.lmu.de" target="_blank">andreas.abel@ifi.lmu.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 04/24/2015 03:06 PM, Ivan Lazar Miljenovic 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>
</blockquote>
<br></span>
I'd say this is harmful, as functions like min and max (and others) rely on the totality of the ordering.<br>
<br>
Partial orderings are useful in itself, I implemented my own library<br>
<br>
<br>
<a href="https://hackage.haskell.org/package/Agda-2.4.2/docs/Agda-Utils-PartialOrd.html" target="_blank">https://hackage.haskell.org/package/Agda-2.4.2/docs/Agda-Utils-PartialOrd.html</a><br>
<br>
mainly to use it for maintaining sets of incomparable elements:<br>
<br>
<br>
<a href="https://hackage.haskell.org/package/Agda-2.4.2/docs/Agda-Utils-Favorites.html" target="_blank">https://hackage.haskell.org/package/Agda-2.4.2/docs/Agda-Utils-Favorites.html</a><span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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>
<br>
</blockquote>
<br>
<br>
-- <br></span>
Andreas Abel  <><      Du bist der geliebte Mensch.<br>
<br>
Department of Computer Science and Engineering<br>
Chalmers and Gothenburg University, Sweden<br>
<br>
<a href="mailto:andreas.abel@gu.se" target="_blank">andreas.abel@gu.se</a><br>
<a href="http://www2.tcs.ifi.lmu.de/~abel/" target="_blank">http://www2.tcs.ifi.lmu.de/~abel/</a><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>