Commit a8c9f7fc authored by Simon Peyton Jones's avatar Simon Peyton Jones

Comments and pretty printing

parent 63efe355
......@@ -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 )
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment