Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a8c9f7fc130944a96f6c25b3fb1ff8a881662af0

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

commit a8c9f7fc130944a96f6c25b3fb1ff8a881662af0
Author: Simon Peyton Jones <[email protected]>
Date:   Tue Jul 10 15:48:03 2012 +0100

    Comments and pretty printing

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

 compiler/hsSyn/HsDecls.lhs |    9 ++++++++-
 compiler/hsSyn/HsTypes.lhs |    7 +++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/compiler/hsSyn/HsDecls.lhs b/compiler/hsSyn/HsDecls.lhs
index 2d8df43..3908980 100644
--- a/compiler/hsSyn/HsDecls.lhs
+++ b/compiler/hsSyn/HsDecls.lhs
@@ -435,7 +435,13 @@ data TyClDecl name
 
   | -- | @type/data declaration
     TyDecl { tcdLName  :: Located name            -- ^ Type constructor
-           , tcdTyVars :: LHsTyVarBndrs name
+           , tcdTyVars :: LHsTyVarBndrs name      -- ^ Type variables; for an 
assoicated type
+                                                  --   these include outer 
binders
+                                                  -- Eg  class T a where
+                                                  --       type F a :: *
+                                                  --       type F a = a -> a
+                                                  -- Here the type decl for 
'f' includes 'a' 
+                                                  -- in its tcdTyVars
            , tcdTyDefn :: HsTyDefn name
            , tcdFVs    :: NameSet }
 
@@ -811,6 +817,7 @@ data FamInstDecl name
   = FamInstDecl
        { fid_tycon :: Located name
        , fid_pats  :: HsWithBndrs [LHsType name]  -- ^ Type patterns (with 
kind and type bndrs)
+                                                  -- See Note [Family instance 
declaration binders]
        , fid_defn  :: HsTyDefn name               -- Type or data family 
instance
        , fid_fvs   :: NameSet  } 
   deriving( Typeable, Data )
diff --git a/compiler/hsSyn/HsTypes.lhs b/compiler/hsSyn/HsTypes.lhs
index a57c48a..ffcc3ba 100644
--- a/compiler/hsSyn/HsTypes.lhs
+++ b/compiler/hsSyn/HsTypes.lhs
@@ -140,7 +140,9 @@ data LHsTyVarBndrs name
 mkHsQTvs :: [LHsTyVarBndr RdrName] -> LHsTyVarBndrs RdrName
 -- Just at RdrName because in the Name variant we should know just
 -- what the kind-variable binders are; and we don't
-mkHsQTvs tvs = HsQTvs { hsq_kvs = panic "mkHsQTvs", hsq_tvs = tvs }
+-- We put an empty list (rather than a panic) for the kind vars so 
+-- that the pretty printer works ok on them.
+mkHsQTvs tvs = HsQTvs { hsq_kvs = [], hsq_tvs = tvs }
 
 emptyHsQTvs :: LHsTyVarBndrs name   -- Use only when you know there are no 
kind binders
 emptyHsQTvs =  HsQTvs { hsq_kvs = [], hsq_tvs = [] }
@@ -521,7 +523,8 @@ instance Outputable HsTyLit where
     ppr = ppr_tylit
 
 instance (OutputableBndr name) => Outputable (LHsTyVarBndrs name) where
-    ppr qtvs = interppSP (hsQTvBndrs qtvs)
+    ppr (HsQTvs { hsq_kvs = kvs, hsq_tvs = tvs }) 
+      = sep [ ifPprDebug $ braces (interppSP kvs), interppSP tvs ]
 
 instance (OutputableBndr name) => Outputable (HsTyVarBndr name) where
     ppr (UserTyVar name)        = ppr name



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to