[commit: ghc] master: Fix comment in TcType (d85606d)

git at git.haskell.org git at git.haskell.org
Thu Oct 25 13:31:13 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d85606d6dcc439a5d3e32da920cf605c13ce0781/ghc

>---------------------------------------------------------------

commit d85606d6dcc439a5d3e32da920cf605c13ce0781
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Oct 25 14:30:40 2018 +0100

    Fix comment in TcType


>---------------------------------------------------------------

d85606d6dcc439a5d3e32da920cf605c13ce0781
 compiler/typecheck/TcType.hs | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index 3202636..5bbaa0f 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -891,28 +891,13 @@ Note [Silly type synonym]
 Consider
   type T a = Int
 What are the free tyvars of (T x)?  Empty, of course!
-Here's the example that Ralf Laemmel showed me:
-  foo :: (forall a. C u a -> C u a) -> u
-  mappend :: Monoid u => u -> u -> u
-
-  bar :: Monoid u => u
-  bar = foo (\t -> t `mappend` t)
-We have to generalise at the arg to f, and we don't
-want to capture the constraint (Monad (C u a)) because
-it appears to mention a.  Pretty silly, but it was useful to him.
 
 exactTyCoVarsOfType is used by the type checker to figure out exactly
-which type variables are mentioned in a type.  It's also used in the
-smart-app checking code --- see TcExpr.tcIdApp
-
-On the other hand, consider a *top-level* definition
-  f = (\x -> x) :: T a -> T a
-If we don't abstract over 'a' it'll get fixed to GHC.Prim.Any, and then
-if we have an application like (f "x") we get a confusing error message
-involving Any.  So the conclusion is this: when generalising
-  - at top level use tyCoVarsOfType
-  - in nested bindings use exactTyCoVarsOfType
-See Trac #1813 for example.
+which type variables are mentioned in a type.  It only matters
+occasionally -- see the calls to exactTyCoVarsOfType.
+
+Historical note: years and years ago this function was used during
+generalisation -- see Trac #1813.  But that code has long since died.
 -}
 
 exactTyCoVarsOfType :: Type -> TyCoVarSet



More information about the ghc-commits mailing list