Created
August 23, 2016 16:21
-
-
Save DrBoolean/da3cbe035c2228e5ab3e50727de01ddc to your computer and use it in GitHub Desktop.
Curry use
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
| // to, from are awkward here. generateReport only needs them to send an email | |
| const generateReport = (to, from, data) => | |
| mungeData(data, (warnings, munged) => | |
| renderReport(munged, (report) => emailReport(to, from, report))) | |
| generateReport(“[email protected]”, “[email protected]”, {some: ‘data’}) | |
| // if emailReport was curried, we could pass in the emailer | |
| const generateReport = (sendEmail, data) => | |
| mungeData(data, (warnings, munged) => | |
| renderReport(munged, sendEmail)) | |
| generateReport(emailReport(“[email protected]”, “[email protected]”), {some: ‘data’}) |
Author
That's some serious indentation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
arguably, this is contrived as we could push the emailing out to the caller, but sometimes this is desirable.