diff --git a/src/function.js b/src/function.js index 057aa19..1ef3e02 100644 --- a/src/function.js +++ b/src/function.js @@ -1,6 +1,6 @@ import { curry, curryN } from './curry.js' import { dispatch } from './fantasy-land.js' -import { concat as iconcat, isIterable, iter } from './list.js' +import { concat as iconcat, isIterable, iter, tail } from './list.js' /** @import { Fn, Morphism, InferredMorphism, Predicate } from './types.js' */ @@ -20,7 +20,7 @@ export const tap = curry((f, x) => { * @param {...Fn} fns * @returns {(x: any) => any} */ -export const pipe = ([f, ...fns]) => (...args) => fns.reduce((v, f) => f(v), f(...args)) +export const pipe = (...fns) => (...args) => tail(fns).reduce((v, f) => f(v), head(fns)(...args)) export const concat = dispatch(['fantasy-land/concat', 'concat'], (b, a) => {