h&      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  Safe-Inferred Safe-InferredipThis is slower that just pattern matching on the Text data constructor. However, it will work with GHCJS. This should only be used in places where we know that it will only be evaluated once.ipThis length is not the character length. It is the length of Word16s required by a UTF16 representation.  Safe-Inferredip,A character in the basic multilingual plane.ip(Default, used when index is out of rangeipTexts to index intosee src/Data/LICENSE experimentalnon-portable (GHC Extensions) Safe-Inferredip12-bit unsigned integer typeip!narrowings represented as primop  in GHC.ipcount leading zerosipcount trailing zerosipthe number of set bits  Safe-Inferred")* +ipCharacters outside the basic multilingual plane are not handled correctly by this function. They will not cause a program to crash; instead, the character will have the upper bits masked out.   Safe-Inferred ")* ip Taken from Data.ByteString.Internal". The same warnings apply here.  Safe-Inferred!016;<<ipThe length should be between 0 and 32. These bounds are inclusive. This expectation is not in any way enforced by this library because it does not cause errors. A mask length greater than 32 will be treated as if it were 32.ipA 32-bit Internet Protocol version 4 address. To use this with the network! library, it is necessary to use Network.Socket.htonl to convert the underlying / from host byte order to network byte order.ipUnboxed variant of . Before GHC 8.10, this is implemented as a type synonym. Portable use of this type requires treating it as though it were opaque. Use ) and *) to convert between this and the lifted .ip Create an  address from four octets. The first argument is the most significant octet. The last argument is the least significant. Since IP addresses are commonly written using dot-decimal notation, this is the recommended way to create an IP address. Additionally, it is used for the  and  instances of & to help keep things readable in GHCi. let addr = IPv4.ipv4 192 168 1 1addripv4 192 168 1 1 getIPv4 addr 3232235777 ipAn alias for the  smart constructor. ipAn uncurried variant of  . ip Convert an  address into a quadruple of octets. The first element in the quadruple is the most significant octet. The last element is the least significant octet. ip%The IP address representing any host.IPv4.any ipv4 0 0 0 0 ipThe local loopback IP address. IPv4.loopbackipv4 127 0 0 1ipA useful and common alias for  .IPv4.localhostipv4 127 0 0 1ipThe broadcast IP address.IPv4.broadcastipv4 255 255 255 255ipChecks to see if the  address belongs to a private network. The three private networks that are checked are  10.0.0.0/8,  172.16.0.0/12, and 192.168.0.0/16.ipChecks to see if the  address belongs to a reserved network. This includes the three private networks that  checks along with several other ranges that are not used on the public Internet. The implementation of this function is optimized.ipChecks to see if the  address is publicly routable.&IPv4.public x == not (IPv4.reserved x)ip Encode an  address to  using dot-decimal notation:1T.putStrLn (IPv4.encode (IPv4.ipv4 192 168 2 47)) 192.168.2.47ip Decode an  address.IPv4.decode "192.168.2.47"Just (ipv4 192 168 2 47)IPv4.decode "10.100.256.256"Nothingip Encode an  address to a text .%IPv4.builder (IPv4.ipv4 192 168 2 47)"192.168.2.47"ip Parse an  address using a .IPv4.reader "192.168.2.47"Right (ipv4 192 168 2 47,"")IPv4.reader "192.168.2.470">Left "All octets in an IPv4 address must be between 0 and 255"ip Parse an  address using a .'AT.parseOnly IPv4.parser "192.168.2.47"Right (ipv4 192 168 2 47)(AT.parseOnly IPv4.parser "192.168.2.470"Left "Failed reading: All octets in an IPv4 address must be between 0 and 255"ip Encode an  address to a UTF-8 encoded .(IPv4.encodeUtf8 (IPv4.ipv4 192 168 2 47)"192.168.2.47"ipDecode a UTF8-encoded  into an .IPv4.decodeUtf8 "192.168.2.47"Just (ipv4 192 168 2 47)Currently not terribly efficient since the implementation re-encodes the argument as UTF-16 text before decoding that IPv4 address from that. PRs to fix this are welcome.ipDecode  as an  address.IPv4.decodeShort "192.168.3.48"Just (ipv4 192 168 3 48)ip Encode an  address as .)IPv4.encodeShort (IPv4.ipv4 192 168 5 99)"192.168.5.99"ipDecode UTF-8-encoded Bytes into an  address.3IPv4.decodeUtf8Bytes (Ascii.fromString "127.0.0.1")Just (ipv4 127 0 0 1)ipParse UTF-8-encoded Bytes as an  address.Parser.parseBytes (IPv4.parserUtf8Bytes ()) (Ascii.fromString "10.0.1.254")Success (Slice {offset = 10, length = 0, value = ipv4 10 0 1 254})ip Variant of  with unboxed result type.ipParse UTF-8-encoded Bytes into an (. This requires the mask to be present.maybe (putStrLn "nope") IPv4.printRange $ Parser.parseBytesMaybe (IPv4.parserRangeUtf8Bytes ()) (Ascii.fromString "192.168.0.0/16")192.168.0.0/16maybe (putStrLn "nope") IPv4.printRange $ Parser.parseBytesMaybe (IPv4.parserRangeUtf8Bytes ()) (Ascii.fromString "10.10.10.1")nopeSee  0 for a variant that treats a missing mask as a /32 mask. ip Variant of  that allows the mask to be omitted. An omitted mask is treated as a /32 mask.maybe (putStrLn "nope") IPv4.printRange $ Parser.parseBytesMaybe (IPv4.parserRangeUtf8BytesLenient ()) (Ascii.fromString "192.168.0.0/16")192.168.0.0/16maybe (putStrLn "nope") IPv4.printRange $ Parser.parseBytesMaybe (IPv4.parserRangeUtf8BytesLenient ()) (Ascii.fromString "10.10.10.1") 10.10.10.1/32!ip Encode an  as a bytestring Builder.toLazyByteString (IPv4.builderUtf8 (IPv4.fromOctets 192 168 2 12))"192.168.2.12""ip Encode an + address as a unbounded byte array builder.Chunks.concat (UB.run 1 (IPv4.byteArrayBuilderUtf8 (IPv4.fromOctets 192 168 2 13)))=[0x31,0x39,0x32,0x2e,0x31,0x36,0x38,0x2e,0x32,0x2e,0x31,0x33](Note that period is encoded by UTF-8 as 0x2e.#ip Encode an ) address as a bounded byte array builder.BB.run Nat.constant (IPv4.boundedBuilderUtf8 (IPv4.fromOctets 192 168 2 14))[0x31, 0x39, 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x32, 0x2e, 0x31, 0x34](Note that period is encoded by UTF-8 as 0x2e.$ipEncode  address to a sequence a 4 bytes with the first byte representing corresponding to the most significant byte in the address.BB.run Nat.constant (IPv4.boundedBuilderOctetsBE (IPv4.fromOctets 0xc0 0xa8 0x02 0x1f))[0xc0, 0xa8, 0x02, 0x1f]%ipEncode  address to a sequence a 4 bytes with the first byte representing corresponding to the least significant byte in the address.BB.run Nat.constant (IPv4.boundedBuilderOctetsLE (IPv4.fromOctets 0xc0 0xa8 0x02 0x1f))[0x1f, 0x02, 0xa8, 0xc0]&ip Parse an  using a .+AB.parseOnly IPv4.parserUtf8 "192.168.2.47"Right (ipv4 192 168 2 47),AB.parseOnly IPv4.parserUtf8 "192.168.2.470"Left "Failed reading: All octets in an ipv4 address must be between 0 and 255"'ip Encode an  as a .(ip Decode an  from a .)ip/Convert an unboxed IPv4 address to a boxed one.*ip/Convert a boxed IPv4 address to an unboxed one.+ip Print an  using the textual encoding.ipRead an IPv4 octet ( 0 <= n <= 255)The input must begin with at least one decimal digit. Input is consumed until a non-digit is reached, the end of the input is reached, or the accumulated value exceeds the maximum bound (255). As with ,, any number of leading zeros are permitted.Optimizations:The  and  functions are avoided in order to avoiding checking the range more than once. This implementation calls  (once) and uses the result for both the range check and the calculation.%The type of the accumulated value is , allowing for a single  call instead of one for each digit. This is possible because the maximum bound (255) is sufficiently less than the maximum bound of . Specifically: #255 * 10 + Char.ord '9' <= maxBound)This implementation does not make use of  UnboxedTuples because the span_ function is part of the internal API. Additional performance could be gained by using this internal API function.ipThis is sort of a misnomer. It takes Word to make dotDecimalParser perform better. This is mostly for internal use. The arguments must all fit in a Word8.ipThis does not do an endOfInput check because it is reused in the range parser implementation.ipI think that this function can be improved. Right now, it always allocates enough space for a fifteen-character text rendering of an IP address. I think that it should be possible to do more of the math upfront and allocate less space.,ipSmart constructor for . Ensures the mask is appropriately sized and sets masked bits in the  to zero.-ipGiven an inclusive lower and upper ip address, create the smallest  that contains the two. This is helpful in situations where input given as a range like 192.168.16.0-192.168.19.255 needs to be handled. This makes the range broader if it cannot be represented in CIDR notation.IPv4.printRange $ IPv4.fromBounds (IPv4.fromOctets 192 168 16 0) (IPv4.fromOctets 192 168 19 255)192.168.16.0/22IPv4.printRange $ IPv4.fromBounds (IPv4.fromOctets 10 0 5 7) (IPv4.fromOctets 10 0 5 14) 10.0.5.0/28.ipChecks to see if an  address belongs in the .#let ip = IPv4.fromOctets 10 10 1 92>IPv4.contains (IPv4.IPv4Range (IPv4.fromOctets 10 0 0 0) 8) ipTrueIPv4.contains (IPv4.IPv4Range (IPv4.fromOctets 10 11 0 0) 16) ipFalseTypically, element-testing functions are written to take the element as the first argument and the set as the second argument. This is intentionally written the other way for better performance when iterating over a collection. For example, you might test elements in a list for membership like this:6let r = IPv4.IPv4Range (IPv4.fromOctets 10 10 10 6) 31mapM_ (P.print . IPv4.contains r) (take 5 $ iterate succ $ IPv4.fromOctets 10 10 10 5)FalseTrueTrueFalseFalseThe implementation of . ensures that (with GHC), the bitmask creation and range normalization only occur once in the above example. They are reused as the list is iterated./ip5This is provided to mirror the interface provided by Data.Set. It behaves just like . but with flipped arguments.&IPv4.member ip r == IPv4.contains r ip0ip The inclusive lower bound of an . This is conventionally understood to be the broadcast address of a subnet. For example:T.putStrLn $ IPv4.encode $ IPv4.lowerInclusive $ IPv4.IPv4Range (IPv4.ipv4 10 10 1 160) 25 10.10.1.128*Note that the lower bound of a normalized ( is simply the ip address of the range:>IPv4.lowerInclusive r == IPv4.ipv4RangeBase (IPv4.normalize r)1ip The inclusive upper bound of an .T.putStrLn $ IPv4.encode $ IPv4.upperInclusive $ IPv4.IPv4Range (IPv4.ipv4 10 10 1 160) 25 10.10.1.2552ip Convert an  into a list of the  addresses that are in it.7let r = IPv4.IPv4Range (IPv4.fromOctets 192 168 1 8) 300mapM_ (T.putStrLn . IPv4.encode) (IPv4.toList r) 192.168.1.8 192.168.1.9 192.168.1.10 192.168.1.113ip'A stream-polymorphic generator over an . For more information, see  http://www.haskellforall.com/2014/11/how-to-build-library-agnostic-streaming.html/How to build library-agnostic streaming sources.4ip'The RFC1918 24-bit block. Subnet mask:  10.0.0.0/85ip'The RFC1918 20-bit block. Subnet mask:  172.16.0.0/126ip'The RFC1918 16-bit block. Subnet mask: 192.168.0.0/167ip Normalize an (. The first result of this is that the  inside the  is changed so that the insignificant bits are zeroed out. For example:IPv4.printRange $ IPv4.normalize $ IPv4.IPv4Range (IPv4.fromOctets 192 168 1 19) 24192.168.1.0/24IPv4.printRange $ IPv4.normalize $ IPv4.IPv4Range (IPv4.fromOctets 192 168 1 163) 28192.168.1.160/28The second effect of this is that the mask length is lowered to be 32 or smaller. Working with s that have not been normalized does not cause any issues for this library, although other applications may reject such ranges (especially those with a mask length above 32). Note that 7 is idempotent, that is:7IPv4.normalize r == (IPv4.normalize . IPv4.normalize) r8ip Encode an  as .;IPv4.encodeRange (IPv4.IPv4Range (IPv4.ipv4 172 16 0 0) 12)"172.16.0.0/12"9ip Decode an  from . IPv4.decodeRange "172.16.0.0/12"Just (IPv4Range {ipv4RangeBase = ipv4 172 16 0 0, ipv4RangeLength = 12})$IPv4.decodeRange "192.168.25.254/16"Just (IPv4Range {ipv4RangeBase = ipv4 192 168 0 0, ipv4RangeLength = 16}):ip Encode an  to a .IPv6.lowerInclusive r == IPv6.ipv6RangeBase (IPv6.normalize r)ip The inclusive upper bound of an `.let addr = IPv6.ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109BT.putStrLn $ IPv6.encode $ IPv6.upperInclusive $ IPv6.IPv6Range addr 25'dead:beff:ffff:ffff:ffff:ffff:ffff:ffffip Print an ` using the textual encoding.ipSmart constructor for `. Ensures the mask is appropriately sized and sets masked bits in the d to zero.let addr = IPv6.ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B$IPv6.printRange $ IPv6.range addr 25dead:be80::/25ipGiven an inclusive lower and upper ip address, create the smallest ` that contains the two. This is helpful in situations where input is given as a range, like  .?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijjklmmn5$ opqrstu&-%')*!ABCE89:;F67vwxyz{|}~ o%-$&'5 !"#%-&'+05                    ip-1.7.6-LkltuNj8Kec7EkWN8EYXKnNet.IPv4Net.IPv6Net.IPNet.MacData.Text.Builder.Common.Compat!Data.Text.Builder.Common.InternalData.Text.Builder.VariableData.Word.Synthetic.Word12Data.Text.Builder.FixedData.ByteString.Builder.Fixed fromOctetsipv4 Net.Types IPv4Range ipv4RangeBaseipv4RangeLengthIPv4getIPv4IPv4#fromTupleOctetstoOctetsanyloopback localhost broadcastprivatereservedpublicencodedecodebuilderreaderparser encodeUtf8 decodeUtf8 decodeShort encodeShortdecodeUtf8BytesparserUtf8BytesparserUtf8Bytes#parserRangeUtf8BytesparserRangeUtf8BytesLenient builderUtf8byteArrayBuilderUtf8boundedBuilderUtf8boundedBuilderOctetsBEboundedBuilderOctetsLE parserUtf8 encodeString decodeStringboxunboxprintrange fromBoundscontainsmemberlowerInclusiveupperInclusivetoList toGenerator private24 private20 private16 normalize encodeRange decodeRange builderRange parserRange printRange$fFromJSONKeyIPv4$fToJSONKeyIPv4$fFromJSONIPv4 $fToJSONIPv4$fVectorVectorIPv4$fMVectorMVectorIPv4 $fUnboxIPv4 $fReadIPv4 $fShowIPv4 $fNFDataIPv4$fVectorVectorIPv4Range$fMVectorMVectorIPv4Range$fUnboxIPv4Range$fFromJSONIPv4Range$fToJSONIPv4Range$fHashableIPv4Range$fNFDataIPv4Range $fEqIPv4Range$fOrdIPv4Range$fShowIPv4Range$fReadIPv4Range$fGenericIPv4Range$fDataIPv4Range $fBitsIPv4 $fBoundedIPv4 $fDataIPv4 $fEnumIPv4$fEqIPv4$fFiniteBitsIPv4 $fGenericIPv4$fHashableIPv4$fIxIPv4 $fOrdIPv4 $fPrimIPv4$fStorableIPv4 IPv6Range ipv6RangeBaseipv6RangeLengthIPv6getIPv6ipv6 fromWord16s toWord16sfromTupleWord16s fromWord32sfromTupleWord32s toWord32s$fFromJSONIPv6 $fToJSONIPv6 $fReadIPv6 $fShowIPv6$fHashableIPv6$fFromJSONIPv6Range$fToJSONIPv6Range$fNFDataIPv6Range $fEqIPv6Range$fOrdIPv6Range$fShowIPv6Range$fReadIPv6Range$fGenericIPv6Range$fDataIPv6Range $fBoundedIPv6 $fEnumIPv6$fEqIPv6 $fOrdIPv6$fStorableIPv6 $fBitsIPv6$fFiniteBitsIPv6 $fNFDataIPv6 $fPrimIPv6$fIxIPv6 $fDataIPv6 $fGenericIPv6IPgetIPcase_fromIPv4fromIPv6isIPv4isIPv6 $fFromJSONIP $fToJSONIP$fReadIP$fShowIP $fNFDataIP$fEqIP$fOrdIP $fGenericIP$fIxIP$fDataIP $fHashableIP MacGroupingMacGroupingPairsMacGroupingTriplesMacGroupingQuadruplesMacGroupingNoSeparatorMacCodecmacCodecGroupingmacCodecUpperCaseMacmac decodeBytes decodeOctets encodeWith decodeWith parserWithdefCodecdecodeWithUtf8parserWithUtf8encodeWithUtf8 $fFromJSONMac$fFromJSONKeyMac$fToJSONKeyMac $fToJSONMac $fEnumMac $fBoundedMac $fReadMac $fShowMac $fPrimMac $fNFDataMac $fEqMacCodec $fOrdMacCodec$fShowMacCodec$fReadMacCodec$fGenericMacCodec$fDataMacCodec$fEqMacGrouping$fOrdMacGrouping$fShowMacGrouping$fReadMacGrouping$fGenericMacGrouping$fDataMacGrouping$fEqMac$fOrdMac $fGenericMac$fIxMac $fDataMac $fHashableMac CodepointportableTextArrayportableTextLengthportableUntext writeString charUtf16SizehexValuesWord12UpperhexValuesWord12LowerhexValuesWord8UpperhexValuesWord8LowertwoDecimalDigitsthreeDecimalDigitscharBmp_vectorBuilderrun contramap staticCharBmpword8Word12 narrow12Word#ghc-primGHC.Primand#clz12#ctz12# popCnt12#W12#fromTextcontramapBuilderword8HexFixedUpperword8HexFixedLowerword12HexFixedUpperword12HexFixedLowerc2wfromByteStringchar8baseGHC.WordWord32GHC.ShowShowGHC.ReadRead text-1.2.5.0Data.Text.InternalTextData.Text.Internal.BuilderData.Text.ReadReader(attoparsec-0.14.4-71LaZYVwF7e8hNWK3nF9jyData.Attoparsec.Text.InternalParserbytestring-0.11.3.1Data.ByteString.Internal ByteString&text-short-0.1.5-47pdwYBqw8IixyiOFqnKOData.Text.Short.Internal ShortText Data.ByteString.Builder.Internal#Data.Attoparsec.ByteString.InternalGHC.BaseString readOctetdecimal GHC.UnicodeisDigit Data.Char digitToIntord GHC.TypesIntGHC.Real fromIntegral fromOctets'dotDecimalParsertoTextPreAllocatedWord8Word64parseOneHexLenientUtf8tryParseWord8Hex