Skip to content

Instantly share code, notes, and snippets.

@huijari
Created May 21, 2017 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huijari/e790332a7ad344163fa5ce418c7c2d28 to your computer and use it in GitHub Desktop.
Save huijari/e790332a7ad344163fa5ce418c7c2d28 to your computer and use it in GitHub Desktop.
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