X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcClassDcl.lhs;h=67f2945464d1eb9ce11303ba63a2a4952fba18fc;hb=7e76baf009923981e5c277afd4bc8b14913dbf04;hp=87c18414ea3abc400c29e68c13d0be6b2d49c845;hpb=e07e74e5a074490d25443aeff4db4f1f299040c4;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcClassDcl.lhs b/compiler/typecheck/TcClassDcl.lhs index 87c1841..67f2945 100644 --- a/compiler/typecheck/TcClassDcl.lhs +++ b/compiler/typecheck/TcClassDcl.lhs @@ -425,7 +425,7 @@ mkMethId origin clas sel_id inst_tys rho_ty = ASSERT( length tyvars == length inst_tys ) substTyWith tyvars inst_tys rho (preds,tau) = tcSplitPhiTy rho_ty - first_pred = head preds + first_pred = ASSERT( not (null preds)) head preds in -- The first predicate should be of form (C a b) -- where C is the class in question @@ -452,8 +452,7 @@ mkMethId origin clas sel_id inst_tys getSrcSpanM `thenM` \ loc -> let real_tau = mkPhiTy (tail preds) tau - meth_id = mkUserLocal (getOccName sel_id) uniq real_tau - (srcSpanStart loc) --TODO + meth_id = mkUserLocal (getOccName sel_id) uniq real_tau loc in returnM (Nothing, meth_id) @@ -529,7 +528,7 @@ mkDefMethRhs origin clas inst_tys sel_id loc GenDefMeth -- case we require that the instance decl is for a single-parameter -- type class with type variable arguments: -- instance (...) => C (T a b) - clas_tyvar = head (classTyVars clas) + clas_tyvar = ASSERT (not (null (classTyVars clas))) head (classTyVars clas) Just tycon = maybe_tycon maybe_tycon = case inst_tys of [ty] -> case tcSplitTyConApp_maybe ty of @@ -707,7 +706,7 @@ mkGenericInstance clas (hs_ty, binds) -- Make the dictionary function. getSrcSpanM `thenM` \ span -> getOverlapFlag `thenM` \ overlap_flag -> - newDFunName clas [inst_ty] (srcSpanStart span) `thenM` \ dfun_name -> + newDFunName clas [inst_ty] span `thenM` \ dfun_name -> let inst_theta = [mkClassPred clas [mkTyVarTy tv] | tv <- tyvars] dfun_id = mkDictFunId dfun_name tyvars inst_theta clas [inst_ty] @@ -734,7 +733,7 @@ tcAddDeclCtxt decl thing_inside else "data type" ++ maybeInst | isFamilyDecl decl = "family" - maybeInst | isFamInstDecl decl = " family" + maybeInst | isFamInstDecl decl = " instance" | otherwise = "" ctxt = hsep [ptext SLIT("In the"), text thing,