{"action":"created","comment":{"url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments/31880018","id":31880018,"diff_hunk":"@@ -82,11 +91,53 @@ object WdlExpression {\n     val parseTree = parser.parse_e(tokens, new WdlSyntaxErrorFormatter(terminalMap))\n     new WdlExpression(parseTree.toAst)\n   }\n+\n+  def toString(ast: AstNode, highlighter: SyntaxHighlighter = NullSyntaxHighlighter): String = {","path":"src/main/scala/cromwell/binding/WdlExpression.scala","position":43,"original_position":43,"commit_id":"2e1b3c7dfbd8ee009a873d400eb57df82c82f3a4","original_commit_id":"2e1b3c7dfbd8ee009a873d400eb57df82c82f3a4","user":{"login":"scottfrazer","id":58551,"avatar_url":"https://avatars.githubusercontent.com/u/58551?v=3","gravatar_id":"","url":"https://api.github.com/users/scottfrazer","html_url":"https://github.com/scottfrazer","followers_url":"https://api.github.com/users/scottfrazer/followers","following_url":"https://api.github.com/users/scottfrazer/following{/other_user}","gists_url":"https://api.github.com/users/scottfrazer/gists{/gist_id}","starred_url":"https://api.github.com/users/scottfrazer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottfrazer/subscriptions","organizations_url":"https://api.github.com/users/scottfrazer/orgs","repos_url":"https://api.github.com/users/scottfrazer/repos","events_url":"https://api.github.com/users/scottfrazer/events{/privacy}","received_events_url":"https://api.github.com/users/scottfrazer/received_events","type":"User","site_admin":false},"body":"I watched the video and read up on more related stuff... keep in mind that my opinion is still inchoate.\r\n\r\nI'm not sure how I really feel about the Reader monad in this context.  I took a good amount of time watching the video and finding other sites to read about it.  In this particular case, the Reader monad would be used by having `toString` return a `Reader[SyntaxFormatter, String]`, essentially delaying execution until that `Reader` is provided with a `SyntaxFormatter`.  To me that seems like it just reshapes the solution a little bit but doesn't appear to me to provide any benefit over passing in the formatter into a function.  Now instead of:\r\n\r\n```scala\r\nexpr.format(HtmlSyntaxFormatter)\r\n```\r\nIt'd just be called like this\r\n\r\n```scala\r\nexpr.format()(HtmlSyntaxFormatter)\r\n```\r\n\r\nThe Reader monad seems to also encourage the use of God objects.  In his case he got around it because all he was sharing was a single Connection object.  But what if your logic requires a lot of things?  I suppose you'd bundle those up in a big object that every method has access to.  In our case, there might be a SyntaxFormatter appropriate for the context, a WdlBinding perhaps, a Backend...\r\n\r\nI don't suppose it's possible to compose these readers... like `Reader[WdlBinding, Reader[SyntaxFormatter [String]]`.\r\n\r\nAlso one comment about the video... my eyebrow raised when he said something to the effect of, \"... Inversion of control, which is just a pretentious way of saying 'taking an argument'\"  (2:33) And the whole crowd laughed.  I was like... whoa whoa, doesn't inversion of control also usually imply that you are not in control, and instead the thing that IS in control is just calling your code?","created_at":"2015-06-07T20:00:47Z","updated_at":"2015-06-07T20:00:47Z","html_url":"https://github.com/broadinstitute/cromwell/pull/37#discussion_r31880018","pull_request_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments/31880018"},"html":{"href":"https://github.com/broadinstitute/cromwell/pull/37#discussion_r31880018"},"pull_request":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37","id":37093111,"html_url":"https://github.com/broadinstitute/cromwell/pull/37","diff_url":"https://github.com/broadinstitute/cromwell/pull/37.diff","patch_url":"https://github.com/broadinstitute/cromwell/pull/37.patch","issue_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/37","number":37,"state":"open","locked":false,"title":"DON'T MERGE: Namespace resolution fixes","user":{"login":"scottfrazer","id":58551,"avatar_url":"https://avatars.githubusercontent.com/u/58551?v=3","gravatar_id":"","url":"https://api.github.com/users/scottfrazer","html_url":"https://github.com/scottfrazer","followers_url":"https://api.github.com/users/scottfrazer/followers","following_url":"https://api.github.com/users/scottfrazer/following{/other_user}","gists_url":"https://api.github.com/users/scottfrazer/gists{/gist_id}","starred_url":"https://api.github.com/users/scottfrazer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottfrazer/subscriptions","organizations_url":"https://api.github.com/users/scottfrazer/orgs","repos_url":"https://api.github.com/users/scottfrazer/repos","events_url":"https://api.github.com/users/scottfrazer/events{/privacy}","received_events_url":"https://api.github.com/users/scottfrazer/received_events","type":"User","site_admin":false},"body":"Needs to be rebased on two other PR's code.  For now the code was committed as cherry-picks.","created_at":"2015-06-06T16:45:15Z","updated_at":"2015-06-07T20:00:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08330d79a0d224c65ea3713f3ecd43bdfb4b21d8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37/commits","review_comments_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37/comments","review_comment_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/37/comments","statuses_url":"https://api.github.com/repos/broadinstitute/cromwell/statuses/2e1b3c7dfbd8ee009a873d400eb57df82c82f3a4","head":{"label":"broadinstitute:namespace_resolution_tmp","ref":"namespace_resolution_tmp","sha":"2e1b3c7dfbd8ee009a873d400eb57df82c82f3a4","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":34136406,"name":"cromwell","full_name":"broadinstitute/cromwell","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/cromwell","description":"Workflow Execution Engine using WDL","fork":false,"url":"https://api.github.com/repos/broadinstitute/cromwell","forks_url":"https://api.github.com/repos/broadinstitute/cromwell/forks","keys_url":"https://api.github.com/repos/broadinstitute/cromwell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/cromwell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/cromwell/teams","hooks_url":"https://api.github.com/repos/broadinstitute/cromwell/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/cromwell/events","assignees_url":"https://api.github.com/repos/broadinstitute/cromwell/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/cromwell/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/cromwell/tags","blobs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/cromwell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/cromwell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/cromwell/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/cromwell/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/cromwell/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/cromwell/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/cromwell/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/cromwell/subscription","commits_url":"https://api.github.com/repos/broadinstitute/cromwell/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/cromwell/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/cromwell/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/cromwell/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/cromwell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/cromwell/merges","archive_url":"https://api.github.com/repos/broadinstitute/cromwell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/cromwell/downloads","issues_url":"https://api.github.com/repos/broadinstitute/cromwell/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/cromwell/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/cromwell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/cromwell/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/cromwell/releases{/id}","created_at":"2015-04-17T19:39:36Z","updated_at":"2015-05-17T12:45:42Z","pushed_at":"2015-06-07T18:27:50Z","git_url":"git://github.com/broadinstitute/cromwell.git","ssh_url":"git@github.com:broadinstitute/cromwell.git","clone_url":"https://github.com/broadinstitute/cromwell.git","svn_url":"https://github.com/broadinstitute/cromwell","homepage":"http://broadinstitute.github.io/cromwell/","size":2198,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"broadinstitute:develop","ref":"develop","sha":"716476030a8dbe30f4e49ef2f59d13bdc4645d62","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":34136406,"name":"cromwell","full_name":"broadinstitute/cromwell","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/cromwell","description":"Workflow Execution Engine using WDL","fork":false,"url":"https://api.github.com/repos/broadinstitute/cromwell","forks_url":"https://api.github.com/repos/broadinstitute/cromwell/forks","keys_url":"https://api.github.com/repos/broadinstitute/cromwell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/cromwell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/cromwell/teams","hooks_url":"https://api.github.com/repos/broadinstitute/cromwell/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/cromwell/events","assignees_url":"https://api.github.com/repos/broadinstitute/cromwell/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/cromwell/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/cromwell/tags","blobs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/cromwell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/cromwell/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/cromwell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/cromwell/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/cromwell/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/cromwell/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/cromwell/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/cromwell/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/cromwell/subscription","commits_url":"https://api.github.com/repos/broadinstitute/cromwell/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/cromwell/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/cromwell/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/cromwell/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/cromwell/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/cromwell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/cromwell/merges","archive_url":"https://api.github.com/repos/broadinstitute/cromwell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/cromwell/downloads","issues_url":"https://api.github.com/repos/broadinstitute/cromwell/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/cromwell/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/cromwell/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/cromwell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/cromwell/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/cromwell/releases{/id}","created_at":"2015-04-17T19:39:36Z","updated_at":"2015-05-17T12:45:42Z","pushed_at":"2015-06-07T18:27:50Z","git_url":"git://github.com/broadinstitute/cromwell.git","ssh_url":"git@github.com:broadinstitute/cromwell.git","clone_url":"https://github.com/broadinstitute/cromwell.git","svn_url":"https://github.com/broadinstitute/cromwell","homepage":"http://broadinstitute.github.io/cromwell/","size":2198,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37"},"html":{"href":"https://github.com/broadinstitute/cromwell/pull/37"},"issue":{"href":"https://api.github.com/repos/broadinstitute/cromwell/issues/37"},"comments":{"href":"https://api.github.com/repos/broadinstitute/cromwell/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broadinstitute/cromwell/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/broadinstitute/cromwell/statuses/2e1b3c7dfbd8ee009a873d400eb57df82c82f3a4"}}}}