Skip to content

Instantly share code, notes, and snippets.

@victorvoid victorvoid/composability-example03.js Secret

Last active Jul 19, 2018
Embed
What would you like to do?
const Functor = x => ({
map: f => Functor(f(x)),
fold: f => f(x)
})
const app = (n) =>
Functor(n)
.map(n => n * 2)
.map(n => n + 1)
app(10)
.fold(console.log) //21
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.