{"action":"created","issue":{"url":"https://api.github.com/repos/zkat/mona/issues/4","labels_url":"https://api.github.com/repos/zkat/mona/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/zkat/mona/issues/4/comments","events_url":"https://api.github.com/repos/zkat/mona/issues/4/events","html_url":"https://github.com/zkat/mona/issues/4","id":113519342,"number":4,"title":"Set userState as context of bind/map functions.","user":{"login":"katyo","id":238571,"avatar_url":"https://avatars.githubusercontent.com/u/238571?v=3","gravatar_id":"","url":"https://api.github.com/users/katyo","html_url":"https://github.com/katyo","followers_url":"https://api.github.com/users/katyo/followers","following_url":"https://api.github.com/users/katyo/following{/other_user}","gists_url":"https://api.github.com/users/katyo/gists{/gist_id}","starred_url":"https://api.github.com/users/katyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katyo/subscriptions","organizations_url":"https://api.github.com/users/katyo/orgs","repos_url":"https://api.github.com/users/katyo/repos","events_url":"https://api.github.com/users/katyo/events{/privacy}","received_events_url":"https://api.github.com/users/katyo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-27T06:53:41Z","updated_at":"2015-10-27T15:35:24Z","closed_at":null,"body":"I see a `userState` field in `ParserState` object, but I don't see any ways for use it. I offer set this as context for functions, which used with `bind` and `map`. I need this feature to create some stateful parsers. So I implemented the next variants of bind and map yet:\r\n\r\n```javascript\r\nfunction bindState(parser, fun) {\r\n  return bind(parser, function(result) {\r\n    return function(parserState) {\r\n      return fun.call(parserState.userState, result)(parserState);\r\n    };\r\n  });\r\n}\r\n\r\nfunction mapState(transformer, parser) {\r\n  return bindState(parser, function(result) {\r\n    return value(transformer.call(this, result));\r\n  });\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/zkat/mona/issues/comments/151543225","html_url":"https://github.com/zkat/mona/issues/4#issuecomment-151543225","issue_url":"https://api.github.com/repos/zkat/mona/issues/4","id":151543225,"user":{"login":"katyo","id":238571,"avatar_url":"https://avatars.githubusercontent.com/u/238571?v=3","gravatar_id":"","url":"https://api.github.com/users/katyo","html_url":"https://github.com/katyo","followers_url":"https://api.github.com/users/katyo/followers","following_url":"https://api.github.com/users/katyo/following{/other_user}","gists_url":"https://api.github.com/users/katyo/gists{/gist_id}","starred_url":"https://api.github.com/users/katyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katyo/subscriptions","organizations_url":"https://api.github.com/users/katyo/orgs","repos_url":"https://api.github.com/users/katyo/repos","events_url":"https://api.github.com/users/katyo/events{/privacy}","received_events_url":"https://api.github.com/users/katyo/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T15:35:24Z","updated_at":"2015-10-27T15:35:24Z","body":"I just used an option `userState` as contexts of functions, which passed to a bind()/map() 36c167d1d680019b5c35d8bccfb776c5fbe29c9f"}}