{"action":"created","comment":{"url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/comments/194800034","pull_request_review_id":128040143,"id":194800034,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDgwMDAzNA==","diff_hunk":"@@ -1,49 +1,69 @@\n-{-# LANGUAGE TemplateHaskell #-}\n+{-# LANGUAGE TemplateHaskell        #-}\n+{-# LANGUAGE TypeFamilyDependencies #-}\n \n--- | Module contains the definition of WorkMode and its implementations.\n+-- | Module contains the definition of basic WorkMode and its implementations.\n \n module Disciplina.Launcher.Mode\n        (\n          -- * Constraints\n          BasicWorkMode\n \n          -- * Implementations\n-       , BasicRealMode\n-       , BasicRealContext (..)\n+       , RealMode\n+       , NodeContext (..)\n+       , CustomContext\n+       , ncCustomCtx\n+\n+       , -- * Misc\n+         FormNodeContext (..)\n        ) where\n \n import Universum\n \n import Control.Lens (makeLenses)\n-import Mockable (MonadMockable, Production (..))\n+import Control.Monad.Trans.Control (MonadBaseControl)\n+import Disciplina.Async (Forall, Pure)\n import System.Wlog (HasLoggerName (..), LoggerName, WithLogger)\n \n-import Disciplina.DB.Class (MonadDB)\n-\n ---------------------------------------------------------------------\n -- WorkMode classes\n ---------------------------------------------------------------------\n \n -- | Set of typeclasses which define basic capabilities of Disciplina node\n type BasicWorkMode m =\n     ( WithLogger m\n-    , MonadMockable m\n     , MonadIO m\n-    , MonadDB m\n+    , MonadBaseControl IO m\n+    , Forall (Pure m)  -- allows to use lifted-async\n     )\n \n ---------------------------------------------------------------------\n -- WorkMode implementations\n ---------------------------------------------------------------------\n \n-data BasicRealContext = BasicRealContext\n-    { _brcLoggerName :: LoggerName\n+-- | For node role returns related context.\n+type family CustomContext r = cc | cc -> r\n+\n+-- | Contains basic context suitable for any node + custom context,\n+-- which depends on node role.\n+data NodeContext r = NodeContext\n+    { _ncCustomCtx  :: CustomContext r\n+    , _ncLoggerName :: LoggerName\n     }\n \n-makeLenses ''BasicRealContext\n+makeLenses ''NodeContext\n+\n+type RealMode r = ReaderT (NodeContext r) IO\n+\n+instance {-# OVERLAPPING #-} HasLoggerName (RealMode r) where\n+    askLoggerName = view ncLoggerName\n+    modifyLoggerName name = local $ ncLoggerName %~ name\n+\n+---------------------------------------------------------------------\n+-- Misc\n+---------------------------------------------------------------------\n \n-type BasicRealMode = ReaderT BasicRealContext Production\n+-- | Forms context using given pack of resources.\n+class FormNodeContext res ctx | ctx -> res, res -> ctx where\n+    formNodeContext :: res -> IO ctx","path":"src/Disciplina/Launcher/Mode.hs","position":81,"original_position":81,"commit_id":"aead45039dc6f784c19fe4f5db862eb975ab0ba1","original_commit_id":"aead45039dc6f784c19fe4f5db862eb975ab0ba1","user":{"login":"Martoon-00","id":5394217,"node_id":"MDQ6VXNlcjUzOTQyMTc=","avatar_url":"https://avatars3.githubusercontent.com/u/5394217?v=4","gravatar_id":"","url":"https://api.github.com/users/Martoon-00","html_url":"https://github.com/Martoon-00","followers_url":"https://api.github.com/users/Martoon-00/followers","following_url":"https://api.github.com/users/Martoon-00/following{/other_user}","gists_url":"https://api.github.com/users/Martoon-00/gists{/gist_id}","starred_url":"https://api.github.com/users/Martoon-00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martoon-00/subscriptions","organizations_url":"https://api.github.com/users/Martoon-00/orgs","repos_url":"https://api.github.com/users/Martoon-00/repos","events_url":"https://api.github.com/users/Martoon-00/events{/privacy}","received_events_url":"https://api.github.com/users/Martoon-00/received_events","type":"User","site_admin":false},"body":"Oh not, I can just place those functions near to resources types, this typeclass really doesn't make sense","created_at":"2018-06-12T16:10:30Z","updated_at":"2018-06-12T16:10:30Z","html_url":"https://github.com/DisciplinaOU/disciplina/pull/23#discussion_r194800034","pull_request_url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/comments/194800034"},"html":{"href":"https://github.com/DisciplinaOU/disciplina/pull/23#discussion_r194800034"},"pull_request":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23"}},"in_reply_to_id":194793962},"pull_request":{"url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23","id":194084479,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0MDg0NDc5","html_url":"https://github.com/DisciplinaOU/disciplina/pull/23","diff_url":"https://github.com/DisciplinaOU/disciplina/pull/23.diff","patch_url":"https://github.com/DisciplinaOU/disciplina/pull/23.patch","issue_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/23","number":23,"state":"open","locked":false,"title":"[DSCP-106] Switch to `ReaderT ctx m`-based monad stack","user":{"login":"Martoon-00","id":5394217,"node_id":"MDQ6VXNlcjUzOTQyMTc=","avatar_url":"https://avatars3.githubusercontent.com/u/5394217?v=4","gravatar_id":"","url":"https://api.github.com/users/Martoon-00","html_url":"https://github.com/Martoon-00","followers_url":"https://api.github.com/users/Martoon-00/followers","following_url":"https://api.github.com/users/Martoon-00/following{/other_user}","gists_url":"https://api.github.com/users/Martoon-00/gists{/gist_id}","starred_url":"https://api.github.com/users/Martoon-00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martoon-00/subscriptions","organizations_url":"https://api.github.com/users/Martoon-00/orgs","repos_url":"https://api.github.com/users/Martoon-00/repos","events_url":"https://api.github.com/users/Martoon-00/events{/privacy}","received_events_url":"https://api.github.com/users/Martoon-00/received_events","type":"User","site_admin":false},"body":"This includes:\r\n* Introduction of node roles - educator, witness.\r\n* NodeContext, which includes common part of context for every node + parts\r\nspecific for given specific role.\r\n* WorkModes - basic, for educator and for witness, in code we abstract\r\nfrom specific monad and require implementation of needed workmode.\r\n* Removal of Mockables and Production.\r\n** Using `async` instead of `fork`. Added alias for module with `async`\r\nfunctions.\r\n** Networking left disabled as soon as it heavily relies on implementation\r\nof Mockables. To be fixed in DSCP-105.","created_at":"2018-06-11T19:49:34Z","updated_at":"2018-06-12T16:10:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08aae8868824f4a2024d971e74b62ad89a3a0180","assignee":null,"assignees":[],"requested_reviewers":[{"login":"volhovm","id":5604643,"node_id":"MDQ6VXNlcjU2MDQ2NDM=","avatar_url":"https://avatars0.githubusercontent.com/u/5604643?v=4","gravatar_id":"","url":"https://api.github.com/users/volhovm","html_url":"https://github.com/volhovm","followers_url":"https://api.github.com/users/volhovm/followers","following_url":"https://api.github.com/users/volhovm/following{/other_user}","gists_url":"https://api.github.com/users/volhovm/gists{/gist_id}","starred_url":"https://api.github.com/users/volhovm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volhovm/subscriptions","organizations_url":"https://api.github.com/users/volhovm/orgs","repos_url":"https://api.github.com/users/volhovm/repos","events_url":"https://api.github.com/users/volhovm/events{/privacy}","received_events_url":"https://api.github.com/users/volhovm/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23/commits","review_comments_url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23/comments","review_comment_url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/23/comments","statuses_url":"https://api.github.com/repos/DisciplinaOU/disciplina/statuses/aead45039dc6f784c19fe4f5db862eb975ab0ba1","head":{"label":"DisciplinaOU:martoon/dscp106-true-modes","ref":"martoon/dscp106-true-modes","sha":"aead45039dc6f784c19fe4f5db862eb975ab0ba1","user":{"login":"DisciplinaOU","id":38657648,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NjU3NjQ4","avatar_url":"https://avatars1.githubusercontent.com/u/38657648?v=4","gravatar_id":"","url":"https://api.github.com/users/DisciplinaOU","html_url":"https://github.com/DisciplinaOU","followers_url":"https://api.github.com/users/DisciplinaOU/followers","following_url":"https://api.github.com/users/DisciplinaOU/following{/other_user}","gists_url":"https://api.github.com/users/DisciplinaOU/gists{/gist_id}","starred_url":"https://api.github.com/users/DisciplinaOU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DisciplinaOU/subscriptions","organizations_url":"https://api.github.com/users/DisciplinaOU/orgs","repos_url":"https://api.github.com/users/DisciplinaOU/repos","events_url":"https://api.github.com/users/DisciplinaOU/events{/privacy}","received_events_url":"https://api.github.com/users/DisciplinaOU/received_events","type":"Organization","site_admin":false},"repo":{"id":113064771,"node_id":"MDEwOlJlcG9zaXRvcnkxMTMwNjQ3NzE=","name":"disciplina","full_name":"DisciplinaOU/disciplina","owner":{"login":"DisciplinaOU","id":38657648,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NjU3NjQ4","avatar_url":"https://avatars1.githubusercontent.com/u/38657648?v=4","gravatar_id":"","url":"https://api.github.com/users/DisciplinaOU","html_url":"https://github.com/DisciplinaOU","followers_url":"https://api.github.com/users/DisciplinaOU/followers","following_url":"https://api.github.com/users/DisciplinaOU/following{/other_user}","gists_url":"https://api.github.com/users/DisciplinaOU/gists{/gist_id}","starred_url":"https://api.github.com/users/DisciplinaOU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DisciplinaOU/subscriptions","organizations_url":"https://api.github.com/users/DisciplinaOU/orgs","repos_url":"https://api.github.com/users/DisciplinaOU/repos","events_url":"https://api.github.com/users/DisciplinaOU/events{/privacy}","received_events_url":"https://api.github.com/users/DisciplinaOU/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DisciplinaOU/disciplina","description":"We are developing the first blockchain for recruiting & education","fork":false,"url":"https://api.github.com/repos/DisciplinaOU/disciplina","forks_url":"https://api.github.com/repos/DisciplinaOU/disciplina/forks","keys_url":"https://api.github.com/repos/DisciplinaOU/disciplina/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DisciplinaOU/disciplina/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DisciplinaOU/disciplina/teams","hooks_url":"https://api.github.com/repos/DisciplinaOU/disciplina/hooks","issue_events_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/events{/number}","events_url":"https://api.github.com/repos/DisciplinaOU/disciplina/events","assignees_url":"https://api.github.com/repos/DisciplinaOU/disciplina/assignees{/user}","branches_url":"https://api.github.com/repos/DisciplinaOU/disciplina/branches{/branch}","tags_url":"https://api.github.com/repos/DisciplinaOU/disciplina/tags","blobs_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/refs{/sha}","trees_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DisciplinaOU/disciplina/statuses/{sha}","languages_url":"https://api.github.com/repos/DisciplinaOU/disciplina/languages","stargazers_url":"https://api.github.com/repos/DisciplinaOU/disciplina/stargazers","contributors_url":"https://api.github.com/repos/DisciplinaOU/disciplina/contributors","subscribers_url":"https://api.github.com/repos/DisciplinaOU/disciplina/subscribers","subscription_url":"https://api.github.com/repos/DisciplinaOU/disciplina/subscription","commits_url":"https://api.github.com/repos/DisciplinaOU/disciplina/commits{/sha}","git_commits_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/commits{/sha}","comments_url":"https://api.github.com/repos/DisciplinaOU/disciplina/comments{/number}","issue_comment_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/comments{/number}","contents_url":"https://api.github.com/repos/DisciplinaOU/disciplina/contents/{+path}","compare_url":"https://api.github.com/repos/DisciplinaOU/disciplina/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DisciplinaOU/disciplina/merges","archive_url":"https://api.github.com/repos/DisciplinaOU/disciplina/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DisciplinaOU/disciplina/downloads","issues_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues{/number}","pulls_url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls{/number}","milestones_url":"https://api.github.com/repos/DisciplinaOU/disciplina/milestones{/number}","notifications_url":"https://api.github.com/repos/DisciplinaOU/disciplina/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DisciplinaOU/disciplina/labels{/name}","releases_url":"https://api.github.com/repos/DisciplinaOU/disciplina/releases{/id}","deployments_url":"https://api.github.com/repos/DisciplinaOU/disciplina/deployments","created_at":"2017-12-04T16:10:46Z","updated_at":"2018-06-12T15:52:03Z","pushed_at":"2018-06-12T14:32:40Z","git_url":"git://github.com/DisciplinaOU/disciplina.git","ssh_url":"git@github.com:DisciplinaOU/disciplina.git","clone_url":"https://github.com/DisciplinaOU/disciplina.git","svn_url":"https://github.com/DisciplinaOU/disciplina","homepage":"https://disciplina.io","size":3697,"stargazers_count":11,"watchers_count":11,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":11,"default_branch":"master"}},"base":{"label":"DisciplinaOU:master","ref":"master","sha":"c1392f6a9db4527d2b69dc803b8c885005751acd","user":{"login":"DisciplinaOU","id":38657648,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NjU3NjQ4","avatar_url":"https://avatars1.githubusercontent.com/u/38657648?v=4","gravatar_id":"","url":"https://api.github.com/users/DisciplinaOU","html_url":"https://github.com/DisciplinaOU","followers_url":"https://api.github.com/users/DisciplinaOU/followers","following_url":"https://api.github.com/users/DisciplinaOU/following{/other_user}","gists_url":"https://api.github.com/users/DisciplinaOU/gists{/gist_id}","starred_url":"https://api.github.com/users/DisciplinaOU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DisciplinaOU/subscriptions","organizations_url":"https://api.github.com/users/DisciplinaOU/orgs","repos_url":"https://api.github.com/users/DisciplinaOU/repos","events_url":"https://api.github.com/users/DisciplinaOU/events{/privacy}","received_events_url":"https://api.github.com/users/DisciplinaOU/received_events","type":"Organization","site_admin":false},"repo":{"id":113064771,"node_id":"MDEwOlJlcG9zaXRvcnkxMTMwNjQ3NzE=","name":"disciplina","full_name":"DisciplinaOU/disciplina","owner":{"login":"DisciplinaOU","id":38657648,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NjU3NjQ4","avatar_url":"https://avatars1.githubusercontent.com/u/38657648?v=4","gravatar_id":"","url":"https://api.github.com/users/DisciplinaOU","html_url":"https://github.com/DisciplinaOU","followers_url":"https://api.github.com/users/DisciplinaOU/followers","following_url":"https://api.github.com/users/DisciplinaOU/following{/other_user}","gists_url":"https://api.github.com/users/DisciplinaOU/gists{/gist_id}","starred_url":"https://api.github.com/users/DisciplinaOU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DisciplinaOU/subscriptions","organizations_url":"https://api.github.com/users/DisciplinaOU/orgs","repos_url":"https://api.github.com/users/DisciplinaOU/repos","events_url":"https://api.github.com/users/DisciplinaOU/events{/privacy}","received_events_url":"https://api.github.com/users/DisciplinaOU/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DisciplinaOU/disciplina","description":"We are developing the first blockchain for recruiting & education","fork":false,"url":"https://api.github.com/repos/DisciplinaOU/disciplina","forks_url":"https://api.github.com/repos/DisciplinaOU/disciplina/forks","keys_url":"https://api.github.com/repos/DisciplinaOU/disciplina/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DisciplinaOU/disciplina/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DisciplinaOU/disciplina/teams","hooks_url":"https://api.github.com/repos/DisciplinaOU/disciplina/hooks","issue_events_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/events{/number}","events_url":"https://api.github.com/repos/DisciplinaOU/disciplina/events","assignees_url":"https://api.github.com/repos/DisciplinaOU/disciplina/assignees{/user}","branches_url":"https://api.github.com/repos/DisciplinaOU/disciplina/branches{/branch}","tags_url":"https://api.github.com/repos/DisciplinaOU/disciplina/tags","blobs_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/refs{/sha}","trees_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DisciplinaOU/disciplina/statuses/{sha}","languages_url":"https://api.github.com/repos/DisciplinaOU/disciplina/languages","stargazers_url":"https://api.github.com/repos/DisciplinaOU/disciplina/stargazers","contributors_url":"https://api.github.com/repos/DisciplinaOU/disciplina/contributors","subscribers_url":"https://api.github.com/repos/DisciplinaOU/disciplina/subscribers","subscription_url":"https://api.github.com/repos/DisciplinaOU/disciplina/subscription","commits_url":"https://api.github.com/repos/DisciplinaOU/disciplina/commits{/sha}","git_commits_url":"https://api.github.com/repos/DisciplinaOU/disciplina/git/commits{/sha}","comments_url":"https://api.github.com/repos/DisciplinaOU/disciplina/comments{/number}","issue_comment_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/comments{/number}","contents_url":"https://api.github.com/repos/DisciplinaOU/disciplina/contents/{+path}","compare_url":"https://api.github.com/repos/DisciplinaOU/disciplina/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DisciplinaOU/disciplina/merges","archive_url":"https://api.github.com/repos/DisciplinaOU/disciplina/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DisciplinaOU/disciplina/downloads","issues_url":"https://api.github.com/repos/DisciplinaOU/disciplina/issues{/number}","pulls_url":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls{/number}","milestones_url":"https://api.github.com/repos/DisciplinaOU/disciplina/milestones{/number}","notifications_url":"https://api.github.com/repos/DisciplinaOU/disciplina/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DisciplinaOU/disciplina/labels{/name}","releases_url":"https://api.github.com/repos/DisciplinaOU/disciplina/releases{/id}","deployments_url":"https://api.github.com/repos/DisciplinaOU/disciplina/deployments","created_at":"2017-12-04T16:10:46Z","updated_at":"2018-06-12T15:52:03Z","pushed_at":"2018-06-12T14:32:40Z","git_url":"git://github.com/DisciplinaOU/disciplina.git","ssh_url":"git@github.com:DisciplinaOU/disciplina.git","clone_url":"https://github.com/DisciplinaOU/disciplina.git","svn_url":"https://github.com/DisciplinaOU/disciplina","homepage":"https://disciplina.io","size":3697,"stargazers_count":11,"watchers_count":11,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23"},"html":{"href":"https://github.com/DisciplinaOU/disciplina/pull/23"},"issue":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/23"},"comments":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/DisciplinaOU/disciplina/statuses/aead45039dc6f784c19fe4f5db862eb975ab0ba1"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Martoon-00"}}