Improve depth-cutoff for printing HsSyn in error messages
[ghc-hetmet.git] / compiler / hsSyn / HsDecls.lhs
index 2b97668..b1c64ef 100644 (file)
@@ -18,7 +18,7 @@ module HsDecls (
        ForeignDecl(..), LForeignDecl, ForeignImport(..), ForeignExport(..),
        CImportSpec(..), FoType(..),
        ConDecl(..), ResType(..), LConDecl,     
-       DocDecl(..), LDocDecl, docDeclDoc, DocEntity(..),
+       DocDecl(..), LDocDecl, docDeclDoc,
        DeprecDecl(..),  LDeprecDecl,
        HsGroup(..),  emptyRdrGroup, emptyRnGroup, appendGroups,
        tcdName, tyClDeclNames, tyClDeclTyVars,
@@ -111,9 +111,7 @@ data HsGroup id
        hs_depds  :: [LDeprecDecl id],
        hs_ruleds :: [LRuleDecl id],
 
-       hs_docs   :: [DocEntity id]
-                -- Used to remember the module structure,
-                -- which is needed to produce Haddock documentation
+       hs_docs   :: [LDocDecl id]
   }
 
 emptyGroup, emptyRdrGroup, emptyRnGroup :: HsGroup a
@@ -375,12 +373,16 @@ data TyClDecl name
                tcdFoType   :: FoType
     }
 
+       -- type/data/newtype family T :: *->*
   | TyFamily {  tcdFlavour:: FamilyFlavour,            -- type, new, or data
                tcdLName  :: Located name,              -- type constructor
                tcdTyVars :: [LHsTyVarBndr name],       -- type variables
                tcdKind   :: Maybe Kind                 -- result kind
     }
 
+       -- Declares a data type or newtype, giving its construcors
+       --      data/newtype T a = <constrs>
+       --      data/newtype instance T [a] = <constrs>
   | TyData {   tcdND     :: NewOrData,
                tcdCtxt   :: LHsContext name,           -- Context
                tcdLName  :: Located name,              -- Type constructor
@@ -408,9 +410,6 @@ data TyClDecl name
                        -- Typically the foralls and ty args are empty, but they
                        -- are non-empty for the newtype-deriving case
     }
-       -- data instance: tcdPats = Just tys
-       --
-       -- data:          tcdPats = Nothing, 
 
   | TySynonym {        tcdLName  :: Located name,              -- type constructor
                tcdTyVars :: [LHsTyVarBndr name],       -- type variables
@@ -431,7 +430,7 @@ data TyClDecl name
                                                        --   only 'TyData',
                                                        --   'TyFunction',
                                                        --   and 'TySynonym'
-               tcdDocs    :: [DocEntity name]          -- Haddock docs
+               tcdDocs    :: [LDocDecl name]           -- Haddock docs
     }
 
 data NewOrData
@@ -935,11 +934,6 @@ instance OutputableBndr name => Outputable (RuleBndr name) where
 
 \begin{code}
 
--- source code entities, for representing the module structure
-data DocEntity name
-  = DeclEntity name
-  | DocEntity (DocDecl name)
 type LDocDecl name = Located (DocDecl name)
 
 data DocDecl name