{"action":"created","issue":{"url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/3052","repository_url":"https://api.github.com/repos/idris-lang/Idris-dev","labels_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/3052/labels{/name}","comments_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/3052/comments","events_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/3052/events","html_url":"https://github.com/idris-lang/Idris-dev/issues/3052","id":142472521,"number":3052,"title":"Improve the error message of `rewrite ... in ...` by showing the term that is rewritten with","user":{"login":"ahmadsalim","id":1647846,"avatar_url":"https://avatars.githubusercontent.com/u/1647846?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmadsalim","html_url":"https://github.com/ahmadsalim","followers_url":"https://api.github.com/users/ahmadsalim/followers","following_url":"https://api.github.com/users/ahmadsalim/following{/other_user}","gists_url":"https://api.github.com/users/ahmadsalim/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmadsalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmadsalim/subscriptions","organizations_url":"https://api.github.com/users/ahmadsalim/orgs","repos_url":"https://api.github.com/users/ahmadsalim/repos","events_url":"https://api.github.com/users/ahmadsalim/events{/privacy}","received_events_url":"https://api.github.com/users/ahmadsalim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-21T21:09:07Z","updated_at":"2016-03-21T21:16:41Z","closed_at":null,"body":"Hi,\r\n\r\nCurrently the error message of rewrite is somewhat confusing since it may not be immediately clear why the rewrite failed. A simple suggestion would be to include the term to be rewritten with in the error message, which may give the programmer a hint on why it did not match.\r\n\r\nFor example\r\n\r\n```idris\r\nimport Data.Vect\r\n\r\ntest : {n : Nat} -> Vect (n + 0) Integer\r\ntest {n} = rewrite (plusCommutative 0 n) in replicate n 10\r\n```\r\n\r\ncurrently gives the following error message:\r\n\r\n```idris\r\n `-- test.idr line 4 col 5:\r\n     When checking right hand side of test with expected type\r\n             Vect (n + 0) Integer\r\n     \r\n     rewrite did not change type Vect (plus n 0) Integer\r\n```\r\n\r\nwhich does not give much additional information.\r\n\r\nI suggest that the message is changed to something like:\r\n\r\n```idris\r\n `-- test.idr line 4 col 5:\r\n     When checking right hand side of test with expected type\r\n             Vect (n + 0) Integer\r\n     \r\n     rewriting with 0 + n did not change type Vect (plus n 0) Integer\r\n```\r\n\r\nwhich now makes it immediately clear that the arguments to `plusAssociative` were switched around."},"comment":{"url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/comments/199490604","html_url":"https://github.com/idris-lang/Idris-dev/issues/3052#issuecomment-199490604","issue_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/3052","id":199490604,"user":{"login":"ahmadsalim","id":1647846,"avatar_url":"https://avatars.githubusercontent.com/u/1647846?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmadsalim","html_url":"https://github.com/ahmadsalim","followers_url":"https://api.github.com/users/ahmadsalim/followers","following_url":"https://api.github.com/users/ahmadsalim/following{/other_user}","gists_url":"https://api.github.com/users/ahmadsalim/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmadsalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmadsalim/subscriptions","organizations_url":"https://api.github.com/users/ahmadsalim/orgs","repos_url":"https://api.github.com/users/ahmadsalim/repos","events_url":"https://api.github.com/users/ahmadsalim/events{/privacy}","received_events_url":"https://api.github.com/users/ahmadsalim/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T21:16:41Z","updated_at":"2016-03-21T21:16:41Z","body":"Melvar: Perhaps, this would make sense if both sides were identical, and then the error message could be extended to (rewriting with something else):\r\n\r\n```idris\r\nrewriting with n did not change type Vect n Integer, left and right hand sides of the equation are identical\r\n```\r\n\r\nor something like that."}}