Last active
August 29, 2015 14:06
-
-
Save L8D/7da36e2a909f8fde363e to your computer and use it in GitHub Desktop.
The 'Data' monad/tuple thingy in JavaScript
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
| var Data = function(first, second, third, fourth, fifth, sixth, seventh) { | |
| return function(iterator) { | |
| return iterator(first, second, third, fourth, fifth, sixth, seventh); | |
| }; | |
| }; | |
| // or more elegantly | |
| var Data = function(a, b, c, d, e, f, g) { | |
| return function(fn) { | |
| return fn(a, b, c, e, f, g); | |
| }; | |
| }; | |
| var Data = (a, b, c, d, e, f, g) => fn => fn(a, b, c, d, e, f, g); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment