diff options
-rw-r--r-- | compiler/GHC/Core/InstEnv.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Types/Id/Make.hs | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/compiler/GHC/Core/InstEnv.hs b/compiler/GHC/Core/InstEnv.hs index 92527851c5..749e6610f1 100644 --- a/compiler/GHC/Core/InstEnv.hs +++ b/compiler/GHC/Core/InstEnv.hs @@ -849,8 +849,10 @@ Here are the moving parts: * `GHC.HsToCore.Binds.dsHsWrapper` desugars the evidence application (f d) into (nospec f d) if `d` is incoherent. It has to do a dependency analysis to - determine transitive dependencies, but we need to do that anway. + determine transitive dependencies, but we need to do that anyway. See Note [Desugaring incoherent evidence] in GHC.HsToCore.Binds. + + See also Note [nospecId magic] in GHC.Types.Id.Make. -} type DFunInstType = Maybe Type diff --git a/compiler/GHC/Types/Id/Make.hs b/compiler/GHC/Types/Id/Make.hs index bf579c0d36..d50e3a52ec 100644 --- a/compiler/GHC/Types/Id/Make.hs +++ b/compiler/GHC/Types/Id/Make.hs @@ -2002,10 +2002,15 @@ Note that this happens *after* unfoldings are exposed in the interface file. This is crucial: otherwise, we could import an unfolding in which 'nospec' has been inlined (= erased), and we would lose the benefit. -'nospec' is used in the implementation of 'withDict': we insert 'nospec' -so that the typeclass specialiser doesn't assume any two evidence terms -of the same type are equal. See Note [withDict] in GHC.Tc.Instance.Class, -and see test case T21575b for an example. +'nospec' is used: + +* In the implementation of 'withDict': we insert 'nospec' so that the + typeclass specialiser doesn't assume any two evidence terms of the + same type are equal. See Note [withDict] in GHC.Tc.Instance.Class, + and see test case T21575b for an example. + +* To defeat the specialiser when we have incoherent instances. + See Note [Coherence and specialisation: overview] in GHC.Core.InstEnv. Note [The oneShot function] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |