{"action":"created","comment":{"url":"https://api.github.com/repos/dry-rb/dry-types/pulls/comments/103880109","pull_request_review_id":24683014,"id":103880109,"diff_hunk":"@@ -71,6 +71,13 @@ def constrained_type\n         Constrained::Coercible\n       end\n \n+      # @api public\n+      #\n+      # @see Definition#to_ast\n+      def to_ast","path":"lib/dry/types/constructor.rb","position":7,"original_position":7,"commit_id":"04b702ebf8120236fb3f3291315200b353d3391a","original_commit_id":"04b702ebf8120236fb3f3291315200b353d3391a","user":{"login":"GustavoCaso","id":4672858,"avatar_url":"https://avatars0.githubusercontent.com/u/4672858?v=3","gravatar_id":"","url":"https://api.github.com/users/GustavoCaso","html_url":"https://github.com/GustavoCaso","followers_url":"https://api.github.com/users/GustavoCaso/followers","following_url":"https://api.github.com/users/GustavoCaso/following{/other_user}","gists_url":"https://api.github.com/users/GustavoCaso/gists{/gist_id}","starred_url":"https://api.github.com/users/GustavoCaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GustavoCaso/subscriptions","organizations_url":"https://api.github.com/users/GustavoCaso/orgs","repos_url":"https://api.github.com/users/GustavoCaso/repos","events_url":"https://api.github.com/users/GustavoCaso/events{/privacy}","received_events_url":"https://api.github.com/users/GustavoCaso/received_events","type":"User","site_admin":false},"body":"I have some questions regarding the `Constructor` `#ast`, since it have `fn` that tells us information regarding the `coercion` method, I do not know if is important to included in the `ast`. Something like `[[:type, type.to_ast], [:fn, fn.to_s]]` id not really clear if we would be able to extract info from the `fn` ","created_at":"2017-03-02T09:18:34Z","updated_at":"2017-03-02T09:18:34Z","html_url":"https://github.com/dry-rb/dry-types/pull/178#discussion_r103880109","pull_request_url":"https://api.github.com/repos/dry-rb/dry-types/pulls/178","_links":{"self":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/comments/103880109"},"html":{"href":"https://github.com/dry-rb/dry-types/pull/178#discussion_r103880109"},"pull_request":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/178"}}},"pull_request":{"url":"https://api.github.com/repos/dry-rb/dry-types/pulls/178","id":106527424,"html_url":"https://github.com/dry-rb/dry-types/pull/178","diff_url":"https://github.com/dry-rb/dry-types/pull/178.diff","patch_url":"https://github.com/dry-rb/dry-types/pull/178.patch","issue_url":"https://api.github.com/repos/dry-rb/dry-types/issues/178","number":178,"state":"open","locked":false,"title":"[WIP] Add type AST","user":{"login":"solnic","id":1066,"avatar_url":"https://avatars1.githubusercontent.com/u/1066?v=3","gravatar_id":"","url":"https://api.github.com/users/solnic","html_url":"https://github.com/solnic","followers_url":"https://api.github.com/users/solnic/followers","following_url":"https://api.github.com/users/solnic/following{/other_user}","gists_url":"https://api.github.com/users/solnic/gists{/gist_id}","starred_url":"https://api.github.com/users/solnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solnic/subscriptions","organizations_url":"https://api.github.com/users/solnic/orgs","repos_url":"https://api.github.com/users/solnic/repos","events_url":"https://api.github.com/users/solnic/events{/privacy}","received_events_url":"https://api.github.com/users/solnic/received_events","type":"User","site_admin":false},"body":"This adds `#to_ast` methods too all types. We need this in order to be able to dump types into ASTs and transform them into slightly different types. ie in rom-rb we'll be able to take database schema attribute types, and convert them to different types that are more suitable for other contexts, like struct attributes.\r\n\r\n### TODO\r\n\r\n- [x] `Definition#to_ast`\r\n- [x] `Sum#to_ast`\r\n- [x] `Constrained#to_ast`\r\n- [x] `Constructor#to_ast`\r\n- [x] `Hash#to_ast`\r\n- [x] `Hash::Schema#to_ast`\r\n- [x] `Hash::Permissive#to_ast`\r\n- [x] `Hash::Strict#to_ast`\r\n- [x] `Hash::StrictWithDefaults#to_ast`\r\n- [x] `Hash::Weak#to_ast`\r\n- [x] `Hash::Symbolized#to_ast`\r\n- [x] `Array#to_ast`\r\n- [x] `Array::Member#to_ast`\r\n- [x] `Enum#to_ast`\r\n- [x] `Safe#to_ast`\r\n- [ ] Tweak existing compiler to work with the AST (currently it relies on ASTs that include type identifiers from the builtin registry, we may want to make that available via `meta` so that when types are registered we set ie `meta(identifier: 'strict.int')` and then meta data can be included in ASTs so that compiler can reuse existing built-in types","created_at":"2017-02-16T13:42:24Z","updated_at":"2017-03-02T09:18:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce8af6a0089700dee76eea9d031e0df913363d7e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dry-rb/dry-types/pulls/178/commits","review_comments_url":"https://api.github.com/repos/dry-rb/dry-types/pulls/178/comments","review_comment_url":"https://api.github.com/repos/dry-rb/dry-types/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dry-rb/dry-types/issues/178/comments","statuses_url":"https://api.github.com/repos/dry-rb/dry-types/statuses/04b702ebf8120236fb3f3291315200b353d3391a","head":{"label":"dry-rb:type-ast","ref":"type-ast","sha":"04b702ebf8120236fb3f3291315200b353d3391a","user":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars1.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"repo":{"id":42923055,"name":"dry-types","full_name":"dry-rb/dry-types","owner":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars1.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dry-rb/dry-types","description":"Flexible type system for Ruby with coercions and constraints","fork":false,"url":"https://api.github.com/repos/dry-rb/dry-types","forks_url":"https://api.github.com/repos/dry-rb/dry-types/forks","keys_url":"https://api.github.com/repos/dry-rb/dry-types/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dry-rb/dry-types/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dry-rb/dry-types/teams","hooks_url":"https://api.github.com/repos/dry-rb/dry-types/hooks","issue_events_url":"https://api.github.com/repos/dry-rb/dry-types/issues/events{/number}","events_url":"https://api.github.com/repos/dry-rb/dry-types/events","assignees_url":"https://api.github.com/repos/dry-rb/dry-types/assignees{/user}","branches_url":"https://api.github.com/repos/dry-rb/dry-types/branches{/branch}","tags_url":"https://api.github.com/repos/dry-rb/dry-types/tags","blobs_url":"https://api.github.com/repos/dry-rb/dry-types/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dry-rb/dry-types/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dry-rb/dry-types/git/refs{/sha}","trees_url":"https://api.github.com/repos/dry-rb/dry-types/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dry-rb/dry-types/statuses/{sha}","languages_url":"https://api.github.com/repos/dry-rb/dry-types/languages","stargazers_url":"https://api.github.com/repos/dry-rb/dry-types/stargazers","contributors_url":"https://api.github.com/repos/dry-rb/dry-types/contributors","subscribers_url":"https://api.github.com/repos/dry-rb/dry-types/subscribers","subscription_url":"https://api.github.com/repos/dry-rb/dry-types/subscription","commits_url":"https://api.github.com/repos/dry-rb/dry-types/commits{/sha}","git_commits_url":"https://api.github.com/repos/dry-rb/dry-types/git/commits{/sha}","comments_url":"https://api.github.com/repos/dry-rb/dry-types/comments{/number}","issue_comment_url":"https://api.github.com/repos/dry-rb/dry-types/issues/comments{/number}","contents_url":"https://api.github.com/repos/dry-rb/dry-types/contents/{+path}","compare_url":"https://api.github.com/repos/dry-rb/dry-types/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dry-rb/dry-types/merges","archive_url":"https://api.github.com/repos/dry-rb/dry-types/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dry-rb/dry-types/downloads","issues_url":"https://api.github.com/repos/dry-rb/dry-types/issues{/number}","pulls_url":"https://api.github.com/repos/dry-rb/dry-types/pulls{/number}","milestones_url":"https://api.github.com/repos/dry-rb/dry-types/milestones{/number}","notifications_url":"https://api.github.com/repos/dry-rb/dry-types/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dry-rb/dry-types/labels{/name}","releases_url":"https://api.github.com/repos/dry-rb/dry-types/releases{/id}","deployments_url":"https://api.github.com/repos/dry-rb/dry-types/deployments","created_at":"2015-09-22T09:01:34Z","updated_at":"2017-02-27T04:39:21Z","pushed_at":"2017-03-02T08:57:37Z","git_url":"git://github.com/dry-rb/dry-types.git","ssh_url":"git@github.com:dry-rb/dry-types.git","clone_url":"https://github.com/dry-rb/dry-types.git","svn_url":"https://github.com/dry-rb/dry-types","homepage":"http://dry-rb.org/gems/dry-types","size":551,"stargazers_count":279,"watchers_count":279,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":21,"forks":43,"open_issues":21,"watchers":279,"default_branch":"master"}},"base":{"label":"dry-rb:master","ref":"master","sha":"bbef68695d64cf8c7882261b349a5b4f7ac55bbe","user":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars1.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"repo":{"id":42923055,"name":"dry-types","full_name":"dry-rb/dry-types","owner":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars1.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dry-rb/dry-types","description":"Flexible type system for Ruby with coercions and constraints","fork":false,"url":"https://api.github.com/repos/dry-rb/dry-types","forks_url":"https://api.github.com/repos/dry-rb/dry-types/forks","keys_url":"https://api.github.com/repos/dry-rb/dry-types/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dry-rb/dry-types/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dry-rb/dry-types/teams","hooks_url":"https://api.github.com/repos/dry-rb/dry-types/hooks","issue_events_url":"https://api.github.com/repos/dry-rb/dry-types/issues/events{/number}","events_url":"https://api.github.com/repos/dry-rb/dry-types/events","assignees_url":"https://api.github.com/repos/dry-rb/dry-types/assignees{/user}","branches_url":"https://api.github.com/repos/dry-rb/dry-types/branches{/branch}","tags_url":"https://api.github.com/repos/dry-rb/dry-types/tags","blobs_url":"https://api.github.com/repos/dry-rb/dry-types/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dry-rb/dry-types/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dry-rb/dry-types/git/refs{/sha}","trees_url":"https://api.github.com/repos/dry-rb/dry-types/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dry-rb/dry-types/statuses/{sha}","languages_url":"https://api.github.com/repos/dry-rb/dry-types/languages","stargazers_url":"https://api.github.com/repos/dry-rb/dry-types/stargazers","contributors_url":"https://api.github.com/repos/dry-rb/dry-types/contributors","subscribers_url":"https://api.github.com/repos/dry-rb/dry-types/subscribers","subscription_url":"https://api.github.com/repos/dry-rb/dry-types/subscription","commits_url":"https://api.github.com/repos/dry-rb/dry-types/commits{/sha}","git_commits_url":"https://api.github.com/repos/dry-rb/dry-types/git/commits{/sha}","comments_url":"https://api.github.com/repos/dry-rb/dry-types/comments{/number}","issue_comment_url":"https://api.github.com/repos/dry-rb/dry-types/issues/comments{/number}","contents_url":"https://api.github.com/repos/dry-rb/dry-types/contents/{+path}","compare_url":"https://api.github.com/repos/dry-rb/dry-types/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dry-rb/dry-types/merges","archive_url":"https://api.github.com/repos/dry-rb/dry-types/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dry-rb/dry-types/downloads","issues_url":"https://api.github.com/repos/dry-rb/dry-types/issues{/number}","pulls_url":"https://api.github.com/repos/dry-rb/dry-types/pulls{/number}","milestones_url":"https://api.github.com/repos/dry-rb/dry-types/milestones{/number}","notifications_url":"https://api.github.com/repos/dry-rb/dry-types/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dry-rb/dry-types/labels{/name}","releases_url":"https://api.github.com/repos/dry-rb/dry-types/releases{/id}","deployments_url":"https://api.github.com/repos/dry-rb/dry-types/deployments","created_at":"2015-09-22T09:01:34Z","updated_at":"2017-02-27T04:39:21Z","pushed_at":"2017-03-02T08:57:37Z","git_url":"git://github.com/dry-rb/dry-types.git","ssh_url":"git@github.com:dry-rb/dry-types.git","clone_url":"https://github.com/dry-rb/dry-types.git","svn_url":"https://github.com/dry-rb/dry-types","homepage":"http://dry-rb.org/gems/dry-types","size":551,"stargazers_count":279,"watchers_count":279,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":21,"forks":43,"open_issues":21,"watchers":279,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/178"},"html":{"href":"https://github.com/dry-rb/dry-types/pull/178"},"issue":{"href":"https://api.github.com/repos/dry-rb/dry-types/issues/178"},"comments":{"href":"https://api.github.com/repos/dry-rb/dry-types/issues/178/comments"},"review_comments":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/178/comments"},"review_comment":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/178/commits"},"statuses":{"href":"https://api.github.com/repos/dry-rb/dry-types/statuses/04b702ebf8120236fb3f3291315200b353d3391a"}}}}
{"actor":{"display_login":"GustavoCaso"}}