{"action":"created","issue":{"url":"https://api.github.com/repos/elaforge/fast-tags/issues/12","labels_url":"https://api.github.com/repos/elaforge/fast-tags/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/elaforge/fast-tags/issues/12/comments","events_url":"https://api.github.com/repos/elaforge/fast-tags/issues/12/events","html_url":"https://github.com/elaforge/fast-tags/pull/12","id":77022248,"number":12,"title":"Recognize unicode variants of special symbols ::, ->, =>","user":{"login":"sergv","id":1149355,"avatar_url":"https://avatars.githubusercontent.com/u/1149355?v=3","gravatar_id":"","url":"https://api.github.com/users/sergv","html_url":"https://github.com/sergv","followers_url":"https://api.github.com/users/sergv/followers","following_url":"https://api.github.com/users/sergv/following{/other_user}","gists_url":"https://api.github.com/users/sergv/gists{/gist_id}","starred_url":"https://api.github.com/users/sergv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergv/subscriptions","organizations_url":"https://api.github.com/users/sergv/orgs","repos_url":"https://api.github.com/users/sergv/repos","events_url":"https://api.github.com/users/sergv/events{/privacy}","received_events_url":"https://api.github.com/users/sergv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-16T11:53:27Z","updated_at":"2015-05-19T06:51:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elaforge/fast-tags/pulls/12","html_url":"https://github.com/elaforge/fast-tags/pull/12","diff_url":"https://github.com/elaforge/fast-tags/pull/12.diff","patch_url":"https://github.com/elaforge/fast-tags/pull/12.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/elaforge/fast-tags/issues/comments/103370189","html_url":"https://github.com/elaforge/fast-tags/pull/12#issuecomment-103370189","issue_url":"https://api.github.com/repos/elaforge/fast-tags/issues/12","id":103370189,"user":{"login":"sergv","id":1149355,"avatar_url":"https://avatars.githubusercontent.com/u/1149355?v=3","gravatar_id":"","url":"https://api.github.com/users/sergv","html_url":"https://github.com/sergv","followers_url":"https://api.github.com/users/sergv/followers","following_url":"https://api.github.com/users/sergv/following{/other_user}","gists_url":"https://api.github.com/users/sergv/gists{/gist_id}","starred_url":"https://api.github.com/users/sergv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergv/subscriptions","organizations_url":"https://api.github.com/users/sergv/orgs","repos_url":"https://api.github.com/users/sergv/repos","events_url":"https://api.github.com/users/sergv/events{/privacy}","received_events_url":"https://api.github.com/users/sergv/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T06:51:25Z","updated_at":"2015-05-19T06:51:25Z","body":"I agree that copy-paste is to be avoided. On the other hand, moving string comparison into patterns will leverage ghc's pattern compiler to produce a state machine that will determine with a singe test whether the given token is double colon, for example. While approach with `elem` will make as many comparisons as there're tokens.\r\n\r\nPerhaps the best way to unify these would be to perform some lexical analysis before looking for tag constructs, e.g. `data`. Then tokenized input will be a list of some intermediate tokens of type\r\n\r\n```\r\ndata LexicalToken =\r\n    Name Text\r\n    | TokArrow -- handles both \"->\" and unicode version\r\n    | TokDoubleColon -- ditto\r\n    ...\r\n```\r\nWith input tokenized in such a way, tests for constructs like function signature will also be able to determine whether token is a double colon with a single operation. I think alex will be a good way to do such lexical analysis.\r\n\r\nRegarding your comment about duplication in stripOptContext function,\r\n```\r\nstripOptContext :: [Token] -> [Token]\r\nstripOptContext (stripBalancedParens -> (Pos _ (Token _ implies) : xs))\r\n  | implies == \"=>\" || implies == \"⇒\" = xs\r\nstripOptContext (stripSingleClassContext -> Pos _ (Token _ implies) : xs)\r\n  | implies == \"=>\" || implies == \"⇒\" = xs\r\nstripOptContext xs = xs\r\n```\r\nI'm not sure on how to unify duplicate cases because they use different view patterns. So I only changed test for implies tokens to use `elem`.\r\n\r\nNB I updated the commit instead of creating a new one."}}