Re: [Haskell-cafe] How to compare PortNumbers or Bug in Network.Socket?

2009-03-13 Thread Bryan O'Sullivan
On Thu, Mar 12, 2009 at 8:45 PM, Antoine Latter aslat...@gmail.com wrote: So the Ord instance is wrong for the PortNumber type? Well, maybe not wrong. It's out and out wrong. You get different results on machines of different endianness. Now, this begs the question of why not just simply use

[Haskell-cafe] How to compare PortNumbers or Bug in Network.Socket?

2009-03-12 Thread Stefan Schmidt
Hello, I want to compare two PortNumber-Values from the Network.Socket module and I think I've experienced some unexpected behavior of the derived ordering methods. I'm using the ghc-6.10.1 and the network library 2.2.0.1 on a x86 32-Bit machine. The following program creates two pairs of

Re: [Haskell-cafe] How to compare PortNumbers or Bug in Network.Socket?

2009-03-12 Thread Bryan O'Sullivan
On Thu, Mar 12, 2009 at 2:44 PM, Stefan Schmidt stefanschmid...@googlemail.com wrote: As a work around, I could convert two PortNumbers back to Int-Values before comparing them, but I think the ordering functions for the PortNumber-Type do not work as expected. Or am I wrong? You're right.

Re: [Haskell-cafe] How to compare PortNumbers or Bug in Network.Socket?

2009-03-12 Thread Philippa Cowderoy
On Thu, 2009-03-12 at 14:56 -0700, Bryan O'Sullivan wrote: However, it's also arguably the case that you shouldn't care about port number ordering. That smells dodgy to me. Port ranges aren't that uncommon. -- Philippa Cowderoy fli...@flippac.org

Re: [Haskell-cafe] How to compare PortNumbers or Bug in Network.Socket?

2009-03-12 Thread Stefan Schmidt
Philippa Cowderoy wrote: On Thu, 2009-03-12 at 14:56 -0700, Bryan O'Sullivan wrote: However, it's also arguably the case that you shouldn't care about port number ordering. That smells dodgy to me. Port ranges aren't that uncommon. That's exactly were I need the comparison. I'm writing a

Re: [Haskell-cafe] How to compare PortNumbers or Bug in Network.Socket?

2009-03-12 Thread Antoine Latter
On Thu, Mar 12, 2009 at 5:32 PM, Stefan Schmidt stefanschmid...@googlemail.com wrote: Philippa Cowderoy wrote: On Thu, 2009-03-12 at 14:56 -0700, Bryan O'Sullivan wrote: However, it's also arguably the case that you shouldn't care about port number ordering. That smells dodgy to me. Port