Solution Review: Working with TaskEither
Learn to use TaskEither in a function.
We'll cover the following...
Solution
Press + to interact
const application = (input: string) => {return pipe(checkInput(input),TE.fromEither,TE.chain((input: string) => TE.tryCatch(() => externalService(input), errorMapper)),TE.map(toUpperCase),TE.getOrElse((err) => T.of(`We got back an error: ${err}`)))();};
Explanation
Here’s a line-by-line explanation of the solution above:
- Line 1