Skip to content

Instantly share code, notes, and snippets.

@huijari huijari/maybe.js
Created May 21, 2017

Embed
What would you like to do?
const Just = value => ({
bind: f => f(value)
});
const Nothing = () => ({
bind: Nothing
});
const getUser = name => Just({
getPicture: () => Nothing()
});
const userM = getUser();
userM
.bind(user => user.getPicture())
.bind(picture => picture.getUrl())
.bind(console.log.bind(console));
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.