Created
February 7, 2016 14:37
-
-
Save derhuerst/8deb93d9fd292b421ce9 to your computer and use it in GitHub Desktop.
something like a maybe monad? not sure…
This file contains 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
maybe = -> | |
fns = [] | |
monad = (input) -> fns.reduce ((v, fn) -> fn v), input | |
Object.assign monad, with: (fn) -> | |
fns.push (v) -> if v? then fn v else null | |
monad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment