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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
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
Alex D
GHC
Commits
02aef112
Commit
02aef112
authored
Jun 14, 2012
by
Ian Lynagh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make -dppr-case-as-let a dynamic flag
parent
ed7dbe82
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
31 deletions
+36
-31
compiler/coreSyn/PprCore.lhs
compiler/coreSyn/PprCore.lhs
+25
-25
compiler/main/DynFlags.hs
compiler/main/DynFlags.hs
+10
-0
compiler/main/StaticFlags.hs
compiler/main/StaticFlags.hs
+0
-5
docs/users_guide/flags.xml
docs/users_guide/flags.xml
+1
-1
No files found.
compiler/coreSyn/PprCore.lhs
View file @
02aef112
...
...
@@ -23,6 +23,7 @@ import DataCon
import TyCon
import Type
import Coercion
import DynFlags
import StaticFlags
import BasicTypes
import Util
...
...
@@ -153,31 +154,30 @@ ppr_expr add_par expr@(App {})
}
ppr_expr add_par (Case expr var ty [(con,args,rhs)])
| opt_PprCaseAsLet
= add_par $
sep [sep [ ptext (sLit "let")
<+> char '{'
<+> ppr_case_pat con args
<+> ptext (sLit "~")
<+> ppr_bndr var
, ptext (sLit "<-")
<+> ppr_expr id expr
, char '}'
<+> ptext (sLit "in")
]
, pprCoreExpr rhs
]
| otherwise
= add_par $
sep [sep [ptext (sLit "case") <+> pprCoreExpr expr,
ifPprDebug (braces (ppr ty)),
sep [ptext (sLit "of") <+> ppr_bndr var,
char '{' <+> ppr_case_pat con args <+> arrow]
],
pprCoreExpr rhs,
char '}'
]
= sdocWithDynFlags $ \dflags ->
if dopt Opt_PprCaseAsLet dflags
then add_par $
sep [sep [ ptext (sLit "let")
<+> char '{'
<+> ppr_case_pat con args
<+> ptext (sLit "~")
<+> ppr_bndr var
, ptext (sLit "<-")
<+> ppr_expr id expr
, char '}'
<+> ptext (sLit "in")
]
, pprCoreExpr rhs
]
else add_par $
sep [sep [ptext (sLit "case") <+> pprCoreExpr expr,
ifPprDebug (braces (ppr ty)),
sep [ptext (sLit "of") <+> ppr_bndr var,
char '{' <+> ppr_case_pat con args <+> arrow]
],
pprCoreExpr rhs,
char '}'
]
where
ppr_bndr = pprBndr CaseBind
...
...
compiler/main/DynFlags.hs
View file @
02aef112
...
...
@@ -308,6 +308,9 @@ data DynFlag
|
Opt_HelpfulErrors
|
Opt_DeferTypeErrors
-- output style opts
|
Opt_PprCaseAsLet
-- temporary flags
|
Opt_RunCPS
|
Opt_RunCPSZ
...
...
@@ -1788,6 +1791,8 @@ dynamic_flags = [
,
Flag
"fpackage-trust"
(
NoArg
setPackageTrust
)
,
Flag
"fno-safe-infer"
(
NoArg
(
setSafeHaskell
Sf_None
))
]
++
map
(
mkFlag
turnOn
"d"
setDynFlag
)
dFlags
++
map
(
mkFlag
turnOff
"dno-"
unSetDynFlag
)
dFlags
++
map
(
mkFlag
turnOn
"f"
setDynFlag
)
fFlags
++
map
(
mkFlag
turnOff
"fno-"
unSetDynFlag
)
fFlags
++
map
(
mkFlag
turnOn
"f"
setWarningFlag
)
fWarningFlags
...
...
@@ -1908,6 +1913,11 @@ fWarningFlags = [
(
"warn-pointless-pragmas"
,
Opt_WarnPointlessPragmas
,
nop
),
(
"warn-unsupported-calling-conventions"
,
Opt_WarnUnsupportedCallingConventions
,
nop
)
]
-- | These @-d\<blah\>@ flags can all be reversed with @-dno-\<blah\>@
dFlags
::
[
FlagSpec
DynFlag
]
dFlags
=
[
(
"ppr-case-as-let"
,
Opt_PprCaseAsLet
,
nop
)
]
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fFlags
::
[
FlagSpec
DynFlag
]
fFlags
=
[
...
...
compiler/main/StaticFlags.hs
View file @
02aef112
...
...
@@ -28,7 +28,6 @@ module StaticFlags (
-- Output style options
opt_PprCols
,
opt_PprCaseAsLet
,
opt_PprStyle_Debug
,
opt_TraceLevel
,
opt_NoDebugOutput
,
...
...
@@ -250,10 +249,6 @@ opt_SuppressUniques :: Bool
opt_SuppressUniques
=
lookUp
(
fsLit
"-dsuppress-uniques"
)
-- | Display case expressions with a single alternative as strict let bindings
opt_PprCaseAsLet
::
Bool
opt_PprCaseAsLet
=
lookUp
(
fsLit
"-dppr-case-as-let"
)
-- | Set the maximum width of the dumps
-- If GHC's command line options are bad then the options parser uses the
-- pretty printer display the error message. In this case the staticFlags
...
...
docs/users_guide/flags.xml
View file @
02aef112
...
...
@@ -2724,7 +2724,7 @@
<row>
<entry><option>
-dppr-case-as-let
</option></entry>
<entry>
Print single alternative case expressions as strict lets.
</entry>
<entry>
stat
ic
</entry>
<entry>
dynam
ic
</entry>
<entry>
-
</entry>
</row>
<row>
...
...
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