expressing injectivity on functional dependencies gives orphan instances warnings
Class.hs
```
{-# LANGUAGE DataKinds, FlexibleInstances, FunctionalDependencies, KindSignatures, MultiParamTypeClasses, TypeFamilies #-}
module Class where
class C a b | a -> b, b -> a
```
Lib.hs
```
{-# LANGUAGE DataKinds, FlexibleInstances, MultiParamTypeClasses, TypeFamilies #-}
module Lib where
import Class
newtype Local = Local ()
instance C Local ()
```
gives
```
/Users/dr/workspace/broken-ophans-ghc/src/Lib.hs:10:1: warning: [-Worphans]
Orphan instance: instance C Local ()
To avoid this
move the instance declaration to the module of the class or of the type, or
wrap the type with a newtype and declare the instance on the new type.
```
It seems weird to me and it is either a bug in the orphan instances checker or there is some fundamental aspect which i don't undestand. I've been able to reproduce this with 7.10.3 and 8-rc4.
I've compiled a git repo with minimalistic example of this: [https://github.com/dredozubov/broken-instances-minimal](https://github.com/dredozubov/broken-instances-minimal)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"expressing injectivity on functional dependencies gives orphan instances warnings","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Class.hs\r\n{{{\r\n{-# LANGUAGE DataKinds, FlexibleInstances, FunctionalDependencies, KindSignatures, MultiParamTypeClasses, TypeFamilies #-}\r\n\r\nmodule Class where\r\n\r\nclass C a b | a -> b, b -> a\r\n}}}\r\n\r\nLib.hs\r\n{{{\r\n{-# LANGUAGE DataKinds, FlexibleInstances, MultiParamTypeClasses, TypeFamilies #-}\r\n\r\nmodule Lib where\r\n\r\nimport Class\r\n\r\n\r\nnewtype Local = Local ()\r\n\r\ninstance C Local ()\r\n}}}\r\n\r\ngives\r\n\r\n{{{\r\n/Users/dr/workspace/broken-ophans-ghc/src/Lib.hs:10:1: warning: [-Worphans]\r\n Orphan instance: instance C Local ()\r\n To avoid this\r\n move the instance declaration to the module of the class or of the type, or\r\n wrap the type with a newtype and declare the instance on the new type.\r\n}}}\r\n\r\nIt seems weird to me and it is either a bug in the orphan instances checker or there is some fundamental aspect which i don't undestand. I've been able to reproduce this with 7.10.3 and 8-rc4.\r\nI've compiled a git repo with minimalistic example of this: [https://github.com/dredozubov/broken-instances-minimal]","type_of_failure":"OtherFailure","blocking":[]} -->
issue