{"action":"created","issue":{"url":"https://api.github.com/repos/purescript/purescript/issues/2279","repository_url":"https://api.github.com/repos/purescript/purescript","labels_url":"https://api.github.com/repos/purescript/purescript/issues/2279/labels{/name}","comments_url":"https://api.github.com/repos/purescript/purescript/issues/2279/comments","events_url":"https://api.github.com/repos/purescript/purescript/issues/2279/events","html_url":"https://github.com/purescript/purescript/pull/2279","id":171580464,"number":2279,"title":"Functional Dependencies","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},"labels":[{"url":"https://api.github.com/repos/purescript/purescript/labels/ready%20for%20review","name":"ready for review","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2016-08-17T05:58:17Z","updated_at":"2016-09-06T17:40:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/purescript/purescript/pulls/2279","html_url":"https://github.com/purescript/purescript/pull/2279","diff_url":"https://github.com/purescript/purescript/pull/2279.diff","patch_url":"https://github.com/purescript/purescript/pull/2279.patch"},"body":"Given\r\n\r\n```purescript\r\nclass Inject f g\r\n\r\ninstance injectRefl :: Inject f f\r\n```\r\n\r\nThe current behavior is that choosing `injectRefl` requires the two type arguments to be equal on the nose. With the new approach, it is as if we defined the instance as\r\n\r\n```purescript\r\ninstance injectRefl :: f ~ g => Inject f g\r\n```\r\n\r\nThat is, any `f` and `g` match, and then the subgoal forces them to unify.\r\n\r\nOf course, this is a potential problem for things like `purescript-inject`, depending on the order in which the instances get defined, but this solves some other problems without having to implement full functional dependencies.\r\n\r\nFor example, this now typechecks, where it wouldn't have before:\r\n\r\n```purescript\r\ntest = inject [1, 2, 3]\r\n```\r\n\r\nand forces `test` to have type `Array Int` (better examples would be things like `MonadEff`, but I haven't tested those yet)."},"comment":{"url":"https://api.github.com/repos/purescript/purescript/issues/comments/245029296","html_url":"https://github.com/purescript/purescript/pull/2279#issuecomment-245029296","issue_url":"https://api.github.com/repos/purescript/purescript/issues/2279","id":245029296,"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":"2016-09-06T17:40:10Z","updated_at":"2016-09-06T17:40:10Z","body":"1. Yes, I changed the rules for when an instance is generalizable. We should decide how flexible we want the generalization to be. I'm fine with making it quite strict, but that might confuse some users.\r\n2. There was a bug in the overlap check, where I was only checking if _all_ instance pairs overlapped, not _any_ pair. So, that instance pair should always have been overlapping, but we never reported it."}}
{"actor":{"display_login":"paf31"}}