Skip to content

Instantly share code, notes, and snippets.

@MattMS MattMS/
Last active Mar 21, 2019

What would you like to do?
Simplify calling curried functions.


Use eat to simplify calling curried functions.

You can rewrite a(b)(c) as eat(a, b, c).


eat = (curries...)->
	curries = curries[0] if Array.isArray curries[0]
	curries.reduce (f, v)-> f v


const eat = (...curries) => (Array.isArray(curries[0]) ? curries[0] : curries).reduce((f, v) => f(v));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.