You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to know if there is a way to mapLeft on a TaskEither pipe that does something similar to the flatMap 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 async json or text method, which makes my left side handling a Task.
I was able to workaround by using TE.swap then transforming the error with TE.flatMapTask, and then swapping them back, it works, but it would be nice If there is a more terse way of doing this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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