Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,251
Issues
4,251
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
394
Merge Requests
394
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
1b1e5a46
Commit
1b1e5a46
authored
Nov 10, 2006
by
simonpj@microsoft.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add HsUtils.unguardedGRHSs, and use it
parent
a515009d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
compiler/hsSyn/HsUtils.lhs
compiler/hsSyn/HsUtils.lhs
+4
-3
compiler/parser/Parser.y.pp
compiler/parser/Parser.y.pp
+2
-2
No files found.
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) emptyLocalBind
s)
Match pats Nothing (
unguardedGRHSs rh
s)
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
)
]))
}
(
unguardedGRHSs
$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
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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