diff --git a/src/function.js b/src/function.js index fd9263f..057aa19 100644 --- a/src/function.js +++ b/src/function.js @@ -11,11 +11,16 @@ import { concat as iconcat, isIterable, iter } from './list.js' */ export const id = x => x +export const tap = curry((f, x) => { + f(x) + return x +}) + /** * @param {...Fn} fns * @returns {(x: any) => any} */ -export const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x) +export const pipe = ([f, ...fns]) => (...args) => fns.reduce((v, f) => f(v), f(...args)) export const concat = dispatch(['fantasy-land/concat', 'concat'], (b, a) => {