[Haskell-cafe] Ord for partially ordered sets
Ivan Lazar Miljenovic
ivan.miljenovic at gmail.com
Fri Apr 24 13:27:46 UTC 2015
On 24 April 2015 at 23:17, Tom Ellis
<tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> On Fri, Apr 24, 2015 at 11:06:07PM +1000, Ivan Lazar Miljenovic wrote:
>> What is the validity of defining an Ord instance for types for which
>> mathematically the `compare` function is partially ordered?
>
> I'm confused. What is supposed to be the result of `g1 <= g2` when `g1` and
> `g2` are not comparable according to the partial order?
With the proposed patch, it's the result of <= on the underlying [Int]Maps.
Does the definition of Ord on Data.Map make sense? e.g. what should
be the result of (fromList [(1,'a'), (2,'b'), (3, 'c')]) <= (fromList
[(1,'a'), (4,'d')])? What about (fromList [(1,'a'), (2,'b'), (3,
'c')]) <= (fromList [(1,'a'), (2,'e')])?
--
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com
More information about the Haskell-Cafe
mailing list