{"action":"created","comment":{"url":"https://api.github.com/repos/melt-umn/silver/pulls/comments/59781790","id":59781790,"diff_hunk":"@@ -0,0 +1,34 @@\n+-- Exact copy of Name, but productions have higher precedence.\n+-- This is needed to avoid a parse conflict with '::' as both the type and cons operator  ","path":"grammars/silver/extension/monad/Name.sv","position":2,"original_position":2,"commit_id":"4b94ac32bf9dbf2644148ecc467d4f6ebfd52165","original_commit_id":"4b94ac32bf9dbf2644148ecc467d4f6ebfd52165","user":{"login":"tedinski","id":1508333,"avatar_url":"https://avatars.githubusercontent.com/u/1508333?v=3","gravatar_id":"","url":"https://api.github.com/users/tedinski","html_url":"https://github.com/tedinski","followers_url":"https://api.github.com/users/tedinski/followers","following_url":"https://api.github.com/users/tedinski/following{/other_user}","gists_url":"https://api.github.com/users/tedinski/gists{/gist_id}","starred_url":"https://api.github.com/users/tedinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tedinski/subscriptions","organizations_url":"https://api.github.com/users/tedinski/orgs","repos_url":"https://api.github.com/users/tedinski/repos","events_url":"https://api.github.com/users/tedinski/events{/privacy}","received_events_url":"https://api.github.com/users/tedinski/received_events","type":"User","site_admin":false},"body":"So, this should be accomplishable with an operator precedence on '<-' without MName at all. I think.\r\n\r\nIn fact, I'm not sure how this solves the problem, except by forbidding `x :: ...` from starting an expression when we're inside a do block. I think this is a wrong approach to disambiguation here.","created_at":"2016-04-14T20:04:08Z","updated_at":"2016-04-14T20:04:08Z","html_url":"https://github.com/melt-umn/silver/pull/69#discussion_r59781790","pull_request_url":"https://api.github.com/repos/melt-umn/silver/pulls/69","_links":{"self":{"href":"https://api.github.com/repos/melt-umn/silver/pulls/comments/59781790"},"html":{"href":"https://github.com/melt-umn/silver/pull/69#discussion_r59781790"},"pull_request":{"href":"https://api.github.com/repos/melt-umn/silver/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/melt-umn/silver/pulls/69","id":66238000,"html_url":"https://github.com/melt-umn/silver/pull/69","diff_url":"https://github.com/melt-umn/silver/pull/69.diff","patch_url":"https://github.com/melt-umn/silver/pull/69.patch","issue_url":"https://api.github.com/repos/melt-umn/silver/issues/69","number":69,"state":"open","locked":false,"title":"Adding monads","user":{"login":"krame505","id":8467850,"avatar_url":"https://avatars.githubusercontent.com/u/8467850?v=3","gravatar_id":"","url":"https://api.github.com/users/krame505","html_url":"https://github.com/krame505","followers_url":"https://api.github.com/users/krame505/followers","following_url":"https://api.github.com/users/krame505/following{/other_user}","gists_url":"https://api.github.com/users/krame505/gists{/gist_id}","starred_url":"https://api.github.com/users/krame505/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krame505/subscriptions","organizations_url":"https://api.github.com/users/krame505/orgs","repos_url":"https://api.github.com/users/krame505/repos","events_url":"https://api.github.com/users/krame505/events{/privacy}","received_events_url":"https://api.github.com/users/krame505/received_events","type":"User","site_admin":false},"body":"This extension adds monads to Silver.  Since we don't have typeclasses (yet), the do expression requires the bind and return functions to be provided explicitly.  The do expression allows for sequences of plain monadic expressions, bind statements, let assignment statements, conditional statements, and return.  These are fairly straightforward, except for conditional statements.  These can have a single statement for a body, or a bracketed sequence of statements.  The else clause is optional, if there is no else provided then it defaults as ```return unit();```.  \r\n\r\nThere are provided bind and return functions for State, IO, lists, and Maybe.  \r\n\r\nFor example:\r\n```\r\nlocal result::IOMonad<Integer> = do (bindIO, returnIO) {\r\n  printM(\"Hello, world!\\n\");\r\n  printM(\"Choose a number: \");\r\n  txt::String <- readLineStdinM;\r\n  num::Integer = toInt(txt);\r\n  if num == 42 then {\r\n    printM(\"Yes\");\r\n    return num;\r\n  }\r\n  else\r\n    return num * 10;\r\n};\r\n```\r\n\r\nIssues to resolve/consider:\r\n* It appears that we can't write functions that ignore their parameter type, due to the way Silver handles type variables, which forces all expression do body statements to have their monadic base type be Unit.  How do we fix this?  \r\n* Should actions such as readLineStdinM that take no arguments just be globals?  \r\n* Unit type; is this done right?\r\n* core:monad isn't being imported automatically, is this an issue?\r\n* if/then/else syntax\r\n* More tests are needed...","created_at":"2016-04-12T22:21:39Z","updated_at":"2016-04-14T20:04:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c89ce2c720c8960aed24f28f0a8783c9f4da7e88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/melt-umn/silver/pulls/69/commits","review_comments_url":"https://api.github.com/repos/melt-umn/silver/pulls/69/comments","review_comment_url":"https://api.github.com/repos/melt-umn/silver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/melt-umn/silver/issues/69/comments","statuses_url":"https://api.github.com/repos/melt-umn/silver/statuses/4b94ac32bf9dbf2644148ecc467d4f6ebfd52165","head":{"label":"melt-umn:feature/monad","ref":"feature/monad","sha":"4b94ac32bf9dbf2644148ecc467d4f6ebfd52165","user":{"login":"melt-umn","id":5133097,"avatar_url":"https://avatars.githubusercontent.com/u/5133097?v=3","gravatar_id":"","url":"https://api.github.com/users/melt-umn","html_url":"https://github.com/melt-umn","followers_url":"https://api.github.com/users/melt-umn/followers","following_url":"https://api.github.com/users/melt-umn/following{/other_user}","gists_url":"https://api.github.com/users/melt-umn/gists{/gist_id}","starred_url":"https://api.github.com/users/melt-umn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melt-umn/subscriptions","organizations_url":"https://api.github.com/users/melt-umn/orgs","repos_url":"https://api.github.com/users/melt-umn/repos","events_url":"https://api.github.com/users/melt-umn/events{/privacy}","received_events_url":"https://api.github.com/users/melt-umn/received_events","type":"Organization","site_admin":false},"repo":{"id":41123074,"name":"silver","full_name":"melt-umn/silver","owner":{"login":"melt-umn","id":5133097,"avatar_url":"https://avatars.githubusercontent.com/u/5133097?v=3","gravatar_id":"","url":"https://api.github.com/users/melt-umn","html_url":"https://github.com/melt-umn","followers_url":"https://api.github.com/users/melt-umn/followers","following_url":"https://api.github.com/users/melt-umn/following{/other_user}","gists_url":"https://api.github.com/users/melt-umn/gists{/gist_id}","starred_url":"https://api.github.com/users/melt-umn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melt-umn/subscriptions","organizations_url":"https://api.github.com/users/melt-umn/orgs","repos_url":"https://api.github.com/users/melt-umn/repos","events_url":"https://api.github.com/users/melt-umn/events{/privacy}","received_events_url":"https://api.github.com/users/melt-umn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/melt-umn/silver","description":"An attribute grammar-based meta-programming language for composable language extensions","fork":false,"url":"https://api.github.com/repos/melt-umn/silver","forks_url":"https://api.github.com/repos/melt-umn/silver/forks","keys_url":"https://api.github.com/repos/melt-umn/silver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/melt-umn/silver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/melt-umn/silver/teams","hooks_url":"https://api.github.com/repos/melt-umn/silver/hooks","issue_events_url":"https://api.github.com/repos/melt-umn/silver/issues/events{/number}","events_url":"https://api.github.com/repos/melt-umn/silver/events","assignees_url":"https://api.github.com/repos/melt-umn/silver/assignees{/user}","branches_url":"https://api.github.com/repos/melt-umn/silver/branches{/branch}","tags_url":"https://api.github.com/repos/melt-umn/silver/tags","blobs_url":"https://api.github.com/repos/melt-umn/silver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/melt-umn/silver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/melt-umn/silver/git/refs{/sha}","trees_url":"https://api.github.com/repos/melt-umn/silver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/melt-umn/silver/statuses/{sha}","languages_url":"https://api.github.com/repos/melt-umn/silver/languages","stargazers_url":"https://api.github.com/repos/melt-umn/silver/stargazers","contributors_url":"https://api.github.com/repos/melt-umn/silver/contributors","subscribers_url":"https://api.github.com/repos/melt-umn/silver/subscribers","subscription_url":"https://api.github.com/repos/melt-umn/silver/subscription","commits_url":"https://api.github.com/repos/melt-umn/silver/commits{/sha}","git_commits_url":"https://api.github.com/repos/melt-umn/silver/git/commits{/sha}","comments_url":"https://api.github.com/repos/melt-umn/silver/comments{/number}","issue_comment_url":"https://api.github.com/repos/melt-umn/silver/issues/comments{/number}","contents_url":"https://api.github.com/repos/melt-umn/silver/contents/{+path}","compare_url":"https://api.github.com/repos/melt-umn/silver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/melt-umn/silver/merges","archive_url":"https://api.github.com/repos/melt-umn/silver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/melt-umn/silver/downloads","issues_url":"https://api.github.com/repos/melt-umn/silver/issues{/number}","pulls_url":"https://api.github.com/repos/melt-umn/silver/pulls{/number}","milestones_url":"https://api.github.com/repos/melt-umn/silver/milestones{/number}","notifications_url":"https://api.github.com/repos/melt-umn/silver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/melt-umn/silver/labels{/name}","releases_url":"https://api.github.com/repos/melt-umn/silver/releases{/id}","deployments_url":"https://api.github.com/repos/melt-umn/silver/deployments","created_at":"2015-08-20T23:16:30Z","updated_at":"2016-02-18T22:39:49Z","pushed_at":"2016-04-14T19:51:51Z","git_url":"git://github.com/melt-umn/silver.git","ssh_url":"git@github.com:melt-umn/silver.git","clone_url":"https://github.com/melt-umn/silver.git","svn_url":"https://github.com/melt-umn/silver","homepage":"http://melt.cs.umn.edu/silver/","size":12499,"stargazers_count":5,"watchers_count":5,"language":"SystemVerilog","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":38,"forks":1,"open_issues":38,"watchers":5,"default_branch":"develop"}},"base":{"label":"melt-umn:develop","ref":"develop","sha":"64fd6a92724b59399e9bf572309466c2aa753ea3","user":{"login":"melt-umn","id":5133097,"avatar_url":"https://avatars.githubusercontent.com/u/5133097?v=3","gravatar_id":"","url":"https://api.github.com/users/melt-umn","html_url":"https://github.com/melt-umn","followers_url":"https://api.github.com/users/melt-umn/followers","following_url":"https://api.github.com/users/melt-umn/following{/other_user}","gists_url":"https://api.github.com/users/melt-umn/gists{/gist_id}","starred_url":"https://api.github.com/users/melt-umn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melt-umn/subscriptions","organizations_url":"https://api.github.com/users/melt-umn/orgs","repos_url":"https://api.github.com/users/melt-umn/repos","events_url":"https://api.github.com/users/melt-umn/events{/privacy}","received_events_url":"https://api.github.com/users/melt-umn/received_events","type":"Organization","site_admin":false},"repo":{"id":41123074,"name":"silver","full_name":"melt-umn/silver","owner":{"login":"melt-umn","id":5133097,"avatar_url":"https://avatars.githubusercontent.com/u/5133097?v=3","gravatar_id":"","url":"https://api.github.com/users/melt-umn","html_url":"https://github.com/melt-umn","followers_url":"https://api.github.com/users/melt-umn/followers","following_url":"https://api.github.com/users/melt-umn/following{/other_user}","gists_url":"https://api.github.com/users/melt-umn/gists{/gist_id}","starred_url":"https://api.github.com/users/melt-umn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melt-umn/subscriptions","organizations_url":"https://api.github.com/users/melt-umn/orgs","repos_url":"https://api.github.com/users/melt-umn/repos","events_url":"https://api.github.com/users/melt-umn/events{/privacy}","received_events_url":"https://api.github.com/users/melt-umn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/melt-umn/silver","description":"An attribute grammar-based meta-programming language for composable language extensions","fork":false,"url":"https://api.github.com/repos/melt-umn/silver","forks_url":"https://api.github.com/repos/melt-umn/silver/forks","keys_url":"https://api.github.com/repos/melt-umn/silver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/melt-umn/silver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/melt-umn/silver/teams","hooks_url":"https://api.github.com/repos/melt-umn/silver/hooks","issue_events_url":"https://api.github.com/repos/melt-umn/silver/issues/events{/number}","events_url":"https://api.github.com/repos/melt-umn/silver/events","assignees_url":"https://api.github.com/repos/melt-umn/silver/assignees{/user}","branches_url":"https://api.github.com/repos/melt-umn/silver/branches{/branch}","tags_url":"https://api.github.com/repos/melt-umn/silver/tags","blobs_url":"https://api.github.com/repos/melt-umn/silver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/melt-umn/silver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/melt-umn/silver/git/refs{/sha}","trees_url":"https://api.github.com/repos/melt-umn/silver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/melt-umn/silver/statuses/{sha}","languages_url":"https://api.github.com/repos/melt-umn/silver/languages","stargazers_url":"https://api.github.com/repos/melt-umn/silver/stargazers","contributors_url":"https://api.github.com/repos/melt-umn/silver/contributors","subscribers_url":"https://api.github.com/repos/melt-umn/silver/subscribers","subscription_url":"https://api.github.com/repos/melt-umn/silver/subscription","commits_url":"https://api.github.com/repos/melt-umn/silver/commits{/sha}","git_commits_url":"https://api.github.com/repos/melt-umn/silver/git/commits{/sha}","comments_url":"https://api.github.com/repos/melt-umn/silver/comments{/number}","issue_comment_url":"https://api.github.com/repos/melt-umn/silver/issues/comments{/number}","contents_url":"https://api.github.com/repos/melt-umn/silver/contents/{+path}","compare_url":"https://api.github.com/repos/melt-umn/silver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/melt-umn/silver/merges","archive_url":"https://api.github.com/repos/melt-umn/silver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/melt-umn/silver/downloads","issues_url":"https://api.github.com/repos/melt-umn/silver/issues{/number}","pulls_url":"https://api.github.com/repos/melt-umn/silver/pulls{/number}","milestones_url":"https://api.github.com/repos/melt-umn/silver/milestones{/number}","notifications_url":"https://api.github.com/repos/melt-umn/silver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/melt-umn/silver/labels{/name}","releases_url":"https://api.github.com/repos/melt-umn/silver/releases{/id}","deployments_url":"https://api.github.com/repos/melt-umn/silver/deployments","created_at":"2015-08-20T23:16:30Z","updated_at":"2016-02-18T22:39:49Z","pushed_at":"2016-04-14T19:51:51Z","git_url":"git://github.com/melt-umn/silver.git","ssh_url":"git@github.com:melt-umn/silver.git","clone_url":"https://github.com/melt-umn/silver.git","svn_url":"https://github.com/melt-umn/silver","homepage":"http://melt.cs.umn.edu/silver/","size":12499,"stargazers_count":5,"watchers_count":5,"language":"SystemVerilog","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":38,"forks":1,"open_issues":38,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/melt-umn/silver/pulls/69"},"html":{"href":"https://github.com/melt-umn/silver/pull/69"},"issue":{"href":"https://api.github.com/repos/melt-umn/silver/issues/69"},"comments":{"href":"https://api.github.com/repos/melt-umn/silver/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/melt-umn/silver/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/melt-umn/silver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/melt-umn/silver/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/melt-umn/silver/statuses/4b94ac32bf9dbf2644148ecc467d4f6ebfd52165"}}}}