Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
The abstract data type to express an IPv4 address.
To create this, use toIPv4
. Or use read
"192.0.2.1"
:: IPv4
, for example. Also, "192.0.2.1"
can be used as literal with OverloadedStrings.
>>>
read "192.0.2.1" :: IPv4
192.0.2.1
IP4 IPv4Addr |
The abstract data type to express an IPv6 address.
To create this, use toIPv6
. Or use read
"2001:DB8::1"
:: IPv6
, for example. Also, "2001:DB8::1"
can be used as literal with OverloadedStrings.
>>>
read "2001:db8:00:00:00:00:00:01" :: IPv6
2001:db8::1>>>
read "2001:db8:11e:c00::101" :: IPv6
2001:db8:11e:c00::101>>>
read "2001:db8:11e:c00:aa:bb:192.0.2.1" :: IPv6
2001:db8:11e:c00:aa:bb:c000:201>>>
read "2001:db8::192.0.2.1" :: IPv6
2001:db8::c000:201>>>
read "0::ffff:192.0.2.1" :: IPv6
::ffff:192.0.2.1>>>
read "0::0:c000:201" :: IPv6
::192.0.2.1>>>
read "::0.0.0.1" :: IPv6
::1
IP6 IPv6Addr |
The Addr range consists of an address, a contiguous mask, and mask length. The contiguous mask and the mask length are essentially same information but contained for pre calculation.
To create this, use makeAddrRange
or read
"192.0.2.0/24"
:: AddrRange
IPv4
.
Also, "192.0.2.0/24"
can be used as literal with OverloadedStrings.
>>>
read "192.0.2.1/24" :: AddrRange IPv4
192.0.2.0/24>>>
read "2001:db8:00:00:00:00:00:01/48" :: AddrRange IPv6
2001:db8::/48