X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FhsSyn%2FConvert.lhs;h=96b5fc183cdcb301bab94c7afb9b4e2a87a12680;hb=7c9ef2cc6a623098b34bafa8f79e2ff3e7c834b8;hp=2848c5566ee93bb45200261812f8670d02c22085;hpb=6a05ec5ef5373f61b7f9f5bdc344483417fa801b;p=ghc-hetmet.git diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs index 2848c55..96b5fc1 100644 --- a/compiler/hsSyn/Convert.lhs +++ b/compiler/hsSyn/Convert.lhs @@ -13,7 +13,7 @@ This module converts Template Haskell syntax into HsSyn -- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings -- for details -module Convert( convertToHsExpr, convertToHsDecls, +module Convert( convertToHsExpr, convertToPat, convertToHsDecls, convertToHsType, thRdrName ) where #include "HsVersions.h" @@ -58,6 +58,13 @@ convertToHsExpr loc e <+> text (show e))) Right res -> Right res +convertToPat :: SrcSpan -> TH.Pat -> Either Message (LPat RdrName) +convertToPat loc e + = case initCvt loc (cvtPat e) of + Left msg -> Left (msg $$ (ptext SLIT("When converting TH pattern") + <+> text (show e))) + Right res -> Right res + convertToHsType :: SrcSpan -> TH.Type -> Either Message (LHsType RdrName) convertToHsType loc t = initCvt loc (cvtType t) @@ -420,7 +427,7 @@ cvtGuard (NormalB e) = do { e' <- cvtl e; g' <- returnL $ GRHS [] e'; retur cvtpair :: (TH.Guard, TH.Exp) -> CvtM (LGRHS RdrName) cvtpair (NormalG ge,rhs) = do { ge' <- cvtl ge; rhs' <- cvtl rhs - ; g' <- returnL $ mkBindStmt truePat ge' + ; g' <- returnL $ mkExprStmt ge' ; returnL $ GRHS [g'] rhs' } cvtpair (PatG gs,rhs) = do { gs' <- cvtStmts gs; rhs' <- cvtl rhs ; returnL $ GRHS gs' rhs' }