:3 im tired of typing these

This commit is contained in:
Rowan 2025-04-17 19:56:17 -05:00
parent 0f2577167f
commit c545be05ea

View file

@ -1,6 +1,6 @@
import { curry, curryN } from './curry.js' import { curry, curryN } from './curry.js'
import { dispatch } from './fantasy-land.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' */ /** @import { Fn, Morphism, InferredMorphism, Predicate } from './types.js' */
@ -20,7 +20,7 @@ export const tap = curry((f, x) => {
* @param {...Fn} fns * @param {...Fn} fns
* @returns {(x: any) => any} * @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'], export const concat = dispatch(['fantasy-land/concat', 'concat'],
(b, a) => { (b, a) => {