[commit: ghc] master: A couple of small refactorings (2de4a2a)

Ian Lynagh igloo at earth.li
Fri Feb 1 17:18:15 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2de4a2aa66baf0492d94c6ea936349112e3e8dba

>---------------------------------------------------------------

commit 2de4a2aa66baf0492d94c6ea936349112e3e8dba
Author: Ian Lynagh <ian at well-typed.com>
Date:   Fri Feb 1 14:32:27 2013 +0000

    A couple of small refactorings

>---------------------------------------------------------------

 compiler/parser/RdrHsSyn.lhs |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/compiler/parser/RdrHsSyn.lhs b/compiler/parser/RdrHsSyn.lhs
index 6bd8701..4d384be 100644
--- a/compiler/parser/RdrHsSyn.lhs
+++ b/compiler/parser/RdrHsSyn.lhs
@@ -560,17 +560,20 @@ checkPat loc e args     -- OK to let this happen even if bang-patterns
   | Just (e', args') <- splitBang e
   = do  { args'' <- checkPatterns args'
         ; checkPat loc e' (args'' ++ args) }
-checkPat loc (L _ (HsApp f x)) args
-  = do { x <- checkLPat x; checkPat loc f (x:args) }
+checkPat loc (L _ (HsApp f e)) args
+  = do p <- checkLPat e
+       checkPat loc f (p : args)
 checkPat loc (L _ e) []
-  = do { pState <- getPState
-       ; p <- checkAPat (dflags pState) loc e
-       ; return (L loc p) }
+  = do p <- checkAPat loc e
+       return (L loc p)
 checkPat loc e _
   = patFail loc (unLoc e)
 
-checkAPat :: DynFlags -> SrcSpan -> HsExpr RdrName -> P (Pat RdrName)
-checkAPat dynflags loc e0 = case e0 of
+checkAPat :: SrcSpan -> HsExpr RdrName -> P (Pat RdrName)
+checkAPat loc e0 = do
+ pState <- getPState
+ let dynflags = dflags pState
+ case e0 of
    EWildPat -> return (WildPat placeHolderType)
    HsVar x  -> return (VarPat x)
    HsLit l  -> return (LitPat l)





More information about the ghc-commits mailing list