{"action":"closed","number":138,"pull_request":{"url":"https://api.github.com/repos/nick8325/quickcheck/pulls/138","id":98478255,"html_url":"https://github.com/nick8325/quickcheck/pull/138","diff_url":"https://github.com/nick8325/quickcheck/pull/138.diff","patch_url":"https://github.com/nick8325/quickcheck/pull/138.patch","issue_url":"https://api.github.com/repos/nick8325/quickcheck/issues/138","number":138,"state":"closed","locked":false,"title":"Parallel generators / implementation matching","user":{"login":"paolino","id":56350,"avatar_url":"https://avatars.githubusercontent.com/u/56350?v=3","gravatar_id":"","url":"https://api.github.com/users/paolino","html_url":"https://github.com/paolino","followers_url":"https://api.github.com/users/paolino/followers","following_url":"https://api.github.com/users/paolino/following{/other_user}","gists_url":"https://api.github.com/users/paolino/gists{/gist_id}","starred_url":"https://api.github.com/users/paolino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paolino/subscriptions","organizations_url":"https://api.github.com/users/paolino/orgs","repos_url":"https://api.github.com/users/paolino/repos","events_url":"https://api.github.com/users/paolino/events{/privacy}","received_events_url":"https://api.github.com/users/paolino/received_events","type":"User","site_admin":false},"body":"I am testing 2 implementations for the same API one against the other one. Without (=!=)  I need some more boilerplate interleaved in the generating code.\r\n\r\n```\r\ntest2Algo :: (Arbitrary a, Eq a) => Algo c a -> Algo d a -> Gen Bool\r\ntest2Algo x y = do\r\n    (n :: Int) <- arbitrary\r\n    (q,r,ts) <- (\\f -> foldM f (newQueue x,newQueue y,[]) [0..n-1]) $ \r\n        \\(q,r,ts) _ -> do\r\n            xs <- listOf1 arbitrary\r\n            k <- choose (0, length xs - 1) \r\n            let t x q = unloadn x k <$> elements \r\n                        [meld x (create x xs) q, flip (load x) xs q]\r\n            (q',es) <- t x q\r\n            (r',es') <- t y r\r\n            return (q', r' , (es == es') : ts)\r\n    return $ unload x q == unload y r && all id ts\r\n\r\ntest :: Gen Bool\r\ntest = test2Algo (naive :: Algo [] Int) efficient\r\n```\r\n\r\nWith (=!=) I can just generate the ([a],[[a]]) and match them after so the testing function stay cleaner\r\n\r\n```\r\ngenAlgo :: Arbitrary a => Algo c a -> Gen ([a], [[a]])\r\ngenAlgo x = do\r\n    (n :: Int) <- arbitrary\r\n    (q,ts) <- (\\f -> foldM f (newQueue x,[]) [0..n-1]) $ \r\n        \\(q,ts) _ -> do\r\n            xs <- listOf1 arbitrary\r\n            k <- choose (0, length xs - 1) \r\n            let t x q = unloadn x k <$> elements \r\n                        [meld x (create x xs) q, flip (load x) xs q]\r\n            (q',es) <- t x q\r\n            return (q', es : ts)\r\n    return $ (unload x q, ts)\r\n\r\ntest :: Gen Bool\r\ntest = genAlgo (naive :: Algo [] Int)  =!= genAlgo efficient\r\n```\r\n\r\nThe full code of the example is [here](https://gist.github.com/paolino/793ca314b5ff0876f99bec59fc091fae)\r\n\r\n\r\n","created_at":"2016-12-18T15:44:50Z","updated_at":"2016-12-22T02:02:43Z","closed_at":"2016-12-22T02:02:43Z","merged_at":null,"merge_commit_sha":"62ddd530e437d43b2614ef44a197717df93b0724","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nick8325/quickcheck/pulls/138/commits","review_comments_url":"https://api.github.com/repos/nick8325/quickcheck/pulls/138/comments","review_comment_url":"https://api.github.com/repos/nick8325/quickcheck/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nick8325/quickcheck/issues/138/comments","statuses_url":"https://api.github.com/repos/nick8325/quickcheck/statuses/77deff8eb385306fb8fba4cebaa2f7be50292085","head":{"label":"paolino:master","ref":"master","sha":"77deff8eb385306fb8fba4cebaa2f7be50292085","user":{"login":"paolino","id":56350,"avatar_url":"https://avatars.githubusercontent.com/u/56350?v=3","gravatar_id":"","url":"https://api.github.com/users/paolino","html_url":"https://github.com/paolino","followers_url":"https://api.github.com/users/paolino/followers","following_url":"https://api.github.com/users/paolino/following{/other_user}","gists_url":"https://api.github.com/users/paolino/gists{/gist_id}","starred_url":"https://api.github.com/users/paolino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paolino/subscriptions","organizations_url":"https://api.github.com/users/paolino/orgs","repos_url":"https://api.github.com/users/paolino/repos","events_url":"https://api.github.com/users/paolino/events{/privacy}","received_events_url":"https://api.github.com/users/paolino/received_events","type":"User","site_admin":false},"repo":{"id":76785167,"name":"quickcheck","full_name":"paolino/quickcheck","owner":{"login":"paolino","id":56350,"avatar_url":"https://avatars.githubusercontent.com/u/56350?v=3","gravatar_id":"","url":"https://api.github.com/users/paolino","html_url":"https://github.com/paolino","followers_url":"https://api.github.com/users/paolino/followers","following_url":"https://api.github.com/users/paolino/following{/other_user}","gists_url":"https://api.github.com/users/paolino/gists{/gist_id}","starred_url":"https://api.github.com/users/paolino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paolino/subscriptions","organizations_url":"https://api.github.com/users/paolino/orgs","repos_url":"https://api.github.com/users/paolino/repos","events_url":"https://api.github.com/users/paolino/events{/privacy}","received_events_url":"https://api.github.com/users/paolino/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paolino/quickcheck","description":"Automatic testing of Haskell programs.","fork":true,"url":"https://api.github.com/repos/paolino/quickcheck","forks_url":"https://api.github.com/repos/paolino/quickcheck/forks","keys_url":"https://api.github.com/repos/paolino/quickcheck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paolino/quickcheck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paolino/quickcheck/teams","hooks_url":"https://api.github.com/repos/paolino/quickcheck/hooks","issue_events_url":"https://api.github.com/repos/paolino/quickcheck/issues/events{/number}","events_url":"https://api.github.com/repos/paolino/quickcheck/events","assignees_url":"https://api.github.com/repos/paolino/quickcheck/assignees{/user}","branches_url":"https://api.github.com/repos/paolino/quickcheck/branches{/branch}","tags_url":"https://api.github.com/repos/paolino/quickcheck/tags","blobs_url":"https://api.github.com/repos/paolino/quickcheck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paolino/quickcheck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paolino/quickcheck/git/refs{/sha}","trees_url":"https://api.github.com/repos/paolino/quickcheck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paolino/quickcheck/statuses/{sha}","languages_url":"https://api.github.com/repos/paolino/quickcheck/languages","stargazers_url":"https://api.github.com/repos/paolino/quickcheck/stargazers","contributors_url":"https://api.github.com/repos/paolino/quickcheck/contributors","subscribers_url":"https://api.github.com/repos/paolino/quickcheck/subscribers","subscription_url":"https://api.github.com/repos/paolino/quickcheck/subscription","commits_url":"https://api.github.com/repos/paolino/quickcheck/commits{/sha}","git_commits_url":"https://api.github.com/repos/paolino/quickcheck/git/commits{/sha}","comments_url":"https://api.github.com/repos/paolino/quickcheck/comments{/number}","issue_comment_url":"https://api.github.com/repos/paolino/quickcheck/issues/comments{/number}","contents_url":"https://api.github.com/repos/paolino/quickcheck/contents/{+path}","compare_url":"https://api.github.com/repos/paolino/quickcheck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paolino/quickcheck/merges","archive_url":"https://api.github.com/repos/paolino/quickcheck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paolino/quickcheck/downloads","issues_url":"https://api.github.com/repos/paolino/quickcheck/issues{/number}","pulls_url":"https://api.github.com/repos/paolino/quickcheck/pulls{/number}","milestones_url":"https://api.github.com/repos/paolino/quickcheck/milestones{/number}","notifications_url":"https://api.github.com/repos/paolino/quickcheck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paolino/quickcheck/labels{/name}","releases_url":"https://api.github.com/repos/paolino/quickcheck/releases{/id}","deployments_url":"https://api.github.com/repos/paolino/quickcheck/deployments","created_at":"2016-12-18T13:38:28Z","updated_at":"2016-12-18T13:38:31Z","pushed_at":"2016-12-18T15:20:00Z","git_url":"git://github.com/paolino/quickcheck.git","ssh_url":"git@github.com:paolino/quickcheck.git","clone_url":"https://github.com/paolino/quickcheck.git","svn_url":"https://github.com/paolino/quickcheck","homepage":"","size":651,"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":"nick8325:master","ref":"master","sha":"389021ab1514d91fc65307420f65cd6ce091ea71","user":{"login":"nick8325","id":104447,"avatar_url":"https://avatars.githubusercontent.com/u/104447?v=3","gravatar_id":"","url":"https://api.github.com/users/nick8325","html_url":"https://github.com/nick8325","followers_url":"https://api.github.com/users/nick8325/followers","following_url":"https://api.github.com/users/nick8325/following{/other_user}","gists_url":"https://api.github.com/users/nick8325/gists{/gist_id}","starred_url":"https://api.github.com/users/nick8325/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nick8325/subscriptions","organizations_url":"https://api.github.com/users/nick8325/orgs","repos_url":"https://api.github.com/users/nick8325/repos","events_url":"https://api.github.com/users/nick8325/events{/privacy}","received_events_url":"https://api.github.com/users/nick8325/received_events","type":"User","site_admin":false},"repo":{"id":5218355,"name":"quickcheck","full_name":"nick8325/quickcheck","owner":{"login":"nick8325","id":104447,"avatar_url":"https://avatars.githubusercontent.com/u/104447?v=3","gravatar_id":"","url":"https://api.github.com/users/nick8325","html_url":"https://github.com/nick8325","followers_url":"https://api.github.com/users/nick8325/followers","following_url":"https://api.github.com/users/nick8325/following{/other_user}","gists_url":"https://api.github.com/users/nick8325/gists{/gist_id}","starred_url":"https://api.github.com/users/nick8325/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nick8325/subscriptions","organizations_url":"https://api.github.com/users/nick8325/orgs","repos_url":"https://api.github.com/users/nick8325/repos","events_url":"https://api.github.com/users/nick8325/events{/privacy}","received_events_url":"https://api.github.com/users/nick8325/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nick8325/quickcheck","description":"Automatic testing of Haskell programs.","fork":false,"url":"https://api.github.com/repos/nick8325/quickcheck","forks_url":"https://api.github.com/repos/nick8325/quickcheck/forks","keys_url":"https://api.github.com/repos/nick8325/quickcheck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nick8325/quickcheck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nick8325/quickcheck/teams","hooks_url":"https://api.github.com/repos/nick8325/quickcheck/hooks","issue_events_url":"https://api.github.com/repos/nick8325/quickcheck/issues/events{/number}","events_url":"https://api.github.com/repos/nick8325/quickcheck/events","assignees_url":"https://api.github.com/repos/nick8325/quickcheck/assignees{/user}","branches_url":"https://api.github.com/repos/nick8325/quickcheck/branches{/branch}","tags_url":"https://api.github.com/repos/nick8325/quickcheck/tags","blobs_url":"https://api.github.com/repos/nick8325/quickcheck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nick8325/quickcheck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nick8325/quickcheck/git/refs{/sha}","trees_url":"https://api.github.com/repos/nick8325/quickcheck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nick8325/quickcheck/statuses/{sha}","languages_url":"https://api.github.com/repos/nick8325/quickcheck/languages","stargazers_url":"https://api.github.com/repos/nick8325/quickcheck/stargazers","contributors_url":"https://api.github.com/repos/nick8325/quickcheck/contributors","subscribers_url":"https://api.github.com/repos/nick8325/quickcheck/subscribers","subscription_url":"https://api.github.com/repos/nick8325/quickcheck/subscription","commits_url":"https://api.github.com/repos/nick8325/quickcheck/commits{/sha}","git_commits_url":"https://api.github.com/repos/nick8325/quickcheck/git/commits{/sha}","comments_url":"https://api.github.com/repos/nick8325/quickcheck/comments{/number}","issue_comment_url":"https://api.github.com/repos/nick8325/quickcheck/issues/comments{/number}","contents_url":"https://api.github.com/repos/nick8325/quickcheck/contents/{+path}","compare_url":"https://api.github.com/repos/nick8325/quickcheck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nick8325/quickcheck/merges","archive_url":"https://api.github.com/repos/nick8325/quickcheck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nick8325/quickcheck/downloads","issues_url":"https://api.github.com/repos/nick8325/quickcheck/issues{/number}","pulls_url":"https://api.github.com/repos/nick8325/quickcheck/pulls{/number}","milestones_url":"https://api.github.com/repos/nick8325/quickcheck/milestones{/number}","notifications_url":"https://api.github.com/repos/nick8325/quickcheck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nick8325/quickcheck/labels{/name}","releases_url":"https://api.github.com/repos/nick8325/quickcheck/releases{/id}","deployments_url":"https://api.github.com/repos/nick8325/quickcheck/deployments","created_at":"2012-07-28T22:50:15Z","updated_at":"2016-12-20T20:55:47Z","pushed_at":"2016-12-18T15:44:51Z","git_url":"git://github.com/nick8325/quickcheck.git","ssh_url":"git@github.com:nick8325/quickcheck.git","clone_url":"https://github.com/nick8325/quickcheck.git","svn_url":"https://github.com/nick8325/quickcheck","homepage":"","size":1056,"stargazers_count":245,"watchers_count":245,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":20,"forks":49,"open_issues":20,"watchers":245,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nick8325/quickcheck/pulls/138"},"html":{"href":"https://github.com/nick8325/quickcheck/pull/138"},"issue":{"href":"https://api.github.com/repos/nick8325/quickcheck/issues/138"},"comments":{"href":"https://api.github.com/repos/nick8325/quickcheck/issues/138/comments"},"review_comments":{"href":"https://api.github.com/repos/nick8325/quickcheck/pulls/138/comments"},"review_comment":{"href":"https://api.github.com/repos/nick8325/quickcheck/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nick8325/quickcheck/pulls/138/commits"},"statuses":{"href":"https://api.github.com/repos/nick8325/quickcheck/statuses/77deff8eb385306fb8fba4cebaa2f7be50292085"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"commits":2,"additions":19,"deletions":0,"changed_files":2}}
{"actor":{"display_login":"nick8325"}}