fetchComponent :: Component -> IO Envelope
fetchComponent cmp =
    let uri = endpoint cmp
    in do
        res <- simpleHTTP (makeLazyRequest uri)
        body <- getResponseBody res

        case decodeEnvelope body of
            Left _ ->
                error $ "Invalid response from " ++ uri

            Right envelope ->
                return envelope
fetchComponent :: Component -> IO Envelope
fetchComponent cmp =
    let uri = endpoint cmp
    in do
        res <- simpleHTTP (makeLazyRequest uri)
        body <- getResponseBody res

        case decodeEnvelope body of
            Left _ ->
                error $ "Invalid response from " ++ uri

            Right envelope ->
                return envelope
fetchComponent cmp =
    let uri = endpoint cmp
    in do
        res <- simpleHTTP (makeLazyRequest uri)
        body <- getResponseBody res

        case decodeEnvelope body of
            Left _ ->
                error $ "Invalid response from " ++ uri

            Right envelope ->
                return envelope