X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fseparate_compilation.xml;h=01748ae9261d66c1ca023a2287210b8b77042b25;hb=911a3e09ad48ff8dac5ee1399fe9294edf58d30c;hp=fc22fbdef3c4c88fa578140e897d5fccfd658221;hpb=4920157a2e5b7679b6971632c1b1f7be38c09f53;p=ghc-hetmet.git diff --git a/docs/users_guide/separate_compilation.xml b/docs/users_guide/separate_compilation.xml index fc22fbd..01748ae 100644 --- a/docs/users_guide/separate_compilation.xml +++ b/docs/users_guide/separate_compilation.xml @@ -702,7 +702,10 @@ module B where hi-boot files Here A imports B, but B imports A with a {-# SOURCE #-} pragma, which breaks the -circular dependency. For every module A.hs that is {-# SOURCE #-}-imported +circular dependency. Every loop in the module import graph must be broken by a {-# SOURCE #-} import; +or, equivalently, the module import graph must be acyclic if {-# SOURCE #-} imports are ignored. + +For every module A.hs that is {-# SOURCE #-}-imported in this way there must exist a source file A.hs-boot. This file contains an abbreviated version of A.hs, thus: @@ -1166,7 +1169,8 @@ just in case they contain an instance declaration that matters to M. This would be a disaster in practice, so GHC tries to be clever. In particular, if an instance declaration is in the same module as the definition -of any type or class mentioned in the head of the instance declaration, then +of any type or class mentioned in the head of the instance declaration +(the part after the “=>”; see ), then GHC has to visit that interface file anyway. Example: module A where @@ -1205,7 +1209,7 @@ functional dependency: class E x y | y -> x where ... Then in some importing module M, the constraint (E a Int) should be "improved" by setting -a = Int, even though there is no explicit mention +a = T, even though there is no explicit mention of T in M. These considerations lead to the following definition of an orphan module: @@ -1229,7 +1233,7 @@ These considerations lead to the following definition of an orphan module: - Only the instance head (the part after the “=>”) + Only the instance head counts. In the example above, it is not good enough for C's declaration to be in module A; it must be the declaration of D or T. @@ -1243,7 +1247,13 @@ These considerations lead to the following definition of an orphan module: -GHC will warn you if you are creating an orphan module, if you add `-fwarn-orphan-modules`. +If you use the flag , GHC will warn you +if you are creating an orphan module. +Like any warning, you can switch the warning off with , +and +will make the compilation fail if the warning is issued. + + You can identify an orphan module by looking in its interface file, M.hi, using the mode. If there is a [orphan module] on the