{"action":"created","comment":{"url":"https://api.github.com/repos/gregorycollins/hashtables/pulls/comments/35127358","id":35127358,"diff_hunk":"@@ -573,27 +588,57 @@ delete' (HashTable sz loadRef hashes keys values) clearOut k h = do\n                         k' <- readArray keys idx\n                         if k == k'\n                           then do\n-                            let samePlace = _slot fp == idx\n                             debug $ \"found at \" ++ show idx\n-                            debug $ \"clearout=\" ++ show clearOut\n-                            debug $ \"sp? \" ++ show samePlace\n-                            -- \"clearOut\" is set if we intend to write a new\n-                            -- element into the slot. If we're doing an update\n-                            -- and we found the old key, instead of writing\n-                            -- \"deleted\" and then re-writing the new element\n-                            -- there, we can just write the new element. This\n-                            -- only works if we were planning on writing the\n-                            -- new element here.\n-                            when (clearOut || not samePlace) $ do\n-                                bumpDel loadRef 1\n-                                U.writeArray hashes idx deletedMarker\n-                                writeArray keys idx undefined\n-                                writeArray values idx undefined\n-                            return (True, fp `mappend` (Slot idx 0))\n+                            let !sl = fp `mappend` (Slot idx)\n+                            return (True, sl, (Slot idx))\n                           else go fp (idx + 1) wrap'\n                       else go fp (idx + 1) wrap'\n \n+\n+------------------------------------------------------------------------------\n+{-# INLINE deleteFromSlot #-}\n+deleteFromSlot :: (HashTable_ s k v) -> Int -> ST s ()\n+deleteFromSlot (HashTable _ loadRef hashes keys values) idx = do\n+    !he <- U.readArray hashes idx\n+    when (recordIsFilled he) $ do\n+        bumpDelLoad loadRef 1\n+        bumpLoad loadRef (-1)\n+        U.writeArray hashes idx deletedMarker\n+        writeArray keys idx undefined\n+        writeArray values idx undefined\n+\n+\n ------------------------------------------------------------------------------\n+{-# INLINE insertIntoSlot #-}\n+insertIntoSlot :: (HashTable_ s k v) -> Int -> Elem -> k -> v -> ST s ()\n+insertIntoSlot (HashTable _ loadRef hashes keys values) idx he k v = do\n+    !heOld <- U.readArray hashes idx\n+    when (recordIsDeleted heOld) $","path":"src/Data/HashTable/ST/Basic.hs","position":283,"original_position":283,"commit_id":"7a9b0bb75a56f70525b4b4554db2252e96ca8847","original_commit_id":"7a9b0bb75a56f70525b4b4554db2252e96ca8847","user":{"login":"gregorycollins","id":37570,"avatar_url":"https://avatars.githubusercontent.com/u/37570?v=3","gravatar_id":"","url":"https://api.github.com/users/gregorycollins","html_url":"https://github.com/gregorycollins","followers_url":"https://api.github.com/users/gregorycollins/followers","following_url":"https://api.github.com/users/gregorycollins/following{/other_user}","gists_url":"https://api.github.com/users/gregorycollins/gists{/gist_id}","starred_url":"https://api.github.com/users/gregorycollins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregorycollins/subscriptions","organizations_url":"https://api.github.com/users/gregorycollins/orgs","repos_url":"https://api.github.com/users/gregorycollins/repos","events_url":"https://api.github.com/users/gregorycollins/events{/privacy}","received_events_url":"https://api.github.com/users/gregorycollins/received_events","type":"User","site_admin":false},"body":"We should be able to do this without branching too (mask heOld against the deleted value and or with \"-1\", unconditionally bump delLoad with that value)","created_at":"2015-07-21T17:07:47Z","updated_at":"2015-07-21T17:07:47Z","html_url":"https://github.com/gregorycollins/hashtables/pull/26#discussion_r35127358","pull_request_url":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/gregorycollins/hashtables/pulls/comments/35127358"},"html":{"href":"https://github.com/gregorycollins/hashtables/pull/26#discussion_r35127358"},"pull_request":{"href":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26","id":40412710,"html_url":"https://github.com/gregorycollins/hashtables/pull/26","diff_url":"https://github.com/gregorycollins/hashtables/pull/26.diff","patch_url":"https://github.com/gregorycollins/hashtables/pull/26.patch","issue_url":"https://api.github.com/repos/gregorycollins/hashtables/issues/26","number":26,"state":"open","locked":false,"title":"Implementation of 'mutate' for Basic hashtable","user":{"login":"vbsd","id":5375365,"avatar_url":"https://avatars.githubusercontent.com/u/5375365?v=3","gravatar_id":"","url":"https://api.github.com/users/vbsd","html_url":"https://github.com/vbsd","followers_url":"https://api.github.com/users/vbsd/followers","following_url":"https://api.github.com/users/vbsd/following{/other_user}","gists_url":"https://api.github.com/users/vbsd/gists{/gist_id}","starred_url":"https://api.github.com/users/vbsd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbsd/subscriptions","organizations_url":"https://api.github.com/users/vbsd/orgs","repos_url":"https://api.github.com/users/vbsd/repos","events_url":"https://api.github.com/users/vbsd/events{/privacy}","received_events_url":"https://api.github.com/users/vbsd/received_events","type":"User","site_admin":false},"body":"Contributes to this issue: https://github.com/gregorycollins/hashtables/issues/6\r\n\r\nTo implement 'mutate' easier, I also made some changes that touch 'insert' and 'delete'. Does this look acceptable?","created_at":"2015-07-21T00:44:18Z","updated_at":"2015-07-21T17:07:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0fe082320b97138a5515b55efd5341a05dac59b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26/commits","review_comments_url":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26/comments","review_comment_url":"https://api.github.com/repos/gregorycollins/hashtables/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gregorycollins/hashtables/issues/26/comments","statuses_url":"https://api.github.com/repos/gregorycollins/hashtables/statuses/7a9b0bb75a56f70525b4b4554db2252e96ca8847","head":{"label":"vbsd:mutate","ref":"mutate","sha":"7a9b0bb75a56f70525b4b4554db2252e96ca8847","user":{"login":"vbsd","id":5375365,"avatar_url":"https://avatars.githubusercontent.com/u/5375365?v=3","gravatar_id":"","url":"https://api.github.com/users/vbsd","html_url":"https://github.com/vbsd","followers_url":"https://api.github.com/users/vbsd/followers","following_url":"https://api.github.com/users/vbsd/following{/other_user}","gists_url":"https://api.github.com/users/vbsd/gists{/gist_id}","starred_url":"https://api.github.com/users/vbsd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbsd/subscriptions","organizations_url":"https://api.github.com/users/vbsd/orgs","repos_url":"https://api.github.com/users/vbsd/repos","events_url":"https://api.github.com/users/vbsd/events{/privacy}","received_events_url":"https://api.github.com/users/vbsd/received_events","type":"User","site_admin":false},"repo":{"id":39415348,"name":"hashtables","full_name":"vbsd/hashtables","owner":{"login":"vbsd","id":5375365,"avatar_url":"https://avatars.githubusercontent.com/u/5375365?v=3","gravatar_id":"","url":"https://api.github.com/users/vbsd","html_url":"https://github.com/vbsd","followers_url":"https://api.github.com/users/vbsd/followers","following_url":"https://api.github.com/users/vbsd/following{/other_user}","gists_url":"https://api.github.com/users/vbsd/gists{/gist_id}","starred_url":"https://api.github.com/users/vbsd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbsd/subscriptions","organizations_url":"https://api.github.com/users/vbsd/orgs","repos_url":"https://api.github.com/users/vbsd/repos","events_url":"https://api.github.com/users/vbsd/events{/privacy}","received_events_url":"https://api.github.com/users/vbsd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vbsd/hashtables","description":"Mutable hash tables for Haskell, in the ST monad","fork":true,"url":"https://api.github.com/repos/vbsd/hashtables","forks_url":"https://api.github.com/repos/vbsd/hashtables/forks","keys_url":"https://api.github.com/repos/vbsd/hashtables/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vbsd/hashtables/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vbsd/hashtables/teams","hooks_url":"https://api.github.com/repos/vbsd/hashtables/hooks","issue_events_url":"https://api.github.com/repos/vbsd/hashtables/issues/events{/number}","events_url":"https://api.github.com/repos/vbsd/hashtables/events","assignees_url":"https://api.github.com/repos/vbsd/hashtables/assignees{/user}","branches_url":"https://api.github.com/repos/vbsd/hashtables/branches{/branch}","tags_url":"https://api.github.com/repos/vbsd/hashtables/tags","blobs_url":"https://api.github.com/repos/vbsd/hashtables/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vbsd/hashtables/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vbsd/hashtables/git/refs{/sha}","trees_url":"https://api.github.com/repos/vbsd/hashtables/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vbsd/hashtables/statuses/{sha}","languages_url":"https://api.github.com/repos/vbsd/hashtables/languages","stargazers_url":"https://api.github.com/repos/vbsd/hashtables/stargazers","contributors_url":"https://api.github.com/repos/vbsd/hashtables/contributors","subscribers_url":"https://api.github.com/repos/vbsd/hashtables/subscribers","subscription_url":"https://api.github.com/repos/vbsd/hashtables/subscription","commits_url":"https://api.github.com/repos/vbsd/hashtables/commits{/sha}","git_commits_url":"https://api.github.com/repos/vbsd/hashtables/git/commits{/sha}","comments_url":"https://api.github.com/repos/vbsd/hashtables/comments{/number}","issue_comment_url":"https://api.github.com/repos/vbsd/hashtables/issues/comments{/number}","contents_url":"https://api.github.com/repos/vbsd/hashtables/contents/{+path}","compare_url":"https://api.github.com/repos/vbsd/hashtables/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vbsd/hashtables/merges","archive_url":"https://api.github.com/repos/vbsd/hashtables/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vbsd/hashtables/downloads","issues_url":"https://api.github.com/repos/vbsd/hashtables/issues{/number}","pulls_url":"https://api.github.com/repos/vbsd/hashtables/pulls{/number}","milestones_url":"https://api.github.com/repos/vbsd/hashtables/milestones{/number}","notifications_url":"https://api.github.com/repos/vbsd/hashtables/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vbsd/hashtables/labels{/name}","releases_url":"https://api.github.com/repos/vbsd/hashtables/releases{/id}","created_at":"2015-07-21T00:35:56Z","updated_at":"2015-07-21T00:35:56Z","pushed_at":"2015-07-21T00:36:14Z","git_url":"git://github.com/vbsd/hashtables.git","ssh_url":"git@github.com:vbsd/hashtables.git","clone_url":"https://github.com/vbsd/hashtables.git","svn_url":"https://github.com/vbsd/hashtables","homepage":"","size":247,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gregorycollins:mutate","ref":"mutate","sha":"adb855f0a651c7d6c546636f5325f6ba3fda65b2","user":{"login":"gregorycollins","id":37570,"avatar_url":"https://avatars.githubusercontent.com/u/37570?v=3","gravatar_id":"","url":"https://api.github.com/users/gregorycollins","html_url":"https://github.com/gregorycollins","followers_url":"https://api.github.com/users/gregorycollins/followers","following_url":"https://api.github.com/users/gregorycollins/following{/other_user}","gists_url":"https://api.github.com/users/gregorycollins/gists{/gist_id}","starred_url":"https://api.github.com/users/gregorycollins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregorycollins/subscriptions","organizations_url":"https://api.github.com/users/gregorycollins/orgs","repos_url":"https://api.github.com/users/gregorycollins/repos","events_url":"https://api.github.com/users/gregorycollins/events{/privacy}","received_events_url":"https://api.github.com/users/gregorycollins/received_events","type":"User","site_admin":false},"repo":{"id":1880539,"name":"hashtables","full_name":"gregorycollins/hashtables","owner":{"login":"gregorycollins","id":37570,"avatar_url":"https://avatars.githubusercontent.com/u/37570?v=3","gravatar_id":"","url":"https://api.github.com/users/gregorycollins","html_url":"https://github.com/gregorycollins","followers_url":"https://api.github.com/users/gregorycollins/followers","following_url":"https://api.github.com/users/gregorycollins/following{/other_user}","gists_url":"https://api.github.com/users/gregorycollins/gists{/gist_id}","starred_url":"https://api.github.com/users/gregorycollins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregorycollins/subscriptions","organizations_url":"https://api.github.com/users/gregorycollins/orgs","repos_url":"https://api.github.com/users/gregorycollins/repos","events_url":"https://api.github.com/users/gregorycollins/events{/privacy}","received_events_url":"https://api.github.com/users/gregorycollins/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gregorycollins/hashtables","description":"Mutable hash tables for Haskell, in the ST monad","fork":false,"url":"https://api.github.com/repos/gregorycollins/hashtables","forks_url":"https://api.github.com/repos/gregorycollins/hashtables/forks","keys_url":"https://api.github.com/repos/gregorycollins/hashtables/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gregorycollins/hashtables/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gregorycollins/hashtables/teams","hooks_url":"https://api.github.com/repos/gregorycollins/hashtables/hooks","issue_events_url":"https://api.github.com/repos/gregorycollins/hashtables/issues/events{/number}","events_url":"https://api.github.com/repos/gregorycollins/hashtables/events","assignees_url":"https://api.github.com/repos/gregorycollins/hashtables/assignees{/user}","branches_url":"https://api.github.com/repos/gregorycollins/hashtables/branches{/branch}","tags_url":"https://api.github.com/repos/gregorycollins/hashtables/tags","blobs_url":"https://api.github.com/repos/gregorycollins/hashtables/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gregorycollins/hashtables/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gregorycollins/hashtables/git/refs{/sha}","trees_url":"https://api.github.com/repos/gregorycollins/hashtables/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gregorycollins/hashtables/statuses/{sha}","languages_url":"https://api.github.com/repos/gregorycollins/hashtables/languages","stargazers_url":"https://api.github.com/repos/gregorycollins/hashtables/stargazers","contributors_url":"https://api.github.com/repos/gregorycollins/hashtables/contributors","subscribers_url":"https://api.github.com/repos/gregorycollins/hashtables/subscribers","subscription_url":"https://api.github.com/repos/gregorycollins/hashtables/subscription","commits_url":"https://api.github.com/repos/gregorycollins/hashtables/commits{/sha}","git_commits_url":"https://api.github.com/repos/gregorycollins/hashtables/git/commits{/sha}","comments_url":"https://api.github.com/repos/gregorycollins/hashtables/comments{/number}","issue_comment_url":"https://api.github.com/repos/gregorycollins/hashtables/issues/comments{/number}","contents_url":"https://api.github.com/repos/gregorycollins/hashtables/contents/{+path}","compare_url":"https://api.github.com/repos/gregorycollins/hashtables/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gregorycollins/hashtables/merges","archive_url":"https://api.github.com/repos/gregorycollins/hashtables/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gregorycollins/hashtables/downloads","issues_url":"https://api.github.com/repos/gregorycollins/hashtables/issues{/number}","pulls_url":"https://api.github.com/repos/gregorycollins/hashtables/pulls{/number}","milestones_url":"https://api.github.com/repos/gregorycollins/hashtables/milestones{/number}","notifications_url":"https://api.github.com/repos/gregorycollins/hashtables/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gregorycollins/hashtables/labels{/name}","releases_url":"https://api.github.com/repos/gregorycollins/hashtables/releases{/id}","created_at":"2011-06-11T15:48:12Z","updated_at":"2015-07-21T09:50:16Z","pushed_at":"2015-07-21T00:44:19Z","git_url":"git://github.com/gregorycollins/hashtables.git","ssh_url":"git@github.com:gregorycollins/hashtables.git","clone_url":"https://github.com/gregorycollins/hashtables.git","svn_url":"https://github.com/gregorycollins/hashtables","homepage":"","size":416,"stargazers_count":57,"watchers_count":57,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":8,"forks":13,"open_issues":8,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26"},"html":{"href":"https://github.com/gregorycollins/hashtables/pull/26"},"issue":{"href":"https://api.github.com/repos/gregorycollins/hashtables/issues/26"},"comments":{"href":"https://api.github.com/repos/gregorycollins/hashtables/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/gregorycollins/hashtables/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gregorycollins/hashtables/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/gregorycollins/hashtables/statuses/7a9b0bb75a56f70525b4b4554db2252e96ca8847"}}}}