[Haskell-cafe] Bug in Network package

Thomas DuBuisson thomas.dubuisson at gmail.com
Wed Apr 10 18:56:09 CEST 2013


Replying to all.  Sorry for the duplicate, Florian.

The fact that the constructor `PortNum` is exported has been argued to be a
bug in past discussions.  PortNumber is stored big endian, which leads to
behaviors that people don't expect.  I suggest you lean on the fact that
PortNumber is an instance of the Num class:

ghci
...
> 478 :: PortNumber
478

Cheers,
Thomas


On Wed, Apr 10, 2013 at 12:26 AM, Florian Hofmann <
fhofmann at techfak.uni-bielefeld.de> wrote:

> I might be mistaken, but is there a bug in the Show instance of PortNum?
>
>
> λ PortNum 1
> 256
> λ PortNum 2
> 512
> λ PortNum 3
> 768
>
> λ let (PortNum x) = PortNum 10
> λ x
> 10
>
> Tested with network-2.4.1.2
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130410/6a52412b/attachment.htm>


More information about the Haskell-Cafe mailing list