{"action":"created","issue":{"url":"https://api.github.com/repos/plaid/async-problem/issues/11","labels_url":"https://api.github.com/repos/plaid/async-problem/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/plaid/async-problem/issues/11/comments","events_url":"https://api.github.com/repos/plaid/async-problem/issues/11/events","html_url":"https://github.com/plaid/async-problem/pull/11","id":110858048,"number":11,"title":"Added kgo version","user":{"login":"KoryNunn","id":1401037,"avatar_url":"https://avatars.githubusercontent.com/u/1401037?v=3","gravatar_id":"","url":"https://api.github.com/users/KoryNunn","html_url":"https://github.com/KoryNunn","followers_url":"https://api.github.com/users/KoryNunn/followers","following_url":"https://api.github.com/users/KoryNunn/following{/other_user}","gists_url":"https://api.github.com/users/KoryNunn/gists{/gist_id}","starred_url":"https://api.github.com/users/KoryNunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KoryNunn/subscriptions","organizations_url":"https://api.github.com/users/KoryNunn/orgs","repos_url":"https://api.github.com/users/KoryNunn/repos","events_url":"https://api.github.com/users/KoryNunn/events{/privacy}","received_events_url":"https://api.github.com/users/KoryNunn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-10-11T14:07:36Z","updated_at":"2015-10-12T04:25:47Z","closed_at":"2015-10-12T03:14:57Z","pull_request":{"url":"https://api.github.com/repos/plaid/async-problem/pulls/11","html_url":"https://github.com/plaid/async-problem/pull/11","diff_url":"https://github.com/plaid/async-problem/pull/11.diff","patch_url":"https://github.com/plaid/async-problem/pull/11.patch"},"body":"I've done it without ES6 features, not sure if that's a concern."},"comment":{"url":"https://api.github.com/repos/plaid/async-problem/issues/comments/147289594","html_url":"https://github.com/plaid/async-problem/pull/11#issuecomment-147289594","issue_url":"https://api.github.com/repos/plaid/async-problem/issues/11","id":147289594,"user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T04:25:47Z","updated_at":"2015-10-12T04:25:47Z","body":"The problem with `doItWithAsync` is that it does nothing except trigger side effects. `concatFiles`, on the other hand, is a pure function which can be used to define more complex functions via composition. For example:\r\n\r\n```javascript\r\n// concatFilesLower :: String -> Task Error String\r\nconst concatFilesLower = R.compose(R.map(R.toLower), concatFiles);\r\n```\r\n\r\nNow we have a function for acquiring the text of all the files in a directory, converted to lower case.\r\n\r\nAchieving something similar with `doItWithAsync` requires a decorator:\r\n\r\n```javascript\r\nconst doItWithAsyncLower = (dir, callback) => {\r\n  doItWithAsync(dir, (err, data) => {\r\n    callback(err == null ? data.toLowerCase() : err);\r\n  });\r\n};\r\n```\r\n\r\nThis has a problem common to all decorators: the decorator must know about the *inputs* to the function it wraps, not just its output. Additionally, the error handling is duplicated.\r\n\r\nIt seems we're talking at cross-purposes. I'm happy to discuss this on [Gitter][1] if you're interested in a low-latency conversation. :)\r\n\r\n\r\n[1]: https://gitter.im/plaid/sanctuary\r\n"}}