{"action":"created","issue":{"url":"https://api.github.com/repos/ku-fpg/hermit/issues/179","repository_url":"https://api.github.com/repos/ku-fpg/hermit","labels_url":"https://api.github.com/repos/ku-fpg/hermit/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/ku-fpg/hermit/issues/179/comments","events_url":"https://api.github.com/repos/ku-fpg/hermit/issues/179/events","html_url":"https://github.com/ku-fpg/hermit/issues/179","id":182840363,"number":179,"title":"Pattern matching variables get renamed in RULES on 'case'","user":{"login":"roboguy13","id":5057707,"avatar_url":"https://avatars.githubusercontent.com/u/5057707?v=3","gravatar_id":"","url":"https://api.github.com/users/roboguy13","html_url":"https://github.com/roboguy13","followers_url":"https://api.github.com/users/roboguy13/followers","following_url":"https://api.github.com/users/roboguy13/following{/other_user}","gists_url":"https://api.github.com/users/roboguy13/gists{/gist_id}","starred_url":"https://api.github.com/users/roboguy13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboguy13/subscriptions","organizations_url":"https://api.github.com/users/roboguy13/orgs","repos_url":"https://api.github.com/users/roboguy13/repos","events_url":"https://api.github.com/users/roboguy13/events{/privacy}","received_events_url":"https://api.github.com/users/roboguy13/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ku-fpg/hermit/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-13T16:39:42Z","updated_at":"2016-10-13T20:16:32Z","closed_at":null,"body":"I notice that if I have\r\n\r\n```\r\n{-# RULES \"abs/case-float-pair\" [~]\r\n    forall d x.\r\n    abs (case d of (,) a b -> x)\r\n      =\r\n    case d of\r\n      (,) a b -> abs x\r\n  #-}\r\n```\r\n\r\nand I fire the rule, it will rename the variables in the match to `a` and `b`, but it doesn't perform the corresponding substitution in the body (`abs x`), leading to references to nonexistent names. Is it possible to avoid this problem? I have tried using `_`s instead of `a` and `b`, but it seems to run into the same problem (except that the specific names used are generated by GHC).\r\n\r\nIf not, is there another way to implement this sort of floating transformation that specifically targets a certain function (in this case `abs`)? I notice that there is `case-float-arg` and `case-float-arg-unsafe`. I have tried `case-float-arg-unsafe [| abs |]` on the node `abs <type and dictionary arguments> (case ds pf wild (,) x y -> ...`, but it says\r\n\r\n```\r\nError in expression: case-float-arg-unsafe [| abs |]\r\nRewrite failed:Case floating from App argument failed: given function does not match current application.\r\n```\r\n\r\nI imagine this is because I am giving it `[| abs |]` instead of `[| (abs <type and dictionary arguments>) |]`. If that's the case, is there a good way to provide it with the appropriate arguments (or avoid the issue altogether)? Ideally, I would like it to apply regardless of the specific type and dictionary arguments."},"comment":{"url":"https://api.github.com/repos/ku-fpg/hermit/issues/comments/253626207","html_url":"https://github.com/ku-fpg/hermit/issues/179#issuecomment-253626207","issue_url":"https://api.github.com/repos/ku-fpg/hermit/issues/179","id":253626207,"user":{"login":"xich","id":19712,"avatar_url":"https://avatars.githubusercontent.com/u/19712?v=3","gravatar_id":"","url":"https://api.github.com/users/xich","html_url":"https://github.com/xich","followers_url":"https://api.github.com/users/xich/followers","following_url":"https://api.github.com/users/xich/following{/other_user}","gists_url":"https://api.github.com/users/xich/gists{/gist_id}","starred_url":"https://api.github.com/users/xich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xich/subscriptions","organizations_url":"https://api.github.com/users/xich/orgs","repos_url":"https://api.github.com/users/xich/repos","events_url":"https://api.github.com/users/xich/events{/privacy}","received_events_url":"https://api.github.com/users/xich/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T20:16:32Z","updated_at":"2016-10-13T20:16:32Z","body":"(or add another variant of `focus` with the right type)\r\n\r\nThis is where a monomorphic scripting language bites us hard."}}
{"actor":{"display_login":"xich"}}