-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library for IP and MAC addresses -- -- The ip package provides types and functions for dealing with -- IPv4 addresses, CIDR blocks, and MAC addresses. We provide instances -- for typeclasses found in commonly used packages like aeson, -- vector, and hashable. We also provide Parsers for -- working with attoparsec. -- -- Notably, this package does not overload functions by introducing any -- typeclasses of its own. Neither does it prefix functions with the name -- of the type that they work on. Instead, functions of the same name are -- exported by several different modules, and it is expected that end -- users disambiguate by importing these modules qualified. -- -- The only module intended to be imported unqualified is -- Net.Types. The types in this package should not conflict with -- the types in any other commonly used packages. -- -- The following packages are intended to be used with this package: -- -- @package ip @version 1.7.4 -- | This module provides the IPv4 data type and functions for working with -- it. module Net.IPv4 -- | Create an IPv4 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 Show and Read instances -- of IPv4 to help keep things readable in GHCi. -- --
--   >>> let addr = ipv4 192 168 1 1
--   
--   >>> addr
--   ipv4 192 168 1 1
--   
--   >>> getIPv4 addr
--   3232235777
--   
ipv4 :: Word8 -> Word8 -> Word8 -> Word8 -> IPv4 -- | An alias for the ipv4 smart constructor. fromOctets :: Word8 -> Word8 -> Word8 -> Word8 -> IPv4 -- | An uncurried variant of fromOctets. fromTupleOctets :: (Word8, Word8, Word8, Word8) -> IPv4 -- | Convert an IPv4 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. toOctets :: IPv4 -> (Word8, Word8, Word8, Word8) -- | The IP address representing any host. -- --
--   >>> any
--   ipv4 0 0 0 0
--   
any :: IPv4 -- | The local loopback IP address. -- --
--   >>> loopback
--   ipv4 127 0 0 1
--   
loopback :: IPv4 -- | A useful and common alias for loopback. -- --
--   >>> localhost
--   ipv4 127 0 0 1
--   
localhost :: IPv4 -- | The broadcast IP address. -- --
--   >>> broadcast
--   ipv4 255 255 255 255
--   
broadcast :: IPv4 -- | Checks to see if the IPv4 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. private :: IPv4 -> Bool -- | Checks to see if the IPv4 address belongs to a reserved -- network. This includes the three private networks that private -- checks along with several other ranges that are not used on the public -- Internet. The implementation of this function is optimized. reserved :: IPv4 -> Bool -- | Checks to see if the IPv4 address is publicly routable. -- --
--   public x == not (reserved x)
--   
public :: IPv4 -> Bool -- | Encode an IPv4 address to Text using dot-decimal -- notation: -- --
--   >>> T.putStrLn (encode (ipv4 192 168 2 47))
--   192.168.2.47
--   
encode :: IPv4 -> Text -- | Decode an IPv4 address. -- --
--   >>> decode "192.168.2.47"
--   Just (ipv4 192 168 2 47)
--   
-- --
--   >>> decode "10.100.256.256"
--   Nothing
--   
decode :: Text -> Maybe IPv4 -- | Encode an IPv4 address to a text Builder. -- --
--   >>> builder (ipv4 192 168 2 47)
--   "192.168.2.47"
--   
builder :: IPv4 -> Builder -- | Parse an IPv4 address using a Reader. -- --
--   >>> reader "192.168.2.47"
--   Right (ipv4 192 168 2 47,"")
--   
-- --
--   >>> reader "192.168.2.470"
--   Left "All octets in an IPv4 address must be between 0 and 255"
--   
reader :: Reader IPv4 -- | Parse an IPv4 address using a Parser. -- --
--   >>> AT.parseOnly parser "192.168.2.47"
--   Right (ipv4 192 168 2 47)
--   
-- --
--   >>> AT.parseOnly parser "192.168.2.470"
--   Left "Failed reading: All octets in an IPv4 address must be between 0 and 255"
--   
parser :: Parser IPv4 -- | Decode ShortText as an IPv4 address. -- --
--   >>> decodeShort "192.168.3.48"
--   Just (ipv4 192 168 3 48)
--   
decodeShort :: ShortText -> Maybe IPv4 -- | Encode an IPv4 address as ShortText. -- --
--   >>> encodeShort (ipv4 192 168 5 99)
--   "192.168.5.99"
--   
encodeShort :: IPv4 -> ShortText -- | Encode an IPv4 address to a UTF-8 encoded ByteString. -- --
--   >>> encodeUtf8 (ipv4 192 168 2 47)
--   "192.168.2.47"
--   
encodeUtf8 :: IPv4 -> ByteString -- | Decode a UTF8-encoded ByteString 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. decodeUtf8 :: ByteString -> Maybe IPv4 -- | Encode an IPv4 as a bytestring Builder -- --
--   >>> Builder.toLazyByteString (builderUtf8 (fromOctets 192 168 2 12))
--   "192.168.2.12"
--   
builderUtf8 :: IPv4 -> Builder -- | Parse an IPv4 using a Parser. -- --
--   >>> AB.parseOnly parserUtf8 "192.168.2.47"
--   Right (ipv4 192 168 2 47)
--   
-- --
--   >>> AB.parseOnly parserUtf8 "192.168.2.470"
--   Left "Failed reading: All octets in an ipv4 address must be between 0 and 255"
--   
parserUtf8 :: Parser IPv4 -- | Decode UTF-8-encoded Bytes into an IPv4 address. -- --
--   >>> decodeUtf8Bytes (Bytes.fromAsciiString "127.0.0.1")
--   Just (ipv4 127 0 0 1)
--   
decodeUtf8Bytes :: Bytes -> Maybe IPv4 -- | Parse UTF-8-encoded Bytes as an IPv4 address. -- --
--   >>> Parser.parseBytes (parserUtf8Bytes ()) (Bytes.fromAsciiString "10.0.1.254")
--   Success (Slice {offset = 10, length = 0, value = ipv4 10 0 1 254})
--   
parserUtf8Bytes :: e -> Parser e s IPv4 -- | Encode an IPv4 address as a unbounded byte array builder. -- --
--   >>> Chunks.concat (UB.run 1 (byteArrayBuilderUtf8 (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. byteArrayBuilderUtf8 :: IPv4 -> Builder -- | Encode an IPv4 address as a bounded byte array builder. -- --
--   >>> BB.run Nat.constant (boundedBuilderUtf8 (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. boundedBuilderUtf8 :: IPv4 -> Builder 15 -- | Encode an IPv4 as a String. encodeString :: IPv4 -> String -- | Decode an IPv4 from a String. decodeString :: String -> Maybe IPv4 -- | Print an IPv4 using the textual encoding. print :: IPv4 -> IO () -- | Smart constructor for IPv4Range. Ensures the mask is -- appropriately sized and sets masked bits in the IPv4 to zero. range :: IPv4 -> Word8 -> IPv4Range -- | Given an inclusive lower and upper ip address, create the smallest -- IPv4Range 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. -- --
--   >>> printRange $ fromBounds (fromOctets 192 168 16 0) (fromOctets 192 168 19 255)
--   192.168.16.0/22
--   
--   >>> printRange $ fromBounds (fromOctets 10 0 5 7) (fromOctets 10 0 5 14)
--   10.0.5.0/28
--   
fromBounds :: IPv4 -> IPv4 -> IPv4Range -- | Normalize an IPv4Range. The first result of this is that the -- IPv4 inside the IPv4Range is changed so that the -- insignificant bits are zeroed out. For example: -- --
--   >>> printRange $ normalize $ IPv4Range (fromOctets 192 168 1 19) 24
--   192.168.1.0/24
--   
--   >>> printRange $ normalize $ IPv4Range (fromOctets 192 168 1 163) 28
--   192.168.1.160/28
--   
-- -- The second effect of this is that the mask length is lowered to be 32 -- or smaller. Working with IPv4Ranges 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 normalize is idempotent, that is: -- --
--   normalize r == (normalize . normalize) r
--   
normalize :: IPv4Range -> IPv4Range -- | Checks to see if an IPv4 address belongs in the -- IPv4Range. -- --
--   >>> let ip = fromOctets 10 10 1 92
--   
--   >>> contains (IPv4Range (fromOctets 10 0 0 0) 8) ip
--   True
--   
--   >>> contains (IPv4Range (fromOctets 10 11 0 0) 16) ip
--   False
--   
-- -- 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) 31
--   
--   >>> mapM_ (P.print . contains r) (take 5 $ iterate succ $ fromOctets 10 10 10 5)
--   False
--   True
--   True
--   False
--   False
--   
-- -- The implementation of contains 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. contains :: IPv4Range -> IPv4 -> Bool -- | This is provided to mirror the interface provided by -- Data.Set. It behaves just like contains but with -- flipped arguments. -- --
--   member ip r == contains r ip
--   
member :: IPv4 -> IPv4Range -> Bool -- | The inclusive lower bound of an IPv4Range. This is -- conventionally understood to be the broadcast address of a subnet. For -- example: -- --
--   >>> T.putStrLn $ encode $ lowerInclusive $ IPv4Range (ipv4 10 10 1 160) 25
--   10.10.1.128
--   
-- -- Note that the lower bound of a normalized IPv4Range is simply -- the ip address of the range: -- --
--   lowerInclusive r == ipv4RangeBase (normalize r)
--   
lowerInclusive :: IPv4Range -> IPv4 -- | The inclusive upper bound of an IPv4Range. -- --
--   >>> T.putStrLn $ encode $ upperInclusive $ IPv4Range (ipv4 10 10 1 160) 25
--   10.10.1.255
--   
upperInclusive :: IPv4Range -> IPv4 -- | Convert an IPv4Range into a list of the IPv4 addresses -- that are in it. -- --
--   >>> let r = IPv4Range (fromOctets 192 168 1 8) 30
--   
--   >>> mapM_ (T.putStrLn . encode) (toList r)
--   192.168.1.8
--   192.168.1.9
--   192.168.1.10
--   192.168.1.11
--   
toList :: IPv4Range -> [IPv4] -- | A stream-polymorphic generator over an IPv4Range. For more -- information, see How to build library-agnostic streaming -- sources. toGenerator :: MonadPlus m => IPv4Range -> m IPv4 -- | The RFC1918 24-bit block. Subnet mask: 10.0.0.0/8 private24 :: IPv4Range -- | The RFC1918 20-bit block. Subnet mask: 172.16.0.0/12 private20 :: IPv4Range -- | The RFC1918 16-bit block. Subnet mask: 192.168.0.0/16 private16 :: IPv4Range -- | Encode an IPv4Range as Text. -- --
--   >>> encodeRange (IPv4Range (ipv4 172 16 0 0) 12)
--   "172.16.0.0/12"
--   
encodeRange :: IPv4Range -> Text -- | Decode an IPv4Range from Text. -- --
--   >>> decodeRange "172.16.0.0/12"
--   Just (IPv4Range {ipv4RangeBase = ipv4 172 16 0 0, ipv4RangeLength = 12})
--   
--   >>> decodeRange "192.168.25.254/16"
--   Just (IPv4Range {ipv4RangeBase = ipv4 192 168 0 0, ipv4RangeLength = 16})
--   
decodeRange :: Text -> Maybe IPv4Range -- | Encode an IPv4Range to a Builder. -- --
--   >>> builderRange (IPv4Range (ipv4 172 16 0 0) 12)
--   "172.16.0.0/12"
--   
builderRange :: IPv4Range -> Builder -- | Parse an IPv4Range using a Parser. -- --
--   >>> AT.parseOnly parserRange "192.168.25.254/16"
--   Right (IPv4Range {ipv4RangeBase = ipv4 192 168 0 0, ipv4RangeLength = 16})
--   
parserRange :: Parser IPv4Range -- | Print an IPv4Range. Helper function that exists mostly for -- testing purposes. printRange :: IPv4Range -> IO () -- | Parse UTF-8-encoded Bytes into an IPv4Range. This -- requires the mask to be present. -- --
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8Bytes ()) (Bytes.fromAsciiString "192.168.0.0/16")
--   192.168.0.0/16
--   
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8Bytes ()) (Bytes.fromAsciiString "10.10.10.1")
--   nope
--   
-- -- See parserRangeUtf8BytesLenient for a variant that treats a -- missing mask as a /32 mask. parserRangeUtf8Bytes :: e -> Parser e s IPv4Range -- | Variant of parserRangeUtf8Bytes that allows the mask to be -- omitted. An omitted mask is treated as a /32 mask. -- --
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8BytesLenient ()) (Bytes.fromAsciiString "192.168.0.0/16")
--   192.168.0.0/16
--   
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8BytesLenient ()) (Bytes.fromAsciiString "10.10.10.1")
--   10.10.10.1/32
--   
parserRangeUtf8BytesLenient :: e -> Parser e s IPv4Range -- | A 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 Word32 -- from host byte order to network byte order. newtype IPv4 IPv4 :: Word32 -> IPv4 [getIPv4] :: IPv4 -> Word32 -- | Unboxed variant of IPv4. 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 box and unbox to convert -- between this and the lifted IPv4. type IPv4# = Word# -- | 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. data IPv4Range IPv4Range :: {-# UNPACK #-} !IPv4 -> {-# UNPACK #-} !Word8 -> IPv4Range [ipv4RangeBase] :: IPv4Range -> {-# UNPACK #-} !IPv4 [ipv4RangeLength] :: IPv4Range -> {-# UNPACK #-} !Word8 -- | Convert an unboxed IPv4 address to a boxed one. box :: IPv4# -> IPv4 -- | Convert a boxed IPv4 address to an unboxed one. unbox :: IPv4 -> IPv4# -- | Variant of parserUtf8Bytes with unboxed result type. parserUtf8Bytes# :: e -> Parser e s IPv4# instance Foreign.Storable.Storable Net.IPv4.IPv4 instance Data.Primitive.Types.Prim Net.IPv4.IPv4 instance GHC.Classes.Ord Net.IPv4.IPv4 instance GHC.Ix.Ix Net.IPv4.IPv4 instance Data.Hashable.Class.Hashable Net.IPv4.IPv4 instance GHC.Generics.Generic Net.IPv4.IPv4 instance Data.Bits.FiniteBits Net.IPv4.IPv4 instance GHC.Classes.Eq Net.IPv4.IPv4 instance GHC.Enum.Enum Net.IPv4.IPv4 instance Data.Data.Data Net.IPv4.IPv4 instance GHC.Enum.Bounded Net.IPv4.IPv4 instance Data.Bits.Bits Net.IPv4.IPv4 instance Data.Data.Data Net.IPv4.IPv4Range instance GHC.Generics.Generic Net.IPv4.IPv4Range instance GHC.Read.Read Net.IPv4.IPv4Range instance GHC.Show.Show Net.IPv4.IPv4Range instance GHC.Classes.Ord Net.IPv4.IPv4Range instance GHC.Classes.Eq Net.IPv4.IPv4Range instance Control.DeepSeq.NFData Net.IPv4.IPv4Range instance Data.Hashable.Class.Hashable Net.IPv4.IPv4Range instance Data.Aeson.Types.ToJSON.ToJSON Net.IPv4.IPv4Range instance Data.Aeson.Types.FromJSON.FromJSON Net.IPv4.IPv4Range instance Data.Vector.Unboxed.Base.Unbox Net.IPv4.IPv4Range instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Net.IPv4.IPv4Range instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Net.IPv4.IPv4Range instance Control.DeepSeq.NFData Net.IPv4.IPv4 instance GHC.Show.Show Net.IPv4.IPv4 instance GHC.Read.Read Net.IPv4.IPv4 instance Data.Vector.Unboxed.Base.Unbox Net.IPv4.IPv4 instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Net.IPv4.IPv4 instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Net.IPv4.IPv4 instance Data.Aeson.Types.ToJSON.ToJSON Net.IPv4.IPv4 instance Data.Aeson.Types.FromJSON.FromJSON Net.IPv4.IPv4 instance Data.Aeson.Types.ToJSON.ToJSONKey Net.IPv4.IPv4 instance Data.Aeson.Types.FromJSON.FromJSONKey Net.IPv4.IPv4 -- | This module provides the IPv6 data type and functions for working with -- it. module Net.IPv6 -- | Create an IPv6 address from the eight 16-bit fragments that -- make it up. This closely resembles the standard IPv6 notation, so is -- used for the Show instance. Note that this lacks the formatting -- feature for suppress zeroes in an IPv6 address, but it should -- be readable enough for hacking in GHCi. -- --
--   >>> let addr = ipv6 0x3124 0x0 0x0 0xDEAD 0xCAFE 0xFF 0xFE00 0x1
--   
--   >>> addr
--   ipv6 0x3124 0x0000 0x0000 0xdead 0xcafe 0x00ff 0xfe00 0x0001
--   
--   >>> T.putStrLn (encode addr)
--   3124::dead:cafe:ff:fe00:1
--   
ipv6 :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IPv6 -- | This could be useful for the rare occasion in which one could -- construct an IPv6 from octets. -- -- Note that while Net.IPv4.fromOctets = -- Net.IPv4.ipv4, Net.IPv6.fromOctets /= -- Net.IPv6.ipv6. While this should be obvious from their types, it -- is worth mentioning since the similarity in naming might be confusing. fromOctets :: Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> IPv6 -- | An alias for the ipv6 smart constructor. fromWord16s :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IPv6 -- | Build an IPv6 from four 32-bit words. The leftmost argument is -- the high word and the rightword is the low word. fromWord32s :: Word32 -> Word32 -> Word32 -> Word32 -> IPv6 -- | Uncurried variant of fromWord16s. fromTupleWord16s :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> IPv6 -- | Uncurried variant of fromWord32s. fromTupleWord32s :: (Word32, Word32, Word32, Word32) -> IPv6 -- | Convert an IPv6 to eight 16-bit words. toWord16s :: IPv6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -- | Convert an IPv6 to four 32-bit words. toWord32s :: IPv6 -> (Word32, Word32, Word32, Word32) -- | The IP address representing any host. -- --
--   >>> any
--   ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
--   
any :: IPv6 -- | The local loopback IP address. -- --
--   >>> loopback
--   ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001
--   
loopback :: IPv6 -- | A useful alias for loopback. -- --
--   >>> localhost
--   ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001
--   
localhost :: IPv6 -- | Encodes the IPv6 address using zero-compression on the leftmost -- longest string of zeroes in the address. Per RFC 5952 Section -- 5, this uses mixed notation when encoding an IPv4-mapped IPv6 -- address: -- --
--   >>> T.putStrLn $ encode $ fromWord16s 0xDEAD 0xBEEF 0x0 0x0 0x0 0x0 0x0 0x1234
--   dead:beef::1234
--   
--   >>> T.putStrLn $ encode $ fromWord16s 0x0 0x0 0x0 0x0 0x0 0xFFFF 0x6437 0xA5B4
--   ::ffff:100.55.165.180
--   
--   >>> T.putStrLn $ encode $ fromWord16s 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
--   ::
--   
-- -- Per Section 4.2.2 of the same RFC, this does not use -- :: to shorten a single 16-bit 0 field. Only runs of multiple -- 0 fields are considered. encode :: IPv6 -> Text -- | Encodes the IPv6 address as ShortText using -- zero-compression on the leftmost longest string of zeroes in the -- address. Per RFC 5952 Section 5, this uses mixed notation when -- encoding an IPv4-mapped IPv6 address. -- --
--   >>> encodeShort $ fromWord16s 0xDEAD 0xBEEF 0x0 0x0 0x0 0x0ABC 0x0 0x1234
--   "dead:beef::abc:0:1234"
--   
encodeShort :: IPv6 -> ShortText -- | Decode an IPv6 address. This accepts both standard IPv6 -- notation (with zero compression) and mixed notation for IPv4-mapped -- IPv6 addresses. For a decoding function that additionally accepts -- dot-decimal-encoded IPv4 addresses, see Net.IP.decode. decode :: Text -> Maybe IPv6 -- | Decode ShortText as an IPv6 address. -- --
--   >>> decodeShort "ffff::2:b"
--   Just (ipv6 0xffff 0x0000 0x0000 0x0000 0x0000 0x0000 0x0002 0x000b)
--   
decodeShort :: ShortText -> Maybe IPv6 -- | Parse an IPv6 using Parser. -- --
--   >>> Atto.parseOnly parser (Text.pack "dead:beef:3240:a426:ba68:1cd0:4263:109b")
--   Right (ipv6 0xdead 0xbeef 0x3240 0xa426 0xba68 0x1cd0 0x4263 0x109b)
--   
parser :: Parser IPv6 -- | Parse UTF-8-encoded Bytes as an IPv6 address. This -- accepts both uppercase and lowercase characters in the hexadecimal -- components. -- --
--   >>> let str = "dead:beef:3240:a426:ba68:1cd0:4263:109b -> alive"
--   
--   >>> Parser.parseBytes (parserUtf8Bytes ()) (Bytes.fromAsciiString str)
--   Success (Slice {offset = 39, length = 9, value = ipv6 0xdead 0xbeef 0x3240 0xa426 0xba68 0x1cd0 0x4263 0x109b})
--   
-- -- This does not currently support parsing embedded IPv4 address (e.g. -- ff00:8000:abc::224.1.2.3). parserUtf8Bytes :: e -> Parser e s IPv6 -- | Decode UTF-8-encoded Bytes into an IPv6 address. -- --
--   >>> decodeUtf8Bytes (Bytes.fromAsciiString "::cab:1")
--   Just (ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0cab 0x0001)
--   
decodeUtf8Bytes :: Bytes -> Maybe IPv6 -- | Encodes the IPv6 address using zero-compression on the leftmost -- longest string of zeroes in the address. -- --
--   >>> BB.run Nat.constant $ boundedBuilderUtf8 $ fromWord16s 0xDEAD 0xBEEF 0x0 0x0 0x0 0x0 0x0 0x1234
--   [0x64, 0x65, 0x61, 0x64, 0x3a, 0x62, 0x65, 0x65, 0x66, 0x3a, 0x3a, 0x31, 0x32, 0x33, 0x34]
--   
boundedBuilderUtf8 :: IPv6 -> Builder 39 -- | Print an IPv6 using the textual encoding. print :: IPv6 -> IO () -- | Smart constructor for IPv6Range. Ensures the mask is -- appropriately sized and sets masked bits in the IPv6 to zero. -- --
--   >>> let addr = ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
--   
--   >>> printRange $ range addr 25
--   dead:be80::/25
--   
range :: IPv6 -> Word8 -> IPv6Range -- | Given an inclusive lower and upper ip address, create the smallest -- IPv6Range that contains the two. This is helpful in situations -- where input is given as a range, like . -- -- This makes the range broader if it cannot be represented in -- CIDR notation. -- --
--   >>> addrLower = ipv6 0xDEAD 0xBE80 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
--   
--   >>> addrUpper = ipv6 0xDEAD 0xBEFF 0xFFFF 0xFFFF 0xFFFF 0xFFFF 0xFFFF 0xFFFF
--   
--   >>> printRange $ fromBounds addrLower addrUpper
--   dead:be80::/25
--   
fromBounds :: IPv6 -> IPv6 -> IPv6Range -- | Normalize an IPv6Range. The first result of this is that the -- IPv6 inside the IPv6Range is changed so that the -- insignificant bits are zeroed out. For example: -- --
--   >>> addr1 = ipv6 0x0192 0x0168 0x0001 0x0019 0x0000 0x0000 0x0000 0x0000
--   
--   >>> addr2 = ipv6 0x0192 0x0168 0x0001 0x0163 0x0000 0x0000 0x0000 0x0000
--   
--   >>> printRange $ normalize $ IPv6Range addr1 24
--   192:100::/24
--   
--   >>> printRange $ normalize $ IPv6Range addr2 28
--   192:160::/28
--   
-- -- The second effect of this is that the mask length is lowered to be 128 -- or smaller. Working with IPv6Ranges 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 128). -- -- Note that 'normalize is idempotent, that is: -- --
--   normalize r == (normalize . normalize) r
--   
normalize :: IPv6Range -> IPv6Range -- | Checks to see if an IPv6 address belongs in the -- IPv6Range. -- --
--   >>> let ip = ipv6 0x2001 0x0db8 0x0db8 0x1094 0x2051 0x0000 0x0000 0x0001
--   
--   >>> let iprange mask = IPv6Range (ipv6 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001) mask
--   
--   >>> contains (iprange 8) ip
--   True
--   
--   >>> contains (iprange 48) ip
--   False
--   
-- -- 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 = IPv6Range (ipv6 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001) 64
--   
--   >>> fmap (contains r) (take 5 $ iterate succ $ ipv6 0x2001 0x0db8 0x0000 0x0000 0xffff 0xffff 0xffff 0xfffe)
--   [True,True,False,False,False]
--   
-- -- The implementation of contains 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. contains :: IPv6Range -> IPv6 -> Bool -- | This is provided to mirror the interface provided by -- Data.Set. It behaves just like contains but with -- flipped arguments. -- --
--   member ip r == contains r ip
--   
member :: IPv6 -> IPv6Range -> Bool -- | The inclusive lower bound of an IPv6Range. This is -- conventionally understood to be the broadcast address of a subnet. For -- example: -- --
--   >>> T.putStrLn $ encode $ lowerInclusive $ IPv6Range (ipv6 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001) 25
--   2001:d80::
--   
-- -- Note that the lower bound of a normalized IPv6Range is simply -- the ip address of the range: -- --
--   lowerInclusive r == ipv6RangeBase (normalize r)
--   
lowerInclusive :: IPv6Range -> IPv6 -- | The inclusive upper bound of an IPv6Range. -- --
--   >>> let addr = ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
--   
--   >>> T.putStrLn $ encode $ upperInclusive $ IPv6Range addr 25
--   dead:beff:ffff:ffff:ffff:ffff:ffff:ffff
--   
upperInclusive :: IPv6Range -> IPv6 -- | Encode an IPv6Range as Text. -- --
--   >>> addr = ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
--   
--   >>> T.putStrLn $ encodeRange $ IPv6Range addr 28
--   dead:beef:3240:a426:ba68:1cd0:4263:109b/28
--   
encodeRange :: IPv6Range -> Text -- | Decode an IPv6Range from Text. -- --
--   >>> addr = ipv6 0xDEAD 0xBEEF 0x3240 0xA426 0xBA68 0x1CD0 0x4263 0x109B
--   
--   >>> fmap encodeRange $ decodeRange (Text.pack "dead:beef:3240:a426:ba68:1cd0:4263:109b/28")
--   Just "dead:bee0::/28"
--   
decodeRange :: Text -> Maybe IPv6Range -- | Parse an IPv6Range using a Parser. parserRange :: Parser IPv6Range -- | Print an IPv6Range using the textual encoding. printRange :: IPv6Range -> IO () -- | Parse UTF-8-encoded Bytes into an IPv4Range. This -- requires the mask to be present. -- --
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8Bytes ()) (Bytes.fromAsciiString "1b02:f001:5:200b::/80")
--   1b02:f001:5:200b::/80
--   
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8Bytes ()) (Bytes.fromAsciiString "abcd::")
--   nope
--   
-- -- See parserRangeUtf8BytesLenient for a variant that treats a -- missing mask as a /32 mask. parserRangeUtf8Bytes :: e -> Parser e s IPv6Range -- | Variant of parserRangeUtf8Bytes that allows the mask to be -- omitted. An omitted mask is treated as a /128 mask. -- --
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8BytesLenient ()) (Bytes.fromAsciiString "1b02:f001:5:200b::/80")
--   1b02:f001:5:200b::/80
--   
--   >>> maybe (putStrLn "nope") printRange $ Parser.parseBytesMaybe (parserRangeUtf8BytesLenient ()) (Bytes.fromAsciiString "abcd::")
--   abcd::/128
--   
parserRangeUtf8BytesLenient :: e -> Parser e s IPv6Range -- | A 128-bit Internet Protocol version 6 address. newtype IPv6 IPv6 :: Word128 -> IPv6 [getIPv6] :: IPv6 -> Word128 -- | An IPv6Range. It is made up of the first IPv6 in the -- range and its length. data IPv6Range IPv6Range :: {-# UNPACK #-} !IPv6 -> {-# UNPACK #-} !Word8 -> IPv6Range [ipv6RangeBase] :: IPv6Range -> {-# UNPACK #-} !IPv6 [ipv6RangeLength] :: IPv6Range -> {-# UNPACK #-} !Word8 instance Data.Data.Data Net.IPv6.IPv6 instance GHC.Ix.Ix Net.IPv6.IPv6 instance Data.Primitive.Types.Prim Net.IPv6.IPv6 instance Control.DeepSeq.NFData Net.IPv6.IPv6 instance Data.Bits.FiniteBits Net.IPv6.IPv6 instance Data.Bits.Bits Net.IPv6.IPv6 instance Foreign.Storable.Storable Net.IPv6.IPv6 instance GHC.Classes.Ord Net.IPv6.IPv6 instance GHC.Classes.Eq Net.IPv6.IPv6 instance GHC.Enum.Enum Net.IPv6.IPv6 instance GHC.Enum.Bounded Net.IPv6.IPv6 instance Data.Data.Data Net.IPv6.IPv6Range instance GHC.Generics.Generic Net.IPv6.IPv6Range instance GHC.Read.Read Net.IPv6.IPv6Range instance GHC.Show.Show Net.IPv6.IPv6Range instance GHC.Classes.Ord Net.IPv6.IPv6Range instance GHC.Classes.Eq Net.IPv6.IPv6Range instance Control.DeepSeq.NFData Net.IPv6.IPv6Range instance Data.Aeson.Types.ToJSON.ToJSON Net.IPv6.IPv6Range instance Data.Aeson.Types.FromJSON.FromJSON Net.IPv6.IPv6Range instance GHC.Show.Show Net.IPv6.IPv6 instance GHC.Read.Read Net.IPv6.IPv6 instance Data.Aeson.Types.ToJSON.ToJSON Net.IPv6.IPv6 instance Data.Aeson.Types.FromJSON.FromJSON Net.IPv6.IPv6 -- | An IP data type representing either an IPv4 address or an IPv6 -- address. The user can think of this as though it were a sum type. -- However, to minimize indirections, it is actually implemented as an -- IPv6 address, with IPv4 addresses being represented as -- an IPv4-mapped IPv6 addresses: -- --
--   +---------+---------+--------------+
--   | 80 bits | 16 bits | 32 bits      |
--   +---------+---------+--------------+
--   | 00...00 | FFFF    | IPv4 address |
--   +---------+---------+--------------+
--   
-- -- All functions and instance methods that deal with textual conversion -- will encode an IP using either dot-decimal notation (for IPv4) -- or RFC 5952 (for IPv6). They will decode an IP from either -- format as well. The Show instance presents an address in as -- valid haskell code that resembles the formatted address: -- --
--   >>> decode "192.168.3.100"
--   Just (ipv4 192 168 3 100)
--   
--   >>> decode "A3F5:12:F26::1466:8B91"
--   Just (ipv6 0xa3f5 0x0012 0x0f26 0x0000 0x0000 0x0000 0x1466 0x8b91)
--   
module Net.IP -- | Run a function over an IP depending on its status as an -- IPv4 or IPv6. -- --
--   >>> case_ IPv4.encode IPv6.encode (ipv4 192 168 2 47)
--   "192.168.2.47"
--   
-- --
--   >>> addr = ipv6 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001
--   
--   >>> case_ IPv4.encode IPv6.encode addr
--   "2001:db8::1"
--   
case_ :: (IPv4 -> a) -> (IPv6 -> a) -> IP -> a -- | Is the IP an IPv4 address? -- --
--   >>> isIPv4 (ipv4 10 0 0 25)
--   True
--   
-- --
--   >>> isIPv4 (ipv6 0x3124 0x0 0x0 0xDEAD 0xCAFE 0xFF 0xFE00 0x1)
--   False
--   
isIPv4 :: IP -> Bool -- | Is the IP an IPv6 address? -- --
--   >>> isIPv6 (ipv4 10 0 0 25)
--   False
--   
-- --
--   >>> isIPv6 (ipv6 0x3124 0x0 0x0 0xDEAD 0xCAFE 0xFF 0xFE00 0x1)
--   True
--   
isIPv6 :: IP -> Bool -- | Construct an IP address from the four octets of an IPv4 -- address. ipv4 :: Word8 -> Word8 -> Word8 -> Word8 -> IP -- | Construct an IP address from the eight 16-bit chunks of an IPv6 -- address. ipv6 :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IP -- | Turn an IPv4 into an IP. fromIPv4 :: IPv4 -> IP -- | Turn an IPv6 into an IP. fromIPv6 :: IPv6 -> IP -- | Encode an IP as Text. -- --
--   >>> encode (ipv4 10 0 0 25)
--   "10.0.0.25"
--   
-- --
--   >>> encode (ipv6 0x3124 0x0 0x0 0xDEAD 0xCAFE 0xFF 0xFE00 0x1)
--   "3124::dead:cafe:ff:fe00:1"
--   
encode :: IP -> Text -- | Encode an IP as ShortText. -- --
--   >>> encodeShort (ipv4 10 0 1 26)
--   "10.0.1.26"
--   
-- --
--   >>> encodeShort (ipv6 0x3124 0x0 0x0 0xDEAD 0xCAFE 0xFF 0xFE01 0x0000)
--   "3124::dead:cafe:ff:fe01:0"
--   
encodeShort :: IP -> ShortText -- | Decode an IP from Text. -- --
--   >>> decode "10.0.0.25"
--   Just (ipv4 10 0 0 25)
--   
-- --
--   >>> fmap isIPv4 (decode "10.0.0.25")
--   Just True
--   
-- --
--   >>> decode "3124::dead:cafe:ff:fe00:1"
--   Just (ipv6 0x3124 0x0000 0x0000 0xdead 0xcafe 0x00ff 0xfe00 0x0001)
--   
-- --
--   >>> fmap isIPv6 (decode "3124::dead:cafe:ff:fe00:1")
--   Just True
--   
decode :: Text -> Maybe IP -- | Decode an IP from ShortText. -- --
--   >>> decodeShort "10.0.0.25"
--   Just (ipv4 10 0 0 25)
--   
--   >>> decodeShort "::dead:cafe"
--   Just (ipv6 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0xdead 0xcafe)
--   
decodeShort :: ShortText -> Maybe IP -- | Encode an IP as a bounded bytearray builder. -- --
--   >>> BB.run Nat.constant (boundedBuilderUtf8 (ipv4 192 168 2 14))
--   [0x31, 0x39, 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x32, 0x2e, 0x31, 0x34]
--   
boundedBuilderUtf8 :: IP -> Builder 39 -- | Decode UTF-8-encoded Bytes into an IP address. decodeUtf8Bytes :: Bytes -> Maybe IP -- | Parse UTF-8-encoded Bytes as an IP address. parserUtf8Bytes :: e -> Parser e s IP -- | Print an IP using the textual encoding. This exists mostly for -- debugging purposes. -- --
--   >>> print (ipv4 10 0 0 25)
--   10.0.0.25
--   
-- --
--   >>> print (ipv6 0x3124 0x0 0x0 0xDEAD 0xCAFE 0xFF 0xFE00 0x1)
--   3124::dead:cafe:ff:fe00:1
--   
print :: IP -> IO () -- | A 32-bit IPv4 address or a 128-bit IPv6 address. -- Internally, this is just represented as an IPv6 address. The -- functions provided in Net.IP help simulate constructing and -- pattern matching on values of this type. All functions and typeclass -- methods that convert IP values to text will display it as an -- IPv4 address if possible. newtype IP IP :: IPv6 -> IP [getIP] :: IP -> IPv6 instance Data.Data.Data Net.IP.IP instance GHC.Ix.Ix Net.IP.IP instance GHC.Generics.Generic Net.IP.IP instance GHC.Classes.Ord Net.IP.IP instance GHC.Classes.Eq Net.IP.IP instance Control.DeepSeq.NFData Net.IP.IP instance GHC.Show.Show Net.IP.IP instance GHC.Read.Read Net.IP.IP instance Data.Aeson.Types.ToJSON.ToJSON Net.IP.IP instance Data.Aeson.Types.FromJSON.FromJSON Net.IP.IP -- | This module provides the Mac data type and functions for working with -- it. module Net.Mac -- | Construct a Mac address from a Word64. Only the lower 48 -- bits are used. mac :: Word64 -> Mac -- | Create a Mac address from six octets. fromOctets :: Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Mac -- | Convert a Mac address to the six octets that make it up. This -- function and fromOctets are inverses: -- --
--   m == (let (a,b,c,d,e,f) = toOctets m in fromOctets a b c d e f)
--   
toOctets :: Mac -> (Word8, Word8, Word8, Word8, Word8, Word8) -- | Encode a Mac address using the default MacCodec -- defCodec. -- --
--   >>> T.putStrLn (encode (Mac 0xA47F247AB423))
--   a4:7f:24:7a:b4:23
--   
encode :: Mac -> Text -- | Encode a Mac address using the given MacCodec. -- --
--   >>> m = Mac 0xA47F247AB423
--   
--   >>> T.putStrLn $ encodeWith defCodec m
--   a4:7f:24:7a:b4:23
--   
-- --
--   >>> T.putStrLn $ encodeWith (MacCodec (MacGroupingTriples '-') True) m
--   A47-F24-7AB-423
--   
encodeWith :: MacCodec -> Mac -> Text -- | Decode a Mac address using the default MacCodec -- defCodec. -- --
--   >>> decode (Text.pack "a4:7f:24:7a:b4:23")
--   Just (mac 0xa47f247ab423)
--   
-- --
--   >>> decode (Text.pack "a47-f24-7ab-423")
--   Nothing
--   
decode :: Text -> Maybe Mac -- | Decode a Mac address from Text using the given -- MacCodec. -- --
--   >>> decodeWith defCodec (Text.pack "a4:7f:24:7a:b4:23")
--   Just (mac 0xa47f247ab423)
--   
-- --
--   >>> decodeWith (MacCodec MacGroupingNoSeparator False) (Text.pack "a47f247ab423")
--   Just (mac 0xa47f247ab423)
--   
decodeWith :: MacCodec -> Text -> Maybe Mac -- | Encode a Mac address as a Builder. builder :: Mac -> Builder -- | Parse a Mac address using a Parser. -- --
--   >>> AT.parseOnly parser (Text.pack "a4:7f:24:7a:b4:23")
--   Right (mac 0xa47f247ab423)
--   
-- --
--   >>> AT.parseOnly parser (Text.pack "a47-f24-7ab-423")
--   Left "':': Failed reading: satisfy"
--   
parser :: Parser Mac -- | Parser a Mac address using the given MacCodec. -- --
--   >>> p1 = parserWith defCodec
--   
--   >>> AT.parseOnly p1 (Text.pack "a4:7f:24:7a:b4:23")
--   Right (mac 0xa47f247ab423)
--   
-- --
--   >>> p2 = parserWith (MacCodec MacGroupingNoSeparator False)
--   
--   >>> AT.parseOnly p2 (Text.pack "a47f247ab423")
--   Right (mac 0xa47f247ab423)
--   
parserWith :: MacCodec -> Parser Mac -- | Encode a Mac address as colon-separated hexadecimal octets, -- preferring lowercase for alphabetical characters. encodeShort :: Mac -> ShortText -- | Encode a Mac address using the default MacCodec -- defCodec. -- --
--   >>> BC.putStrLn (encodeUtf8 (mac 0x64255A0F2C47))
--   64:25:5a:0f:2c:47
--   
encodeUtf8 :: Mac -> ByteString -- | Encode a Mac address as a ByteString using the given -- MacCodec. -- --
--   >>> m = Mac 0xA47F247AB423
--   
--   >>> BC.putStrLn $ encodeWithUtf8 defCodec m
--   a4:7f:24:7a:b4:23
--   
-- --
--   >>> BC.putStrLn $ encodeWithUtf8 (MacCodec (MacGroupingTriples '-') True) m
--   A47-F24-7AB-423
--   
encodeWithUtf8 :: MacCodec -> Mac -> ByteString -- | Lenient decoding of MAC address that accepts lowercase, uppercase, and -- any kind of separator. -- --
--   >>> decodeUtf8 "A2:DE:AD:BE:EF:67"
--   Just (mac 0xa2deadbeef67)
--   
--   >>> decodeUtf8 "13-a2-fe-a4-17-96"
--   Just (mac 0x13a2fea41796)
--   
--   >>> decodeUtf8 "0A42.47BA.67C2"
--   Just (mac 0x0a4247ba67c2)
--   
decodeUtf8 :: ByteString -> Maybe Mac -- | Decode a ByteString as a Mac address using the given -- MacCodec. -- --
--   >>> decodeWithUtf8 defCodec (BC.pack "64:25:5a:0f:2c:47")
--   Just (mac 0x64255a0f2c47)
--   
-- --
--   >>> decodeWithUtf8 (MacCodec MacGroupingNoSeparator False) (BC.pack "64255a0f2c47")
--   Just (mac 0x64255a0f2c47)
--   
decodeWithUtf8 :: MacCodec -> ByteString -> Maybe Mac -- | Make a bytestring builder from a Mac address using a colon as -- the separator. builderUtf8 :: Mac -> Builder -- | Lenient parser for a Mac address using any character as the -- separator and accepting any digit grouping (i.e. -- FA:43:B2:C0:0F:99 or A065.647B.87FA). parserUtf8 :: Parser Mac -- | Parser for a Mac address using the provided settings. parserWithUtf8 :: MacCodec -> Parser Mac -- | This function is deprecated. It will be renamed in a future release -- since the name is misleading. -- | Deprecated: Prefer decodeOctets decodeBytes :: ByteString -> Maybe Mac -- | Decode a Mac address from a ByteString. Each byte is -- interpreted as an octet of the Mac address. Consequently, -- ByteStrings of length 6 successfully decode, and all other -- ByteStrings fail to decode. -- --
--   >>> decodeOctets (B.pack [0x6B,0x47,0x18,0x90,0x55,0xC3])
--   Just (mac 0x6b47189055c3)
--   
--   >>> decodeOctets (B.replicate 6 0x3A)
--   Just (mac 0x3a3a3a3a3a3a)
--   
--   >>> decodeOctets (B.replicate 7 0x3A)
--   Nothing
--   
decodeOctets :: ByteString -> Maybe Mac -- | Encode a Mac address as colon-separated hexadecimal octets, -- preferring lowercase for alphabetical characters. -- --
--   >>> BBB.run Nat.constant $ boundedBuilderUtf8 $ mac 0xDEADBEEF1609
--   [0x64, 0x65, 0x3a, 0x61, 0x64, 0x3a, 0x62, 0x65, 0x3a, 0x65, 0x66, 0x3a, 0x31, 0x36, 0x3a, 0x30, 0x39]
--   
boundedBuilderUtf8 :: Mac -> Builder 17 -- | Lenient decoding of MAC address. This is case insensitive and allows -- either : or - as the separator. It also allows -- leading zeroes to be missing. -- --
--   >>> decodeUtf8Bytes (Bytes.fromAsciiString "A2:DE:AD:BE:EF:67")
--   Just (mac 0xa2deadbeef67)
--   
--   >>> decodeUtf8Bytes (Bytes.fromAsciiString "13-a2-FE-A4-17-96")
--   Just (mac 0x13a2fea41796)
--   
decodeUtf8Bytes :: Bytes -> Maybe Mac -- | Leniently parse UTF-8-encoded Bytes as a Mac address. -- This is case insensitive and allows either : or - as -- the separator. It also allows leading zeroes to be missing. -- --
--   >>> Parser.parseBytes (parserUtf8Bytes ()) (Bytes.fromAsciiString "de:ad:BE:EF:1:23")
--   Success (Slice {offset = 16, length = 0, value = mac 0xdeadbeef0123})
--   
parserUtf8Bytes :: e -> Parser e s Mac -- | Print a Mac address using the textual encoding. print :: Mac -> IO () -- | A 48-bit MAC address. Do not use the data constructor for this type. -- It is not considered part of the stable API, and it allows you to -- construct invalid MAC addresses. newtype Mac Mac :: Word64 -> Mac -- | A MacCodec allows users to control the encoding/decoding of -- their Mac addresses. data MacCodec MacCodec :: !MacGrouping -> !Bool -> MacCodec [macCodecGrouping] :: MacCodec -> !MacGrouping [macCodecUpperCase] :: MacCodec -> !Bool -- | The format expected by the mac address parser. The Word8 taken -- by some of these constructors is the ascii value of the character to -- be used as the separator. This is typically a colon, a hyphen, or a -- space character. All decoding functions are case insensitive. data MacGrouping -- | Two-character groups, FA:2B:40:09:8C:11 MacGroupingPairs :: !Char -> MacGrouping -- | Three-character groups, 24B-F0A-025-829 MacGroupingTriples :: !Char -> MacGrouping -- | Four-character groups, A220.0745.CAC7 MacGroupingQuadruples :: !Char -> MacGrouping -- | No separator, 24AF4B5B0780 MacGroupingNoSeparator :: MacGrouping instance Data.Data.Data Net.Mac.Mac instance GHC.Ix.Ix Net.Mac.Mac instance GHC.Generics.Generic Net.Mac.Mac instance GHC.Classes.Ord Net.Mac.Mac instance GHC.Classes.Eq Net.Mac.Mac instance Data.Data.Data Net.Mac.MacGrouping instance GHC.Generics.Generic Net.Mac.MacGrouping instance GHC.Read.Read Net.Mac.MacGrouping instance GHC.Show.Show Net.Mac.MacGrouping instance GHC.Classes.Ord Net.Mac.MacGrouping instance GHC.Classes.Eq Net.Mac.MacGrouping instance Data.Data.Data Net.Mac.MacCodec instance GHC.Generics.Generic Net.Mac.MacCodec instance GHC.Read.Read Net.Mac.MacCodec instance GHC.Show.Show Net.Mac.MacCodec instance GHC.Classes.Ord Net.Mac.MacCodec instance GHC.Classes.Eq Net.Mac.MacCodec instance Control.DeepSeq.NFData Net.Mac.Mac instance Data.Primitive.Types.Prim Net.Mac.Mac instance GHC.Show.Show Net.Mac.Mac instance GHC.Read.Read Net.Mac.Mac instance GHC.Enum.Bounded Net.Mac.Mac instance GHC.Enum.Enum Net.Mac.Mac instance Data.Hashable.Class.Hashable Net.Mac.Mac instance Data.Aeson.Types.ToJSON.ToJSON Net.Mac.Mac instance Data.Aeson.Types.ToJSON.ToJSONKey Net.Mac.Mac instance Data.Aeson.Types.FromJSON.FromJSONKey Net.Mac.Mac instance Data.Aeson.Types.FromJSON.FromJSON Net.Mac.Mac -- | This module re-exports all of the thematic types that this library -- defines. module Net.Types -- | A 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 Word32 -- from host byte order to network byte order. newtype IPv4 IPv4 :: Word32 -> IPv4 [getIPv4] :: IPv4 -> Word32 -- | A 128-bit Internet Protocol version 6 address. newtype IPv6 IPv6 :: Word128 -> IPv6 [getIPv6] :: IPv6 -> Word128 -- | A 32-bit IPv4 address or a 128-bit IPv6 address. -- Internally, this is just represented as an IPv6 address. The -- functions provided in Net.IP help simulate constructing and -- pattern matching on values of this type. All functions and typeclass -- methods that convert IP values to text will display it as an -- IPv4 address if possible. newtype IP IP :: IPv6 -> IP [getIP] :: IP -> IPv6 -- | 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. data IPv4Range IPv4Range :: {-# UNPACK #-} !IPv4 -> {-# UNPACK #-} !Word8 -> IPv4Range [ipv4RangeBase] :: IPv4Range -> {-# UNPACK #-} !IPv4 [ipv4RangeLength] :: IPv4Range -> {-# UNPACK #-} !Word8 -- | An IPv6Range. It is made up of the first IPv6 in the -- range and its length. data IPv6Range IPv6Range :: {-# UNPACK #-} !IPv6 -> {-# UNPACK #-} !Word8 -> IPv6Range [ipv6RangeBase] :: IPv6Range -> {-# UNPACK #-} !IPv6 [ipv6RangeLength] :: IPv6Range -> {-# UNPACK #-} !Word8 -- | A 48-bit MAC address. Do not use the data constructor for this type. -- It is not considered part of the stable API, and it allows you to -- construct invalid MAC addresses. newtype Mac Mac :: Word64 -> Mac -- | A MacCodec allows users to control the encoding/decoding of -- their Mac addresses. data MacCodec MacCodec :: !MacGrouping -> !Bool -> MacCodec [macCodecGrouping] :: MacCodec -> !MacGrouping [macCodecUpperCase] :: MacCodec -> !Bool -- | The format expected by the mac address parser. The Word8 taken -- by some of these constructors is the ascii value of the character to -- be used as the separator. This is typically a colon, a hyphen, or a -- space character. All decoding functions are case insensitive. data MacGrouping -- | Two-character groups, FA:2B:40:09:8C:11 MacGroupingPairs :: !Char -> MacGrouping -- | Three-character groups, 24B-F0A-025-829 MacGroupingTriples :: !Char -> MacGrouping -- | Four-character groups, A220.0745.CAC7 MacGroupingQuadruples :: !Char -> MacGrouping -- | No separator, 24AF4B5B0780 MacGroupingNoSeparator :: MacGrouping