{"action":"opened","number":642,"pull_request":{"url":"https://api.github.com/repos/ekmett/lens/pulls/642","id":64895629,"html_url":"https://github.com/ekmett/lens/pull/642","diff_url":"https://github.com/ekmett/lens/pull/642.diff","patch_url":"https://github.com/ekmett/lens/pull/642.patch","issue_url":"https://api.github.com/repos/ekmett/lens/issues/642","number":642,"state":"open","locked":false,"title":"Arg type prisms","user":{"login":"duog","id":3441949,"avatar_url":"https://avatars.githubusercontent.com/u/3441949?v=3","gravatar_id":"","url":"https://api.github.com/users/duog","html_url":"https://github.com/duog","followers_url":"https://api.github.com/users/duog/followers","following_url":"https://api.github.com/users/duog/following{/other_user}","gists_url":"https://api.github.com/users/duog/gists{/gist_id}","starred_url":"https://api.github.com/users/duog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duog/subscriptions","organizations_url":"https://api.github.com/users/duog/orgs","repos_url":"https://api.github.com/users/duog/repos","events_url":"https://api.github.com/users/duog/events{/privacy}","received_events_url":"https://api.github.com/users/duog/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nThis PR expands the capability of prism-generating template haskell. Constructors that take multiple arguments have data types for those arguments generated, and the prisms for those constructors target the generated data types instead of tuples. The generated data types also have lenses generated.  \r\n\r\nTwo new functions, declareArgTypePrisms and makeArgTypePrisms, are added that take a Parameter of type ``Name -> Maybe (Name, LensRules)``.  This function is applied to each constructor name. A result of Nothing will cause tuple prisms to be generated as usual, while a result of Just (n, lr) will cause a data type n to be generated, and lenses on that data type to be generated using lr.\r\n\r\ne.g.\r\n```haskell\r\ndata A = A1 {_a :: Int, _b :: Int } | A2 {_c :: Int, _d :: Int}\r\nmakeArgTypePrisms argTypesRulesSelector ''A\r\n```\r\n\r\nWill generate:\r\n```haskell\r\ndata A1Args = A1Args Int Int\r\ndata A2Args = A2Args Int Int\r\n_A1 :: Prism' A A1Args\r\na :: Lens' A1Args Int\r\nb :: Lens' A1Args Int\r\n_A2 :: Prism' A A2Args\r\nc :: Lens' A2Args Int\r\nd :: Lens' A2Args Int\r\n```\r\n\r\nI have added some tests to templates.hs to exercise the new functionality.\r\nI'm not confident that the names of chosen are any good.\r\n\r\nPlease let me know if you are interested in merging this.","created_at":"2016-04-01T04:57:07Z","updated_at":"2016-04-01T04:57:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ekmett/lens/pulls/642/commits","review_comments_url":"https://api.github.com/repos/ekmett/lens/pulls/642/comments","review_comment_url":"https://api.github.com/repos/ekmett/lens/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ekmett/lens/issues/642/comments","statuses_url":"https://api.github.com/repos/ekmett/lens/statuses/27a93b31817136e448c8824f610a0229f21a80bd","head":{"label":"duog:argTypePrisms","ref":"argTypePrisms","sha":"27a93b31817136e448c8824f610a0229f21a80bd","user":{"login":"duog","id":3441949,"avatar_url":"https://avatars.githubusercontent.com/u/3441949?v=3","gravatar_id":"","url":"https://api.github.com/users/duog","html_url":"https://github.com/duog","followers_url":"https://api.github.com/users/duog/followers","following_url":"https://api.github.com/users/duog/following{/other_user}","gists_url":"https://api.github.com/users/duog/gists{/gist_id}","starred_url":"https://api.github.com/users/duog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duog/subscriptions","organizations_url":"https://api.github.com/users/duog/orgs","repos_url":"https://api.github.com/users/duog/repos","events_url":"https://api.github.com/users/duog/events{/privacy}","received_events_url":"https://api.github.com/users/duog/received_events","type":"User","site_admin":false},"repo":{"id":55028959,"name":"lens","full_name":"duog/lens","owner":{"login":"duog","id":3441949,"avatar_url":"https://avatars.githubusercontent.com/u/3441949?v=3","gravatar_id":"","url":"https://api.github.com/users/duog","html_url":"https://github.com/duog","followers_url":"https://api.github.com/users/duog/followers","following_url":"https://api.github.com/users/duog/following{/other_user}","gists_url":"https://api.github.com/users/duog/gists{/gist_id}","starred_url":"https://api.github.com/users/duog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duog/subscriptions","organizations_url":"https://api.github.com/users/duog/orgs","repos_url":"https://api.github.com/users/duog/repos","events_url":"https://api.github.com/users/duog/events{/privacy}","received_events_url":"https://api.github.com/users/duog/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/duog/lens","description":"Lenses, Folds, and Traversals - Join us on freenode #haskell-lens","fork":true,"url":"https://api.github.com/repos/duog/lens","forks_url":"https://api.github.com/repos/duog/lens/forks","keys_url":"https://api.github.com/repos/duog/lens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/duog/lens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/duog/lens/teams","hooks_url":"https://api.github.com/repos/duog/lens/hooks","issue_events_url":"https://api.github.com/repos/duog/lens/issues/events{/number}","events_url":"https://api.github.com/repos/duog/lens/events","assignees_url":"https://api.github.com/repos/duog/lens/assignees{/user}","branches_url":"https://api.github.com/repos/duog/lens/branches{/branch}","tags_url":"https://api.github.com/repos/duog/lens/tags","blobs_url":"https://api.github.com/repos/duog/lens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/duog/lens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/duog/lens/git/refs{/sha}","trees_url":"https://api.github.com/repos/duog/lens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/duog/lens/statuses/{sha}","languages_url":"https://api.github.com/repos/duog/lens/languages","stargazers_url":"https://api.github.com/repos/duog/lens/stargazers","contributors_url":"https://api.github.com/repos/duog/lens/contributors","subscribers_url":"https://api.github.com/repos/duog/lens/subscribers","subscription_url":"https://api.github.com/repos/duog/lens/subscription","commits_url":"https://api.github.com/repos/duog/lens/commits{/sha}","git_commits_url":"https://api.github.com/repos/duog/lens/git/commits{/sha}","comments_url":"https://api.github.com/repos/duog/lens/comments{/number}","issue_comment_url":"https://api.github.com/repos/duog/lens/issues/comments{/number}","contents_url":"https://api.github.com/repos/duog/lens/contents/{+path}","compare_url":"https://api.github.com/repos/duog/lens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/duog/lens/merges","archive_url":"https://api.github.com/repos/duog/lens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/duog/lens/downloads","issues_url":"https://api.github.com/repos/duog/lens/issues{/number}","pulls_url":"https://api.github.com/repos/duog/lens/pulls{/number}","milestones_url":"https://api.github.com/repos/duog/lens/milestones{/number}","notifications_url":"https://api.github.com/repos/duog/lens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/duog/lens/labels{/name}","releases_url":"https://api.github.com/repos/duog/lens/releases{/id}","deployments_url":"https://api.github.com/repos/duog/lens/deployments","created_at":"2016-03-30T03:19:33Z","updated_at":"2016-03-30T03:19:34Z","pushed_at":"2016-04-01T04:40:37Z","git_url":"git://github.com/duog/lens.git","ssh_url":"git@github.com:duog/lens.git","clone_url":"https://github.com/duog/lens.git","svn_url":"https://github.com/duog/lens","homepage":"http://lens.github.com/","size":26671,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ekmett:master","ref":"master","sha":"bdb7e9142e83ff92a3f914a7ffc7ea4f5582a6d9","user":{"login":"ekmett","id":304657,"avatar_url":"https://avatars.githubusercontent.com/u/304657?v=3","gravatar_id":"","url":"https://api.github.com/users/ekmett","html_url":"https://github.com/ekmett","followers_url":"https://api.github.com/users/ekmett/followers","following_url":"https://api.github.com/users/ekmett/following{/other_user}","gists_url":"https://api.github.com/users/ekmett/gists{/gist_id}","starred_url":"https://api.github.com/users/ekmett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekmett/subscriptions","organizations_url":"https://api.github.com/users/ekmett/orgs","repos_url":"https://api.github.com/users/ekmett/repos","events_url":"https://api.github.com/users/ekmett/events{/privacy}","received_events_url":"https://api.github.com/users/ekmett/received_events","type":"User","site_admin":false},"repo":{"id":5185084,"name":"lens","full_name":"ekmett/lens","owner":{"login":"ekmett","id":304657,"avatar_url":"https://avatars.githubusercontent.com/u/304657?v=3","gravatar_id":"","url":"https://api.github.com/users/ekmett","html_url":"https://github.com/ekmett","followers_url":"https://api.github.com/users/ekmett/followers","following_url":"https://api.github.com/users/ekmett/following{/other_user}","gists_url":"https://api.github.com/users/ekmett/gists{/gist_id}","starred_url":"https://api.github.com/users/ekmett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekmett/subscriptions","organizations_url":"https://api.github.com/users/ekmett/orgs","repos_url":"https://api.github.com/users/ekmett/repos","events_url":"https://api.github.com/users/ekmett/events{/privacy}","received_events_url":"https://api.github.com/users/ekmett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ekmett/lens","description":"Lenses, Folds, and Traversals - Join us on freenode #haskell-lens","fork":false,"url":"https://api.github.com/repos/ekmett/lens","forks_url":"https://api.github.com/repos/ekmett/lens/forks","keys_url":"https://api.github.com/repos/ekmett/lens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ekmett/lens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ekmett/lens/teams","hooks_url":"https://api.github.com/repos/ekmett/lens/hooks","issue_events_url":"https://api.github.com/repos/ekmett/lens/issues/events{/number}","events_url":"https://api.github.com/repos/ekmett/lens/events","assignees_url":"https://api.github.com/repos/ekmett/lens/assignees{/user}","branches_url":"https://api.github.com/repos/ekmett/lens/branches{/branch}","tags_url":"https://api.github.com/repos/ekmett/lens/tags","blobs_url":"https://api.github.com/repos/ekmett/lens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ekmett/lens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ekmett/lens/git/refs{/sha}","trees_url":"https://api.github.com/repos/ekmett/lens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ekmett/lens/statuses/{sha}","languages_url":"https://api.github.com/repos/ekmett/lens/languages","stargazers_url":"https://api.github.com/repos/ekmett/lens/stargazers","contributors_url":"https://api.github.com/repos/ekmett/lens/contributors","subscribers_url":"https://api.github.com/repos/ekmett/lens/subscribers","subscription_url":"https://api.github.com/repos/ekmett/lens/subscription","commits_url":"https://api.github.com/repos/ekmett/lens/commits{/sha}","git_commits_url":"https://api.github.com/repos/ekmett/lens/git/commits{/sha}","comments_url":"https://api.github.com/repos/ekmett/lens/comments{/number}","issue_comment_url":"https://api.github.com/repos/ekmett/lens/issues/comments{/number}","contents_url":"https://api.github.com/repos/ekmett/lens/contents/{+path}","compare_url":"https://api.github.com/repos/ekmett/lens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ekmett/lens/merges","archive_url":"https://api.github.com/repos/ekmett/lens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ekmett/lens/downloads","issues_url":"https://api.github.com/repos/ekmett/lens/issues{/number}","pulls_url":"https://api.github.com/repos/ekmett/lens/pulls{/number}","milestones_url":"https://api.github.com/repos/ekmett/lens/milestones{/number}","notifications_url":"https://api.github.com/repos/ekmett/lens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ekmett/lens/labels{/name}","releases_url":"https://api.github.com/repos/ekmett/lens/releases{/id}","deployments_url":"https://api.github.com/repos/ekmett/lens/deployments","created_at":"2012-07-25T22:00:42Z","updated_at":"2016-04-01T04:44:45Z","pushed_at":"2016-03-28T18:34:28Z","git_url":"git://github.com/ekmett/lens.git","ssh_url":"git@github.com:ekmett/lens.git","clone_url":"https://github.com/ekmett/lens.git","svn_url":"https://github.com/ekmett/lens","homepage":"http://lens.github.com/","size":26782,"stargazers_count":813,"watchers_count":813,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":143,"mirror_url":null,"open_issues_count":39,"forks":143,"open_issues":39,"watchers":813,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ekmett/lens/pulls/642"},"html":{"href":"https://github.com/ekmett/lens/pull/642"},"issue":{"href":"https://api.github.com/repos/ekmett/lens/issues/642"},"comments":{"href":"https://api.github.com/repos/ekmett/lens/issues/642/comments"},"review_comments":{"href":"https://api.github.com/repos/ekmett/lens/pulls/642/comments"},"review_comment":{"href":"https://api.github.com/repos/ekmett/lens/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ekmett/lens/pulls/642/commits"},"statuses":{"href":"https://api.github.com/repos/ekmett/lens/statuses/27a93b31817136e448c8824f610a0229f21a80bd"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":9,"additions":320,"deletions":154,"changed_files":5}}