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

Antoine Latter aslatter at gmail.com
Thu Mar 12 23:45:54 EDT 2009


On Thu, Mar 12, 2009 at 5:32 PM, Stefan Schmidt
<stefanschmidt42 at 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 ranges aren't that uncommon.
>
> That's exactly were I need the comparison. I'm writing a program which takes
> a range of port numbers and tries to open a socket with the first available
> port number. The whole thing is part of a distributed system and I cannot
> specify just a single port number because I could already been taken.
>
> Stefan

So the Ord instance is wrong for the PortNumber type?  Well, maybe not
wrong.  But not as useful as it could be.

Antoine


More information about the Haskell-Cafe mailing list