{"action":"created","comment":{"url":"https://api.github.com/repos/frontrowed/graphula/pulls/comments/122714021","pull_request_review_id":44853585,"id":122714021,"diff_hunk":"@@ -111,6 +115,48 @@ runGraphula frontend f =\n     InR r -> frontend r\n     InL l -> backendArbitrary l\n \n+-- | An extension of 'runGraphula' that produces finalizers to remove graph nodes\n+-- on error or completion. An idempotent 'Graph' produces no data outside of its\n+-- own closure.\n+runGraphulaIdempotent\n+  :: (MonadIO m, MonadCatch m, MonadMask m)\n+  => (Frontend nodeConstraint entity (m a) -> m a)\n+  -> Graph Arbitrary NoConstraint nodeConstraint entity m a -> m a\n+runGraphulaIdempotent = runGraphulaIdempotentUsing backendArbitrary\n+\n+-- | An extension of 'runGraphulaIdemptotent' that produces replayable logs, like\n+-- 'runGraphulaLogged'.\n+runGraphulaIdempotentLogged\n+  :: (MonadIO m, MonadCatch m, MonadMask m)\n+  => (Frontend nodeConstraint entity (m a) -> m a)\n+  -> Graph Arbitrary ToJSON nodeConstraint entity m a -> m a\n+runGraphulaIdempotentLogged frontend graph = do\n+  graphLog <- liftIO $ newIORef \"\"\n+  go graphLog `catch` logFailTemp graphLog\n+  where\n+    go graphLog = runGraphulaIdempotentUsing (backendArbitraryLogged graphLog) frontend graph\n+\n+runGraphulaIdempotentUsing\n+  :: (MonadIO m, MonadCatch m, MonadMask m)\n+  => (Backend generate log (m a) -> m a)\n+  -> (Frontend nodeConstraint entity (m a) -> m a)\n+  -> Graph generate log nodeConstraint entity m a -> m a\n+runGraphulaIdempotentUsing backend frontend f =\n+  mask $ \\unmasked -> do","path":"graphula-core/src/Graphula.hs","position":60,"original_position":60,"commit_id":"a13ebfa8adf394aa2b874caa8781b6cbf75b60e9","original_commit_id":"a13ebfa8adf394aa2b874caa8781b6cbf75b60e9","user":{"login":"eborden","id":545655,"avatar_url":"https://avatars1.githubusercontent.com/u/545655?v=3","gravatar_id":"","url":"https://api.github.com/users/eborden","html_url":"https://github.com/eborden","followers_url":"https://api.github.com/users/eborden/followers","following_url":"https://api.github.com/users/eborden/following{/other_user}","gists_url":"https://api.github.com/users/eborden/gists{/gist_id}","starred_url":"https://api.github.com/users/eborden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eborden/subscriptions","organizations_url":"https://api.github.com/users/eborden/orgs","repos_url":"https://api.github.com/users/eborden/repos","events_url":"https://api.github.com/users/eborden/events{/privacy}","received_events_url":"https://api.github.com/users/eborden/received_events","type":"User","site_admin":false},"body":"I don't think this defensive masking is actually necessary.","created_at":"2017-06-19T13:58:47Z","updated_at":"2017-06-19T13:58:47Z","html_url":"https://github.com/frontrowed/graphula/pull/12#discussion_r122714021","pull_request_url":"https://api.github.com/repos/frontrowed/graphula/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/frontrowed/graphula/pulls/comments/122714021"},"html":{"href":"https://github.com/frontrowed/graphula/pull/12#discussion_r122714021"},"pull_request":{"href":"https://api.github.com/repos/frontrowed/graphula/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/frontrowed/graphula/pulls/12","id":126202006,"html_url":"https://github.com/frontrowed/graphula/pull/12","diff_url":"https://github.com/frontrowed/graphula/pull/12.diff","patch_url":"https://github.com/frontrowed/graphula/pull/12.patch","issue_url":"https://api.github.com/repos/frontrowed/graphula/issues/12","number":12,"state":"open","locked":false,"title":"Add removal to frontend to support finalizers ","user":{"login":"eborden","id":545655,"avatar_url":"https://avatars1.githubusercontent.com/u/545655?v=3","gravatar_id":"","url":"https://api.github.com/users/eborden","html_url":"https://github.com/eborden","followers_url":"https://api.github.com/users/eborden/followers","following_url":"https://api.github.com/users/eborden/following{/other_user}","gists_url":"https://api.github.com/users/eborden/gists{/gist_id}","starred_url":"https://api.github.com/users/eborden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eborden/subscriptions","organizations_url":"https://api.github.com/users/eborden/orgs","repos_url":"https://api.github.com/users/eborden/repos","events_url":"https://api.github.com/users/eborden/events{/privacy}","received_events_url":"https://api.github.com/users/eborden/received_events","type":"User","site_admin":false},"body":"Finalizers allow graphula to unwind the graph upon completion (or\r\nfailure). This allows idempotent tests to clean up after themselves. In\r\na more complicated database setting, this would avoid the need to\r\ntruncate many tables and repopulate any preloaded data.","created_at":"2017-06-18T20:52:06Z","updated_at":"2017-06-19T13:58:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30578f90cd8da667fbfe3376dfdbf1151eb2e31a","assignee":null,"assignees":[],"requested_reviewers":[{"login":"tfausak","id":408753,"avatar_url":"https://avatars2.githubusercontent.com/u/408753?v=3","gravatar_id":"","url":"https://api.github.com/users/tfausak","html_url":"https://github.com/tfausak","followers_url":"https://api.github.com/users/tfausak/followers","following_url":"https://api.github.com/users/tfausak/following{/other_user}","gists_url":"https://api.github.com/users/tfausak/gists{/gist_id}","starred_url":"https://api.github.com/users/tfausak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfausak/subscriptions","organizations_url":"https://api.github.com/users/tfausak/orgs","repos_url":"https://api.github.com/users/tfausak/repos","events_url":"https://api.github.com/users/tfausak/events{/privacy}","received_events_url":"https://api.github.com/users/tfausak/received_events","type":"User","site_admin":false},{"login":"cdparks","id":592078,"avatar_url":"https://avatars3.githubusercontent.com/u/592078?v=3","gravatar_id":"","url":"https://api.github.com/users/cdparks","html_url":"https://github.com/cdparks","followers_url":"https://api.github.com/users/cdparks/followers","following_url":"https://api.github.com/users/cdparks/following{/other_user}","gists_url":"https://api.github.com/users/cdparks/gists{/gist_id}","starred_url":"https://api.github.com/users/cdparks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdparks/subscriptions","organizations_url":"https://api.github.com/users/cdparks/orgs","repos_url":"https://api.github.com/users/cdparks/repos","events_url":"https://api.github.com/users/cdparks/events{/privacy}","received_events_url":"https://api.github.com/users/cdparks/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/frontrowed/graphula/pulls/12/commits","review_comments_url":"https://api.github.com/repos/frontrowed/graphula/pulls/12/comments","review_comment_url":"https://api.github.com/repos/frontrowed/graphula/pulls/comments{/number}","comments_url":"https://api.github.com/repos/frontrowed/graphula/issues/12/comments","statuses_url":"https://api.github.com/repos/frontrowed/graphula/statuses/a13ebfa8adf394aa2b874caa8781b6cbf75b60e9","head":{"label":"frontrowed:finalizers","ref":"finalizers","sha":"a13ebfa8adf394aa2b874caa8781b6cbf75b60e9","user":{"login":"frontrowed","id":8933560,"avatar_url":"https://avatars3.githubusercontent.com/u/8933560?v=3","gravatar_id":"","url":"https://api.github.com/users/frontrowed","html_url":"https://github.com/frontrowed","followers_url":"https://api.github.com/users/frontrowed/followers","following_url":"https://api.github.com/users/frontrowed/following{/other_user}","gists_url":"https://api.github.com/users/frontrowed/gists{/gist_id}","starred_url":"https://api.github.com/users/frontrowed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frontrowed/subscriptions","organizations_url":"https://api.github.com/users/frontrowed/orgs","repos_url":"https://api.github.com/users/frontrowed/repos","events_url":"https://api.github.com/users/frontrowed/events{/privacy}","received_events_url":"https://api.github.com/users/frontrowed/received_events","type":"Organization","site_admin":false},"repo":{"id":86860859,"name":"graphula","full_name":"frontrowed/graphula","owner":{"login":"frontrowed","id":8933560,"avatar_url":"https://avatars3.githubusercontent.com/u/8933560?v=3","gravatar_id":"","url":"https://api.github.com/users/frontrowed","html_url":"https://github.com/frontrowed","followers_url":"https://api.github.com/users/frontrowed/followers","following_url":"https://api.github.com/users/frontrowed/following{/other_user}","gists_url":"https://api.github.com/users/frontrowed/gists{/gist_id}","starred_url":"https://api.github.com/users/frontrowed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frontrowed/subscriptions","organizations_url":"https://api.github.com/users/frontrowed/orgs","repos_url":"https://api.github.com/users/frontrowed/repos","events_url":"https://api.github.com/users/frontrowed/events{/privacy}","received_events_url":"https://api.github.com/users/frontrowed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/frontrowed/graphula","description":"A declarative library for describing dependencies between data","fork":false,"url":"https://api.github.com/repos/frontrowed/graphula","forks_url":"https://api.github.com/repos/frontrowed/graphula/forks","keys_url":"https://api.github.com/repos/frontrowed/graphula/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frontrowed/graphula/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frontrowed/graphula/teams","hooks_url":"https://api.github.com/repos/frontrowed/graphula/hooks","issue_events_url":"https://api.github.com/repos/frontrowed/graphula/issues/events{/number}","events_url":"https://api.github.com/repos/frontrowed/graphula/events","assignees_url":"https://api.github.com/repos/frontrowed/graphula/assignees{/user}","branches_url":"https://api.github.com/repos/frontrowed/graphula/branches{/branch}","tags_url":"https://api.github.com/repos/frontrowed/graphula/tags","blobs_url":"https://api.github.com/repos/frontrowed/graphula/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frontrowed/graphula/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frontrowed/graphula/git/refs{/sha}","trees_url":"https://api.github.com/repos/frontrowed/graphula/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frontrowed/graphula/statuses/{sha}","languages_url":"https://api.github.com/repos/frontrowed/graphula/languages","stargazers_url":"https://api.github.com/repos/frontrowed/graphula/stargazers","contributors_url":"https://api.github.com/repos/frontrowed/graphula/contributors","subscribers_url":"https://api.github.com/repos/frontrowed/graphula/subscribers","subscription_url":"https://api.github.com/repos/frontrowed/graphula/subscription","commits_url":"https://api.github.com/repos/frontrowed/graphula/commits{/sha}","git_commits_url":"https://api.github.com/repos/frontrowed/graphula/git/commits{/sha}","comments_url":"https://api.github.com/repos/frontrowed/graphula/comments{/number}","issue_comment_url":"https://api.github.com/repos/frontrowed/graphula/issues/comments{/number}","contents_url":"https://api.github.com/repos/frontrowed/graphula/contents/{+path}","compare_url":"https://api.github.com/repos/frontrowed/graphula/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frontrowed/graphula/merges","archive_url":"https://api.github.com/repos/frontrowed/graphula/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frontrowed/graphula/downloads","issues_url":"https://api.github.com/repos/frontrowed/graphula/issues{/number}","pulls_url":"https://api.github.com/repos/frontrowed/graphula/pulls{/number}","milestones_url":"https://api.github.com/repos/frontrowed/graphula/milestones{/number}","notifications_url":"https://api.github.com/repos/frontrowed/graphula/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frontrowed/graphula/labels{/name}","releases_url":"https://api.github.com/repos/frontrowed/graphula/releases{/id}","deployments_url":"https://api.github.com/repos/frontrowed/graphula/deployments","created_at":"2017-03-31T21:13:01Z","updated_at":"2017-06-14T16:40:51Z","pushed_at":"2017-06-19T13:57:07Z","git_url":"git://github.com/frontrowed/graphula.git","ssh_url":"git@github.com:frontrowed/graphula.git","clone_url":"https://github.com/frontrowed/graphula.git","svn_url":"https://github.com/frontrowed/graphula","homepage":null,"size":77,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"frontrowed:master","ref":"master","sha":"0ba45e959f89a641a64f9a5a1b3ce601b186fc57","user":{"login":"frontrowed","id":8933560,"avatar_url":"https://avatars3.githubusercontent.com/u/8933560?v=3","gravatar_id":"","url":"https://api.github.com/users/frontrowed","html_url":"https://github.com/frontrowed","followers_url":"https://api.github.com/users/frontrowed/followers","following_url":"https://api.github.com/users/frontrowed/following{/other_user}","gists_url":"https://api.github.com/users/frontrowed/gists{/gist_id}","starred_url":"https://api.github.com/users/frontrowed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frontrowed/subscriptions","organizations_url":"https://api.github.com/users/frontrowed/orgs","repos_url":"https://api.github.com/users/frontrowed/repos","events_url":"https://api.github.com/users/frontrowed/events{/privacy}","received_events_url":"https://api.github.com/users/frontrowed/received_events","type":"Organization","site_admin":false},"repo":{"id":86860859,"name":"graphula","full_name":"frontrowed/graphula","owner":{"login":"frontrowed","id":8933560,"avatar_url":"https://avatars3.githubusercontent.com/u/8933560?v=3","gravatar_id":"","url":"https://api.github.com/users/frontrowed","html_url":"https://github.com/frontrowed","followers_url":"https://api.github.com/users/frontrowed/followers","following_url":"https://api.github.com/users/frontrowed/following{/other_user}","gists_url":"https://api.github.com/users/frontrowed/gists{/gist_id}","starred_url":"https://api.github.com/users/frontrowed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frontrowed/subscriptions","organizations_url":"https://api.github.com/users/frontrowed/orgs","repos_url":"https://api.github.com/users/frontrowed/repos","events_url":"https://api.github.com/users/frontrowed/events{/privacy}","received_events_url":"https://api.github.com/users/frontrowed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/frontrowed/graphula","description":"A declarative library for describing dependencies between data","fork":false,"url":"https://api.github.com/repos/frontrowed/graphula","forks_url":"https://api.github.com/repos/frontrowed/graphula/forks","keys_url":"https://api.github.com/repos/frontrowed/graphula/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frontrowed/graphula/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frontrowed/graphula/teams","hooks_url":"https://api.github.com/repos/frontrowed/graphula/hooks","issue_events_url":"https://api.github.com/repos/frontrowed/graphula/issues/events{/number}","events_url":"https://api.github.com/repos/frontrowed/graphula/events","assignees_url":"https://api.github.com/repos/frontrowed/graphula/assignees{/user}","branches_url":"https://api.github.com/repos/frontrowed/graphula/branches{/branch}","tags_url":"https://api.github.com/repos/frontrowed/graphula/tags","blobs_url":"https://api.github.com/repos/frontrowed/graphula/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frontrowed/graphula/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frontrowed/graphula/git/refs{/sha}","trees_url":"https://api.github.com/repos/frontrowed/graphula/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frontrowed/graphula/statuses/{sha}","languages_url":"https://api.github.com/repos/frontrowed/graphula/languages","stargazers_url":"https://api.github.com/repos/frontrowed/graphula/stargazers","contributors_url":"https://api.github.com/repos/frontrowed/graphula/contributors","subscribers_url":"https://api.github.com/repos/frontrowed/graphula/subscribers","subscription_url":"https://api.github.com/repos/frontrowed/graphula/subscription","commits_url":"https://api.github.com/repos/frontrowed/graphula/commits{/sha}","git_commits_url":"https://api.github.com/repos/frontrowed/graphula/git/commits{/sha}","comments_url":"https://api.github.com/repos/frontrowed/graphula/comments{/number}","issue_comment_url":"https://api.github.com/repos/frontrowed/graphula/issues/comments{/number}","contents_url":"https://api.github.com/repos/frontrowed/graphula/contents/{+path}","compare_url":"https://api.github.com/repos/frontrowed/graphula/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frontrowed/graphula/merges","archive_url":"https://api.github.com/repos/frontrowed/graphula/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frontrowed/graphula/downloads","issues_url":"https://api.github.com/repos/frontrowed/graphula/issues{/number}","pulls_url":"https://api.github.com/repos/frontrowed/graphula/pulls{/number}","milestones_url":"https://api.github.com/repos/frontrowed/graphula/milestones{/number}","notifications_url":"https://api.github.com/repos/frontrowed/graphula/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frontrowed/graphula/labels{/name}","releases_url":"https://api.github.com/repos/frontrowed/graphula/releases{/id}","deployments_url":"https://api.github.com/repos/frontrowed/graphula/deployments","created_at":"2017-03-31T21:13:01Z","updated_at":"2017-06-14T16:40:51Z","pushed_at":"2017-06-19T13:57:07Z","git_url":"git://github.com/frontrowed/graphula.git","ssh_url":"git@github.com:frontrowed/graphula.git","clone_url":"https://github.com/frontrowed/graphula.git","svn_url":"https://github.com/frontrowed/graphula","homepage":null,"size":77,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/frontrowed/graphula/pulls/12"},"html":{"href":"https://github.com/frontrowed/graphula/pull/12"},"issue":{"href":"https://api.github.com/repos/frontrowed/graphula/issues/12"},"comments":{"href":"https://api.github.com/repos/frontrowed/graphula/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/frontrowed/graphula/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/frontrowed/graphula/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/frontrowed/graphula/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/frontrowed/graphula/statuses/a13ebfa8adf394aa2b874caa8781b6cbf75b60e9"}}}}
{"actor":{"display_login":"eborden"}}