{"action":"created","issue":{"url":"https://api.github.com/repos/ramda/ramda/issues/1443","labels_url":"https://api.github.com/repos/ramda/ramda/issues/1443/labels{/name}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1443/comments","events_url":"https://api.github.com/repos/ramda/ramda/issues/1443/events","html_url":"https://github.com/ramda/ramda/pull/1443","id":111328478,"number":1443,"title":"Adds mergeWith and mergeWithKey","user":{"login":"scott-christopher","id":8951601,"avatar_url":"https://avatars.githubusercontent.com/u/8951601?v=3","gravatar_id":"","url":"https://api.github.com/users/scott-christopher","html_url":"https://github.com/scott-christopher","followers_url":"https://api.github.com/users/scott-christopher/followers","following_url":"https://api.github.com/users/scott-christopher/following{/other_user}","gists_url":"https://api.github.com/users/scott-christopher/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-christopher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-christopher/subscriptions","organizations_url":"https://api.github.com/users/scott-christopher/orgs","repos_url":"https://api.github.com/users/scott-christopher/repos","events_url":"https://api.github.com/users/scott-christopher/events{/privacy}","received_events_url":"https://api.github.com/users/scott-christopher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-14T05:46:40Z","updated_at":"2015-10-27T18:07:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ramda/ramda/pulls/1443","html_url":"https://github.com/ramda/ramda/pull/1443","diff_url":"https://github.com/ramda/ramda/pull/1443.diff","patch_url":"https://github.com/ramda/ramda/pull/1443.patch"},"body":"Given the recent discussions again in gitter about merging objects, I thought it might help to throw this up as a concrete example to discuss, if nothing else.\r\n\r\nTwo new public functions are introduced to allow a custom merging strategy to be provided for merging objects with intersecting keys:\r\n```\r\n// provided with values of each object only\r\nmergeWith :: (a -> a -> a) -> {a} -> {a}\r\n// provided with the key along with the values of each object\r\nmergeWithKey :: (String -> a -> a -> a) -> {a} -> {a} -> {a}\r\n```\r\n\r\nThe main points of potential contention with this implementation:\r\n* ~~`internal/_mergeWith` provides the non-intersecting keys as objects to the provided `fnL` and `fnR` functions (e.g. `fnL :: {a} -> {a}`) to allow filtering of the resulting object – should these instead operate on individual key/pairs like `fn` (e.g. `(String, a) -> a`)? Doing so would prevent reuse for potential hypothetical functions like `mergeIntersection`.~~\r\n\r\n* ~~to support filtering, the implementation currently excludes keys from the resulting object whose values are `undefined` – this feels like it overloads the behaviour of `mergeWith`/`mergeWithKeys` a little.~~\r\n\r\n_edit_: I've since removed `internal/_mergeWith`, moving the implementation into `mergeWithKeys` and I've also removed the behaviour of filtering `undefined` values."},"comment":{"url":"https://api.github.com/repos/ramda/ramda/issues/comments/151591579","html_url":"https://github.com/ramda/ramda/pull/1443#issuecomment-151591579","issue_url":"https://api.github.com/repos/ramda/ramda/issues/1443","id":151591579,"user":{"login":"CrossEye","id":151263,"avatar_url":"https://avatars.githubusercontent.com/u/151263?v=3","gravatar_id":"","url":"https://api.github.com/users/CrossEye","html_url":"https://github.com/CrossEye","followers_url":"https://api.github.com/users/CrossEye/followers","following_url":"https://api.github.com/users/CrossEye/following{/other_user}","gists_url":"https://api.github.com/users/CrossEye/gists{/gist_id}","starred_url":"https://api.github.com/users/CrossEye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrossEye/subscriptions","organizations_url":"https://api.github.com/users/CrossEye/orgs","repos_url":"https://api.github.com/users/CrossEye/repos","events_url":"https://api.github.com/users/CrossEye/events{/privacy}","received_events_url":"https://api.github.com/users/CrossEye/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T18:07:57Z","updated_at":"2015-10-27T18:07:57Z","body":"It looks as though there are some conflicts here... But once those are cleaned up, anyone have objections to merging this?"}}