
#11999: expressing injectivity on functional dependencies gives orphan instances warnings -------------------------------------+------------------------------------- Reporter: dredozubov | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11999 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler