Skip to content

Instantly share code, notes, and snippets.

@DrBoolean
Created August 23, 2016 16:21
Show Gist options
  • Select an option

  • Save DrBoolean/da3cbe035c2228e5ab3e50727de01ddc to your computer and use it in GitHub Desktop.

Select an option

Save DrBoolean/da3cbe035c2228e5ab3e50727de01ddc to your computer and use it in GitHub Desktop.
Curry use
// 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’})
@ryanpcmcquen
Copy link

That's some serious indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment