-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Parser and Printer of PostgreSQL extended types
--   
--   This package involves parser and printer for text expressions of
--   PostgreSQL extended types. - inet type, cidr type
@package text-postgresql
@version 0.0.3.1

-- | This module defines network-address types of PostgreSQL.
--   http://www.postgresql.org/docs/current/static/datatype-net-types.html
module Data.PostgreSQL.NetworkAddress

-- | Corresponding to INET type of PostgreSQL
newtype Inet
Inet :: NetAddress -> Inet

-- | Corresponding to CIDR type of PostgreSQL
newtype Cidr
Cidr :: NetAddress -> Cidr

-- | Make Cidr type of IPv4 from host-address bits consistent with mask
cidr4 :: V4HostAddress -> Word8 -> Maybe Cidr

-- | Same as cidr4 except for dropping host-address bits along with mask
cidr4' :: V4HostAddress -> Word8 -> Maybe Cidr

-- | Make Cidr type of IPv6 from host-address bits consistent with mask
cidr6 :: V6HostAddress -> Word8 -> Maybe Cidr

-- | Same as cidr6 except for dropping host-address bits along with mask
cidr6' :: V6HostAddress -> Word8 -> Maybe Cidr

-- | IPv4 or IPv6 netword address corresponding
--   host-addr/mask. eg. '192.168.0.1/24'
data NetAddress
NetAddress4 :: !V4HostAddress -> !Word8 -> NetAddress
NetAddress6 :: !V6HostAddress -> !Word8 -> NetAddress

-- | Make IPv4 NetAddress type consistent with IPv4 mask
netAddress4 :: V4HostAddress -> Word8 -> Maybe NetAddress

-- | Make IPv6 NetAddress type consistent with IPv6 mask
netAddress6 :: V6HostAddress -> Word8 -> Maybe NetAddress

-- | Host address type along with IPv4 address bytes with IPv4 string
--   order.
data V4HostAddress
V4HostAddress :: !Word8 -> !Word8 -> !Word8 -> !Word8 -> V4HostAddress
v4HostAddressOctets :: V4HostAddress -> (Word8, Word8, Word8, Word8)

-- | Host address type along with IPv6 address words with IPv6 string
--   order. Each Word16 value is host byte order. Host byte order is
--   portable in programs on its own host. Network byte order is only
--   needed, when communicating other hosts.
data V6HostAddress
V6HostAddress :: !Word16 -> !Word16 -> !Word16 -> !Word16 -> !Word16 -> !Word16 -> !Word16 -> !Word16 -> V6HostAddress
v6HostAddressLong :: Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> V6HostAddress
v6HostAddressWords :: V6HostAddress -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16)
v6HostAddress :: [Word16] -> [Word16] -> Maybe V6HostAddress
v6HostAddressL :: [Word16] -> Maybe V6HostAddress
v6HostAddressR :: [Word16] -> Maybe V6HostAddress
instance GHC.Classes.Eq Data.PostgreSQL.NetworkAddress.Cidr
instance GHC.Classes.Eq Data.PostgreSQL.NetworkAddress.Inet
instance GHC.Classes.Eq Data.PostgreSQL.NetworkAddress.NetAddress
instance GHC.Classes.Eq Data.PostgreSQL.NetworkAddress.V4HostAddress
instance GHC.Classes.Eq Data.PostgreSQL.NetworkAddress.V6HostAddress
instance GHC.Classes.Ord Data.PostgreSQL.NetworkAddress.Cidr
instance GHC.Classes.Ord Data.PostgreSQL.NetworkAddress.Inet
instance GHC.Classes.Ord Data.PostgreSQL.NetworkAddress.NetAddress
instance GHC.Classes.Ord Data.PostgreSQL.NetworkAddress.V4HostAddress
instance GHC.Classes.Ord Data.PostgreSQL.NetworkAddress.V6HostAddress
instance GHC.Internal.Read.Read Data.PostgreSQL.NetworkAddress.Cidr
instance GHC.Internal.Read.Read Data.PostgreSQL.NetworkAddress.Inet
instance GHC.Internal.Read.Read Data.PostgreSQL.NetworkAddress.NetAddress
instance GHC.Internal.Read.Read Data.PostgreSQL.NetworkAddress.V4HostAddress
instance GHC.Internal.Read.Read Data.PostgreSQL.NetworkAddress.V6HostAddress
instance GHC.Internal.Show.Show Data.PostgreSQL.NetworkAddress.Cidr
instance GHC.Internal.Show.Show Data.PostgreSQL.NetworkAddress.Inet
instance GHC.Internal.Show.Show Data.PostgreSQL.NetworkAddress.NetAddress
instance GHC.Internal.Show.Show Data.PostgreSQL.NetworkAddress.V4HostAddress
instance GHC.Internal.Show.Show Data.PostgreSQL.NetworkAddress.V6HostAddress

module Database.PostgreSQL.Parser
type Parser = Parser Char
runParser :: Parser t a -> [t] -> Either String (a, [t])
evalParser :: Parser t a -> [t] -> Either String a
eof :: Parser t ()
netAddress :: Parser NetAddress
v4HostAddress :: Parser V4HostAddress
decMask4 :: Parser Word8
v6HostAddress :: Parser V6HostAddress
decMask6 :: Parser Word8

module Database.PostgreSQL.Printer
type Printer a = Printer Char a
execPrinter :: Printer t a -> a -> [t]
v4HostAddress :: Printer V4HostAddress
v6HostAddress :: Printer V6HostAddress
netAddress :: Printer NetAddress
