{"action":"created","comment":{"url":"https://api.github.com/repos/non/cats/pulls/comments/24085953","id":24085953,"diff_hunk":"@@ -0,0 +1,32 @@\n+package cats\n+package std\n+\n+\n+trait MapInstances {\n+\n+  implicit def MapInstance[K]: Traverse[Map[K, ?]] with FlatMap[Map[K, ?]] =\n+    new Traverse[Map[K, ?]] with FlatMap[Map[K, ?]] {\n+      override def traverse[G[_] : Applicative, A, B](fa: Map[K, A])(f: (A) => G[B]): G[Map[K, B]] = ???\n+\n+      override def flatMap[A, B](fa: Map[K, A])(f: (A) => Map[K, B]): Map[K, B] =\n+        fa.flatMap { case (_, a) => f(a) }\n+\n+      override def foldLeft[A, B](fa: Map[K, A], b: B)(f: (B, A) => B): B =\n+        fa.foldLeft(b) { case (x, (k, a)) => f(x, a)}\n+\n+      override def foldRight[A, B](fa: Map[K, A], b: B)(f: (A, B) => B): B =\n+        fa.foldRight(b) { case ((k, a), z) => f(a, z)}\n+\n+      override def foldRight[A, B](fa: Map[K, A], b: Lazy[B])(f: (A, Lazy[B]) => B): Lazy[B] = {\n+        // we use Lazy.byName(...) to avoid memoizing intermediate values.\n+        def loop(as: Map[K, A], b: Lazy[B]): Lazy[B] =\n+          as.toList match {\n+            case Nil => b\n+            case a :: rest => Lazy.byName(f(a._2, foldRight(rest.toMap, b)(f)))","path":"std/src/main/scala/cats/std/map.scala","position":25,"original_position":25,"commit_id":"25822741587cb1260fb12dc5ff2110ef23bf8390","original_commit_id":"25822741587cb1260fb12dc5ff2110ef23bf8390","user":{"login":"non","id":218045,"avatar_url":"https://avatars.githubusercontent.com/u/218045?v=3","gravatar_id":"","url":"https://api.github.com/users/non","html_url":"https://github.com/non","followers_url":"https://api.github.com/users/non/followers","following_url":"https://api.github.com/users/non/following{/other_user}","gists_url":"https://api.github.com/users/non/gists{/gist_id}","starred_url":"https://api.github.com/users/non/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/non/subscriptions","organizations_url":"https://api.github.com/users/non/orgs","repos_url":"https://api.github.com/users/non/repos","events_url":"https://api.github.com/users/non/events{/privacy}","received_events_url":"https://api.github.com/users/non/received_events","type":"User","site_admin":false},"body":"I think that's based on code I wrote.\r\n\r\nWhen I'm deconstructing things I like to avoid the words *head* and *tail* since they potentially can be confused with the methods involved. In this case, we are splitting a list into `a` (the head value) and `rest` (the rest of the list).\r\n\r\nI guess tastes vary. Interested to hear if this bugs other people too?","created_at":"2015-02-04T14:28:08Z","updated_at":"2015-02-04T14:28:08Z","html_url":"https://github.com/non/cats/pull/65#discussion_r24085953","pull_request_url":"https://api.github.com/repos/non/cats/pulls/65","_links":{"self":{"href":"https://api.github.com/repos/non/cats/pulls/comments/24085953"},"html":{"href":"https://github.com/non/cats/pull/65#discussion_r24085953"},"pull_request":{"href":"https://api.github.com/repos/non/cats/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/non/cats/pulls/65","id":28634154,"html_url":"https://github.com/non/cats/pull/65","diff_url":"https://github.com/non/cats/pull/65.diff","patch_url":"https://github.com/non/cats/pull/65.patch","issue_url":"https://api.github.com/repos/non/cats/issues/65","number":65,"state":"open","locked":false,"title":"Map Instance Implementation","user":{"login":"bthuillier","id":482256,"avatar_url":"https://avatars.githubusercontent.com/u/482256?v=3","gravatar_id":"","url":"https://api.github.com/users/bthuillier","html_url":"https://github.com/bthuillier","followers_url":"https://api.github.com/users/bthuillier/followers","following_url":"https://api.github.com/users/bthuillier/following{/other_user}","gists_url":"https://api.github.com/users/bthuillier/gists{/gist_id}","starred_url":"https://api.github.com/users/bthuillier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bthuillier/subscriptions","organizations_url":"https://api.github.com/users/bthuillier/orgs","repos_url":"https://api.github.com/users/bthuillier/repos","events_url":"https://api.github.com/users/bthuillier/events{/privacy}","received_events_url":"https://api.github.com/users/bthuillier/received_events","type":"User","site_admin":false},"body":"#54","created_at":"2015-02-04T12:19:49Z","updated_at":"2015-02-04T14:28:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af2cc324c4fe1d02d36e906f7632ee41e83f5509","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/non/cats/pulls/65/commits","review_comments_url":"https://api.github.com/repos/non/cats/pulls/65/comments","review_comment_url":"https://api.github.com/repos/non/cats/pulls/comments/{number}","comments_url":"https://api.github.com/repos/non/cats/issues/65/comments","statuses_url":"https://api.github.com/repos/non/cats/statuses/25822741587cb1260fb12dc5ff2110ef23bf8390","head":{"label":"bthuillier:map-instances","ref":"map-instances","sha":"25822741587cb1260fb12dc5ff2110ef23bf8390","user":{"login":"bthuillier","id":482256,"avatar_url":"https://avatars.githubusercontent.com/u/482256?v=3","gravatar_id":"","url":"https://api.github.com/users/bthuillier","html_url":"https://github.com/bthuillier","followers_url":"https://api.github.com/users/bthuillier/followers","following_url":"https://api.github.com/users/bthuillier/following{/other_user}","gists_url":"https://api.github.com/users/bthuillier/gists{/gist_id}","starred_url":"https://api.github.com/users/bthuillier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bthuillier/subscriptions","organizations_url":"https://api.github.com/users/bthuillier/orgs","repos_url":"https://api.github.com/users/bthuillier/repos","events_url":"https://api.github.com/users/bthuillier/events{/privacy}","received_events_url":"https://api.github.com/users/bthuillier/received_events","type":"User","site_admin":false},"repo":{"id":30291754,"name":"cats","full_name":"bthuillier/cats","owner":{"login":"bthuillier","id":482256,"avatar_url":"https://avatars.githubusercontent.com/u/482256?v=3","gravatar_id":"","url":"https://api.github.com/users/bthuillier","html_url":"https://github.com/bthuillier","followers_url":"https://api.github.com/users/bthuillier/followers","following_url":"https://api.github.com/users/bthuillier/following{/other_user}","gists_url":"https://api.github.com/users/bthuillier/gists{/gist_id}","starred_url":"https://api.github.com/users/bthuillier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bthuillier/subscriptions","organizations_url":"https://api.github.com/users/bthuillier/orgs","repos_url":"https://api.github.com/users/bthuillier/repos","events_url":"https://api.github.com/users/bthuillier/events{/privacy}","received_events_url":"https://api.github.com/users/bthuillier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bthuillier/cats","description":"","fork":true,"url":"https://api.github.com/repos/bthuillier/cats","forks_url":"https://api.github.com/repos/bthuillier/cats/forks","keys_url":"https://api.github.com/repos/bthuillier/cats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bthuillier/cats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bthuillier/cats/teams","hooks_url":"https://api.github.com/repos/bthuillier/cats/hooks","issue_events_url":"https://api.github.com/repos/bthuillier/cats/issues/events{/number}","events_url":"https://api.github.com/repos/bthuillier/cats/events","assignees_url":"https://api.github.com/repos/bthuillier/cats/assignees{/user}","branches_url":"https://api.github.com/repos/bthuillier/cats/branches{/branch}","tags_url":"https://api.github.com/repos/bthuillier/cats/tags","blobs_url":"https://api.github.com/repos/bthuillier/cats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bthuillier/cats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bthuillier/cats/git/refs{/sha}","trees_url":"https://api.github.com/repos/bthuillier/cats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bthuillier/cats/statuses/{sha}","languages_url":"https://api.github.com/repos/bthuillier/cats/languages","stargazers_url":"https://api.github.com/repos/bthuillier/cats/stargazers","contributors_url":"https://api.github.com/repos/bthuillier/cats/contributors","subscribers_url":"https://api.github.com/repos/bthuillier/cats/subscribers","subscription_url":"https://api.github.com/repos/bthuillier/cats/subscription","commits_url":"https://api.github.com/repos/bthuillier/cats/commits{/sha}","git_commits_url":"https://api.github.com/repos/bthuillier/cats/git/commits{/sha}","comments_url":"https://api.github.com/repos/bthuillier/cats/comments{/number}","issue_comment_url":"https://api.github.com/repos/bthuillier/cats/issues/comments/{number}","contents_url":"https://api.github.com/repos/bthuillier/cats/contents/{+path}","compare_url":"https://api.github.com/repos/bthuillier/cats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bthuillier/cats/merges","archive_url":"https://api.github.com/repos/bthuillier/cats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bthuillier/cats/downloads","issues_url":"https://api.github.com/repos/bthuillier/cats/issues{/number}","pulls_url":"https://api.github.com/repos/bthuillier/cats/pulls{/number}","milestones_url":"https://api.github.com/repos/bthuillier/cats/milestones{/number}","notifications_url":"https://api.github.com/repos/bthuillier/cats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bthuillier/cats/labels{/name}","releases_url":"https://api.github.com/repos/bthuillier/cats/releases{/id}","created_at":"2015-02-04T09:40:39Z","updated_at":"2015-02-04T09:40:42Z","pushed_at":"2015-02-04T13:52:30Z","git_url":"git://github.com/bthuillier/cats.git","ssh_url":"git@github.com:bthuillier/cats.git","clone_url":"https://github.com/bthuillier/cats.git","svn_url":"https://github.com/bthuillier/cats","homepage":null,"size":689,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"non:master","ref":"master","sha":"e352f37809e69893dc3a82aa54f6a07080584ea8","user":{"login":"non","id":218045,"avatar_url":"https://avatars.githubusercontent.com/u/218045?v=3","gravatar_id":"","url":"https://api.github.com/users/non","html_url":"https://github.com/non","followers_url":"https://api.github.com/users/non/followers","following_url":"https://api.github.com/users/non/following{/other_user}","gists_url":"https://api.github.com/users/non/gists{/gist_id}","starred_url":"https://api.github.com/users/non/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/non/subscriptions","organizations_url":"https://api.github.com/users/non/orgs","repos_url":"https://api.github.com/users/non/repos","events_url":"https://api.github.com/users/non/events{/privacy}","received_events_url":"https://api.github.com/users/non/received_events","type":"User","site_admin":false},"repo":{"id":29986727,"name":"cats","full_name":"non/cats","owner":{"login":"non","id":218045,"avatar_url":"https://avatars.githubusercontent.com/u/218045?v=3","gravatar_id":"","url":"https://api.github.com/users/non","html_url":"https://github.com/non","followers_url":"https://api.github.com/users/non/followers","following_url":"https://api.github.com/users/non/following{/other_user}","gists_url":"https://api.github.com/users/non/gists{/gist_id}","starred_url":"https://api.github.com/users/non/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/non/subscriptions","organizations_url":"https://api.github.com/users/non/orgs","repos_url":"https://api.github.com/users/non/repos","events_url":"https://api.github.com/users/non/events{/privacy}","received_events_url":"https://api.github.com/users/non/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/non/cats","description":"","fork":false,"url":"https://api.github.com/repos/non/cats","forks_url":"https://api.github.com/repos/non/cats/forks","keys_url":"https://api.github.com/repos/non/cats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/non/cats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/non/cats/teams","hooks_url":"https://api.github.com/repos/non/cats/hooks","issue_events_url":"https://api.github.com/repos/non/cats/issues/events{/number}","events_url":"https://api.github.com/repos/non/cats/events","assignees_url":"https://api.github.com/repos/non/cats/assignees{/user}","branches_url":"https://api.github.com/repos/non/cats/branches{/branch}","tags_url":"https://api.github.com/repos/non/cats/tags","blobs_url":"https://api.github.com/repos/non/cats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/non/cats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/non/cats/git/refs{/sha}","trees_url":"https://api.github.com/repos/non/cats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/non/cats/statuses/{sha}","languages_url":"https://api.github.com/repos/non/cats/languages","stargazers_url":"https://api.github.com/repos/non/cats/stargazers","contributors_url":"https://api.github.com/repos/non/cats/contributors","subscribers_url":"https://api.github.com/repos/non/cats/subscribers","subscription_url":"https://api.github.com/repos/non/cats/subscription","commits_url":"https://api.github.com/repos/non/cats/commits{/sha}","git_commits_url":"https://api.github.com/repos/non/cats/git/commits{/sha}","comments_url":"https://api.github.com/repos/non/cats/comments{/number}","issue_comment_url":"https://api.github.com/repos/non/cats/issues/comments/{number}","contents_url":"https://api.github.com/repos/non/cats/contents/{+path}","compare_url":"https://api.github.com/repos/non/cats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/non/cats/merges","archive_url":"https://api.github.com/repos/non/cats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/non/cats/downloads","issues_url":"https://api.github.com/repos/non/cats/issues{/number}","pulls_url":"https://api.github.com/repos/non/cats/pulls{/number}","milestones_url":"https://api.github.com/repos/non/cats/milestones{/number}","notifications_url":"https://api.github.com/repos/non/cats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/non/cats/labels{/name}","releases_url":"https://api.github.com/repos/non/cats/releases{/id}","created_at":"2015-01-28T20:26:48Z","updated_at":"2015-02-04T14:00:15Z","pushed_at":"2015-02-04T05:11:08Z","git_url":"git://github.com/non/cats.git","ssh_url":"git@github.com:non/cats.git","clone_url":"https://github.com/non/cats.git","svn_url":"https://github.com/non/cats","homepage":null,"size":689,"stargazers_count":167,"watchers_count":167,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":28,"mirror_url":null,"open_issues_count":29,"forks":28,"open_issues":29,"watchers":167,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/non/cats/pulls/65"},"html":{"href":"https://github.com/non/cats/pull/65"},"issue":{"href":"https://api.github.com/repos/non/cats/issues/65"},"comments":{"href":"https://api.github.com/repos/non/cats/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/non/cats/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/non/cats/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/non/cats/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/non/cats/statuses/25822741587cb1260fb12dc5ff2110ef23bf8390"}}}}