{"action":"created","issue":{"url":"https://api.github.com/repos/ramda/ramda/issues/1073","labels_url":"https://api.github.com/repos/ramda/ramda/issues/1073/labels{/name}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1073/comments","events_url":"https://api.github.com/repos/ramda/ramda/issues/1073/events","html_url":"https://github.com/ramda/ramda/issues/1073","id":74359030,"number":1073,"title":"Deep merge","user":{"login":"ivan-kleshnin","id":2128182,"avatar_url":"https://avatars.githubusercontent.com/u/2128182?v=3","gravatar_id":"","url":"https://api.github.com/users/ivan-kleshnin","html_url":"https://github.com/ivan-kleshnin","followers_url":"https://api.github.com/users/ivan-kleshnin/followers","following_url":"https://api.github.com/users/ivan-kleshnin/following{/other_user}","gists_url":"https://api.github.com/users/ivan-kleshnin/gists{/gist_id}","starred_url":"https://api.github.com/users/ivan-kleshnin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivan-kleshnin/subscriptions","organizations_url":"https://api.github.com/users/ivan-kleshnin/orgs","repos_url":"https://api.github.com/users/ivan-kleshnin/repos","events_url":"https://api.github.com/users/ivan-kleshnin/events{/privacy}","received_events_url":"https://api.github.com/users/ivan-kleshnin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":90,"created_at":"2015-05-08T13:13:22Z","updated_at":"2015-05-24T18:15:29Z","closed_at":"2015-05-19T21:59:35Z","body":"```js\r\nimport {merge} from \"ramda\";\r\n\r\nconsole.log(\r\n  merge(\r\n    {age: 30, tags: [\"a\"] },\r\n    {tags: [\"b\"] }\r\n  )\r\n); // {age: 30, tags: [\"b\"]} -- ok\r\n\r\nconsole.log(\r\n  merge(\r\n    {model: {age: 30, tags: [\"a\"] }},\r\n    {model: {tags: [\"b\"] }}\r\n  )\r\n); // {model: { tags: [\"b\"] }} -- ??? where is age ???\r\n```\r\n\r\nSo now merge behaves like `Object.assign` and does not merge nested objects.\r\n\r\n```js\r\nconsole.log(\r\n  Object.assign(\r\n    {},\r\n    {model: {age: 30, tags: [\"a\"] }},\r\n    {model: {tags: [\"b\"] }}\r\n  )\r\n); // {model: { tags: [\"b\"] }} -- this is still lame but expectable from Object.assign\r\n```\r\n\r\nThe note from docs \r\n\r\n> This function will not mutate passed-in objects\r\n\r\nis not clear. Do we talk about being immutable or do we talk about mimicking `Object.assign` behavior?\r\n\r\nIf it's expected behavior I'd recommend to reconsider it. \r\nTo my experience, the business cases where merges of nested objects are required are\r\nmuch more common. And, even more important, you may emulate \"shallow merge\" behavior with \"deep merge\" but not vice versa.\r\n\r\n```js \r\n// emulate SHALLOW merge for specific field\r\nresult = assoc(\"model\", data2.model, merge(data1, data2));\r\n```"},"comment":{"url":"https://api.github.com/repos/ramda/ramda/issues/comments/105045678","html_url":"https://github.com/ramda/ramda/issues/1073#issuecomment-105045678","issue_url":"https://api.github.com/repos/ramda/ramda/issues/1073","id":105045678,"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-05-24T18:15:29Z","updated_at":"2015-05-24T18:15:29Z","body":"> At this point I better unbsubscribe. \r\n\r\nUp to you, of course.  I know you're not happy with Ramda living with some of the quirks of the language.  But that's how it's always worked.  It is a Javascript library, and not an attempt to build Clojure, Haskell, Erlang, or some other more functional language inside JS."}}