No title

Anonymous Coward 2018-03-05 13:24:28.872829 UTC

1
2simplify
3 :: FromJSON a
4 => Either HttpException (Response (Either JSONException a))
5 -> Either String a
6simplify result = case result of
7 Right res -> case (getResponseStatus res, getResponseBody res) of
8 (ok200, Right parsed) -> Right parsed
9 (notfound404, _) -> Left "not found"
10 (_, Left x) -> Left "parse error"
11 (_, _) -> Left "server error"
12 Left _ -> Left "no connection"