    {-# LANGUAGE DeriveDataTypeable #-}

    {- |
    Module      : Network.Socks5.Types
    License     : BSD-style
    Copyright   : (c) 2010-2019 Vincent Hanquez <vincent@snarc.org>
    Stability   : experimental
    Portability : unknown
    -}

    module Network.Socks5.Types
      ( SocksVersion (..)
      , SocksCommand (..)
      , SocksMethod (..)
      , SocksHostAddress (..)
      , SocksAddress (..)
      , SocksReply (..)
      , SocksVersionNotSupported (..)
      , SocksError (..)
      , SocksFQDN
      ) where

    import           Control.Exception ( Exception )
    import           Data.ByteString ( ByteString )
    import           Data.Data ( Data, Typeable )
    import qualified Data.List as L
    import           Data.Word ( Word8 )
    import           Network.Socket ( HostAddress, HostAddress6, PortNumber )
    import           Numeric ( showHex )

    -- | Type representing SOCKS protocol versions.

    data SocksVersion =
        SocksVer5
        -- ^ SOCKS Protocol Version 5. The only version implemented by the library.

      deriving (SocksVersion -> SocksVersion -> Bool
    (SocksVersion -> SocksVersion -> Bool)
    -> (SocksVersion -> SocksVersion -> Bool) -> Eq SocksVersion
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SocksVersion -> SocksVersion -> Bool
    == :: SocksVersion -> SocksVersion -> Bool
    $c/= :: SocksVersion -> SocksVersion -> Bool
    /= :: SocksVersion -> SocksVersion -> Bool
    Eq, Eq SocksVersion
    Eq SocksVersion =>
    (SocksVersion -> SocksVersion -> Ordering)
    -> (SocksVersion -> SocksVersion -> Bool)
    -> (SocksVersion -> SocksVersion -> Bool)
    -> (SocksVersion -> SocksVersion -> Bool)
    -> (SocksVersion -> SocksVersion -> Bool)
    -> (SocksVersion -> SocksVersion -> SocksVersion)
    -> (SocksVersion -> SocksVersion -> SocksVersion)
    -> Ord SocksVersion
    SocksVersion -> SocksVersion -> Bool
    SocksVersion -> SocksVersion -> Ordering
    SocksVersion -> SocksVersion -> SocksVersion
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SocksVersion -> SocksVersion -> Ordering
    compare :: SocksVersion -> SocksVersion -> Ordering
    $c< :: SocksVersion -> SocksVersion -> Bool
    < :: SocksVersion -> SocksVersion -> Bool
    $c<= :: SocksVersion -> SocksVersion -> Bool
    <= :: SocksVersion -> SocksVersion -> Bool
    $c> :: SocksVersion -> SocksVersion -> Bool
    > :: SocksVersion -> SocksVersion -> Bool
    $c>= :: SocksVersion -> SocksVersion -> Bool
    >= :: SocksVersion -> SocksVersion -> Bool
    $cmax :: SocksVersion -> SocksVersion -> SocksVersion
    max :: SocksVersion -> SocksVersion -> SocksVersion
    $cmin :: SocksVersion -> SocksVersion -> SocksVersion
    min :: SocksVersion -> SocksVersion -> SocksVersion
    Ord, Int -> SocksVersion -> ShowS
    [SocksVersion] -> ShowS
    SocksVersion -> String
    (Int -> SocksVersion -> ShowS)
    -> (SocksVersion -> String)
    -> ([SocksVersion] -> ShowS)
    -> Show SocksVersion
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SocksVersion -> ShowS
    showsPrec :: Int -> SocksVersion -> ShowS
    $cshow :: SocksVersion -> String
    show :: SocksVersion -> String
    $cshowList :: [SocksVersion] -> ShowS
    showList :: [SocksVersion] -> ShowS
    Show)

    -- | Type representing commands that can be sent or received under the SOCKS

    -- protocol.

    data SocksCommand =
        SocksCommandConnect
        -- ^ The CONNECT request.

      | SocksCommandBind
        -- ^ The BIND request. Not implemented by the library.

      | SocksCommandUdpAssociate
        -- ^ The UDP ASSOCIATE request. Not implemented by the library.

      | SocksCommandOther !Word8
        -- ^ Other requests. None are specified by the SOCKS Protocol Version 5.

      deriving (SocksCommand -> SocksCommand -> Bool
    (SocksCommand -> SocksCommand -> Bool)
    -> (SocksCommand -> SocksCommand -> Bool) -> Eq SocksCommand
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SocksCommand -> SocksCommand -> Bool
    == :: SocksCommand -> SocksCommand -> Bool
    $c/= :: SocksCommand -> SocksCommand -> Bool
    /= :: SocksCommand -> SocksCommand -> Bool
    Eq, Eq SocksCommand
    Eq SocksCommand =>
    (SocksCommand -> SocksCommand -> Ordering)
    -> (SocksCommand -> SocksCommand -> Bool)
    -> (SocksCommand -> SocksCommand -> Bool)
    -> (SocksCommand -> SocksCommand -> Bool)
    -> (SocksCommand -> SocksCommand -> Bool)
    -> (SocksCommand -> SocksCommand -> SocksCommand)
    -> (SocksCommand -> SocksCommand -> SocksCommand)
    -> Ord SocksCommand
    SocksCommand -> SocksCommand -> Bool
    SocksCommand -> SocksCommand -> Ordering
    SocksCommand -> SocksCommand -> SocksCommand
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SocksCommand -> SocksCommand -> Ordering
    compare :: SocksCommand -> SocksCommand -> Ordering
    $c< :: SocksCommand -> SocksCommand -> Bool
    < :: SocksCommand -> SocksCommand -> Bool
    $c<= :: SocksCommand -> SocksCommand -> Bool
    <= :: SocksCommand -> SocksCommand -> Bool
    $c> :: SocksCommand -> SocksCommand -> Bool
    > :: SocksCommand -> SocksCommand -> Bool
    $c>= :: SocksCommand -> SocksCommand -> Bool
    >= :: SocksCommand -> SocksCommand -> Bool
    $cmax :: SocksCommand -> SocksCommand -> SocksCommand
    max :: SocksCommand -> SocksCommand -> SocksCommand
    $cmin :: SocksCommand -> SocksCommand -> SocksCommand
    min :: SocksCommand -> SocksCommand -> SocksCommand
    Ord, Int -> SocksCommand -> ShowS
    [SocksCommand] -> ShowS
    SocksCommand -> String
    (Int -> SocksCommand -> ShowS)
    -> (SocksCommand -> String)
    -> ([SocksCommand] -> ShowS)
    -> Show SocksCommand
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SocksCommand -> ShowS
    showsPrec :: Int -> SocksCommand -> ShowS
    $cshow :: SocksCommand -> String
    show :: SocksCommand -> String
    $cshowList :: [SocksCommand] -> ShowS
    showList :: [SocksCommand] -> ShowS
    Show)

    -- | Type representing authentication methods available under the SOCKS

    -- protocol.

    --

    -- Only 'SocksMethodNone' is effectively implemented, but other values are

    -- enumerated for completeness.

    data SocksMethod =
        SocksMethodNone
        -- ^ NO AUTHENTICATION REQUIRED.

      | SocksMethodGSSAPI
        -- ^ GSSAPI.

      | SocksMethodUsernamePassword
        -- ^ USERNAME/PASSWORD.

      | SocksMethodOther !Word8
        -- ^ IANA ASSIGNED or RESERVED FOR PRIVATE METHODS.

      | SocksMethodNotAcceptable
        -- ^ NO ACCEPTABLE METHODS.

      deriving (SocksMethod -> SocksMethod -> Bool
    (SocksMethod -> SocksMethod -> Bool)
    -> (SocksMethod -> SocksMethod -> Bool) -> Eq SocksMethod
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SocksMethod -> SocksMethod -> Bool
    == :: SocksMethod -> SocksMethod -> Bool
    $c/= :: SocksMethod -> SocksMethod -> Bool
    /= :: SocksMethod -> SocksMethod -> Bool
    Eq, Eq SocksMethod
    Eq SocksMethod =>
    (SocksMethod -> SocksMethod -> Ordering)
    -> (SocksMethod -> SocksMethod -> Bool)
    -> (SocksMethod -> SocksMethod -> Bool)
    -> (SocksMethod -> SocksMethod -> Bool)
    -> (SocksMethod -> SocksMethod -> Bool)
    -> (SocksMethod -> SocksMethod -> SocksMethod)
    -> (SocksMethod -> SocksMethod -> SocksMethod)
    -> Ord SocksMethod
    SocksMethod -> SocksMethod -> Bool
    SocksMethod -> SocksMethod -> Ordering
    SocksMethod -> SocksMethod -> SocksMethod
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SocksMethod -> SocksMethod -> Ordering
    compare :: SocksMethod -> SocksMethod -> Ordering
    $c< :: SocksMethod -> SocksMethod -> Bool
    < :: SocksMethod -> SocksMethod -> Bool
    $c<= :: SocksMethod -> SocksMethod -> Bool
    <= :: SocksMethod -> SocksMethod -> Bool
    $c> :: SocksMethod -> SocksMethod -> Bool
    > :: SocksMethod -> SocksMethod -> Bool
    $c>= :: SocksMethod -> SocksMethod -> Bool
    >= :: SocksMethod -> SocksMethod -> Bool
    $cmax :: SocksMethod -> SocksMethod -> SocksMethod
    max :: SocksMethod -> SocksMethod -> SocksMethod
    $cmin :: SocksMethod -> SocksMethod -> SocksMethod
    min :: SocksMethod -> SocksMethod -> SocksMethod
    Ord, Int -> SocksMethod -> ShowS
    [SocksMethod] -> ShowS
    SocksMethod -> String
    (Int -> SocksMethod -> ShowS)
    -> (SocksMethod -> String)
    -> ([SocksMethod] -> ShowS)
    -> Show SocksMethod
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SocksMethod -> ShowS
    showsPrec :: Int -> SocksMethod -> ShowS
    $cshow :: SocksMethod -> String
    show :: SocksMethod -> String
    $cshowList :: [SocksMethod] -> ShowS
    showList :: [SocksMethod] -> ShowS
    Show)

    -- | Type representing host addresses under the SOCKS protocol.

    data SocksHostAddress =
        SocksAddrIPV4 !HostAddress
        -- ^ A version-4 IP address.

      | SocksAddrDomainName !SocksFQDN
        -- ^ A fully-qualified domain name (FQDN).

      | SocksAddrIPV6 !HostAddress6
        -- ^ A version-6 IP address.

      deriving (SocksHostAddress -> SocksHostAddress -> Bool
    (SocksHostAddress -> SocksHostAddress -> Bool)
    -> (SocksHostAddress -> SocksHostAddress -> Bool)
    -> Eq SocksHostAddress
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SocksHostAddress -> SocksHostAddress -> Bool
    == :: SocksHostAddress -> SocksHostAddress -> Bool
    $c/= :: SocksHostAddress -> SocksHostAddress -> Bool
    /= :: SocksHostAddress -> SocksHostAddress -> Bool
    Eq, Eq SocksHostAddress
    Eq SocksHostAddress =>
    (SocksHostAddress -> SocksHostAddress -> Ordering)
    -> (SocksHostAddress -> SocksHostAddress -> Bool)
    -> (SocksHostAddress -> SocksHostAddress -> Bool)
    -> (SocksHostAddress -> SocksHostAddress -> Bool)
    -> (SocksHostAddress -> SocksHostAddress -> Bool)
    -> (SocksHostAddress -> SocksHostAddress -> SocksHostAddress)
    -> (SocksHostAddress -> SocksHostAddress -> SocksHostAddress)
    -> Ord SocksHostAddress
    SocksHostAddress -> SocksHostAddress -> Bool
    SocksHostAddress -> SocksHostAddress -> Ordering
    SocksHostAddress -> SocksHostAddress -> SocksHostAddress
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SocksHostAddress -> SocksHostAddress -> Ordering
    compare :: SocksHostAddress -> SocksHostAddress -> Ordering
    $c< :: SocksHostAddress -> SocksHostAddress -> Bool
    < :: SocksHostAddress -> SocksHostAddress -> Bool
    $c<= :: SocksHostAddress -> SocksHostAddress -> Bool
    <= :: SocksHostAddress -> SocksHostAddress -> Bool
    $c> :: SocksHostAddress -> SocksHostAddress -> Bool
    > :: SocksHostAddress -> SocksHostAddress -> Bool
    $c>= :: SocksHostAddress -> SocksHostAddress -> Bool
    >= :: SocksHostAddress -> SocksHostAddress -> Bool
    $cmax :: SocksHostAddress -> SocksHostAddress -> SocksHostAddress
    max :: SocksHostAddress -> SocksHostAddress -> SocksHostAddress
    $cmin :: SocksHostAddress -> SocksHostAddress -> SocksHostAddress
    min :: SocksHostAddress -> SocksHostAddress -> SocksHostAddress
    Ord)

    -- | Type synonym representing fully-qualified domain names (FQDN). The SOCKS

    -- Protocol Version 5 does not specify an encoding for a FQDN other than there

    -- is no terminating @NUL@ octet (byte).

    --

    -- This library's API assumes that FQDN values comprise only ASCII characters.

    -- Domain names that include other Unicode code points should be

    -- Punycode encoded.

    type SocksFQDN = ByteString

    instance Show SocksHostAddress where
      show :: SocksHostAddress -> String
    show (SocksAddrIPV4 Word32
    ha) = String
    "SocksAddrIPV4(" String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Word32 -> String
    showHostAddress Word32
    ha String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    ")"
      show (SocksAddrIPV6 HostAddress6
    ha6) = String
    "SocksAddrIPV6(" String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ HostAddress6 -> String
    showHostAddress6 HostAddress6
    ha6 String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    ")"
      show (SocksAddrDomainName SocksFQDN
    dn) = String
    "SocksAddrDomainName(" String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ SocksFQDN -> String
    showFQDN SocksFQDN
    dn String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    ")"

    -- | Converts the specified fully-qualified domain name (FQDN) to a 'String'.

    showFQDN :: SocksFQDN -> String
    showFQDN :: SocksFQDN -> String
    showFQDN = SocksFQDN -> String
    forall a. Show a => a -> String
    show

    -- | Converts the specified SOCKS host address to a 'String' in dot-decimal

    -- notation.

    showHostAddress :: HostAddress -> String
    showHostAddress :: Word32 -> String
    showHostAddress Word32
    num = [String] -> String
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat [Word32 -> String
    forall a. Show a => a -> String
    show Word32
    q1, String
    ".", Word32 -> String
    forall a. Show a => a -> String
    show Word32
    q2, String
    ".", Word32 -> String
    forall a. Show a => a -> String
    show Word32
    q3, String
    ".", Word32 -> String
    forall a. Show a => a -> String
    show Word32
    q4]
     where
      (Word32
    num', Word32
    q1)   = Word32
    num Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    256
      (Word32
    num'', Word32
    q2)  = Word32
    num' Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    256
      (Word32
    num''', Word32
    q3) = Word32
    num'' Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    256
      (Word32
    _, Word32
    q4)      = Word32
    num''' Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    256

    -- | Converts the specified IPv6 host address to standard hex notation.

    showHostAddress6 :: HostAddress6 -> String
    showHostAddress6 :: HostAddress6 -> String
    showHostAddress6 (Word32
    a, Word32
    b, Word32
    c, Word32
    d) =
      (String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    L.intercalate String
    ":" ([String] -> String)
    -> ([Word32] -> [String]) -> [Word32] -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Word32 -> String) -> [Word32] -> [String]
    forall a b. (a -> b) -> [a] -> [b]
    map (Word32 -> ShowS
    forall a. Integral a => a -> ShowS
    `showHex` String
    "")) [Word32
    p1, Word32
    p2, Word32
    p3, Word32
    p4, Word32
    p5, Word32
    p6, Word32
    p7, Word32
    p8]
     where
      (Word32
    a', Word32
    p2) = Word32
    a Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536
      (Word32
    _, Word32
    p1)  = Word32
    a' Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536
      (Word32
    b', Word32
    p4) = Word32
    b Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536
      (Word32
    _, Word32
    p3)  = Word32
    b' Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536
      (Word32
    c', Word32
    p6) = Word32
    c Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536
      (Word32
    _, Word32
    p5)  = Word32
    c' Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536
      (Word32
    d', Word32
    p8) = Word32
    d Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536
      (Word32
    _, Word32
    p7)  = Word32
    d' Word32 -> Word32 -> (Word32, Word32)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Word32
    65536

    -- | Type representing socket addresses under the SOCKS protocol.

    data SocksAddress = SocksAddress !SocksHostAddress !PortNumber
      deriving (SocksAddress -> SocksAddress -> Bool
    (SocksAddress -> SocksAddress -> Bool)
    -> (SocksAddress -> SocksAddress -> Bool) -> Eq SocksAddress
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SocksAddress -> SocksAddress -> Bool
    == :: SocksAddress -> SocksAddress -> Bool
    $c/= :: SocksAddress -> SocksAddress -> Bool
    /= :: SocksAddress -> SocksAddress -> Bool
    Eq, Eq SocksAddress
    Eq SocksAddress =>
    (SocksAddress -> SocksAddress -> Ordering)
    -> (SocksAddress -> SocksAddress -> Bool)
    -> (SocksAddress -> SocksAddress -> Bool)
    -> (SocksAddress -> SocksAddress -> Bool)
    -> (SocksAddress -> SocksAddress -> Bool)
    -> (SocksAddress -> SocksAddress -> SocksAddress)
    -> (SocksAddress -> SocksAddress -> SocksAddress)
    -> Ord SocksAddress
    SocksAddress -> SocksAddress -> Bool
    SocksAddress -> SocksAddress -> Ordering
    SocksAddress -> SocksAddress -> SocksAddress
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SocksAddress -> SocksAddress -> Ordering
    compare :: SocksAddress -> SocksAddress -> Ordering
    $c< :: SocksAddress -> SocksAddress -> Bool
    < :: SocksAddress -> SocksAddress -> Bool
    $c<= :: SocksAddress -> SocksAddress -> Bool
    <= :: SocksAddress -> SocksAddress -> Bool
    $c> :: SocksAddress -> SocksAddress -> Bool
    > :: SocksAddress -> SocksAddress -> Bool
    $c>= :: SocksAddress -> SocksAddress -> Bool
    >= :: SocksAddress -> SocksAddress -> Bool
    $cmax :: SocksAddress -> SocksAddress -> SocksAddress
    max :: SocksAddress -> SocksAddress -> SocksAddress
    $cmin :: SocksAddress -> SocksAddress -> SocksAddress
    min :: SocksAddress -> SocksAddress -> SocksAddress
    Ord, Int -> SocksAddress -> ShowS
    [SocksAddress] -> ShowS
    SocksAddress -> String
    (Int -> SocksAddress -> ShowS)
    -> (SocksAddress -> String)
    -> ([SocksAddress] -> ShowS)
    -> Show SocksAddress
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SocksAddress -> ShowS
    showsPrec :: Int -> SocksAddress -> ShowS
    $cshow :: SocksAddress -> String
    show :: SocksAddress -> String
    $cshowList :: [SocksAddress] -> ShowS
    showList :: [SocksAddress] -> ShowS
    Show)

    -- | Type representing replies under the SOCKS protocol.

    data SocksReply =
        SocksReplySuccess
        -- ^ The server reports that the request succeeded.

      | SocksReplyError SocksError
        -- ^ The server reports that the request did not succeed.

      deriving (SocksReply -> SocksReply -> Bool
    (SocksReply -> SocksReply -> Bool)
    -> (SocksReply -> SocksReply -> Bool) -> Eq SocksReply
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SocksReply -> SocksReply -> Bool
    == :: SocksReply -> SocksReply -> Bool
    $c/= :: SocksReply -> SocksReply -> Bool
    /= :: SocksReply -> SocksReply -> Bool
    Eq, Typeable SocksReply
    Typeable SocksReply =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> SocksReply -> c SocksReply)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c SocksReply)
    -> (SocksReply -> Constr)
    -> (SocksReply -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c SocksReply))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c SocksReply))
    -> ((forall b. Data b => b -> b) -> SocksReply -> SocksReply)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> SocksReply -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> SocksReply -> r)
    -> (forall u. (forall d. Data d => d -> u) -> SocksReply -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> SocksReply -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply)
    -> Data SocksReply
    SocksReply -> Constr
    SocksReply -> DataType
    (forall b. Data b => b -> b) -> SocksReply -> SocksReply
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> SocksReply -> u
    forall u. (forall d. Data d => d -> u) -> SocksReply -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksReply -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksReply -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksReply
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SocksReply -> c SocksReply
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksReply)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksReply)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SocksReply -> c SocksReply
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SocksReply -> c SocksReply
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksReply
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksReply
    $ctoConstr :: SocksReply -> Constr
    toConstr :: SocksReply -> Constr
    $cdataTypeOf :: SocksReply -> DataType
    dataTypeOf :: SocksReply -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksReply)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksReply)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksReply)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksReply)
    $cgmapT :: (forall b. Data b => b -> b) -> SocksReply -> SocksReply
    gmapT :: (forall b. Data b => b -> b) -> SocksReply -> SocksReply
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksReply -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksReply -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksReply -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksReply -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> SocksReply -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> SocksReply -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SocksReply -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SocksReply -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksReply -> m SocksReply
    Data, Eq SocksReply
    Eq SocksReply =>
    (SocksReply -> SocksReply -> Ordering)
    -> (SocksReply -> SocksReply -> Bool)
    -> (SocksReply -> SocksReply -> Bool)
    -> (SocksReply -> SocksReply -> Bool)
    -> (SocksReply -> SocksReply -> Bool)
    -> (SocksReply -> SocksReply -> SocksReply)
    -> (SocksReply -> SocksReply -> SocksReply)
    -> Ord SocksReply
    SocksReply -> SocksReply -> Bool
    SocksReply -> SocksReply -> Ordering
    SocksReply -> SocksReply -> SocksReply
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SocksReply -> SocksReply -> Ordering
    compare :: SocksReply -> SocksReply -> Ordering
    $c< :: SocksReply -> SocksReply -> Bool
    < :: SocksReply -> SocksReply -> Bool
    $c<= :: SocksReply -> SocksReply -> Bool
    <= :: SocksReply -> SocksReply -> Bool
    $c> :: SocksReply -> SocksReply -> Bool
    > :: SocksReply -> SocksReply -> Bool
    $c>= :: SocksReply -> SocksReply -> Bool
    >= :: SocksReply -> SocksReply -> Bool
    $cmax :: SocksReply -> SocksReply -> SocksReply
    max :: SocksReply -> SocksReply -> SocksReply
    $cmin :: SocksReply -> SocksReply -> SocksReply
    min :: SocksReply -> SocksReply -> SocksReply
    Ord, Int -> SocksReply -> ShowS
    [SocksReply] -> ShowS
    SocksReply -> String
    (Int -> SocksReply -> ShowS)
    -> (SocksReply -> String)
    -> ([SocksReply] -> ShowS)
    -> Show SocksReply
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SocksReply -> ShowS
    showsPrec :: Int -> SocksReply -> ShowS
    $cshow :: SocksReply -> String
    show :: SocksReply -> String
    $cshowList :: [SocksReply] -> ShowS
    showList :: [SocksReply] -> ShowS
    Show, Typeable)

    -- | Type representing SOCKS errors that can be part of a SOCKS reply.

    data SocksError =
        SocksErrorGeneralServerFailure
        -- ^ General SOCKS server failure.

      | SocksErrorConnectionNotAllowedByRule
        -- ^ Connection not allowed by ruleset.

      | SocksErrorNetworkUnreachable
        -- ^ Network unreachable.

      | SocksErrorHostUnreachable
        -- ^ Host unreachable.

      | SocksErrorConnectionRefused
        -- ^ Connection refused.

      | SocksErrorTTLExpired
        -- ^ TTL expired.

      | SocksErrorCommandNotSupported
        -- ^ Command not supported.

      | SocksErrorAddrTypeNotSupported
        -- ^ Address type not supported.

      | SocksErrorOther Word8
        -- ^ Other error. Unassigned in SOCKS Protocol Version 5.

      deriving (SocksError -> SocksError -> Bool
    (SocksError -> SocksError -> Bool)
    -> (SocksError -> SocksError -> Bool) -> Eq SocksError
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SocksError -> SocksError -> Bool
    == :: SocksError -> SocksError -> Bool
    $c/= :: SocksError -> SocksError -> Bool
    /= :: SocksError -> SocksError -> Bool
    Eq, Typeable SocksError
    Typeable SocksError =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> SocksError -> c SocksError)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c SocksError)
    -> (SocksError -> Constr)
    -> (SocksError -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c SocksError))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c SocksError))
    -> ((forall b. Data b => b -> b) -> SocksError -> SocksError)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> SocksError -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> SocksError -> r)
    -> (forall u. (forall d. Data d => d -> u) -> SocksError -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> SocksError -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> SocksError -> m SocksError)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SocksError -> m SocksError)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> SocksError -> m SocksError)
    -> Data SocksError
    SocksError -> Constr
    SocksError -> DataType
    (forall b. Data b => b -> b) -> SocksError -> SocksError
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> SocksError -> u
    forall u. (forall d. Data d => d -> u) -> SocksError -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksError -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksError -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksError
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SocksError -> c SocksError
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksError)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksError)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SocksError -> c SocksError
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SocksError -> c SocksError
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksError
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksError
    $ctoConstr :: SocksError -> Constr
    toConstr :: SocksError -> Constr
    $cdataTypeOf :: SocksError -> DataType
    dataTypeOf :: SocksError -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksError)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksError)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksError)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SocksError)
    $cgmapT :: (forall b. Data b => b -> b) -> SocksError -> SocksError
    gmapT :: (forall b. Data b => b -> b) -> SocksError -> SocksError
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksError -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksError -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksError -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SocksError -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> SocksError -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> SocksError -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SocksError -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SocksError -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SocksError -> m SocksError
    Data, Eq SocksError
    Eq SocksError =>
    (SocksError -> SocksError -> Ordering)
    -> (SocksError -> SocksError -> Bool)
    -> (SocksError -> SocksError -> Bool)
    -> (SocksError -> SocksError -> Bool)
    -> (SocksError -> SocksError -> Bool)
    -> (SocksError -> SocksError -> SocksError)
    -> (SocksError -> SocksError -> SocksError)
    -> Ord SocksError
    SocksError -> SocksError -> Bool
    SocksError -> SocksError -> Ordering
    SocksError -> SocksError -> SocksError
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SocksError -> SocksError -> Ordering
    compare :: SocksError -> SocksError -> Ordering
    $c< :: SocksError -> SocksError -> Bool
    < :: SocksError -> SocksError -> Bool
    $c<= :: SocksError -> SocksError -> Bool
    <= :: SocksError -> SocksError -> Bool
    $c> :: SocksError -> SocksError -> Bool
    > :: SocksError -> SocksError -> Bool
    $c>= :: SocksError -> SocksError -> Bool
    >= :: SocksError -> SocksError -> Bool
    $cmax :: SocksError -> SocksError -> SocksError
    max :: SocksError -> SocksError -> SocksError
    $cmin :: SocksError -> SocksError -> SocksError
    min :: SocksError -> SocksError -> SocksError
    Ord, Int -> SocksError -> ShowS
    [SocksError] -> ShowS
    SocksError -> String
    (Int -> SocksError -> ShowS)
    -> (SocksError -> String)
    -> ([SocksError] -> ShowS)
    -> Show SocksError
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SocksError -> ShowS
    showsPrec :: Int -> SocksError -> ShowS
    $cshow :: SocksError -> String
    show :: SocksError -> String
    $cshowList :: [SocksError] -> ShowS
    showList :: [SocksError] -> ShowS
    Show, Typeable)

    -- | Type representing exceptions.

    data SocksVersionNotSupported =
        SocksVersionNotSupported
        -- ^ The SOCKS protocol version is not supported. This library only

        -- implements SOCKS Protocol Version 5.

      deriving (Typeable SocksVersionNotSupported
    Typeable SocksVersionNotSupported =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g)
     -> SocksVersionNotSupported
     -> c SocksVersionNotSupported)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c SocksVersionNotSupported)
    -> (SocksVersionNotSupported -> Constr)
    -> (SocksVersionNotSupported -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d))
        -> Maybe (c SocksVersionNotSupported))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c SocksVersionNotSupported))
    -> ((forall b. Data b => b -> b)
        -> SocksVersionNotSupported -> SocksVersionNotSupported)
    -> (forall r r'.
        (r -> r' -> r)
        -> r
        -> (forall d. Data d => d -> r')
        -> SocksVersionNotSupported
        -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r
        -> (forall d. Data d => d -> r')
        -> SocksVersionNotSupported
        -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> SocksVersionNotSupported -> [u])
    -> (forall u.
        Int
        -> (forall d. Data d => d -> u) -> SocksVersionNotSupported -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> SocksVersionNotSupported -> m SocksVersionNotSupported)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> SocksVersionNotSupported -> m SocksVersionNotSupported)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> SocksVersionNotSupported -> m SocksVersionNotSupported)
    -> Data SocksVersionNotSupported
    SocksVersionNotSupported -> Constr
    SocksVersionNotSupported -> DataType
    (forall b. Data b => b -> b)
    -> SocksVersionNotSupported -> SocksVersionNotSupported
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int
    -> (forall d. Data d => d -> u) -> SocksVersionNotSupported -> u
    forall u.
    (forall d. Data d => d -> u) -> SocksVersionNotSupported -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SocksVersionNotSupported
    -> r
    forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SocksVersionNotSupported
    -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksVersionNotSupported
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> SocksVersionNotSupported
    -> c SocksVersionNotSupported
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksVersionNotSupported)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SocksVersionNotSupported)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> SocksVersionNotSupported
    -> c SocksVersionNotSupported
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> SocksVersionNotSupported
    -> c SocksVersionNotSupported
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksVersionNotSupported
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SocksVersionNotSupported
    $ctoConstr :: SocksVersionNotSupported -> Constr
    toConstr :: SocksVersionNotSupported -> Constr
    $cdataTypeOf :: SocksVersionNotSupported -> DataType
    dataTypeOf :: SocksVersionNotSupported -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksVersionNotSupported)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SocksVersionNotSupported)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SocksVersionNotSupported)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SocksVersionNotSupported)
    $cgmapT :: (forall b. Data b => b -> b)
    -> SocksVersionNotSupported -> SocksVersionNotSupported
    gmapT :: (forall b. Data b => b -> b)
    -> SocksVersionNotSupported -> SocksVersionNotSupported
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SocksVersionNotSupported
    -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SocksVersionNotSupported
    -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SocksVersionNotSupported
    -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SocksVersionNotSupported
    -> r
    $cgmapQ :: forall u.
    (forall d. Data d => d -> u) -> SocksVersionNotSupported -> [u]
    gmapQ :: forall u.
    (forall d. Data d => d -> u) -> SocksVersionNotSupported -> [u]
    $cgmapQi :: forall u.
    Int
    -> (forall d. Data d => d -> u) -> SocksVersionNotSupported -> u
    gmapQi :: forall u.
    Int
    -> (forall d. Data d => d -> u) -> SocksVersionNotSupported -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SocksVersionNotSupported -> m SocksVersionNotSupported
    Data, Int -> SocksVersionNotSupported -> ShowS
    [SocksVersionNotSupported] -> ShowS
    SocksVersionNotSupported -> String
    (Int -> SocksVersionNotSupported -> ShowS)
    -> (SocksVersionNotSupported -> String)
    -> ([SocksVersionNotSupported] -> ShowS)
    -> Show SocksVersionNotSupported
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SocksVersionNotSupported -> ShowS
    showsPrec :: Int -> SocksVersionNotSupported -> ShowS
    $cshow :: SocksVersionNotSupported -> String
    show :: SocksVersionNotSupported -> String
    $cshowList :: [SocksVersionNotSupported] -> ShowS
    showList :: [SocksVersionNotSupported] -> ShowS
    Show, Typeable)

    instance Exception SocksError

    instance Exception SocksVersionNotSupported

    instance Enum SocksCommand where
      toEnum :: Int -> SocksCommand
    toEnum Int
    1 = SocksCommand
    SocksCommandConnect
      toEnum Int
    2 = SocksCommand
    SocksCommandBind
      toEnum Int
    3 = SocksCommand
    SocksCommandUdpAssociate
      toEnum Int
    w
        | Int
    w Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < Int
    256   = Word8 -> SocksCommand
    SocksCommandOther (Word8 -> SocksCommand) -> Word8 -> SocksCommand
    forall a b. (a -> b) -> a -> b
    $ Int -> Word8
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    w
        | Bool
    otherwise = String -> SocksCommand
    forall a. HasCallStack => String -> a
    error String
    "socks command is only 8 bits"
      fromEnum :: SocksCommand -> Int
    fromEnum SocksCommand
    SocksCommandConnect      = Int
    1
      fromEnum SocksCommand
    SocksCommandBind         = Int
    2
      fromEnum SocksCommand
    SocksCommandUdpAssociate = Int
    3
      fromEnum (SocksCommandOther Word8
    w)    = Word8 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word8
    w

    instance Enum SocksMethod where
      toEnum :: Int -> SocksMethod
    toEnum Int
    0    = SocksMethod
    SocksMethodNone
      toEnum Int
    1    = SocksMethod
    SocksMethodGSSAPI
      toEnum Int
    2    = SocksMethod
    SocksMethodUsernamePassword
      toEnum Int
    0xff = SocksMethod
    SocksMethodNotAcceptable
      toEnum Int
    w
        | Int
    w Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < Int
    256   = Word8 -> SocksMethod
    SocksMethodOther (Word8 -> SocksMethod) -> Word8 -> SocksMethod
    forall a b. (a -> b) -> a -> b
    $ Int -> Word8
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    w
        | Bool
    otherwise = String -> SocksMethod
    forall a. HasCallStack => String -> a
    error String
    "socks method is only 8 bits"
      fromEnum :: SocksMethod -> Int
    fromEnum SocksMethod
    SocksMethodNone             = Int
    0
      fromEnum SocksMethod
    SocksMethodGSSAPI           = Int
    1
      fromEnum SocksMethod
    SocksMethodUsernamePassword = Int
    2
      fromEnum (SocksMethodOther Word8
    w)        = Word8 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word8
    w
      fromEnum SocksMethod
    SocksMethodNotAcceptable    = Int
    0xff

    instance Enum SocksError where
      fromEnum :: SocksError -> Int
    fromEnum SocksError
    SocksErrorGeneralServerFailure       = Int
    1
      fromEnum SocksError
    SocksErrorConnectionNotAllowedByRule = Int
    2
      fromEnum SocksError
    SocksErrorNetworkUnreachable         = Int
    3
      fromEnum SocksError
    SocksErrorHostUnreachable            = Int
    4
      fromEnum SocksError
    SocksErrorConnectionRefused          = Int
    5
      fromEnum SocksError
    SocksErrorTTLExpired                 = Int
    6
      fromEnum SocksError
    SocksErrorCommandNotSupported        = Int
    7
      fromEnum SocksError
    SocksErrorAddrTypeNotSupported       = Int
    8
      fromEnum (SocksErrorOther Word8
    w)                  = Word8 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word8
    w
      toEnum :: Int -> SocksError
    toEnum Int
    1 = SocksError
    SocksErrorGeneralServerFailure
      toEnum Int
    2 = SocksError
    SocksErrorConnectionNotAllowedByRule
      toEnum Int
    3 = SocksError
    SocksErrorNetworkUnreachable
      toEnum Int
    4 = SocksError
    SocksErrorHostUnreachable
      toEnum Int
    5 = SocksError
    SocksErrorConnectionRefused
      toEnum Int
    6 = SocksError
    SocksErrorTTLExpired
      toEnum Int
    7 = SocksError
    SocksErrorCommandNotSupported
      toEnum Int
    8 = SocksError
    SocksErrorAddrTypeNotSupported
      toEnum Int
    w = Word8 -> SocksError
    SocksErrorOther (Word8 -> SocksError) -> Word8 -> SocksError
    forall a b. (a -> b) -> a -> b
    $ Int -> Word8
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    w

    instance Enum SocksReply where
      fromEnum :: SocksReply -> Int
    fromEnum SocksReply
    SocksReplySuccess   = Int
    0
      fromEnum (SocksReplyError SocksError
    e) = SocksError -> Int
    forall a. Enum a => a -> Int
    fromEnum SocksError
    e
      toEnum :: Int -> SocksReply
    toEnum Int
    0 = SocksReply
    SocksReplySuccess
      toEnum Int
    n = SocksError -> SocksReply
    SocksReplyError (Int -> SocksError
    forall a. Enum a => Int -> a
    toEnum Int
    n)