Last active
November 16, 2016 18:53
-
-
Save rajaraodv/8b34f487ce9e3fc21624f6126455992a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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