I have three different functions: f1
, f2
, and f3
.
f1
and f3
are synchronous functions that return an Option<string>
, while f2
is an asynchronous function that returns a
Promise<Option<string>>
.
How can I combine these three functions into a single pipe?
Below is the code I currently have:
import {some, chain} from 'fp-ts/lib/Option';
import {pipe} from 'fp-ts/lib/pipeable';
const f1 = (input: string) => {
return some(input + " f1")
};
const f2 = async (input: string) => {
return some(input + " f2")
};
const f3 = (input: string) => {
return some(input + " f3");
};
const result = pipe(
"X",
f1,
chain(f2),
chain(f3),
);
console.log("result", result);