    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveTraversable #-}
    {-# LANGUAGE OverloadedStrings #-}

    module Web.Twitter.Conduit.Response (
        Response (..),
        TwitterError (..),
        TwitterErrorMessage (..),
    ) where

    import Control.Exception
    import Data.Aeson
    import Data.Data
    import qualified Data.Text as T
    import Network.HTTP.Types (ResponseHeaders, Status)

    data Response responseType = Response
        { forall responseType. Response responseType -> Status
    responseStatus :: Status
        , forall responseType. Response responseType -> ResponseHeaders
    responseHeaders :: ResponseHeaders
        , forall responseType. Response responseType -> responseType
    responseBody :: responseType
        }
        deriving (Int -> Response responseType -> ShowS
    [Response responseType] -> ShowS
    Response responseType -> String
    (Int -> Response responseType -> ShowS)
    -> (Response responseType -> String)
    -> ([Response responseType] -> ShowS)
    -> Show (Response responseType)
    forall responseType.
    Show responseType =>
    Int -> Response responseType -> ShowS
    forall responseType.
    Show responseType =>
    [Response responseType] -> ShowS
    forall responseType.
    Show responseType =>
    Response responseType -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall responseType.
    Show responseType =>
    Int -> Response responseType -> ShowS
    showsPrec :: Int -> Response responseType -> ShowS
    $cshow :: forall responseType.
    Show responseType =>
    Response responseType -> String
    show :: Response responseType -> String
    $cshowList :: forall responseType.
    Show responseType =>
    [Response responseType] -> ShowS
    showList :: [Response responseType] -> ShowS
    Show, Response responseType -> Response responseType -> Bool
    (Response responseType -> Response responseType -> Bool)
    -> (Response responseType -> Response responseType -> Bool)
    -> Eq (Response responseType)
    forall responseType.
    Eq responseType =>
    Response responseType -> Response responseType -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall responseType.
    Eq responseType =>
    Response responseType -> Response responseType -> Bool
    == :: Response responseType -> Response responseType -> Bool
    $c/= :: forall responseType.
    Eq responseType =>
    Response responseType -> Response responseType -> Bool
    /= :: Response responseType -> Response responseType -> Bool
    Eq, Typeable, (forall a b. (a -> b) -> Response a -> Response b)
    -> (forall a b. a -> Response b -> Response a) -> Functor Response
    forall a b. a -> Response b -> Response a
    forall a b. (a -> b) -> Response a -> Response b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall a b. (a -> b) -> Response a -> Response b
    fmap :: forall a b. (a -> b) -> Response a -> Response b
    $c<$ :: forall a b. a -> Response b -> Response a
    <$ :: forall a b. a -> Response b -> Response a
    Functor, (forall m. Monoid m => Response m -> m)
    -> (forall m a. Monoid m => (a -> m) -> Response a -> m)
    -> (forall m a. Monoid m => (a -> m) -> Response a -> m)
    -> (forall a b. (a -> b -> b) -> b -> Response a -> b)
    -> (forall a b. (a -> b -> b) -> b -> Response a -> b)
    -> (forall b a. (b -> a -> b) -> b -> Response a -> b)
    -> (forall b a. (b -> a -> b) -> b -> Response a -> b)
    -> (forall a. (a -> a -> a) -> Response a -> a)
    -> (forall a. (a -> a -> a) -> Response a -> a)
    -> (forall a. Response a -> [a])
    -> (forall a. Response a -> Bool)
    -> (forall a. Response a -> Int)
    -> (forall a. Eq a => a -> Response a -> Bool)
    -> (forall a. Ord a => Response a -> a)
    -> (forall a. Ord a => Response a -> a)
    -> (forall a. Num a => Response a -> a)
    -> (forall a. Num a => Response a -> a)
    -> Foldable Response
    forall a. Eq a => a -> Response a -> Bool
    forall a. Num a => Response a -> a
    forall a. Ord a => Response a -> a
    forall m. Monoid m => Response m -> m
    forall a. Response a -> Bool
    forall a. Response a -> Int
    forall a. Response a -> [a]
    forall a. (a -> a -> a) -> Response a -> a
    forall m a. Monoid m => (a -> m) -> Response a -> m
    forall b a. (b -> a -> b) -> b -> Response a -> b
    forall a b. (a -> b -> b) -> b -> Response a -> b
    forall (t :: * -> *).
    (forall m. Monoid m => t m -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. t a -> [a])
    -> (forall a. t a -> Bool)
    -> (forall a. t a -> Int)
    -> (forall a. Eq a => a -> t a -> Bool)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> Foldable t
    $cfold :: forall m. Monoid m => Response m -> m
    fold :: forall m. Monoid m => Response m -> m
    $cfoldMap :: forall m a. Monoid m => (a -> m) -> Response a -> m
    foldMap :: forall m a. Monoid m => (a -> m) -> Response a -> m
    $cfoldMap' :: forall m a. Monoid m => (a -> m) -> Response a -> m
    foldMap' :: forall m a. Monoid m => (a -> m) -> Response a -> m
    $cfoldr :: forall a b. (a -> b -> b) -> b -> Response a -> b
    foldr :: forall a b. (a -> b -> b) -> b -> Response a -> b
    $cfoldr' :: forall a b. (a -> b -> b) -> b -> Response a -> b
    foldr' :: forall a b. (a -> b -> b) -> b -> Response a -> b
    $cfoldl :: forall b a. (b -> a -> b) -> b -> Response a -> b
    foldl :: forall b a. (b -> a -> b) -> b -> Response a -> b
    $cfoldl' :: forall b a. (b -> a -> b) -> b -> Response a -> b
    foldl' :: forall b a. (b -> a -> b) -> b -> Response a -> b
    $cfoldr1 :: forall a. (a -> a -> a) -> Response a -> a
    foldr1 :: forall a. (a -> a -> a) -> Response a -> a
    $cfoldl1 :: forall a. (a -> a -> a) -> Response a -> a
    foldl1 :: forall a. (a -> a -> a) -> Response a -> a
    $ctoList :: forall a. Response a -> [a]
    toList :: forall a. Response a -> [a]
    $cnull :: forall a. Response a -> Bool
    null :: forall a. Response a -> Bool
    $clength :: forall a. Response a -> Int
    length :: forall a. Response a -> Int
    $celem :: forall a. Eq a => a -> Response a -> Bool
    elem :: forall a. Eq a => a -> Response a -> Bool
    $cmaximum :: forall a. Ord a => Response a -> a
    maximum :: forall a. Ord a => Response a -> a
    $cminimum :: forall a. Ord a => Response a -> a
    minimum :: forall a. Ord a => Response a -> a
    $csum :: forall a. Num a => Response a -> a
    sum :: forall a. Num a => Response a -> a
    $cproduct :: forall a. Num a => Response a -> a
    product :: forall a. Num a => Response a -> a
    Foldable, Functor Response
    Foldable Response
    Functor Response
    -> Foldable Response
    -> (forall (f :: * -> *) a b.
        Applicative f =>
        (a -> f b) -> Response a -> f (Response b))
    -> (forall (f :: * -> *) a.
        Applicative f =>
        Response (f a) -> f (Response a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> Response a -> m (Response b))
    -> (forall (m :: * -> *) a.
        Monad m =>
        Response (m a) -> m (Response a))
    -> Traversable Response
    forall (t :: * -> *).
    Functor t
    -> Foldable t
    -> (forall (f :: * -> *) a b.
        Applicative f =>
        (a -> f b) -> t a -> f (t b))
    -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> t a -> m (t b))
    -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
    -> Traversable t
    forall (m :: * -> *) a. Monad m => Response (m a) -> m (Response a)
    forall (f :: * -> *) a.
    Applicative f =>
    Response (f a) -> f (Response a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Response a -> m (Response b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Response a -> f (Response b)
    $ctraverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Response a -> f (Response b)
    traverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Response a -> f (Response b)
    $csequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    Response (f a) -> f (Response a)
    sequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    Response (f a) -> f (Response a)
    $cmapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Response a -> m (Response b)
    mapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Response a -> m (Response b)
    $csequence :: forall (m :: * -> *) a. Monad m => Response (m a) -> m (Response a)
    sequence :: forall (m :: * -> *) a. Monad m => Response (m a) -> m (Response a)
    Traversable)

    data TwitterError
        = FromJSONError String
        | TwitterErrorResponse Status ResponseHeaders [TwitterErrorMessage]
        | TwitterUnknownErrorResponse Status ResponseHeaders Value
        | TwitterStatusError Status ResponseHeaders Value
        deriving (Int -> TwitterError -> ShowS
    [TwitterError] -> ShowS
    TwitterError -> String
    (Int -> TwitterError -> ShowS)
    -> (TwitterError -> String)
    -> ([TwitterError] -> ShowS)
    -> Show TwitterError
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> TwitterError -> ShowS
    showsPrec :: Int -> TwitterError -> ShowS
    $cshow :: TwitterError -> String
    show :: TwitterError -> String
    $cshowList :: [TwitterError] -> ShowS
    showList :: [TwitterError] -> ShowS
    Show, Typeable, TwitterError -> TwitterError -> Bool
    (TwitterError -> TwitterError -> Bool)
    -> (TwitterError -> TwitterError -> Bool) -> Eq TwitterError
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: TwitterError -> TwitterError -> Bool
    == :: TwitterError -> TwitterError -> Bool
    $c/= :: TwitterError -> TwitterError -> Bool
    /= :: TwitterError -> TwitterError -> Bool
    Eq)

    instance Exception TwitterError

    -- | Twitter Error Messages
    --
    -- see detail: <https://dev.twitter.com/docs/error-codes-responses>
    data TwitterErrorMessage = TwitterErrorMessage
        { TwitterErrorMessage -> Int
    twitterErrorCode :: Int
        , TwitterErrorMessage -> Text
    twitterErrorMessage :: T.Text
        }
        deriving (Int -> TwitterErrorMessage -> ShowS
    [TwitterErrorMessage] -> ShowS
    TwitterErrorMessage -> String
    (Int -> TwitterErrorMessage -> ShowS)
    -> (TwitterErrorMessage -> String)
    -> ([TwitterErrorMessage] -> ShowS)
    -> Show TwitterErrorMessage
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> TwitterErrorMessage -> ShowS
    showsPrec :: Int -> TwitterErrorMessage -> ShowS
    $cshow :: TwitterErrorMessage -> String
    show :: TwitterErrorMessage -> String
    $cshowList :: [TwitterErrorMessage] -> ShowS
    showList :: [TwitterErrorMessage] -> ShowS
    Show, Typeable TwitterErrorMessage
    Typeable TwitterErrorMessage
    -> (forall (c :: * -> *).
        (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g)
        -> TwitterErrorMessage
        -> c TwitterErrorMessage)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c TwitterErrorMessage)
    -> (TwitterErrorMessage -> Constr)
    -> (TwitterErrorMessage -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c TwitterErrorMessage))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c TwitterErrorMessage))
    -> ((forall b. Data b => b -> b)
        -> TwitterErrorMessage -> TwitterErrorMessage)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> TwitterErrorMessage -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> TwitterErrorMessage -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> TwitterErrorMessage -> m TwitterErrorMessage)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> TwitterErrorMessage -> m TwitterErrorMessage)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> TwitterErrorMessage -> m TwitterErrorMessage)
    -> Data TwitterErrorMessage
    TwitterErrorMessage -> Constr
    TwitterErrorMessage -> DataType
    (forall b. Data b => b -> b)
    -> TwitterErrorMessage -> TwitterErrorMessage
    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) -> TwitterErrorMessage -> u
    forall u.
    (forall d. Data d => d -> u) -> TwitterErrorMessage -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TwitterErrorMessage
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> TwitterErrorMessage
    -> c TwitterErrorMessage
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TwitterErrorMessage)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TwitterErrorMessage)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> TwitterErrorMessage
    -> c TwitterErrorMessage
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> TwitterErrorMessage
    -> c TwitterErrorMessage
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TwitterErrorMessage
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TwitterErrorMessage
    $ctoConstr :: TwitterErrorMessage -> Constr
    toConstr :: TwitterErrorMessage -> Constr
    $cdataTypeOf :: TwitterErrorMessage -> DataType
    dataTypeOf :: TwitterErrorMessage -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TwitterErrorMessage)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TwitterErrorMessage)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TwitterErrorMessage)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TwitterErrorMessage)
    $cgmapT :: (forall b. Data b => b -> b)
    -> TwitterErrorMessage -> TwitterErrorMessage
    gmapT :: (forall b. Data b => b -> b)
    -> TwitterErrorMessage -> TwitterErrorMessage
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r
    $cgmapQ :: forall u.
    (forall d. Data d => d -> u) -> TwitterErrorMessage -> [u]
    gmapQ :: forall u.
    (forall d. Data d => d -> u) -> TwitterErrorMessage -> [u]
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> TwitterErrorMessage -> u
    gmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> TwitterErrorMessage -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TwitterErrorMessage -> m TwitterErrorMessage
    Data, Typeable)

    instance Eq TwitterErrorMessage where
        TwitterErrorMessage {twitterErrorCode :: TwitterErrorMessage -> Int
    twitterErrorCode = Int
    a} == :: TwitterErrorMessage -> TwitterErrorMessage -> Bool
    == TwitterErrorMessage {twitterErrorCode :: TwitterErrorMessage -> Int
    twitterErrorCode = Int
    b} =
            Int
    a Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == Int
    b

    instance Ord TwitterErrorMessage where
        compare :: TwitterErrorMessage -> TwitterErrorMessage -> Ordering
    compare TwitterErrorMessage {twitterErrorCode :: TwitterErrorMessage -> Int
    twitterErrorCode = Int
    a} TwitterErrorMessage {twitterErrorCode :: TwitterErrorMessage -> Int
    twitterErrorCode = Int
    b} =
            Int
    a Int -> Int -> Ordering
    forall a. Ord a => a -> a -> Ordering
    `compare` Int
    b

    instance Enum TwitterErrorMessage where
        fromEnum :: TwitterErrorMessage -> Int
    fromEnum = TwitterErrorMessage -> Int
    twitterErrorCode
        toEnum :: Int -> TwitterErrorMessage
    toEnum Int
    a = Int -> Text -> TwitterErrorMessage
    TwitterErrorMessage Int
    a Text
    T.empty

    instance FromJSON TwitterErrorMessage where
        parseJSON :: Value -> Parser TwitterErrorMessage
    parseJSON (Object Object
    o) =
            Int -> Text -> TwitterErrorMessage
    TwitterErrorMessage
                (Int -> Text -> TwitterErrorMessage)
    -> Parser Int -> Parser (Text -> TwitterErrorMessage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Object
    o Object -> Key -> Parser Int
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "code"
                Parser (Text -> TwitterErrorMessage)
    -> Parser Text -> Parser TwitterErrorMessage
    forall a b. Parser (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Object
    o Object -> Key -> Parser Text
    forall a. FromJSON a => Object -> Key -> Parser a
    .: Key
    "message"
        parseJSON Value
    v = String -> Parser TwitterErrorMessage
    forall a. String -> Parser a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Parser TwitterErrorMessage)
    -> String -> Parser TwitterErrorMessage
    forall a b. (a -> b) -> a -> b
    $ String
    "unexpected: " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Value -> String
    forall a. Show a => a -> String
    show Value
    v