X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcHsType.lhs;h=dabd17f764785a70252e56c093ee83b5021aac5a;hb=3f1b316d7035c55cd712cd39a9981339bcef2e8c;hp=86870c9c35064779011b2218dcaa75a5b98a727b;hpb=84923cc7de2a93c22a2f72daf9ac863959efae13;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcHsType.lhs b/compiler/typecheck/TcHsType.lhs index 86870c9..dabd17f 100644 --- a/compiler/typecheck/TcHsType.lhs +++ b/compiler/typecheck/TcHsType.lhs @@ -5,6 +5,13 @@ \section[TcMonoType]{Typechecking user-specified @MonoTypes@} \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module TcHsType ( tcHsSigType, tcHsDeriv, tcHsInstHead, tcHsQuantifiedType, @@ -334,8 +341,12 @@ kc_hs_type ty@(HsAppTy ty1 ty2) split (L _ (HsAppTy f a)) as = split f (a:as) split f as = (f,as) mk_app fun arg = HsAppTy (noLoc fun) arg -- Add noLocs for inner nodes of - -- the application; they are never used - + -- the application; they are + -- never used + +kc_hs_type ty@(HsPredTy (HsEqualP _ _)) + = wrongEqualityErr + kc_hs_type (HsPredTy pred) = kcHsPred pred `thenM` \ pred' -> returnM (HsPredTy pred', liftedTypeKind) @@ -417,10 +428,11 @@ kc_pred pred@(HsClassP cls tys) } kc_pred pred@(HsEqualP ty1 ty2) = do { (ty1', kind1) <- kcHsType ty1 - ; checkExpectedKind ty1 kind1 liftedTypeKind +-- ; checkExpectedKind ty1 kind1 liftedTypeKind ; (ty2', kind2) <- kcHsType ty2 - ; checkExpectedKind ty2 kind2 liftedTypeKind - ; returnM (HsEqualP ty1 ty2, liftedTypeKind) +-- ; checkExpectedKind ty2 kind2 liftedTypeKind + ; checkExpectedKind ty2 kind2 kind1 + ; returnM (HsEqualP ty1' ty2', liftedTypeKind) } --------------------------- @@ -663,9 +675,8 @@ tcDataKindSig (Just kind) = do { checkTc (isLiftedTypeKind res_kind) (badKindSig kind) ; span <- getSrcSpanM ; us <- newUniqueSupply - ; let loc = srcSpanStart span - uniqs = uniqsFromSupply us - ; return [ mk_tv loc uniq str kind + ; let uniqs = uniqsFromSupply us + ; return [ mk_tv span uniq str kind | ((kind, str), uniq) <- arg_kinds `zip` names `zip` uniqs ] } where (arg_kinds, res_kind) = splitKindFunTys kind @@ -849,5 +860,8 @@ dupInScope n n' ty = hang (ptext SLIT("The scoped type variables") <+> quotes (ppr n) <+> ptext SLIT("and") <+> quotes (ppr n')) 2 (vcat [ptext SLIT("are bound to the same type (variable)"), ptext SLIT("Distinct scoped type variables must be distinct")]) + +wrongEqualityErr + = failWithTc (text "Equality predicate used as a type") \end{code}