我認為有兩種慣用的寫作方式: 使用對chain的嵌套調用: pipe( fetchDataA(), TE.chain(a => { // capture `a` here return pipe( fetchBBasedOnOutputOfA(a), // use `a` to get `b` TE.chain(b => fetchCBasedOnOutputOfAandB(a, b)) // use `a` and `b` to get `c` ) })) 使用Do表示法:fp-ts公開了一個“do”語法,它可以減輕與chain的過度嵌套,特別是當您需要捕獲大量稍后在程序流的不同部分重用的值時。 pipe( // begin the `do` notation TE.Do, // bind the first result to a variable `a` TE.bind('a', fetchDataA), // use your `a` to get your second result, and bind that to the variable `b` TE.bind('b', ({ a }) => fetchBBasedOnOutputOfA(a)), // finally, use `a` and `b` to get your third resu