{"action":"created","issue":{"url":"https://api.github.com/repos/purescript/purescript/issues/1218","labels_url":"https://api.github.com/repos/purescript/purescript/issues/1218/labels{/name}","comments_url":"https://api.github.com/repos/purescript/purescript/issues/1218/comments","events_url":"https://api.github.com/repos/purescript/purescript/issues/1218/events","html_url":"https://github.com/purescript/purescript/pull/1218","id":92494486,"number":1218,"title":"Exhaustivity Checker","user":{"login":"nicodelpiano","id":5914822,"avatar_url":"https://avatars.githubusercontent.com/u/5914822?v=3","gravatar_id":"","url":"https://api.github.com/users/nicodelpiano","html_url":"https://github.com/nicodelpiano","followers_url":"https://api.github.com/users/nicodelpiano/followers","following_url":"https://api.github.com/users/nicodelpiano/following{/other_user}","gists_url":"https://api.github.com/users/nicodelpiano/gists{/gist_id}","starred_url":"https://api.github.com/users/nicodelpiano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicodelpiano/subscriptions","organizations_url":"https://api.github.com/users/nicodelpiano/orgs","repos_url":"https://api.github.com/users/nicodelpiano/repos","events_url":"https://api.github.com/users/nicodelpiano/events{/privacy}","received_events_url":"https://api.github.com/users/nicodelpiano/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-01T22:01:27Z","updated_at":"2015-07-09T22:23:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/purescript/purescript/pulls/1218","html_url":"https://github.com/purescript/purescript/pull/1218","diff_url":"https://github.com/purescript/purescript/pull/1218.diff","patch_url":"https://github.com/purescript/purescript/pull/1218.patch"},"body":"It covers exhaustivity for data constructors, objects, guards and boolean literals.\r\nBasically, we analyse the clauses of a definition one by one from top to bottom, where in each step we have the cases already missing (uncovered), and we generate the new set of missing cases.\r\nStarting with `uncovered = { _ }` (nothing covered), we partition that set with the new uncovered cases.\r\n\r\nExample:\r\n```haskell\r\nmodule Main where\r\n\r\ndata Nat = Zero | Succ Nat\r\n\r\nf Zero = Zero\r\n```\r\nThis returns\r\n```\r\nPattern Match(es) are not exhaustive\r\nThe definition of \"\" has the following uncovered cases:\r\n  Main.Succ _\r\n```\r\nRecords:\r\n```haskell\r\ng {bar : Zero} = Zero\r\ng {foo: Zero, bar : _} = Zero\r\n```\r\nwe obtain:\r\n```\r\nPattern Match(es) are not exhaustive\r\nThe definition of \"\" has the following uncovered cases:\r\n  {\r\n  bar: Main.Succ _\r\n  foo: Main.Succ _}\r\n```\r\nFor guards, we simply say that are not exhaustive those clauses who hasn't an `otherwise` guard.\r\n\r\nTODO:\r\n- Remove redundant and repeated cases (this is already done, but it makes the main algorithm's complexity nearly `O(n^2)`) \r\n- Add function names to warnings and improve the pretty-printing\r\n- Add tests and documentation"},"comment":{"url":"https://api.github.com/repos/purescript/purescript/issues/comments/120164686","html_url":"https://github.com/purescript/purescript/pull/1218#issuecomment-120164686","issue_url":"https://api.github.com/repos/purescript/purescript/issues/1218","id":120164686,"user":{"login":"paf31","id":630306,"avatar_url":"https://avatars.githubusercontent.com/u/630306?v=3","gravatar_id":"","url":"https://api.github.com/users/paf31","html_url":"https://github.com/paf31","followers_url":"https://api.github.com/users/paf31/followers","following_url":"https://api.github.com/users/paf31/following{/other_user}","gists_url":"https://api.github.com/users/paf31/gists{/gist_id}","starred_url":"https://api.github.com/users/paf31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paf31/subscriptions","organizations_url":"https://api.github.com/users/paf31/orgs","repos_url":"https://api.github.com/users/paf31/repos","events_url":"https://api.github.com/users/paf31/events{/privacy}","received_events_url":"https://api.github.com/users/paf31/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T22:23:56Z","updated_at":"2015-07-09T22:23:56Z","body":"@nicodelpiano Looks like you added all the changes we discussed. Is this good to go?\r\n\r\nThanks! :+1: "}}