Is there a flatMapLeft or similar when transforming errors? #1903
Unanswered
batusai513
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to know if there is a way to
mapLeft
on a TaskEither pipe that does something similar to theflatMap
function, it can take a transformer function that return a Task and flatten the type, the reason I'm asking is that the http library that I use when there is a response other than in the range of 200, it throws and the response is a Response object, which I can extract the server response using the asyncjson
ortext
method, which makes my left side handling a Task.I was able to workaround by using
TE.swap
then transforming the error withTE.flatMapTask
, and then swapping them back, it works, but it would be nice If there is a more terse way of doing this.Beta Was this translation helpful? Give feedback.
All reactions