Trim unused imports detected by new unused-import code
[ghc-hetmet.git] / compiler / typecheck / TcTyClsDecls.lhs
index f0619d8..738d36f 100644 (file)
@@ -13,7 +13,6 @@ module TcTyClsDecls (
 #include "HsVersions.h"
 
 import HsSyn
-import HsTypes
 import HscTypes
 import BuildTyCl
 import TcUnify
@@ -36,7 +35,6 @@ import IdInfo
 import Var
 import VarSet
 import Name
-import OccName
 import Outputable
 import Maybes
 import Monad
@@ -52,7 +50,6 @@ import BasicTypes
 
 import Bag
 import Data.List
-import Control.Monad    ( mplus )
 \end{code}
 
 
@@ -590,7 +587,8 @@ kcDataDecl decl@(TyData {tcdND = new_or_data, tcdCtxt = ctxt, tcdCons = cons})
        ; return (decl {tcdTyVars = tvs, tcdCtxt = ctxt', tcdCons = cons'}) }
   where
     -- doc comments are typechecked to Nothing here
-    kc_con_decl (ConDecl name expl ex_tvs ex_ctxt details res _) 
+    kc_con_decl con_decl@(ConDecl { con_name = name, con_qvars = ex_tvs
+                                  , con_cxt = ex_ctxt, con_details = details, con_res = res })
       = addErrCtxt (dataConCtxt name)  $ 
         kcHsTyVars ex_tvs $ \ex_tvs' -> do
         do { ex_ctxt' <- kcHsContext ex_ctxt
@@ -598,7 +596,8 @@ kcDataDecl decl@(TyData {tcdND = new_or_data, tcdCtxt = ctxt, tcdCons = cons})
            ; res'     <- case res of
                 ResTyH98 -> return ResTyH98
                 ResTyGADT ty -> do { ty' <- kcHsSigType ty; return (ResTyGADT ty') }
-           ; return (ConDecl name expl ex_tvs' ex_ctxt' details' res' Nothing) }
+           ; return (con_decl { con_qvars = ex_tvs', con_cxt = ex_ctxt'
+                              , con_details = details', con_res = res' }) }
 
     kc_con_details (PrefixCon btys) 
        = do { btys' <- mapM kc_larg_ty btys 
@@ -691,9 +690,6 @@ tcTyClDecl1 _calc_isrec
   ; idx_tys <- doptM Opt_TypeFamilies
   ; checkTc idx_tys $ badFamInstDecl tc_name
 
-        -- Check for no type indices
-  ; checkTc (not (null tvs)) (noIndexTypes tc_name)
-
   ; tycon <- buildSynTyCon tc_name tvs' (OpenSynTyCon kind Nothing) kind Nothing
   ; return [ATyCon tycon]
   }
@@ -712,9 +708,6 @@ tcTyClDecl1 _calc_isrec
   ; idx_tys <- doptM Opt_TypeFamilies
   ; checkTc idx_tys $ badFamInstDecl tc_name
 
-        -- Check for no type indices
-  ; checkTc (not (null tvs)) (noIndexTypes tc_name)
-
   ; tycon <- buildAlgTyCon tc_name final_tvs [] 
               mkOpenDataTyConRhs Recursive False True Nothing
   ; return [ATyCon tycon]
@@ -829,7 +822,8 @@ tcConDecl :: Bool           -- True <=> -funbox-strict_fields
          -> TcM DataCon
 
 tcConDecl unbox_strict existential_ok rep_tycon res_tmpl       -- Data types
-         (ConDecl name _ tvs ctxt details res_ty _)
+         (ConDecl {con_name =name, con_qvars = tvs, con_cxt = ctxt
+                   , con_details = details, con_res = res_ty })
   = addErrCtxt (dataConCtxt name)      $ 
     tcTyVarBndrs tvs                   $ \ tvs' -> do 
     { ctxt' <- tcHsKindedContext ctxt
@@ -1497,11 +1491,6 @@ badSigTyDecl tc_name
           quotes (ppr tc_name)
         , nest 2 (parens $ ptext (sLit "Use -XKindSignatures to allow kind signatures")) ]
 
-noIndexTypes :: Name -> SDoc
-noIndexTypes tc_name
-  = ptext (sLit "Type family constructor") <+> quotes (ppr tc_name)
-    <+> ptext (sLit "must have at least one type index parameter")
-
 badFamInstDecl :: Outputable a => a -> SDoc
 badFamInstDecl tc_name
   = vcat [ ptext (sLit "Illegal family instance for") <+>