[Haskell] [ANNOUNCE] network-address-0.2.0

Conrad Parker conrad at metadecks.org
Thu Sep 8 04:19:48 CEST 2011


On 7 September 2011 20:03, Sebastian Nowicki <sebnow at gmail.com> wrote:
> Hi All,
>
> I'm pleased to announce the release of network-address v0.2.0. The
> library provides data structures and textual representation of network
> addresses (IPv4, IPv6, subnets).
>
> Major changes in this release:
>
>  * Revised Address type class (readAddress was moved out of the class,
> readsAddress :: String -> ReadS a was added for better error
> reporting)
>  * Better support for IPv6 parsing (compressed zeroes).
>  * Implementation of RFC5952 (a recommendation for IPv6 text
> representation). Most notably showAddress for IPv6 compresses zeroes.
>
> Example GHCi session:
>
> *Data.Network.Address> let ip = readAddress "2001:db8:0:0:0::1" :: IPv6
> *Data.Network.Address> ip
> IPv6 2306139568115548160 1
> *Data.Network.Address> showAddress ip
> "2001:db8::1"
> *Data.Network.Address> let subnet = readSubnet "2001:db8::1/56" :: IPSubnet IPv6
> *Data.Network.Address> showSubnet subnet
> "2001:db8::/56"
> *Data.Network.Address> ip `member` subnet
> True
>

Hi,

given that readAddress can parse the output of showAddress, and
readSubnet can parse the output of showSubnet, is there any reason not
to use these for the implementation of Show and Read instances?

I notice that currently you deriving Show and Read instances:

-- |The abstract data structure to represent an IPv4 address.
data IPv4 = IPv4 !Word32
            deriving (Eq, Ord, Bounded, Show, Read)

-- |The abstract data structure to represent an IPv6 address.
data IPv6 = IPv6 !Word64 !Word64
            deriving (Eq, Ord, Show, Read)

resulting in strings like "IPv6 2306139568115548160 1" above. I can't
really see a use for that big number representation (other than for
debugging the library...) so why not just use your existing
show*/read* functions?

> Planned for the next release:
>
>  * Support for parsing IPv4 notation embedded in IPv6 (e.g. "::192.168.1.1")

is the result a value of type IPv4 or IPv6? For an IPv4-Compatible
address I'd expect the result to be IPv4. It might also be useful to
add a conversion function to turn an IPv4 address into an IPv4-Mapped
IPv6 address.

cheers,

Conrad.

>  * Performance optimisations - IPv6 parsing/pretty printing is quite
> slow due to zero compression (>2x speed decrease)
>
> The next release will likely be v1.0.0 as there isn't much to add. I'd
> like to keep the API stable in that version, I welcome any feedback
> regarding the API (or otherwise).
>
> Hackage: http://hackage.haskell.org/package/network-address
> GitHub: https://github.com/sebnow/haskell-network-address
>
> Regards,
> Sebastian
>
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>
>



More information about the Haskell mailing list