Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Las Safin
GHC
Commits
5295316c
Commit
5295316c
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-09-04 20:19:15 by sof]
ppr wibble; new functions: dumpIfSet, doIfSet
parent
d46d9882
Branches
wip/T19847
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/main/ErrUtils.lhs
+25
-3
25 additions, 3 deletions
ghc/compiler/main/ErrUtils.lhs
with
25 additions
and
3 deletions
ghc/compiler/main/ErrUtils.lhs
+
25
−
3
View file @
5295316c
...
...
@@ -12,14 +12,15 @@ module ErrUtils (
addShortErrLocLine, addShortWarnLocLine,
dontAddErrLoc,
pprBagOfErrors,
ghcExit
ghcExit,
doIfSet, dumpIfSet
) where
IMP_Ubiq(){-uitous-}
import CmdLineOpts ( opt_PprUserLength )
import Bag --( bagToList )
import Outputable ( PprStyle(..), Outputable(..) )
import Outputable ( PprStyle(..), Outputable(..)
, printErrs
)
import Pretty
import SrcLoc ( noSrcLoc, SrcLoc{-instance-} )
\end{code}
...
...
@@ -53,7 +54,8 @@ dontAddErrLoc title rest_of_err_msg sty
pprBagOfErrors :: PprStyle -> Bag Error -> Doc
pprBagOfErrors sty bag_of_errors
= let pretties = map ( \ e -> e sty ) (bagToList bag_of_errors) in
= let pretties = map ( \ e -> e sty ) (bagToList bag_of_errors)
in
vcat (map (\ p -> ($$) space p) pretties)
\end{code}
...
...
@@ -65,3 +67,23 @@ ghcExit val
then error "Compilation had errors\n"
else return ()
\end{code}
\begin{code}
doIfSet :: Bool -> IO () -> IO ()
doIfSet flag action | flag = action
| otherwise = return ()
\end{code}
\begin{code}
dumpIfSet :: Bool -> String -> Doc -> IO ()
dumpIfSet flag hdr doc
| not flag = return ()
| otherwise = printErrs dump
where
dump = (line <+> text hdr <+> line)
$$
doc
$$
text ""
line = text (take 20 (repeat '='))
\end{code}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment