HTTP Response Either How?

Hi all,

I’m trying to use HTTP Conduit and it’s really good but now I’m trapped on how to get if the response is OK or if it has an error using the Response Either.

Normally that is done with a case of using Left and Right but this is wrapped on a Response that I don’t know how to extract.

module Main where

import Data.Aeson ( Value )
import Network.HTTP.Simple ( httpJSONEither, Response, JSONException )

main :: IO ()
main = do
    response <- httpJSONEither "" :: IO (Response (Either JSONException Value))
    case response of
        r ->
            print r

So instead of just r, what match cases are required for the Response Either ?

The type of the response and source code can be found at

Please find a cabal repo at for easy reproducing this.

Best regards,

Carlos Saltos

You’re probably looking for

Just use that function on response to get the Either, then you can pattern match on it like you mentioned.


Yes, that’s the one, great !! :+1: :sunglasses:

You are my hero Eddie … thank you very much for your valuable help !! :+1::sunglasses: