{"action":"created","comment":{"url":"https://api.github.com/repos/purescript/purescript-generics/pulls/comments/37686700","id":37686700,"diff_hunk":"@@ -49,6 +51,24 @@ class Generic a where\n     toSignature :: Proxy a -> GenericSignature\n     fromSpine :: GenericSpine -> Maybe a\n \n+-- | Checks that the spine follows the structure defined by the signature\n+isValidSpine :: GenericSignature -> GenericSpine -> Boolean\n+isValidSpine SigBoolean (SBoolean _) = true\n+isValidSpine SigNumber (SNumber _) = true\n+isValidSpine SigInt (SInt _) = true\n+isValidSpine SigString (SString _) = true\n+isValidSpine (SigArray sig) (SArray spines) = all (isValidSpine (sig unit) <<< (unit #)) spines\n+isValidSpine (SigProd alts) (SProd tag values) =\n+  case find ((tag ==) <<< _.sigConstructor) alts of\n+    Nothing -> false\n+    Just { sigValues: sigValues } ->\n+      and $ zipWith (\\sig spine -> isValidSpine (sig unit) (spine unit)) sigValues values\n+isValidSpine (SigRecord fieldSigs) (SRecord fieldVals) =\n+  and $ zipWith (\\sig val -> isValidSpine (sig.recValue unit) (val.recValue unit))\n+                (sortBy (\\a b -> compare a.recLabel b.recLabel) fieldSigs)","path":"src/Data/Generic.purs","position":36,"original_position":36,"commit_id":"a1d0c7d5611c2b5655eef4486a58dc27af6717f2","original_commit_id":"a1d0c7d5611c2b5655eef4486a58dc27af6717f2","user":{"login":"paf31","id":630306,"avatar_url":"https://avatars.githubusercontent.com/u/630306?v=3","gravatar_id":"","url":"https://api.github.com/users/paf31","html_url":"https://github.com/paf31","followers_url":"https://api.github.com/users/paf31/followers","following_url":"https://api.github.com/users/paf31/following{/other_user}","gists_url":"https://api.github.com/users/paf31/gists{/gist_id}","starred_url":"https://api.github.com/users/paf31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paf31/subscriptions","organizations_url":"https://api.github.com/users/paf31/orgs","repos_url":"https://api.github.com/users/paf31/repos","events_url":"https://api.github.com/users/paf31/events{/privacy}","received_events_url":"https://api.github.com/users/paf31/received_events","type":"User","site_admin":false},"body":"`compare \\`on\\` _.recLabel` perhaps?","created_at":"2015-08-21T23:17:34Z","updated_at":"2015-08-21T23:17:34Z","html_url":"https://github.com/purescript/purescript-generics/pull/13#discussion_r37686700","pull_request_url":"https://api.github.com/repos/purescript/purescript-generics/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/purescript/purescript-generics/pulls/comments/37686700"},"html":{"href":"https://github.com/purescript/purescript-generics/pull/13#discussion_r37686700"},"pull_request":{"href":"https://api.github.com/repos/purescript/purescript-generics/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/purescript/purescript-generics/pulls/13","id":43090029,"html_url":"https://github.com/purescript/purescript-generics/pull/13","diff_url":"https://github.com/purescript/purescript-generics/pull/13.diff","patch_url":"https://github.com/purescript/purescript-generics/pull/13.patch","issue_url":"https://api.github.com/repos/purescript/purescript-generics/issues/13","number":13,"state":"open","locked":false,"title":"Spine validation","user":{"login":"zudov","id":2613966,"avatar_url":"https://avatars.githubusercontent.com/u/2613966?v=3","gravatar_id":"","url":"https://api.github.com/users/zudov","html_url":"https://github.com/zudov","followers_url":"https://api.github.com/users/zudov/followers","following_url":"https://api.github.com/users/zudov/following{/other_user}","gists_url":"https://api.github.com/users/zudov/gists{/gist_id}","starred_url":"https://api.github.com/users/zudov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zudov/subscriptions","organizations_url":"https://api.github.com/users/zudov/orgs","repos_url":"https://api.github.com/users/zudov/repos","events_url":"https://api.github.com/users/zudov/events{/privacy}","received_events_url":"https://api.github.com/users/zudov/received_events","type":"User","site_admin":false},"body":"Adds a function `isValidSpine` which takes GenericSignature and\r\nGenericSpine and checks that the spine conforms to the signature.","created_at":"2015-08-21T23:14:20Z","updated_at":"2015-08-21T23:17:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c858b8aca1914c8cf0cb5640893f518d6522ea62","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/purescript/purescript-generics/pulls/13/commits","review_comments_url":"https://api.github.com/repos/purescript/purescript-generics/pulls/13/comments","review_comment_url":"https://api.github.com/repos/purescript/purescript-generics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/purescript/purescript-generics/issues/13/comments","statuses_url":"https://api.github.com/repos/purescript/purescript-generics/statuses/a1d0c7d5611c2b5655eef4486a58dc27af6717f2","head":{"label":"zudov:spine-validation","ref":"spine-validation","sha":"a1d0c7d5611c2b5655eef4486a58dc27af6717f2","user":{"login":"zudov","id":2613966,"avatar_url":"https://avatars.githubusercontent.com/u/2613966?v=3","gravatar_id":"","url":"https://api.github.com/users/zudov","html_url":"https://github.com/zudov","followers_url":"https://api.github.com/users/zudov/followers","following_url":"https://api.github.com/users/zudov/following{/other_user}","gists_url":"https://api.github.com/users/zudov/gists{/gist_id}","starred_url":"https://api.github.com/users/zudov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zudov/subscriptions","organizations_url":"https://api.github.com/users/zudov/orgs","repos_url":"https://api.github.com/users/zudov/repos","events_url":"https://api.github.com/users/zudov/events{/privacy}","received_events_url":"https://api.github.com/users/zudov/received_events","type":"User","site_admin":false},"repo":{"id":40696332,"name":"purescript-generics","full_name":"zudov/purescript-generics","owner":{"login":"zudov","id":2613966,"avatar_url":"https://avatars.githubusercontent.com/u/2613966?v=3","gravatar_id":"","url":"https://api.github.com/users/zudov","html_url":"https://github.com/zudov","followers_url":"https://api.github.com/users/zudov/followers","following_url":"https://api.github.com/users/zudov/following{/other_user}","gists_url":"https://api.github.com/users/zudov/gists{/gist_id}","starred_url":"https://api.github.com/users/zudov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zudov/subscriptions","organizations_url":"https://api.github.com/users/zudov/orgs","repos_url":"https://api.github.com/users/zudov/repos","events_url":"https://api.github.com/users/zudov/events{/privacy}","received_events_url":"https://api.github.com/users/zudov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zudov/purescript-generics","description":"Generic Programming","fork":true,"url":"https://api.github.com/repos/zudov/purescript-generics","forks_url":"https://api.github.com/repos/zudov/purescript-generics/forks","keys_url":"https://api.github.com/repos/zudov/purescript-generics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zudov/purescript-generics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zudov/purescript-generics/teams","hooks_url":"https://api.github.com/repos/zudov/purescript-generics/hooks","issue_events_url":"https://api.github.com/repos/zudov/purescript-generics/issues/events{/number}","events_url":"https://api.github.com/repos/zudov/purescript-generics/events","assignees_url":"https://api.github.com/repos/zudov/purescript-generics/assignees{/user}","branches_url":"https://api.github.com/repos/zudov/purescript-generics/branches{/branch}","tags_url":"https://api.github.com/repos/zudov/purescript-generics/tags","blobs_url":"https://api.github.com/repos/zudov/purescript-generics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zudov/purescript-generics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zudov/purescript-generics/git/refs{/sha}","trees_url":"https://api.github.com/repos/zudov/purescript-generics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zudov/purescript-generics/statuses/{sha}","languages_url":"https://api.github.com/repos/zudov/purescript-generics/languages","stargazers_url":"https://api.github.com/repos/zudov/purescript-generics/stargazers","contributors_url":"https://api.github.com/repos/zudov/purescript-generics/contributors","subscribers_url":"https://api.github.com/repos/zudov/purescript-generics/subscribers","subscription_url":"https://api.github.com/repos/zudov/purescript-generics/subscription","commits_url":"https://api.github.com/repos/zudov/purescript-generics/commits{/sha}","git_commits_url":"https://api.github.com/repos/zudov/purescript-generics/git/commits{/sha}","comments_url":"https://api.github.com/repos/zudov/purescript-generics/comments{/number}","issue_comment_url":"https://api.github.com/repos/zudov/purescript-generics/issues/comments{/number}","contents_url":"https://api.github.com/repos/zudov/purescript-generics/contents/{+path}","compare_url":"https://api.github.com/repos/zudov/purescript-generics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zudov/purescript-generics/merges","archive_url":"https://api.github.com/repos/zudov/purescript-generics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zudov/purescript-generics/downloads","issues_url":"https://api.github.com/repos/zudov/purescript-generics/issues{/number}","pulls_url":"https://api.github.com/repos/zudov/purescript-generics/pulls{/number}","milestones_url":"https://api.github.com/repos/zudov/purescript-generics/milestones{/number}","notifications_url":"https://api.github.com/repos/zudov/purescript-generics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zudov/purescript-generics/labels{/name}","releases_url":"https://api.github.com/repos/zudov/purescript-generics/releases{/id}","created_at":"2015-08-14T04:50:28Z","updated_at":"2015-08-14T04:50:29Z","pushed_at":"2015-08-21T23:10:12Z","git_url":"git://github.com/zudov/purescript-generics.git","ssh_url":"git@github.com:zudov/purescript-generics.git","clone_url":"https://github.com/zudov/purescript-generics.git","svn_url":"https://github.com/zudov/purescript-generics","homepage":null,"size":114,"stargazers_count":0,"watchers_count":0,"language":"PureScript","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":"purescript:master","ref":"master","sha":"3853bacd160ae74df862b0642cd7eeb307276925","user":{"login":"purescript","id":6556677,"avatar_url":"https://avatars.githubusercontent.com/u/6556677?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript","html_url":"https://github.com/purescript","followers_url":"https://api.github.com/users/purescript/followers","following_url":"https://api.github.com/users/purescript/following{/other_user}","gists_url":"https://api.github.com/users/purescript/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript/subscriptions","organizations_url":"https://api.github.com/users/purescript/orgs","repos_url":"https://api.github.com/users/purescript/repos","events_url":"https://api.github.com/users/purescript/events{/privacy}","received_events_url":"https://api.github.com/users/purescript/received_events","type":"Organization","site_admin":false},"repo":{"id":17457181,"name":"purescript-generics","full_name":"purescript/purescript-generics","owner":{"login":"purescript","id":6556677,"avatar_url":"https://avatars.githubusercontent.com/u/6556677?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript","html_url":"https://github.com/purescript","followers_url":"https://api.github.com/users/purescript/followers","following_url":"https://api.github.com/users/purescript/following{/other_user}","gists_url":"https://api.github.com/users/purescript/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript/subscriptions","organizations_url":"https://api.github.com/users/purescript/orgs","repos_url":"https://api.github.com/users/purescript/repos","events_url":"https://api.github.com/users/purescript/events{/privacy}","received_events_url":"https://api.github.com/users/purescript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/purescript/purescript-generics","description":"Generic Programming","fork":false,"url":"https://api.github.com/repos/purescript/purescript-generics","forks_url":"https://api.github.com/repos/purescript/purescript-generics/forks","keys_url":"https://api.github.com/repos/purescript/purescript-generics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/purescript/purescript-generics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/purescript/purescript-generics/teams","hooks_url":"https://api.github.com/repos/purescript/purescript-generics/hooks","issue_events_url":"https://api.github.com/repos/purescript/purescript-generics/issues/events{/number}","events_url":"https://api.github.com/repos/purescript/purescript-generics/events","assignees_url":"https://api.github.com/repos/purescript/purescript-generics/assignees{/user}","branches_url":"https://api.github.com/repos/purescript/purescript-generics/branches{/branch}","tags_url":"https://api.github.com/repos/purescript/purescript-generics/tags","blobs_url":"https://api.github.com/repos/purescript/purescript-generics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/purescript/purescript-generics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/purescript/purescript-generics/git/refs{/sha}","trees_url":"https://api.github.com/repos/purescript/purescript-generics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/purescript/purescript-generics/statuses/{sha}","languages_url":"https://api.github.com/repos/purescript/purescript-generics/languages","stargazers_url":"https://api.github.com/repos/purescript/purescript-generics/stargazers","contributors_url":"https://api.github.com/repos/purescript/purescript-generics/contributors","subscribers_url":"https://api.github.com/repos/purescript/purescript-generics/subscribers","subscription_url":"https://api.github.com/repos/purescript/purescript-generics/subscription","commits_url":"https://api.github.com/repos/purescript/purescript-generics/commits{/sha}","git_commits_url":"https://api.github.com/repos/purescript/purescript-generics/git/commits{/sha}","comments_url":"https://api.github.com/repos/purescript/purescript-generics/comments{/number}","issue_comment_url":"https://api.github.com/repos/purescript/purescript-generics/issues/comments{/number}","contents_url":"https://api.github.com/repos/purescript/purescript-generics/contents/{+path}","compare_url":"https://api.github.com/repos/purescript/purescript-generics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/purescript/purescript-generics/merges","archive_url":"https://api.github.com/repos/purescript/purescript-generics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/purescript/purescript-generics/downloads","issues_url":"https://api.github.com/repos/purescript/purescript-generics/issues{/number}","pulls_url":"https://api.github.com/repos/purescript/purescript-generics/pulls{/number}","milestones_url":"https://api.github.com/repos/purescript/purescript-generics/milestones{/number}","notifications_url":"https://api.github.com/repos/purescript/purescript-generics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/purescript/purescript-generics/labels{/name}","releases_url":"https://api.github.com/repos/purescript/purescript-generics/releases{/id}","created_at":"2014-03-05T22:14:02Z","updated_at":"2015-08-11T20:48:29Z","pushed_at":"2015-08-21T23:14:20Z","git_url":"git://github.com/purescript/purescript-generics.git","ssh_url":"git@github.com:purescript/purescript-generics.git","clone_url":"https://github.com/purescript/purescript-generics.git","svn_url":"https://github.com/purescript/purescript-generics","homepage":null,"size":327,"stargazers_count":2,"watchers_count":2,"language":"PureScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/purescript/purescript-generics/pulls/13"},"html":{"href":"https://github.com/purescript/purescript-generics/pull/13"},"issue":{"href":"https://api.github.com/repos/purescript/purescript-generics/issues/13"},"comments":{"href":"https://api.github.com/repos/purescript/purescript-generics/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/purescript/purescript-generics/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/purescript/purescript-generics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/purescript/purescript-generics/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/purescript/purescript-generics/statuses/a1d0c7d5611c2b5655eef4486a58dc27af6717f2"}}}}