Skip to content

Instantly share code, notes, and snippets.

@rajaraodv
Last active November 16, 2016 18:53
Show Gist options
  • Save rajaraodv/8b34f487ce9e3fc21624f6126455992a to your computer and use it in GitHub Desktop.
Save rajaraodv/8b34f487ce9e3fc21624f6126455992a to your computer and use it in GitHub Desktop.
class Maybe {
constructor(val) {
this.val = val;
}
...
...
//"ap" takes another "maybe" and applies the function it's holding in itself.
//this.val MUST be a function or Nothing (and can't be some string or int)
ap(differentMayBe) {
return differentMayBe.map(this.val); 
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment