{"action":"created","comment":{"url":"https://api.github.com/repos/dry-rb/dry-types/pulls/comments/173620668","pull_request_review_id":102849437,"id":173620668,"diff_hunk":"@@ -0,0 +1,110 @@\n+module Dry\n+  module Types\n+    class Map < Definition\n+\n+      def initialize(keys: Undefined, values: Undefined, meta: EMPTY_HASH)","path":"lib/dry/types/map.rb","position":5,"original_position":5,"commit_id":"f0016be78ebbd53d847982b5f4e636e186fa47bd","original_commit_id":"f0016be78ebbd53d847982b5f4e636e186fa47bd","user":{"login":"GustavoCaso","id":4672858,"avatar_url":"https://avatars3.githubusercontent.com/u/4672858?v=4","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":"Hi @fledman one more question, hope you do not mind, why we are using `Undefined` for default values for `keys` and `values`? Maybe we could use `Dry::Types::Any` and we avoid all the checking of `Undefined` in the class.\r\n\r\nAlso, I think it would be better for the `ast` having an empty map the result would be more idiomatic:\r\n```ruby\r\n[:map, [{:keys=>[:definition, [Object, {}]], :values=>[:definition, [Object, {}]]}, {}]])\r\n```\r\n\r\ninstead of:\r\n\r\n```ruby\r\n[:map, [{}, {}]]\r\n```\r\n\r\nWDYT?","created_at":"2018-03-10T12:15:05Z","updated_at":"2018-03-10T12:15:05Z","html_url":"https://github.com/dry-rb/dry-types/pull/242#discussion_r173620668","pull_request_url":"https://api.github.com/repos/dry-rb/dry-types/pulls/242","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/comments/173620668"},"html":{"href":"https://github.com/dry-rb/dry-types/pull/242#discussion_r173620668"},"pull_request":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/242"}}},"pull_request":{"url":"https://api.github.com/repos/dry-rb/dry-types/pulls/242","id":172108661,"html_url":"https://github.com/dry-rb/dry-types/pull/242","diff_url":"https://github.com/dry-rb/dry-types/pull/242.diff","patch_url":"https://github.com/dry-rb/dry-types/pull/242.patch","issue_url":"https://api.github.com/repos/dry-rb/dry-types/issues/242","number":242,"state":"open","locked":false,"title":"implement a Map type","user":{"login":"fledman","id":996501,"avatar_url":"https://avatars2.githubusercontent.com/u/996501?v=4","gravatar_id":"","url":"https://api.github.com/users/fledman","html_url":"https://github.com/fledman","followers_url":"https://api.github.com/users/fledman/followers","following_url":"https://api.github.com/users/fledman/following{/other_user}","gists_url":"https://api.github.com/users/fledman/gists{/gist_id}","starred_url":"https://api.github.com/users/fledman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fledman/subscriptions","organizations_url":"https://api.github.com/users/fledman/orgs","repos_url":"https://api.github.com/users/fledman/repos","events_url":"https://api.github.com/users/fledman/events{/privacy}","received_events_url":"https://api.github.com/users/fledman/received_events","type":"User","site_admin":false},"body":"@flash-gordon \r\nimplement a Map type based on the discussion from https://github.com/dry-rb/dry-types/issues/113\r\n\r\ncreate one like:\r\n```ruby\r\nDry::Types::Map.new(keys: Dry::Types['strict.integer'], values: Dry::Types['strict.string'])\r\n```\r\nthe empty<sup>[1]</sup> map is registered as `Dry::Types['map']` so you could also do:\r\n```ruby\r\nDry::Types['map'].with(keys: Dry::Types['strict.integer'], values: Dry::Types['strict.string'])\r\n```\r\nI chose to inherit from `Definition` as opposed to `Hash` to  avoid unintended interactions with the `Schema` logic\r\n\r\n[1] by empty I mean unconstrained; any key-value pair is valid","created_at":"2018-03-01T00:00:08Z","updated_at":"2018-03-10T12:15:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80618c35de382b39a48659c858772e230c030f0c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dry-rb/dry-types/pulls/242/commits","review_comments_url":"https://api.github.com/repos/dry-rb/dry-types/pulls/242/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/242/comments","statuses_url":"https://api.github.com/repos/dry-rb/dry-types/statuses/f0016be78ebbd53d847982b5f4e636e186fa47bd","head":{"label":"fledman:create_map_type","ref":"create_map_type","sha":"f0016be78ebbd53d847982b5f4e636e186fa47bd","user":{"login":"fledman","id":996501,"avatar_url":"https://avatars2.githubusercontent.com/u/996501?v=4","gravatar_id":"","url":"https://api.github.com/users/fledman","html_url":"https://github.com/fledman","followers_url":"https://api.github.com/users/fledman/followers","following_url":"https://api.github.com/users/fledman/following{/other_user}","gists_url":"https://api.github.com/users/fledman/gists{/gist_id}","starred_url":"https://api.github.com/users/fledman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fledman/subscriptions","organizations_url":"https://api.github.com/users/fledman/orgs","repos_url":"https://api.github.com/users/fledman/repos","events_url":"https://api.github.com/users/fledman/events{/privacy}","received_events_url":"https://api.github.com/users/fledman/received_events","type":"User","site_admin":false},"repo":{"id":123356165,"name":"dry-types","full_name":"fledman/dry-types","owner":{"login":"fledman","id":996501,"avatar_url":"https://avatars2.githubusercontent.com/u/996501?v=4","gravatar_id":"","url":"https://api.github.com/users/fledman","html_url":"https://github.com/fledman","followers_url":"https://api.github.com/users/fledman/followers","following_url":"https://api.github.com/users/fledman/following{/other_user}","gists_url":"https://api.github.com/users/fledman/gists{/gist_id}","starred_url":"https://api.github.com/users/fledman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fledman/subscriptions","organizations_url":"https://api.github.com/users/fledman/orgs","repos_url":"https://api.github.com/users/fledman/repos","events_url":"https://api.github.com/users/fledman/events{/privacy}","received_events_url":"https://api.github.com/users/fledman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fledman/dry-types","description":"Flexible type system for Ruby with coercions and constraints","fork":true,"url":"https://api.github.com/repos/fledman/dry-types","forks_url":"https://api.github.com/repos/fledman/dry-types/forks","keys_url":"https://api.github.com/repos/fledman/dry-types/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fledman/dry-types/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fledman/dry-types/teams","hooks_url":"https://api.github.com/repos/fledman/dry-types/hooks","issue_events_url":"https://api.github.com/repos/fledman/dry-types/issues/events{/number}","events_url":"https://api.github.com/repos/fledman/dry-types/events","assignees_url":"https://api.github.com/repos/fledman/dry-types/assignees{/user}","branches_url":"https://api.github.com/repos/fledman/dry-types/branches{/branch}","tags_url":"https://api.github.com/repos/fledman/dry-types/tags","blobs_url":"https://api.github.com/repos/fledman/dry-types/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fledman/dry-types/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fledman/dry-types/git/refs{/sha}","trees_url":"https://api.github.com/repos/fledman/dry-types/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fledman/dry-types/statuses/{sha}","languages_url":"https://api.github.com/repos/fledman/dry-types/languages","stargazers_url":"https://api.github.com/repos/fledman/dry-types/stargazers","contributors_url":"https://api.github.com/repos/fledman/dry-types/contributors","subscribers_url":"https://api.github.com/repos/fledman/dry-types/subscribers","subscription_url":"https://api.github.com/repos/fledman/dry-types/subscription","commits_url":"https://api.github.com/repos/fledman/dry-types/commits{/sha}","git_commits_url":"https://api.github.com/repos/fledman/dry-types/git/commits{/sha}","comments_url":"https://api.github.com/repos/fledman/dry-types/comments{/number}","issue_comment_url":"https://api.github.com/repos/fledman/dry-types/issues/comments{/number}","contents_url":"https://api.github.com/repos/fledman/dry-types/contents/{+path}","compare_url":"https://api.github.com/repos/fledman/dry-types/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fledman/dry-types/merges","archive_url":"https://api.github.com/repos/fledman/dry-types/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fledman/dry-types/downloads","issues_url":"https://api.github.com/repos/fledman/dry-types/issues{/number}","pulls_url":"https://api.github.com/repos/fledman/dry-types/pulls{/number}","milestones_url":"https://api.github.com/repos/fledman/dry-types/milestones{/number}","notifications_url":"https://api.github.com/repos/fledman/dry-types/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fledman/dry-types/labels{/name}","releases_url":"https://api.github.com/repos/fledman/dry-types/releases{/id}","deployments_url":"https://api.github.com/repos/fledman/dry-types/deployments","created_at":"2018-02-28T23:43:27Z","updated_at":"2018-02-28T23:43:29Z","pushed_at":"2018-03-08T20:55:56Z","git_url":"git://github.com/fledman/dry-types.git","ssh_url":"git@github.com:fledman/dry-types.git","clone_url":"https://github.com/fledman/dry-types.git","svn_url":"https://github.com/fledman/dry-types","homepage":"http://dry-rb.org/gems/dry-types","size":881,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dry-rb:master","ref":"master","sha":"f3c2561dbad3b1d44b564951c823983fdf30493d","user":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars2.githubusercontent.com/u/11280820?v=4","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://avatars2.githubusercontent.com/u/11280820?v=4","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":"2018-03-04T12:01:08Z","pushed_at":"2018-03-08T20:55:58Z","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":865,"stargazers_count":416,"watchers_count":416,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":64,"open_issues":7,"watchers":416,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/242"},"html":{"href":"https://github.com/dry-rb/dry-types/pull/242"},"issue":{"href":"https://api.github.com/repos/dry-rb/dry-types/issues/242"},"comments":{"href":"https://api.github.com/repos/dry-rb/dry-types/issues/242/comments"},"review_comments":{"href":"https://api.github.com/repos/dry-rb/dry-types/pulls/242/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/242/commits"},"statuses":{"href":"https://api.github.com/repos/dry-rb/dry-types/statuses/f0016be78ebbd53d847982b5f4e636e186fa47bd"}},"author_association":"NONE"}}
{"actor":{"display_login":"GustavoCaso"}}