Commit 2de4a2aa authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

A couple of small refactorings

parent 8760cf35
...@@ -560,17 +560,20 @@ checkPat loc e args -- OK to let this happen even if bang-patterns ...@@ -560,17 +560,20 @@ checkPat loc e args -- OK to let this happen even if bang-patterns
| Just (e', args') <- splitBang e | Just (e', args') <- splitBang e
= do { args'' <- checkPatterns args' = do { args'' <- checkPatterns args'
; checkPat loc e' (args'' ++ args) } ; checkPat loc e' (args'' ++ args) }
checkPat loc (L _ (HsApp f x)) args checkPat loc (L _ (HsApp f e)) args
= do { x <- checkLPat x; checkPat loc f (x:args) } = do p <- checkLPat e
checkPat loc f (p : args)
checkPat loc (L _ e) [] checkPat loc (L _ e) []
= do { pState <- getPState = do p <- checkAPat loc e
; p <- checkAPat (dflags pState) loc e return (L loc p)
; return (L loc p) }
checkPat loc e _ checkPat loc e _
= patFail loc (unLoc e) = patFail loc (unLoc e)
checkAPat :: DynFlags -> SrcSpan -> HsExpr RdrName -> P (Pat RdrName) checkAPat :: SrcSpan -> HsExpr RdrName -> P (Pat RdrName)
checkAPat dynflags loc e0 = case e0 of checkAPat loc e0 = do
pState <- getPState
let dynflags = dflags pState
case e0 of
EWildPat -> return (WildPat placeHolderType) EWildPat -> return (WildPat placeHolderType)
HsVar x -> return (VarPat x) HsVar x -> return (VarPat x)
HsLit l -> return (LitPat l) HsLit l -> return (LitPat l)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment