f|]j      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None I 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.^This does not do an endOfInput check because it is reused in the range parser implementation.This is sort of a misnomer. It takes Word32 to make dotDecimalParser probably perform better. This is mostly for internal use.Given the size of the mask, return the total number of ips in the subnet. This only works for IPv4 addresses because an IPv6 subnet can have up to 2^128 addresses.2  !"#$%&'()*+,-./012  !"#$%&'()*+,-./012  "%'$!&(#)*+,-./012  !"#$%&'()*+,-./01None -5<=DIRT4ASCII value of the separator6A 48-bit MAC address.:The 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.>#A 32-bit Internet Protocol address..23456789:;<=>?@ABCDEFGHIJKLMNOPQ23456789:;<=>?@>?@:;<=6789234523456789:;<=>?@ABCDEFGHIJKLMNOPQNonek Create an >~ address from four octets. The first argument is the most significant octet. The last argument is the least significant. Since the  and  instances for >N are not generally usefully, this function is the recommened way to create > addresses. For example:fromOctets 192 168 1 1IPv4 {getIPv4 = 3232235777}l 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.m&The IP address representing any host: 0.0.0.0nThe loopback IP address:  127.0.0.1oThe broadcast IP address: 255.255.255.255pChecks to see if the >Y 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.qChecks to see if the >W address belongs to a reserved network. This includes the three private networks that pS checks along with several other ranges that are not used on the public Internet.rChecks to see if the > address is publicly routable.public x == not (reserved x)klmnopqrklmnopqrklmnopqrklmnopqrNone sChecks to see if an > address belongs in the :.let ip = fromOctets 10 10 1 92/contains (IPv4Range (fromOctets 10 0 0 0) 8) ipTrue1contains (IPv4Range (fromOctets 10 11 0 0) 16) ipFalse/Typically, 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:,let r = IPv4Range (fromOctets 10 10 10 6) 31JmapM_ (print . contains r) (take 5 $ iterate succ $ fromOctets 10 10 10 5)FalseTrueTrueFalseFalseThe implementation of s 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.t5This is provided to mirror the interface provided by Data.Set. It behaves just like s but with flipped arguments.member ip r == contains r ipu The inclusive lower bound of an :\. This is conventionally understood to be the broadcast address of a subnet. For example:@I.print $ lowerInclusive $ IPv4Range (fromOctets 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:/lowerInclusive r == ipv4RangeBase (normalize r)w Convert an : into a list of the > addresses that are in it. >>> let r = IPv4Range (fromOctets 192 168 1 8) 30 >>> mapM_ I.print (toList r) 192.168.1.8 192.168.1.9 192.168.1.10 192.168.1.11y'The RFC1918 24-bit block. Subnet mask:  10.0.0.0/8z'The RFC1918 20-bit block. Subnet mask:  172.16.0.0/12{'The RFC1918 16-bit block. Subnet mask: 192.168.0.0/16| Normalize an :(. The first result of this is that the > inside the :H is changed so that the insignificant bits are zeroed out. For example:<prRange $ normalize $ IPv4Range (fromOctets 192 168 1 19) 24192.168.1.0/24=prRange $ normalize $ IPv4Range (fromOctets 192 168 1 163) 28192.168.1.160/28`The 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 | is idempotent, that is:(normalize r == (normalize . normalize) r}-This only exists for doctests. Do not use it. stuvwxyz{|} stuvwxyz{|} |stuvwxyz{} stuvwxyz{|}None(This exists mostly for testing purposes.~~~~None(This exists mostly for testing purposes.NoneNone'This should be rewritten to not create Text as an intermediate step.This should also be rewritten None5I None None5This is a bad implementation that should be rewritten5This is a bad implementation that should be rewritten   !"#$%&'()*+,-./0123456789:;<=>>?@AABCDDEFGGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ s :;ip-0.8.5-L4Y0NiwW6E2vLmfH9K8RG Net.Internal Net.TypesNet.IPv4Net.IPv4.RangeNet.IPv4.Range.Text Net.IPv4.TextNet.IPv4.StringNet.IPv4.ByteString.Char8Net.Mac Net.Mac.TextNet.Mac.ByteString.Char8eitherToAesonParserattoparsecParseJSON stripDecimaldecodeIPv4TextReaderdecodeIPv4TextEitheripOctetSizeErrorMsg rightToMaybetoDotDecimalTexttoDotDecimalBuilderrangeToDotDecimalTextrangeToDotDecimalBuildertoTextPreAllocated putAndCountputMacmacToTextPreAllocatedzeroi2wfromDotDecimalText'fromDotDecimalTextrangeFromDotDecimalText'rangeFromDotDecimalTextdotDecimalRangeParserdotDecimalParser fromOctets' countAddrswordSuccessorswordSuccessorsMmaskp24p20p16mask4mask8mask10mask12mask15mask16mask20mask24mask28mask32 macTextParser macToTextmacToTextBuilder macFromText macFromText' twoDigits threeDigits twoHexDigitstwoHexDigitsLower MacEncodingmacEncodingSeparatormacEncodingUpperCaseMacmacAmacB IPv4Range ipv4RangeBaseipv4RangeLengthIPv4getIPv4$fVectorVectorMac$fMVectorMVectorMac $fUnboxMac$fVectorVectorIPv4Range$fMVectorMVectorIPv4Range$fUnboxIPv4Range$fVectorVectorIPv4$fMVectorMVectorIPv4 $fUnboxIPv4$fFromJSONIPv4Range$fToJSONIPv4Range$fFromJSONIPv4 $fToJSONIPv4$fHashableIPv4Range $fFromJSONMac $fToJSONMac $fHashableMac$fEqIPv4 $fOrdIPv4 $fShowIPv4 $fReadIPv4 $fEnumIPv4 $fBoundedIPv4$fHashableIPv4 $fGenericIPv4 $fPrimIPv4 $fBitsIPv4 $fEqIPv4Range$fOrdIPv4Range$fShowIPv4Range$fReadIPv4Range$fGenericIPv4Range$fEqMac$fOrdMac $fShowMac $fReadMac $fGenericMac$fEqMacEncoding$fOrdMacEncoding$fShowMacEncoding$fReadMacEncoding$fGenericMacEncoding fromOctetstoOctetsanyloopback broadcastprivatereservedpubliccontainsmemberlowerInclusiveupperInclusivetoList toGenerator private24 private20 private16 normalizeprRangeencode decodeEitherdecodebuilderparserprintreaderfromOctetsNoCast encodeWithV_MacMV_Mac V_IPv4Range MV_IPv4RangeV_IPv4MV_IPv4macFromOctets' mkIPv4RangeD:R:VectorMac0D:R:MVectorsMac0D:R:VectorIPv4Range0D:R:MVectorsIPv4Range0D:R:VectorIPv40D:R:MVectorsIPv40baseGHC.ShowShowGHC.ReadReadtoBSPreAllocated