{"action":"closed","issue":{"url":"https://api.github.com/repos/ekmett/parsers/issues/16","repository_url":"https://api.github.com/repos/ekmett/parsers","labels_url":"https://api.github.com/repos/ekmett/parsers/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/ekmett/parsers/issues/16/comments","events_url":"https://api.github.com/repos/ekmett/parsers/issues/16/events","html_url":"https://github.com/ekmett/parsers/issues/16","id":16619202,"number":16,"title":"Runtime crash caused by permutation parsing with Optimization flag","user":{"login":"konn","id":21860,"avatar_url":"https://avatars0.githubusercontent.com/u/21860?v=4","gravatar_id":"","url":"https://api.github.com/users/konn","html_url":"https://github.com/konn","followers_url":"https://api.github.com/users/konn/followers","following_url":"https://api.github.com/users/konn/following{/other_user}","gists_url":"https://api.github.com/users/konn/gists{/gist_id}","starred_url":"https://api.github.com/users/konn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konn/subscriptions","organizations_url":"https://api.github.com/users/konn/orgs","repos_url":"https://api.github.com/users/konn/repos","events_url":"https://api.github.com/users/konn/events{/privacy}","received_events_url":"https://api.github.com/users/konn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2013-07-11T08:19:34Z","updated_at":"2018-02-11T00:14:19Z","closed_at":"2018-02-11T00:14:19Z","author_association":"NONE","body":"Consider the following code:\n\n``` haskell\nmodule Main where\nimport Control.Applicative\nimport Text.Parser.Permutation\nimport Text.Trifecta\n\nmain :: IO ()\nmain =  parseTest (myPerm \"a\") \"semanticsppp\"\n\nmyPerm :: String -> Parser (String, String, String)\nmyPerm opN = permute $\n   (,,) opN <$$> string \"semantics\"\n            <|?> ([], (some (char 'p')))\n```\n\nIf I compile this code with `-O2` flag with GHC 7.6.3, this program halt with runtime crash:\n\n``` zsh\n$ ghc -O2 crash.hs\n[1 of 1] Compiling Main             ( crash.hs, crash.o )\nLinking crash ...\n\n$ ./crash\ncrash: Oops!  Entered absent arg w_s3DL{v} [lid] base:GHC.Base.String{tc 36u}\n```\n\nIf I compile the same code without `-O2` flag, then it runs without fail:\n\n``` zsh\n$ ghc -O0 crash.hs -fforce-recomp\n[1 of 1] Compiling Main             ( crash.hs, crash.o )\nLinking crash ...\n\n$ ./crash                        \n(\"a\",\"semantics\",\"ppp\")\n```\n\nIt might be GHC's bug, but I couldn't find out what caused this.\n"}}
{"actor":{"display_login":"RyanGlScott"}}