X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Frename%2FRnTypes.lhs;h=34a19a33c762fa19e416ef00964a17e6b3727f3b;hb=923ee9d360ed15331ac6faf8a6b4aca334fc0cee;hp=fe51c1af32604920d1b92800fa8db97916c8628e;hpb=190f24892156953d73b55401d0467a6f1a88ce5d;p=ghc-hetmet.git diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs index fe51c1a..34a19a3 100644 --- a/compiler/rename/RnTypes.lhs +++ b/compiler/rename/RnTypes.lhs @@ -21,7 +21,7 @@ module RnTypes ( dupFieldErr, patSigErr, checkTupSize ) where -import DynFlags ( DynFlag(Opt_WarnUnusedMatches, Opt_GlasgowExts, Opt_ScopedTypeVariables ) ) +import DynFlags ( DynFlag(Opt_WarnUnusedMatches, Opt_GlasgowExts, Opt_ScopedTypeVariables, Opt_OverloadedStrings ) ) import HsSyn import RdrHsSyn ( extractHsRhoRdrTyVars ) @@ -40,7 +40,7 @@ import RdrName ( RdrName, elemLocalRdrEnv ) import PrelNames ( eqClassName, integralClassName, geName, eqName, negateName, minusName, lengthPName, indexPName, plusIntegerName, fromIntegerName, timesIntegerName, - ratioDataConName, fromRationalName ) + ratioDataConName, fromRationalName, fromStringName ) import TypeRep ( funTyCon ) import Constants ( mAX_TUPLE_SIZE ) import Name ( Name ) @@ -505,14 +505,20 @@ rnLPred :: SDoc -> LHsPred RdrName -> RnM (LHsPred Name) rnLPred doc = wrapLocM (rnPred doc) rnPred doc (HsClassP clas tys) - = lookupOccRn clas `thenM` \ clas_name -> - rnLHsTypes doc tys `thenM` \ tys' -> - returnM (HsClassP clas_name tys') - + = do { clas_name <- lookupOccRn clas + ; tys' <- rnLHsTypes doc tys + ; returnM (HsClassP clas_name tys') + } +rnPred doc (HsEqualP ty1 ty2) + = do { ty1' <- rnLHsType doc ty1 + ; ty2' <- rnLHsType doc ty2 + ; returnM (HsEqualP ty1' ty2') + } rnPred doc (HsIParam n ty) - = newIPNameRn n `thenM` \ name -> - rnLHsType doc ty `thenM` \ ty' -> - returnM (HsIParam name ty') + = do { name <- newIPNameRn n + ; ty' <- rnLHsType doc ty + ; returnM (HsIParam name ty') + } \end{code} @@ -580,6 +586,10 @@ rnPat (SigPatIn pat ty) where doc = text "In a pattern type-signature" +rnPat (LitPat lit@(HsString s)) + = do { ovlStr <- doptM Opt_OverloadedStrings + ; if ovlStr then rnPat (mkNPat (mkHsIsString s) Nothing) + else do { rnLit lit; return (LitPat lit, emptyFVs) } } -- Same as below rnPat (LitPat lit) = rnLit lit `thenM_` returnM (LitPat lit, emptyFVs) @@ -735,6 +745,10 @@ rnOverLit (HsFractional i _) -- and denominator (see DsUtils.mkIntegerLit) in returnM (HsFractional i from_rat_name, fvs `plusFV` extra_fvs) + +rnOverLit (HsIsString s _) + = lookupSyntaxName fromStringName `thenM` \ (from_string_name, fvs) -> + returnM (HsIsString s from_string_name, fvs) \end{code}