【发布时间】:2019-11-22 21:29:00
【问题描述】:
一些例子
const f = <L, R>(xs: Either<L, R>[]): Either<L, R[]> => { throw new Error('Not Implemented') };
const f = <T>(xs: Promise<T>[]): Promise<T[]> => { throw new Error('Not Implemented') };
const f = <T>(xs: Box<T>[]): Box<T[]> => { throw new Error('Not Implemented') };
这些都执行某种减少。但是,这里的半群只是一个 List。
从可读性的角度来看,这些函数有什么好名字。
这里显然存在一定程度的主观性,这是 SO 所不鼓励的。但是,我觉得也可以根据一些客观标准/理由来说一个名字的好坏。
也许只有collect或gather这行?
【问题讨论】:
-
可能是
sequence。
标签: typescript functional-programming naming-conventions naming