Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tobias Decking
GHC
Commits
1b1e5a46
Commit
1b1e5a46
authored
Nov 10, 2006
by
simonpj@microsoft.com
Browse files
Add HsUtils.unguardedGRHSs, and use it
parent
a515009d
Changes
2
Hide whitespace changes
Inline
Side-by-side
compiler/hsSyn/HsUtils.lhs
View file @
1b1e5a46
...
...
@@ -28,7 +28,6 @@ import RdrName
import Var
import Type
import DataCon
import OccName
import Name
import BasicTypes
import SrcLoc
...
...
@@ -53,16 +52,18 @@ just attach noSrcSpan to everything.
mkHsPar :: LHsExpr id -> LHsExpr id
mkHsPar e = L (getLoc e) (HsPar e)
-- gaw 2004
mkSimpleMatch :: [LPat id] -> LHsExpr id -> LMatch id
mkSimpleMatch pats rhs
= L loc $
Match pats Nothing
(GRHSs
(unguardedRHS rhs)
emptyLocalBinds)
Match pats Nothing (unguarded
G
RHS
s
rhs)
where
loc = case pats of
[] -> getLoc rhs
(pat:_) -> combineSrcSpans (getLoc pat) (getLoc rhs)
unguardedGRHSs :: LHsExpr id -> GRHSs id
unguardedGRHSs rhs = GRHSs (unguardedRHS rhs) emptyLocalBinds
unguardedRHS :: LHsExpr id -> [LGRHS id]
unguardedRHS rhs@(L loc _) = [L loc (GRHS [] rhs)]
...
...
compiler/parser/Parser.y.pp
View file @
1b1e5a46
...
...
@@ -1186,8 +1186,8 @@ exp10 :: { LHsExpr RdrName }
:
'\\'
aexp
aexps
opt_asig
'->'
exp
{% checkPatterns ($2 : reverse $3) >>= \ ps ->
return (LL $ HsLam (mkMatchGroup [LL $ Match ps $4
(GRHSs
(unguardedRHS $6)
emptyLocalBinds
)
])) }
(unguarded
G
RHS
s
$6)
])) }
|
'let'
binds
'in'
exp
{ LL $ HsLet (unLoc $2) $4 }
|
'if'
exp
'then'
exp
'else'
exp
{ LL $ HsIf $2 $4 $6 }
|
'case'
exp
'of'
altslist
{ LL $ HsCase $2 (mkMatchGroup (unLoc $4)) }
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment