diff --git a/ghc/compiler/basicTypes/FieldLabel.lhs b/ghc/compiler/basicTypes/FieldLabel.lhs
index 47725c49a0e59be742fa3f382f4b56a8a5342dc8..7e03b31c501187a12c941a7ab565d4017a66f274 100644
--- a/ghc/compiler/basicTypes/FieldLabel.lhs
+++ b/ghc/compiler/basicTypes/FieldLabel.lhs
@@ -14,7 +14,7 @@ import Name		--( Name{-instance Eq/Outputable-}, nameUnique )
 import Type		( SYN_IE(Type) )
 
 import Outputable
-import UniqFM           ( Uniquable(..) )
+import Unique           ( Uniquable(..) )
 \end{code}
 
 \begin{code}
diff --git a/ghc/compiler/basicTypes/Id.lhs b/ghc/compiler/basicTypes/Id.lhs
index 0e4aa066c4aa38d0bd29749efcae5ef9da5abbde..a39e8302d88fc63ac87a43e9f05afa506af6fb65 100644
--- a/ghc/compiler/basicTypes/Id.lhs
+++ b/ghc/compiler/basicTypes/Id.lhs
@@ -203,7 +203,8 @@ import UniqFM
 import UniqSet		-- practically all of it
 import Unique		( getBuiltinUniques, pprUnique, showUnique,
 			  incrUnique, 
-			  Unique{-instance Ord3-}
+			  Unique{-instance Ord3-},
+			  Uniquable(..)
 			)
 import Outputable	( ifPprDebug, Outputable(..), PprStyle(..) )
 import Util	{-	( mapAccumL, nOfThem, zipEqual, assoc,
diff --git a/ghc/compiler/basicTypes/Name.lhs b/ghc/compiler/basicTypes/Name.lhs
index 198fc42c4e9a5a7ba151faa036f3851430abecd9..1750dc7b0a3cf31df3753bda75865c4e58f7332b 100644
--- a/ghc/compiler/basicTypes/Name.lhs
+++ b/ghc/compiler/basicTypes/Name.lhs
@@ -72,10 +72,10 @@ import Pretty
 import Lex		( isLexSym, isLexConId )
 import SrcLoc		( noSrcLoc, SrcLoc )
 import Usage            ( SYN_IE(UVar), SYN_IE(Usage) )
-import Unique		( pprUnique, showUnique, Unique )
+import Unique		( pprUnique, showUnique, Unique, Uniquable(..) )
 import UniqSet		( UniqSet(..), emptyUniqSet, unitUniqSet, unionUniqSets, uniqSetToList, isEmptyUniqSet,
 		 	  unionManyUniqSets, minusUniqSet, mkUniqSet, elementOfUniqSet, addListToUniqSet, addOneToUniqSet )
-import UniqFM		( UniqFM, Uniquable(..) )
+import UniqFM		( UniqFM )
 import Util		--( cmpPString, panic, assertPanic {-, pprTrace ToDo:rm-} )
 
 \end{code}
diff --git a/ghc/compiler/basicTypes/Unique.hi-boot b/ghc/compiler/basicTypes/Unique.hi-boot
index 237ea4a018f5684616977bdab92285272792c36e..22415252dcfdda0921834ec6b1cd19c3ce033538 100644
--- a/ghc/compiler/basicTypes/Unique.hi-boot
+++ b/ghc/compiler/basicTypes/Unique.hi-boot
@@ -1,6 +1,7 @@
 _interface_ Unique 1
 _exports_
-Unique Unique mkUniqueGrimily;
+Unique Unique Uniquable(uniqueOf) mkUniqueGrimily;
 _declarations_
 1 data Unique;
 1 mkUniqueGrimily _:_ GHC.Int# -> Unique.Unique ;;
+1 class Uniquable a where {uniqueOf :: a -> Unique};
diff --git a/ghc/compiler/basicTypes/Unique.lhs b/ghc/compiler/basicTypes/Unique.lhs
index a25498b84eac6ebdd4ed54158e208c8a2859a070..5fa5ad7286532acf7049dd9fa4492b4c90872701 100644
--- a/ghc/compiler/basicTypes/Unique.lhs
+++ b/ghc/compiler/basicTypes/Unique.lhs
@@ -21,7 +21,7 @@ Haskell).
 --<mkdependHS:friends> UniqSupply
 
 module Unique (
-	Unique,
+	Unique, Uniquable(..),
 	u2i,				-- hack: used in UniqFM
 
 	pprUnique, pprUnique10, showUnique,
@@ -236,10 +236,6 @@ import PrelBase ( Char(..) )
 
 IMP_Ubiq(){-uitous-}
 
-#if __GLASGOW_HASKELL__ >= 202
-import {-# SOURCE #-} UniqFM ( Uniquable(..) )
-#endif
-
 import Outputable
 import Pretty
 import Util
@@ -255,9 +251,14 @@ The @Chars@ are ``tag letters'' that identify the @UniqueSupply@.
 Fast comparison is everything on @Uniques@:
 
 \begin{code}
-u2i :: Unique -> FAST_INT
-
 data Unique = MkUnique Int#
+
+class Uniquable a where
+    uniqueOf :: a -> Unique
+\end{code}
+
+\begin{code}
+u2i :: Unique -> FAST_INT
 u2i (MkUnique i) = i
 \end{code}
 
diff --git a/ghc/compiler/codeGen/CgBindery.lhs b/ghc/compiler/codeGen/CgBindery.lhs
index e5916e4df742cdb03a2a1d6b57522a07f5ac062d..37937d06b9c61f573826fb67035623ffd0d63569 100644
--- a/ghc/compiler/codeGen/CgBindery.lhs
+++ b/ghc/compiler/codeGen/CgBindery.lhs
@@ -53,8 +53,7 @@ import Outputable	( PprStyle(..) )
 import Pretty		( Doc )
 import PrimRep          ( PrimRep )
 import StgSyn		( SYN_IE(StgArg), SYN_IE(StgLiveVars), GenStgArg(..) )
-import Unique           ( Unique )
-import UniqFM           ( Uniquable(..) )
+import Unique           ( Unique, Uniquable(..) )
 import Util		( zipWithEqual, panic )
 \end{code}
 
diff --git a/ghc/compiler/codeGen/CgCase.lhs b/ghc/compiler/codeGen/CgCase.lhs
index 1c15b4be431ffa95751953246c4e71d4ed598c13..c6eb9f06f3cbb92b6fa70696cd3915fa57b9d23f 100644
--- a/ghc/compiler/codeGen/CgCase.lhs
+++ b/ghc/compiler/codeGen/CgCase.lhs
@@ -73,8 +73,7 @@ import Type		( typePrimRep,
 			  maybeAppSpecDataTyConExpandingDicts,
 			  SYN_IE(Type)
 			)
-import Unique           ( Unique )
-import UniqFM           ( Uniquable(..) )
+import Unique           ( Unique, Uniquable(..) )
 import Util		( sortLt, isIn, isn'tIn, zipEqual,
 			  pprError, panic, assertPanic
 			)
diff --git a/ghc/compiler/deSugar/DsGRHSs.lhs b/ghc/compiler/deSugar/DsGRHSs.lhs
index 63c41d70a46f5e1996f8588c07ebc18dd1fbe1c5..b22c6fa4131cc5528b90dbe98644615ceb182d58 100644
--- a/ghc/compiler/deSugar/DsGRHSs.lhs
+++ b/ghc/compiler/deSugar/DsGRHSs.lhs
@@ -38,8 +38,7 @@ import PrelVals		( nON_EXHAUSTIVE_GUARDS_ERROR_ID )
 import Outputable	( PprStyle(..) )
 import SrcLoc		( SrcLoc{-instance-} )
 import Type             ( SYN_IE(Type) )
-import Unique		( Unique, otherwiseIdKey )
-import UniqFM           ( Uniquable(..) )
+import Unique		( Unique, otherwiseIdKey, Uniquable(..) )
 import Util		( panic )
 \end{code}
 
diff --git a/ghc/compiler/hsSyn/HsBinds.lhs b/ghc/compiler/hsSyn/HsBinds.lhs
index f28cff83aeba0997c3a410fdd27fc71024980930..c3a8a6db32fd2f9608e5d0d55c06d252083410c8 100644
--- a/ghc/compiler/hsSyn/HsBinds.lhs
+++ b/ghc/compiler/hsSyn/HsBinds.lhs
@@ -196,17 +196,17 @@ ppr_monobind sty (AndMonoBinds binds1 binds2)
       = ($$) (ppr_monobind sty binds1) (ppr_monobind sty binds2)
 
 ppr_monobind sty (PatMonoBind pat grhss_n_binds locn)
-      = hang (ppr sty pat) 4 (pprGRHSsAndBinds sty False grhss_n_binds)
+      = sep [ppr sty pat, nest 4 (pprGRHSsAndBinds sty False grhss_n_binds)]
 
 ppr_monobind sty (FunMonoBind fun inf matches locn)
       = pprMatches sty (False, ppr sty fun) matches
       -- ToDo: print infix if appropriate
 
 ppr_monobind sty (VarMonoBind name expr)
-      = hang (hsep [ppr sty name, equals]) 4 (pprExpr sty expr)
+      = sep [ppr sty name <+> equals, nest 4 (pprExpr sty expr)]
 
 ppr_monobind sty (CoreMonoBind name expr)
-      = hang (hsep [ppr sty name, equals]) 4 (ppr sty expr)
+      = sep [ppr sty name <+> equals, nest 4 (ppr sty expr)]
 
 ppr_monobind sty (AbsBinds tyvars dictvars exports val_binds)
      = ($$) (sep [ptext SLIT("AbsBinds"),
diff --git a/ghc/compiler/hsSyn/HsTypes.lhs b/ghc/compiler/hsSyn/HsTypes.lhs
index b83f4b8fcd4e2fe5bd090f0c5ed961299aab7aba..ba9adf6eae97d45faf6d315d18e1a01d1c68c314 100644
--- a/ghc/compiler/hsSyn/HsTypes.lhs
+++ b/ghc/compiler/hsSyn/HsTypes.lhs
@@ -118,7 +118,7 @@ ppr_forall sty ctxt_prec tvs ctxt ty
 pprContext :: (Outputable name) => PprStyle -> (Context name) -> Doc
 pprContext sty []	        = empty
 pprContext sty context
-  = hsep [braces (hsep (punctuate comma (map ppr_assert context)))]
+  = pprQuote sty $ \ sty -> parens (hsep (punctuate comma (map ppr_assert context)))
   where
     ppr_assert (clas, ty) = hsep [ppr sty clas, ppr sty ty]
 \end{code}
diff --git a/ghc/compiler/nativeGen/MachRegs.lhs b/ghc/compiler/nativeGen/MachRegs.lhs
index a2af7420cea3dd8218171e9bad1e2ba928a68390..13897a85eba58404b4ca2e68a6488ef36609d2d2 100644
--- a/ghc/compiler/nativeGen/MachRegs.lhs
+++ b/ghc/compiler/nativeGen/MachRegs.lhs
@@ -77,10 +77,9 @@ import Stix		( sStLitLbl, StixTree(..), StixReg(..),
 			  CodeSegment
 			)
 import Unique		( mkPseudoUnique1, mkPseudoUnique2, mkPseudoUnique3,
-			  Unique{-instance Ord3-}
+			  Unique{-instance Ord3-}, Uniquable(..)
 			)
 import UniqSupply	( getUnique, returnUs, thenUs, SYN_IE(UniqSM) )
-import UniqFM		( Uniquable(..) )
 import Util		( panic, Ord3(..) )
 \end{code}
 
diff --git a/ghc/compiler/prelude/PrelInfo.lhs b/ghc/compiler/prelude/PrelInfo.lhs
index 37de70cbd691d2319b0933723c94221517553cc7..f28f21827209c9196ae1663a68ae4dbba79cbf11 100644
--- a/ghc/compiler/prelude/PrelInfo.lhs
+++ b/ghc/compiler/prelude/PrelInfo.lhs
@@ -60,7 +60,7 @@ import TyCon		( tyConDataCons, mkFunTyCon, TyCon )
 import Type
 import Bag
 import Unique		-- *Key stuff
-import UniqFM		( UniqFM, listToUFM, Uniquable(..) ) 
+import UniqFM		( UniqFM, listToUFM ) 
 import Util		( isIn )
 \end{code}
 
diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs
index d9265832d730265bb36b1622d994323c58f61ca1..43abb70edc039595aa7360ca5210188320aaed60 100644
--- a/ghc/compiler/rename/RnEnv.lhs
+++ b/ghc/compiler/rename/RnEnv.lhs
@@ -30,8 +30,8 @@ import TyCon		( TyCon )
 import TysWiredIn	( tupleTyCon, listTyCon, charTyCon, intTyCon )
 import FiniteMap
 import Outputable
-import Unique		( Unique, unboundKey )
-import UniqFM           ( Uniquable(..), listToUFM, plusUFM_C )
+import Unique		( Unique, Uniquable(..), unboundKey )
+import UniqFM           ( listToUFM, plusUFM_C )
 import Maybes		( maybeToBool )
 import UniqSupply
 import SrcLoc		( SrcLoc, noSrcLoc )
diff --git a/ghc/compiler/rename/RnExpr.lhs b/ghc/compiler/rename/RnExpr.lhs
index 31dbf24e377e19d58fdc470637ab4ec0902a42e6..ac323aca0589e85aa01fcfc8d41499fd3408d431 100644
--- a/ghc/compiler/rename/RnExpr.lhs
+++ b/ghc/compiler/rename/RnExpr.lhs
@@ -143,17 +143,27 @@ rnPat (RecPatIn con rpats)
 ************************************************************************
 
 \begin{code}
-rnMatch :: RdrNameMatch -> RnMS s (RenamedMatch, FreeVars)
+rnMatch, rnMatch1 :: RdrNameMatch -> RnMS s (RenamedMatch, FreeVars)
 
-rnMatch (PatMatch pat match)
-  = bindLocalsRn "pattern" binders	$ \ new_binders ->
-    rnPat pat				`thenRn` \ pat' ->
-    rnMatch match			`thenRn` \ (match', fvMatch) ->
-    returnRn (PatMatch pat' match', fvMatch `minusNameSet` mkNameSet new_binders)
+-- The only tricky bit here is that we want to do a single
+-- bindLocalsRn for all the matches together, so that we spot
+-- the repeated variable in
+--	f x x = 1
+
+rnMatch match
+  = bindLocalsRn "pattern" (get_binders	match) 	$ \ new_binders ->
+    rnMatch1 match				`thenRn` \ (match', fvs) ->
+    returnRn (match', fvs `minusNameSet` mkNameSet new_binders)
  where
-    binders = collectPatBinders pat
+    get_binders (GRHSMatch _)	     = []
+    get_binders (PatMatch pat match) = collectPatBinders pat ++ get_binders match
+
+rnMatch1 (PatMatch pat match)
+  = rnPat pat				`thenRn` \ pat' ->
+    rnMatch1 match			`thenRn` \ (match', fvs) ->
+    returnRn (PatMatch pat' match', fvs)
 
-rnMatch (GRHSMatch grhss_and_binds)
+rnMatch1 (GRHSMatch grhss_and_binds)
   = rnGRHSsAndBinds grhss_and_binds `thenRn` \ (grhss_and_binds', fvs) ->
     returnRn (GRHSMatch grhss_and_binds', fvs)
 \end{code}
diff --git a/ghc/compiler/rename/RnSource.lhs b/ghc/compiler/rename/RnSource.lhs
index ff3620e1750e6eba005254a0ba3b45eec6ff0fcd..a40921fb38cca489e74ef26b4713ab73502199f4 100644
--- a/ghc/compiler/rename/RnSource.lhs
+++ b/ghc/compiler/rename/RnSource.lhs
@@ -51,7 +51,7 @@ import PrelInfo		( derivingOccurrences, evalClass_RDR, numClass_RDR, allClass_NA
 import ListSetOps	( unionLists, minusList )
 import Maybes		( maybeToBool, catMaybes )
 import Bag		( emptyBag, unitBag, consBag, unionManyBags, unionBags, listToBag, bagToList )
-import Outputable	( PprStyle(..), Outputable(..){-instances-} )
+import Outputable	( PprStyle(..), Outputable(..){-instances-}, pprQuote )
 import Pretty
 import SrcLoc		( SrcLoc )
 import Unique		( Unique )
@@ -705,17 +705,17 @@ classTyVarNotInOpTyErr clas_tyvar sig sty
 		       ptext SLIT("does not appear in method signature")])
 	 4 (ppr sty sig)
 
-dupClassAssertWarn ctxt dups sty
-  = hang (hcat [ptext SLIT("Duplicate class assertion `"), 
-		       ppr sty dups, 
-		       ptext SLIT("' in context:")])
-	 4 (ppr sty ctxt)
+dupClassAssertWarn ctxt ((clas,ty) : dups) sty
+  = hang (hcat [ptext SLIT("Duplicated class assertion"), 
+		       pprQuote sty $ \ sty -> ppr sty clas <+> ppr sty ty,
+		       ptext SLIT("in context:")])
+	 4 (pprContext sty ctxt)
 
 badDataCon name sty
-   = hsep [ptext SLIT("Illegal data constructor name:"), ppr sty name]
+   = hsep [ptext SLIT("Illegal data constructor name"), ppr sty name]
 
 allOfNonTyVar ty sty
-  = hsep [ptext SLIT("`All' applied to a non-type variable:"), ppr sty ty]
+  = hsep [ptext SLIT("`All' applied to a non-type variable"), ppr sty ty]
 
 ctxtErr1 doc tyvars sty
   = hsep [ptext SLIT("Context constrains in-scope type variable(s)"), 
diff --git a/ghc/compiler/simplCore/SimplCore.lhs b/ghc/compiler/simplCore/SimplCore.lhs
index c96b21d78c7a50b2d212e6249743394c9628db4f..62d6eb82078bf80c5ed2e5bd5c979edecd0b4777 100644
--- a/ghc/compiler/simplCore/SimplCore.lhs
+++ b/ghc/compiler/simplCore/SimplCore.lhs
@@ -64,8 +64,7 @@ import Specialise
 import SpecUtils	( pprSpecErrs )
 import StrictAnal	( saWwTopBinds )
 import TyVar		( nullTyVarEnv, GenTyVar{-instance Eq-} )
-import Unique		( integerTyConKey, ratioTyConKey, Unique{-instance Eq-} )
-import UniqFM           ( Uniquable(..) )
+import Unique		( integerTyConKey, ratioTyConKey, Unique{-instance Eq-}, Uniquable(..) )
 import UniqSupply	( splitUniqSupply, getUnique, UniqSupply )
 import Util		( mapAccumL, assertPanic, panic{-ToDo:rm-}, pprTrace, pprPanic )
 import SrcLoc		( noSrcLoc )
diff --git a/ghc/compiler/simplCore/SimplEnv.lhs b/ghc/compiler/simplCore/SimplEnv.lhs
index 3775477cc29ada22b604926996c5553ec6698e4b..52d8a97a704bbe31bc976a826bfdc4cb730d7b0a 100644
--- a/ghc/compiler/simplCore/SimplEnv.lhs
+++ b/ghc/compiler/simplCore/SimplEnv.lhs
@@ -83,9 +83,8 @@ import TyVar		( nullTyVarEnv, addOneToTyVarEnv, growTyVarEnvList,
 			  SYN_IE(TyVarEnv), GenTyVar{-instance Eq-} ,
 			  SYN_IE(TyVar)
 			)
-import Unique		( Unique{-instance Outputable-} )
-import UniqFM		( addToUFM_C, ufmToList, Uniquable(..)
-			)
+import Unique		( Unique{-instance Outputable-}, Uniquable(..) )
+import UniqFM		( addToUFM_C, ufmToList	)
 import Usage		( SYN_IE(UVar), GenUsage{-instances-} )
 import Util		( SYN_IE(Eager), appEager, returnEager, runEager,
 			  zipEqual, thenCmp, cmpList, panic, panic#, assertPanic, Ord3(..) )
diff --git a/ghc/compiler/typecheck/TcClassDcl.lhs b/ghc/compiler/typecheck/TcClassDcl.lhs
index 0b577afd843597310cc2be8796884882e090bbe8..5eecebbc3da29932d92981f2c081693c3d8df1d3 100644
--- a/ghc/compiler/typecheck/TcClassDcl.lhs
+++ b/ghc/compiler/typecheck/TcClassDcl.lhs
@@ -61,8 +61,7 @@ import Type		( mkFunTy, mkTyVarTy, mkTyVarTys, mkDictTy,
 			)
 import TysWiredIn	( stringTy )
 import TyVar		( unitTyVarSet, GenTyVar, SYN_IE(TyVar) )
-import Unique		( Unique )
-import UniqFM		( Uniquable(..) )
+import Unique		( Unique, Uniquable(..) )
 import Util
 
 
diff --git a/ghc/compiler/typecheck/TcEnv.lhs b/ghc/compiler/typecheck/TcEnv.lhs
index 3327ece393a25b327b615a0f614cd1e63359f786..4b45f0a538406d0562b34cdbc5e390894882fa83 100644
--- a/ghc/compiler/typecheck/TcEnv.lhs
+++ b/ghc/compiler/typecheck/TcEnv.lhs
@@ -52,7 +52,7 @@ import Name		( Name, OccName(..), getSrcLoc, occNameString,
 			  NamedThing(..)
 			)
 import Pretty
-import Unique		( pprUnique10{-, pprUnique ToDo:rm-}, Unique )
+import Unique		( pprUnique10{-, pprUnique ToDo:rm-}, Unique, Uniquable(..) )
 import UniqFM	     
 import Util		( zipEqual, zipWithEqual, zipWith3Equal, zipLazy,
 			  panic, pprPanic, pprTrace
diff --git a/ghc/compiler/typecheck/TcInstDcls.lhs b/ghc/compiler/typecheck/TcInstDcls.lhs
index 8d988abc2ef71e0b5865423e3c2d001cb56bca7e..45ed9134bf65a624680a8b9dfff5540ff783bb73 100644
--- a/ghc/compiler/typecheck/TcInstDcls.lhs
+++ b/ghc/compiler/typecheck/TcInstDcls.lhs
@@ -86,16 +86,15 @@ import Pretty
 import TyCon		( isSynTyCon, isDataTyCon, derivedClasses )
 import Type		( GenType(..), SYN_IE(ThetaType), mkTyVarTys, isPrimType,
 			  splitSigmaTy, splitAppTys, isTyVarTy, matchTy, mkSigmaTy,
-			  getTyCon_maybe, maybeAppTyCon, SYN_IE(Type),
+			  getTyCon_maybe, maybeAppTyCon, SYN_IE(Type), getTyVar,
 			  maybeBoxedPrimType, maybeAppDataTyCon, splitRhoTy, eqTy
 			)
 import TyVar		( GenTyVar, SYN_IE(GenTyVarSet), tyVarSetToList, 
 		          mkTyVarSet, unionTyVarSets, SYN_IE(TyVar) )
 import TysPrim		( byteArrayPrimTyCon, mutableByteArrayPrimTyCon )
 import TysWiredIn	( stringTy )
-import Unique		( Unique, cCallableClassKey, cReturnableClassKey )
-import UniqFM           ( Uniquable(..) )
-import Util		( zipEqual, panic, pprPanic, pprTrace
+import Unique		( Unique, cCallableClassKey, cReturnableClassKey, Uniquable(..) )
+import Util		( zipEqual, panic, pprPanic, pprTrace, removeDups, Ord3(..),
 #if __GLASGOW_HASKELL__ < 202
 		          , trace 
 #endif
@@ -665,8 +664,9 @@ scrutiniseInstanceType dfun_name clas inst_tau
   = returnTc (inst_tycon,arg_tys)
 
 	-- TYVARS CHECK
-  | not (all isTyVarTy arg_tys ||
-	 opt_GlasgowExts)
+  | not (opt_GlasgowExts ||
+	 (all isTyVarTy arg_tys && null tyvar_dups)
+    )
   = failTc (instTypeErr inst_tau)
 
   	-- DERIVING CHECK
@@ -692,6 +692,7 @@ scrutiniseInstanceType dfun_name clas inst_tau
     (possible_tycon, arg_tys) = splitAppTys inst_tau
     inst_tycon_maybe	      = getTyCon_maybe possible_tycon
     inst_tycon 		      = expectJust "tcInstDecls1:inst_tycon" inst_tycon_maybe
+    (_, tyvar_dups)	      = removeDups cmp (map (getTyVar "tcInstDecls1:getTyVarTy") arg_tys)
 
 -- These conditions come directly from what the DsCCall is capable of.
 -- Totally grotesque.  Green card should solve this.
@@ -727,11 +728,11 @@ creturnable_type ty = maybeToBool (maybeBoxedPrimType ty) ||
 
 instTypeErr ty sty
   = case ty of
-      SynTy tc _ _ -> hcat [ptext SLIT("The type synonym `"), ppr sty tc, rest_of_msg]
-      TyVarTy tv   -> hcat [ptext SLIT("The type variable `"), ppr sty tv, rest_of_msg]
-      other	   -> hcat [ptext SLIT("The type `"), ppr sty ty, rest_of_msg]
+      SynTy tc _ _ -> hsep [ptext SLIT("The type synonym"), ppr sty tc, rest_of_msg]
+      TyVarTy tv   -> hsep [ptext SLIT("The type variable"), ppr sty tv, rest_of_msg]
+      other	   -> hsep [ptext SLIT("The type"), ppr sty ty, rest_of_msg]
   where
-    rest_of_msg = ptext SLIT("' cannot be used as an instance type.")
+    rest_of_msg = ptext SLIT("cannot be used as an instance type")
 
 instBndrErr bndr clas sty
   = hsep [ptext SLIT("Class"), ppr sty clas, ptext SLIT("does not have a method"), ppr sty bndr]
diff --git a/ghc/compiler/typecheck/TcMonoType.lhs b/ghc/compiler/typecheck/TcMonoType.lhs
index 0f2ad8429aef6463d33136a5c6c5c8a3663b284a..d2cd24fb18eafdde7b91d2950b2a7ae715536869 100644
--- a/ghc/compiler/typecheck/TcMonoType.lhs
+++ b/ghc/compiler/typecheck/TcMonoType.lhs
@@ -29,9 +29,8 @@ import PrelInfo		( cCallishClassKeys )
 import TyCon		( TyCon )
 import Name		( Name, OccName, isTvOcc, getOccName )
 import TysWiredIn	( mkListTy, mkTupleTy )
-import Unique		( Unique )
+import Unique		( Unique, Uniquable(..) )
 import Pretty
-import UniqFM           ( Uniquable(..) )
 import Util		( zipWithEqual, zipLazy, panic{-, pprPanic ToDo:rm-} )
 
 
diff --git a/ghc/compiler/typecheck/TcPat.lhs b/ghc/compiler/typecheck/TcPat.lhs
index 4b2241cd82a136ab92d95d863cd1768904f1e112..021ce0dc9df1d1384ab4a9a3502a24d421423f19 100644
--- a/ghc/compiler/typecheck/TcPat.lhs
+++ b/ghc/compiler/typecheck/TcPat.lhs
@@ -64,7 +64,7 @@ tcPat :: RenamedPat -> TcM s (TcPat s, LIE s, TcType s)
 
 \begin{code}
 tcPat (VarPatIn name)
-  = tcLookupLocalValueOK ("tcPat1:"{-++show (ppr PprDebug name)-}) name	`thenNF_Tc` \ id ->
+  = tcLookupLocalValueOK "tcPat1:" name		`thenNF_Tc` \ id ->
     returnTc (VarPat (TcId id), emptyLIE, idType id)
 
 tcPat (LazyPatIn pat)
diff --git a/ghc/compiler/typecheck/TcTyClsDecls.lhs b/ghc/compiler/typecheck/TcTyClsDecls.lhs
index bd06cd587c435bfed8206968ee699830a3ff6985..22eaf9e8cd669e8b074b017a2c4785bb020ecb9b 100644
--- a/ghc/compiler/typecheck/TcTyClsDecls.lhs
+++ b/ghc/compiler/typecheck/TcTyClsDecls.lhs
@@ -42,8 +42,7 @@ import UniqSet		( SYN_IE(UniqSet), emptyUniqSet,
 			  unionManyUniqSets, uniqSetToList ) 
 import SrcLoc		( SrcLoc )
 import TyCon		( TyCon, SYN_IE(Arity) )
-import Unique		( Unique )
-import UniqFM           ( Uniquable(..) )
+import Unique		( Unique, Uniquable(..) )
 import Util		( panic{-, pprTrace-} )
 
 \end{code}
diff --git a/ghc/compiler/types/Class.lhs b/ghc/compiler/types/Class.lhs
index 16496e0a0a476e44706735e8e930adfd522e8e0c..945a1d54a86b7d75cb910d69841e2236a214b9c4 100644
--- a/ghc/compiler/types/Class.lhs
+++ b/ghc/compiler/types/Class.lhs
@@ -48,7 +48,6 @@ import Maybes		( assocMaybe )
 import Name		( changeUnique, Name, OccName, occNameString )
 import Outputable
 import Unique		-- Keys for built-in classes
-import UniqFM           ( Uniquable(..) )
 import Pretty		( Doc, hsep, ptext )
 import SrcLoc		( SrcLoc )
 import Util
diff --git a/ghc/compiler/types/PprType.lhs b/ghc/compiler/types/PprType.lhs
index 6a2f82754548407da583e7894aedc93625e8d593..1cf7336574925e9e4ab4665e7e108a84108c0dc2 100644
--- a/ghc/compiler/types/PprType.lhs
+++ b/ghc/compiler/types/PprType.lhs
@@ -54,9 +54,8 @@ import Outputable	( PprStyle(..), codeStyle, userStyle, ifaceStyle,
 			  ifPprShowAll, interpp'SP, Outputable(..) )
 import PprEnv
 import Pretty
-import UniqFM		( addToUFM_Directly, lookupUFM_Directly{-, ufmToList ToDo:rm-},
-			  Uniquable(..) )
-import Unique	--TEMP:	( pprUnique10, pprUnique, incrUnique, listTyConKey )
+import UniqFM		( addToUFM_Directly, lookupUFM_Directly )
+import Unique		( Uniquable(..), pprUnique10, pprUnique, incrUnique, listTyConKey )
 import Util
 \end{code}
 
diff --git a/ghc/compiler/types/TyCon.lhs b/ghc/compiler/types/TyCon.lhs
index 0608ba553c25b319553ce0f924d26fce1f0a1cec..ada7c8d4b362d990b6ea8ce1584b9cb5d10ca7a9 100644
--- a/ghc/compiler/types/TyCon.lhs
+++ b/ghc/compiler/types/TyCon.lhs
@@ -49,10 +49,9 @@ IMPORT_DELOOPER(TyLoop) ( SYN_IE(Type), GenType,
 			  --LATER: specMaybeTysSuffix
 			)
 #else
-import {-# SOURCE #-} Type  ( Type  )
+import {-# SOURCE #-} Type  ( Type, splitSigmaTy, splitFunTy  )
 import {-# SOURCE #-} Class ( Class )
 import {-# SOURCE #-} Id    ( Id, isNullaryDataCon, idType )
-import {-# SOURCE #-} Type  ( splitSigmaTy, splitFunTy  )
 import {-# SOURCE #-} TysWiredIn ( tupleCon )
 #endif
 
@@ -63,8 +62,7 @@ import Kind		( Kind, mkBoxedTypeKind, mkArrowKind, resultKind, argKind )
 
 import Maybes
 import Name		( Name, nameUnique, mkWiredInTyConName, NamedThing(getName) )
-import Unique		( Unique, funTyConKey )
-import UniqFM           ( Uniquable(..) )
+import Unique		( Unique, funTyConKey, Uniquable(..) )
 import Pretty		( Doc )
 import PrimRep		( PrimRep(..) )
 import PrelMods		( gHC__, pREL_TUP, pREL_BASE )
diff --git a/ghc/compiler/types/TyVar.lhs b/ghc/compiler/types/TyVar.lhs
index 0fdfc32b9749db1a29f80ba133b34019019b301c..8db508b3381bb0c8e05ae76a80a6b9813a398858 100644
--- a/ghc/compiler/types/TyVar.lhs
+++ b/ghc/compiler/types/TyVar.lhs
@@ -38,8 +38,7 @@ import Name		( mkSysLocalName, changeUnique, Name, NamedThing(..) )
 import Pretty		( Doc, (<>), ptext )
 import Outputable	( PprStyle(..), Outputable(..) )
 import SrcLoc		( noSrcLoc, SrcLoc )
-import Unique		( showUnique, mkAlphaTyVarUnique, Unique )
-import UniqFM           ( Uniquable(..) )
+import Unique		( showUnique, mkAlphaTyVarUnique, Unique, Uniquable(..) )
 import Util		( panic, Ord3(..) )
 \end{code}
 
diff --git a/ghc/compiler/types/Type.lhs b/ghc/compiler/types/Type.lhs
index 294f4235cd6ecb2805e5daea288f21666a78deb7..da4941a7bee2d3b45880780c63a0da4257516c91 100644
--- a/ghc/compiler/types/Type.lhs
+++ b/ghc/compiler/types/Type.lhs
@@ -74,7 +74,6 @@ import Name	( NamedThing(..),
 import Maybes	( maybeToBool, assocMaybe )
 import PrimRep	( PrimRep(..) )
 import Unique	-- quite a few *Keys
-import UniqFM   ( Uniquable(..) )
 import Util	( thenCmp, zipEqual, assoc,
 		  panic, panic#, assertPanic, pprPanic,
 		  Ord3(..){-instances-}
diff --git a/ghc/compiler/utils/FastString.lhs b/ghc/compiler/utils/FastString.lhs
index 463cc79ee3e39b13da501223bc399a3277e233f9..e55979c38cc250501859da78bdb35526c39e5f07 100644
--- a/ghc/compiler/utils/FastString.lhs
+++ b/ghc/compiler/utils/FastString.lhs
@@ -53,8 +53,7 @@ import IOBase
 import IOHandle
 import ST
 import STBase
-import {-# SOURCE #-} Unique  ( mkUniqueGrimily, Unique )
-import {-# SOURCE #-} UniqFM  ( Uniquable(..) )
+import {-# SOURCE #-} Unique  ( mkUniqueGrimily, Unique, Uniquable(..) )
 #if __GLASGOW_HASKELL__ == 202
 import PrelBase ( Char (..) )
 #endif
diff --git a/ghc/compiler/utils/Pretty.lhs b/ghc/compiler/utils/Pretty.lhs
index c8aef7de7936d17325ec35d2d401c318e264b583..54abced398ad03b6fcb27d04d3830612d4b1e90b 100644
--- a/ghc/compiler/utils/Pretty.lhs
+++ b/ghc/compiler/utils/Pretty.lhs
@@ -418,7 +418,7 @@ hcat = foldr (<>)  empty
 hsep = foldr (<+>) empty
 vcat = foldr ($$)  empty
 
-hang d1 n d2 = d1 $$ (nest n d2)
+hang d1 n d2 = sep [d1, nest n d2]
 
 punctuate p []     = []
 punctuate p (d:ds) = go d ds
diff --git a/ghc/compiler/utils/Ubiq.lhi b/ghc/compiler/utils/Ubiq.lhi
index 4f6d3c65c055e55cc3e782805fad732ac34d87d4..c02b80672e5e5f35cd1576a48bb4526afb51e82a 100644
--- a/ghc/compiler/utils/Ubiq.lhi
+++ b/ghc/compiler/utils/Ubiq.lhi
@@ -3,7 +3,6 @@ Things which are ubiquitous in the GHC compiler.
 \begin{code}
 interface Ubiq where
 
---import PreludePS(_PackedString)
 import FastString(FastString)
 
 import BasicTypes	( Module(..), Arity(..) )
diff --git a/ghc/compiler/utils/UniqFM.lhs b/ghc/compiler/utils/UniqFM.lhs
index 1cd56ffbed378c422f695b7f379e7762fb7e67d1..12de7a5baeeb736902aef860e25f6129d7873328 100644
--- a/ghc/compiler/utils/UniqFM.lhs
+++ b/ghc/compiler/utils/UniqFM.lhs
@@ -21,7 +21,6 @@ Basically, the things need to be in class @Uniquable@, and we use the
 
 module UniqFM (
 	UniqFM,   -- abstract type
-	Uniquable(..), -- class to go with it
 
 	emptyUFM,
 	unitUFM,
@@ -64,7 +63,7 @@ import {-# SOURCE #-} Name
 # endif
 #endif
 
-import Unique		( Unique, u2i, mkUniqueGrimily )
+import Unique		( Uniquable(..), Unique, u2i, mkUniqueGrimily )
 import Util
 import Pretty		( Doc )
 import Outputable	( PprStyle, Outputable(..) )
@@ -207,9 +206,6 @@ data UniqFM ele
 	    (UniqFM ele)
 	    (UniqFM ele)
 
-class Uniquable a where
-    uniqueOf :: a -> Unique
-
 -- for debugging only :-)
 {-
 instance Text (UniqFM a) where
diff --git a/ghc/compiler/utils/UniqSet.lhs b/ghc/compiler/utils/UniqSet.lhs
index 8772f2c02279d64a33ba83d95eba35295a41b63a..2f53d068bc221353e6b2a867bd28161c58f35390 100644
--- a/ghc/compiler/utils/UniqSet.lhs
+++ b/ghc/compiler/utils/UniqSet.lhs
@@ -28,7 +28,7 @@ import {-# SOURCE #-} Name
 
 import Maybes		( maybeToBool )
 import UniqFM
-import Unique		( Unique )
+import Unique		( Unique, Uniquable(..) )
 import SrcLoc		( SrcLoc )
 import Outputable	( PprStyle, Outputable(..) )
 import Pretty		( Doc )