{"action":"created","comment":{"url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/comments/68685024","id":68685024,"diff_hunk":"@@ -13,74 +13,77 @@ import Data.Tuple (Tuple(..))\n import Text.Parsing.Parser.Pos (Position, initialPos)\n \n -- | A parsing error, consisting of a message and position information.\n-data ParseError = ParseError\n-  { message :: String\n-  , position :: Position\n-  }\n+data ParseError = ParseError String Position\n+\n+-- | The result of a single parse\n+data Result s a = Result  s                     -- the new input\n+                          (Either ParseError a) -- the result\n+                          Boolean               -- consumed?\n+                          Position              -- the new position\n \n instance showParseError :: Show ParseError where\n-  show (ParseError msg) = \"ParseError { message: \" <> msg.message <> \", position: \" <> show msg.position <> \" }\"\n+  show (ParseError msg pos) = \"ParseError \" <> msg <> \" \" <> show pos\n \n instance eqParseError :: Eq ParseError where\n-  eq (ParseError {message : m1, position : p1}) (ParseError {message : m2, position : p2}) = m1 == m2 && p1 == p2\n+  eq (ParseError m1  p1) (ParseError m2 p2) = m1 == m2 && p1 == p2\n \n -- | `PState` contains the remaining input and current position.\n-data PState s = PState\n-  { input :: s\n-  , position :: Position\n-  }\n+data PState s = PState s Position\n \n -- | The Parser monad transformer.\n -- |\n -- | The first type argument is the stream type. Typically, this is either `String`, or some sort of token stream.\n-newtype ParserT s m a = ParserT (PState s -> m { input :: s, result :: Either ParseError a, consumed :: Boolean, position :: Position })\n+newtype ParserT s m a = ParserT (PState s -> m (Result s a))\n \n -- | Apply a parser by providing an initial state.\n-unParserT :: forall m s a. ParserT s m a -> PState s -> m { input :: s, result :: Either ParseError a, consumed :: Boolean, position :: Position }\n+unParserT :: forall m s a. ParserT s m a -> PState s -> m (Result s a)\n unParserT (ParserT p) = p\n \n -- | Apply a parser, keeping only the parsed result.\n runParserT :: forall m s a. Monad m => PState s -> ParserT s m a -> m (Either ParseError a)\n runParserT s p = do\n-  o <- unParserT p s\n-  pure o.result\n+  (Result _ result _ _) <- unParserT p s","path":"src/Text/Parsing/Parser.purs","position":47,"original_position":47,"commit_id":"196309bd97db060fecc0be7a5d8c9133f97cc80d","original_commit_id":"196309bd97db060fecc0be7a5d8c9133f97cc80d","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":"These parens are redundant.","created_at":"2016-06-28T01:29:45Z","updated_at":"2016-06-28T01:29:45Z","html_url":"https://github.com/purescript-contrib/purescript-parsing/pull/33#discussion_r68685024","pull_request_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/comments/68685024"},"html":{"href":"https://github.com/purescript-contrib/purescript-parsing/pull/33#discussion_r68685024"},"pull_request":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33","id":75049307,"html_url":"https://github.com/purescript-contrib/purescript-parsing/pull/33","diff_url":"https://github.com/purescript-contrib/purescript-parsing/pull/33.diff","patch_url":"https://github.com/purescript-contrib/purescript-parsing/pull/33.patch","issue_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/issues/33","number":33,"state":"open","locked":false,"title":"Use ADTs for ParseError, PState and intermediate results","user":{"login":"felixSchl","id":2703310,"avatar_url":"https://avatars.githubusercontent.com/u/2703310?v=3","gravatar_id":"","url":"https://api.github.com/users/felixSchl","html_url":"https://github.com/felixSchl","followers_url":"https://api.github.com/users/felixSchl/followers","following_url":"https://api.github.com/users/felixSchl/following{/other_user}","gists_url":"https://api.github.com/users/felixSchl/gists{/gist_id}","starred_url":"https://api.github.com/users/felixSchl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixSchl/subscriptions","organizations_url":"https://api.github.com/users/felixSchl/orgs","repos_url":"https://api.github.com/users/felixSchl/repos","events_url":"https://api.github.com/users/felixSchl/events{/privacy}","received_events_url":"https://api.github.com/users/felixSchl/received_events","type":"User","site_admin":false},"body":"I have seen a major speed up of neodoc after this change. For an example, the lexer processing the git branch example in the repo ran at ~ 44ms before the change, and at around ~ 14 ms after the change.\r\n\r\nBe aware that this will break the API though as all these types are exported.","created_at":"2016-06-24T00:38:27Z","updated_at":"2016-06-28T01:29:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e0c6218c8f780f74bd1280d572739be77392ad8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33/commits","review_comments_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33/comments","review_comment_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/issues/33/comments","statuses_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/statuses/196309bd97db060fecc0be7a5d8c9133f97cc80d","head":{"label":"felixSchl:performance/use-ADTs","ref":"performance/use-ADTs","sha":"196309bd97db060fecc0be7a5d8c9133f97cc80d","user":{"login":"felixSchl","id":2703310,"avatar_url":"https://avatars.githubusercontent.com/u/2703310?v=3","gravatar_id":"","url":"https://api.github.com/users/felixSchl","html_url":"https://github.com/felixSchl","followers_url":"https://api.github.com/users/felixSchl/followers","following_url":"https://api.github.com/users/felixSchl/following{/other_user}","gists_url":"https://api.github.com/users/felixSchl/gists{/gist_id}","starred_url":"https://api.github.com/users/felixSchl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixSchl/subscriptions","organizations_url":"https://api.github.com/users/felixSchl/orgs","repos_url":"https://api.github.com/users/felixSchl/repos","events_url":"https://api.github.com/users/felixSchl/events{/privacy}","received_events_url":"https://api.github.com/users/felixSchl/received_events","type":"User","site_admin":false},"repo":{"id":41619932,"name":"purescript-parsing","full_name":"felixSchl/purescript-parsing","owner":{"login":"felixSchl","id":2703310,"avatar_url":"https://avatars.githubusercontent.com/u/2703310?v=3","gravatar_id":"","url":"https://api.github.com/users/felixSchl","html_url":"https://github.com/felixSchl","followers_url":"https://api.github.com/users/felixSchl/followers","following_url":"https://api.github.com/users/felixSchl/following{/other_user}","gists_url":"https://api.github.com/users/felixSchl/gists{/gist_id}","starred_url":"https://api.github.com/users/felixSchl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixSchl/subscriptions","organizations_url":"https://api.github.com/users/felixSchl/orgs","repos_url":"https://api.github.com/users/felixSchl/repos","events_url":"https://api.github.com/users/felixSchl/events{/privacy}","received_events_url":"https://api.github.com/users/felixSchl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/felixSchl/purescript-parsing","description":"A parser combinator library based on Parsec","fork":true,"url":"https://api.github.com/repos/felixSchl/purescript-parsing","forks_url":"https://api.github.com/repos/felixSchl/purescript-parsing/forks","keys_url":"https://api.github.com/repos/felixSchl/purescript-parsing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/felixSchl/purescript-parsing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/felixSchl/purescript-parsing/teams","hooks_url":"https://api.github.com/repos/felixSchl/purescript-parsing/hooks","issue_events_url":"https://api.github.com/repos/felixSchl/purescript-parsing/issues/events{/number}","events_url":"https://api.github.com/repos/felixSchl/purescript-parsing/events","assignees_url":"https://api.github.com/repos/felixSchl/purescript-parsing/assignees{/user}","branches_url":"https://api.github.com/repos/felixSchl/purescript-parsing/branches{/branch}","tags_url":"https://api.github.com/repos/felixSchl/purescript-parsing/tags","blobs_url":"https://api.github.com/repos/felixSchl/purescript-parsing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/felixSchl/purescript-parsing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/felixSchl/purescript-parsing/git/refs{/sha}","trees_url":"https://api.github.com/repos/felixSchl/purescript-parsing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/felixSchl/purescript-parsing/statuses/{sha}","languages_url":"https://api.github.com/repos/felixSchl/purescript-parsing/languages","stargazers_url":"https://api.github.com/repos/felixSchl/purescript-parsing/stargazers","contributors_url":"https://api.github.com/repos/felixSchl/purescript-parsing/contributors","subscribers_url":"https://api.github.com/repos/felixSchl/purescript-parsing/subscribers","subscription_url":"https://api.github.com/repos/felixSchl/purescript-parsing/subscription","commits_url":"https://api.github.com/repos/felixSchl/purescript-parsing/commits{/sha}","git_commits_url":"https://api.github.com/repos/felixSchl/purescript-parsing/git/commits{/sha}","comments_url":"https://api.github.com/repos/felixSchl/purescript-parsing/comments{/number}","issue_comment_url":"https://api.github.com/repos/felixSchl/purescript-parsing/issues/comments{/number}","contents_url":"https://api.github.com/repos/felixSchl/purescript-parsing/contents/{+path}","compare_url":"https://api.github.com/repos/felixSchl/purescript-parsing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/felixSchl/purescript-parsing/merges","archive_url":"https://api.github.com/repos/felixSchl/purescript-parsing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/felixSchl/purescript-parsing/downloads","issues_url":"https://api.github.com/repos/felixSchl/purescript-parsing/issues{/number}","pulls_url":"https://api.github.com/repos/felixSchl/purescript-parsing/pulls{/number}","milestones_url":"https://api.github.com/repos/felixSchl/purescript-parsing/milestones{/number}","notifications_url":"https://api.github.com/repos/felixSchl/purescript-parsing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/felixSchl/purescript-parsing/labels{/name}","releases_url":"https://api.github.com/repos/felixSchl/purescript-parsing/releases{/id}","deployments_url":"https://api.github.com/repos/felixSchl/purescript-parsing/deployments","created_at":"2015-08-30T07:08:27Z","updated_at":"2015-08-30T07:08:28Z","pushed_at":"2016-06-24T00:33:47Z","git_url":"git://github.com/felixSchl/purescript-parsing.git","ssh_url":"git@github.com:felixSchl/purescript-parsing.git","clone_url":"https://github.com/felixSchl/purescript-parsing.git","svn_url":"https://github.com/felixSchl/purescript-parsing","homepage":"","size":144,"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-contrib:master","ref":"master","sha":"b4a6402fff04fcfe93dfdc1a9b0f063b31d190ea","user":{"login":"purescript-contrib","id":7391813,"avatar_url":"https://avatars.githubusercontent.com/u/7391813?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript-contrib","html_url":"https://github.com/purescript-contrib","followers_url":"https://api.github.com/users/purescript-contrib/followers","following_url":"https://api.github.com/users/purescript-contrib/following{/other_user}","gists_url":"https://api.github.com/users/purescript-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript-contrib/subscriptions","organizations_url":"https://api.github.com/users/purescript-contrib/orgs","repos_url":"https://api.github.com/users/purescript-contrib/repos","events_url":"https://api.github.com/users/purescript-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/purescript-contrib/received_events","type":"Organization","site_admin":false},"repo":{"id":16590695,"name":"purescript-parsing","full_name":"purescript-contrib/purescript-parsing","owner":{"login":"purescript-contrib","id":7391813,"avatar_url":"https://avatars.githubusercontent.com/u/7391813?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript-contrib","html_url":"https://github.com/purescript-contrib","followers_url":"https://api.github.com/users/purescript-contrib/followers","following_url":"https://api.github.com/users/purescript-contrib/following{/other_user}","gists_url":"https://api.github.com/users/purescript-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript-contrib/subscriptions","organizations_url":"https://api.github.com/users/purescript-contrib/orgs","repos_url":"https://api.github.com/users/purescript-contrib/repos","events_url":"https://api.github.com/users/purescript-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/purescript-contrib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/purescript-contrib/purescript-parsing","description":"A parser combinator library based on Parsec","fork":false,"url":"https://api.github.com/repos/purescript-contrib/purescript-parsing","forks_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/forks","keys_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/teams","hooks_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/hooks","issue_events_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/issues/events{/number}","events_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/events","assignees_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/assignees{/user}","branches_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/branches{/branch}","tags_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/tags","blobs_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/git/refs{/sha}","trees_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/statuses/{sha}","languages_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/languages","stargazers_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/stargazers","contributors_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/contributors","subscribers_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/subscribers","subscription_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/subscription","commits_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/commits{/sha}","git_commits_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/git/commits{/sha}","comments_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/comments{/number}","issue_comment_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/issues/comments{/number}","contents_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/contents/{+path}","compare_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/merges","archive_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/downloads","issues_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/issues{/number}","pulls_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls{/number}","milestones_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/milestones{/number}","notifications_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/labels{/name}","releases_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/releases{/id}","deployments_url":"https://api.github.com/repos/purescript-contrib/purescript-parsing/deployments","created_at":"2014-02-06T19:27:17Z","updated_at":"2016-05-30T01:53:49Z","pushed_at":"2016-06-24T00:38:28Z","git_url":"git://github.com/purescript-contrib/purescript-parsing.git","ssh_url":"git@github.com:purescript-contrib/purescript-parsing.git","clone_url":"https://github.com/purescript-contrib/purescript-parsing.git","svn_url":"https://github.com/purescript-contrib/purescript-parsing","homepage":"","size":156,"stargazers_count":30,"watchers_count":30,"language":"PureScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":3,"forks":16,"open_issues":3,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33"},"html":{"href":"https://github.com/purescript-contrib/purescript-parsing/pull/33"},"issue":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/issues/33"},"comments":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/purescript-contrib/purescript-parsing/statuses/196309bd97db060fecc0be7a5d8c9133f97cc80d"}}}}
{"actor":{"display_login":"paf31"}}