[Haskell-cafe] Sockets get bound to wrong port on Windows

Matthias Reisner matthias.reisner at googlemail.com
Thu Jun 3 13:58:19 EDT 2010


Am 03.06.2010 08:05 schrieb Ketil Malde:
> Antoine Latter <aslatter at gmail.com> writes:
>
>   
>>>   *Main> PortNum 8888
>>>   47138
>>>       
>
>   
>> The PortNum constructor should rarely be used directly
>>     
>
> So, shouldn't the constructor be hidden, and exported from an .Internal
> module? 
>
>   
>> - it contains the port number in network-order. You should try:
>>     
>
> Or perhaps even better, the type could be:
>
>     data PortNum = PortNum { msb, lsb :: Word8 }
>
> so that we avoid this kind of confusion?
>
> -k
>   

Hi,

since this is really not obvious, I'd second to hide the constructor or 
at least a note should be added to the docs how to use PortNumber correctly.


Regards,

Matthias


More information about the Haskell-Cafe mailing list