Skip to content

Instantly share code, notes, and snippets.

@dewey92
Last active February 28, 2019 02:16
Show Gist options
  • Select an option

  • Save dewey92/9d55f47ea80adf2793ab56abdbcded15 to your computer and use it in GitHub Desktop.

Select an option

Save dewey92/9d55f47ea80adf2793ab56abdbcded15 to your computer and use it in GitHub Desktop.
Partial App - Applicative Functor JS
const liftA2 = f => (m, n) => m.map(f).ap(n);
const add = x => y => x + y;
const monadicAdd = liftA2(add);
add(5, 6) // 11
monadicAdd(Just(5), Just(6)) // Just(11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment