summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.lhs
Commit message (Collapse)AuthorAgeFilesLines
* compiler: de-lhs utils/Austin Seipp2014-12-031-1047/+0
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Some refactoring around endPass and debug dumpingSimon Peyton Jones2014-11-041-35/+46
| | | | | I forget all the details, but I spent some time trying to understand the current setup, and tried to simplify it a bit
* Use DumpStyle rather than UserStyle for pprTrace outputSimon Peyton Jones2014-08-251-2/+2
| | | | | | | | The main motivation is that user-style output assumes that everything has been tidied, not enough uniques are printed by default. The downside is that pprTrace output now has module prefixes which can be overwhelming, but -dsuppress-module-prefixes will suppress them.
* Package keys (for linking/type equality) separated from package IDs.Edward Z. Yang2014-08-051-13/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch set makes us no longer assume that a package key is a human readable string, leaving Cabal free to "do whatever it wants" to allocate keys; we'll look up the PackageId in the database to display to the user. This also means we have a new level of qualifier decisions to make at the package level, and rewriting some Safe Haskell error reporting code to DTRT. Additionally, we adjust the build system to use a new ghc-cabal output Make variable PACKAGE_KEY to determine library names and other things, rather than concatenating PACKAGE/VERSION as before. Adds a new `-this-package-key` flag to subsume the old, erroneously named `-package-name` flag, and `-package-key` to select packages by package key. RFC: The md5 hashes are pretty tough on the eye, as far as the file system is concerned :( ToDo: safePkg01 test had its output updated, but the fix is not really right: the rest of the dependencies are truncated due to the fact the we're only grepping a single line, but ghc-pkg is wrapping its output. ToDo: In a later commit, update all submodules to stop using -package-name and use -this-package-key. For now, we don't do it to avoid submodule explosion. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D80
* Only use UnicodeSytanx pretty printing if the locale supports itJoachim Breitner2014-06-061-4/+5
| | | | using the same check as for unicode quotes.
* Use UnicodeSyntax when printingJoachim Breitner2014-06-061-9/+24
| | | | | When printing Haskell source, and UnicodeSyntax is enabled, use the unicode sytax characters (#8959).
* Be less verbose when printing Names when we don't know what's in scopeSimon Peyton Jones2014-04-241-13/+12
| | | | | | | | Previously we always printed qualified names, but that makes a lot of debug or warning output very verbose. So now we only print qualified names with -dppr-debug. Civilised output (from pukka error messages, with the environment available) is unaffected
* Use U+2018 instead of U+201B quote mark in compiler messagesHerbert Valerio Riedel2014-02-251-1/+1
| | | | | | | This matches GCC's choice of Unicode quotation marks (i.e. U+2018 and U+2019) and therefore looks more familiar on the console. This addresses #2507. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Make showSDoc and friends respect -dppr-colsSimon Peyton Jones2014-01-101-20/+22
| | | | | | | | Previously they just used a fixed width of 100, ignoring -dppr-cols. I think this dates back to a time when the flag didn't exist, or wasn't conveniently available. Thanks to Andrew Gibiansky for pointing this out.
* Re-work the naming story for the GHCi prompt (Trac #8649)Simon Peyton Jones2014-01-091-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic idea here is simple, and described in Note [The interactive package] in HscTypes, which starts thus: Note [The interactive package] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Type and class declarations at the command prompt are treated as if they were defined in modules interactive:Ghci1 interactive:Ghci2 ...etc... with each bunch of declarations using a new module, all sharing a common package 'interactive' (see Module.interactivePackageId, and PrelNames.mkInteractiveModule). This scheme deals well with shadowing. For example: ghci> data T = A ghci> data T = B ghci> :i A data Ghci1.T = A -- Defined at <interactive>:2:10 Here we must display info about constructor A, but its type T has been shadowed by the second declaration. But it has a respectable qualified name (Ghci1.T), and its source location says where it was defined. So the main invariant continues to hold, that in any session an original name M.T only refers to oe unique thing. (In a previous iteration both the T's above were called :Interactive.T, albeit with different uniques, which gave rise to all sorts of trouble.) This scheme deals nicely with the original problem. It allows us to eliminate a couple of grotseque hacks - Note [Outputable Orig RdrName] in HscTypes - Note [interactive name cache] in IfaceEnv (both these comments have gone, because the hacks they describe are no longer necessary). I was also able to simplify Outputable.QueryQualifyName, so that it takes a Module/OccName as args rather than a Name. However, matters are never simple, and this change took me an unreasonably long time to get right. There are some details in Note [The interactive package] in HscTypes.
* Outputable.isOrAre: "is" or "are" for correct grammarJoachim Breitner2013-09-131-1/+10
|
* Use SDoc for all LLVM pretty-printingPeter Wortmann2013-06-271-0/+7
| | | | | | | This patch reworks some parts of the LLVM pretty-printing code that were still using Show and String. Now we should be using SDoc and Outputable throughout. Note that many get*Name functions become pp*Name here as a side-effect.
* Make sure that Pretty.text is inlined in stage 0,Simon Peyton Jones2013-06-241-0/+3
| | | | | | | | | | so that RULE text/str gets a chance to fire (Trac #7995). And make sure that Outputable.text is inlined, so that the underlying Pretty.text rule can fire. The thing is that literal strings only turn into unpackCString# in phase 1.
* Fix pretty printing of human-readable integers (#7750)Patrick Palka2013-03-091-1/+4
|
* Use unicode quote characters in error messages etc; fixes #2507Ian Lynagh2013-02-241-1/+6
| | | | We only use the unicode characters if the locale supports them.
* Add OverloadedLists, allowing list syntax to be overloadedSimon Peyton Jones2013-02-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | This work was all done by Achim Krause <achim.t.krause@gmail.com> George Giorgidze <giorgidze@gmail.com> Weijers Jeroen <jeroen.weijers@uni-tuebingen.de> It allows list syntax, such as [a,b], [a..b] and so on, to be overloaded so that it works for a variety of types. The design is described here: http://hackage.haskell.org/trac/ghc/wiki/OverloadedLists Eg. you can use it for maps, so that [(1,"foo"), (4,"bar")] :: Map Int String The main changes * The ExplicitList constructor of HsExpr gets witness field * Ditto ArithSeq constructor * Ditto the ListPat constructor of HsPat Everything else flows from this.
* StaticFlags code cleanup (fixes #7595)Jan Stolarek2013-01-281-2/+3
| | | | | | | | | Function responsible for parsing the static flags, that were spread across two modules (StaticFlags and StaticFlagParser), are now in one file. This is analogous to dynamic flags parsing, which is also contained within a single module. Signed-off-by: David Terei <davidterei@gmail.com>
* Rename remaining FastBytes usages to ByteStringIan Lynagh2012-12-141-2/+3
|
* Inline some FastBytes/ByteString wrappersIan Lynagh2012-12-141-1/+2
| | | | Working towards removing FastBytes
* Revert "Fix pprPanic so that it doesn't throw away the SDoc part of the error."Ian Lynagh2012-12-041-2/+1
| | | | | | | This reverts commit e6ce335e8e3ba0718efd234910185e4257424562. pprPanic doesn't throw the Doc away: It gets passed in the PprPanic constructor.
* Fix pprPanic so that it doesn't throw away the SDoc part of the error.Erik de Castro Lopo2012-12-041-1/+2
|
* fix some typosGabor Greif2012-11-211-4/+4
|
* Put the DynFlags in a global variable for tracing; fixes #7304Ian Lynagh2012-10-081-4/+4
| | | | | | | | | This is an ugly kludge to make a DynFlags value available for the 'trace' functions. It may not be the value we really ought to use, but it'll be good enough for the pretty-printer to use. Ideally we'd pass the real DynFlags down to all the trace calls, but this will do for now at least.
* Remove pprDefiniteTraceIan Lynagh2012-08-051-5/+1
| | | | | All uses of it are now in an IO Monad, so we don't need to use a trace-like function.
* De-orphan the Outputable Fingerprint instanceIan Lynagh2012-08-051-0/+5
|
* Whitespace only in utils/Outputable.lhsIan Lynagh2012-08-051-9/+9
|
* De-orphan the Outputable Char instanceIan Lynagh2012-08-051-0/+3
|
* GHC 7.4 is now required for building HEADIan Lynagh2012-07-201-7/+0
|
* Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghcIan Lynagh2012-07-191-9/+1
|\
| * Remove hPrintDump and make rule dump output more consistent (#7060)Paolo Capriotti2012-07-181-9/+1
| | | | | | | | | | | | | | | | The only difference between SevDump and SevOutput in defaultLogAction is an extra blank line, so we don't need a separate hPrintDump function. Also make -ddump-to-file consistent with the stdout version, by avoiding to add the extra empty line when dumping rules.
* | Add a separate FastZString typeIan Lynagh2012-07-151-1/+3
| | | | | | | | | | | | | | | | | | FastStrings are now always UTF8-encoded. There's no StringTable for FastZString, but I don't think one is needed. We only ever make a FastZString by running zEncodeFS on a FastString, and the FastStrings are shared via the FastString StringTable, so we get the same FastZString from the IORef.
* | Implement FastBytes, and use it for MachStrIan Lynagh2012-07-141-1/+11
|/ | | | | | | | | | | | | This is a first step on the way to refactoring the FastString type. FastBytes currently has no unique, mainly because there isn't currently a nice way to produce them in Binary. Also, we don't currently do the "Dictionary" thing with FastBytes in Binary. I'm not sure whether this is important. We can change both decisions later, but in the meantime this gets the refactoring underway.
* Small tidy-upIan Lynagh2012-07-131-1/+1
|
* Don't use tracingDynFlags in assertPprPanicIan Lynagh2012-07-131-1/+1
| | | | It wasn't needed, but was left over as an oversight
* Make -dppr-cols a dynamic flagIan Lynagh2012-06-181-6/+6
|
* Be strict in the DynFlags inside an SDocIan Lynagh2012-06-141-1/+1
| | | | | | This is safe now that the tracingDynFlags is not just a call to panic. Not sure if it was causing a problem as it was, but this change should help make sure we don't get a chain of thunks built up inside SDocs.
* Change -dppr-user-length from a static to a dynamic flagIan Lynagh2012-06-141-7/+9
|
* Remove PlatformOutputableIan Lynagh2012-06-131-24/+9
| | | | | We can now get the Platform from the DynFlags inside an SDoc, so we no longer need to pass the Platform in.
* Make tracingDynFlags slightly more definedIan Lynagh2012-06-121-9/+1
| | | | | In particular, fields like 'flags' are now set to the default, so at least they will work to some extent.
* Pass DynFlags down to pprDefiniteTraceIan Lynagh2012-06-121-2/+2
|
* Add DynFlags to the SDoc stateIan Lynagh2012-06-121-31/+33
|
* Pass DynFlags down to pprDebugAndThenIan Lynagh2012-06-121-6/+6
|
* Remove unused showsPrecSDocIan Lynagh2012-06-121-4/+1
|
* Pass DynFlags down to showSDocDumpOneLineIan Lynagh2012-06-121-2/+2
|
* Pass DynFlags down to showSDocDebugIan Lynagh2012-06-121-2/+2
|
* Pass DynFlags down to showSDocIan Lynagh2012-06-121-4/+12
|
* Redefine pprPanicFastInt in terms of panicDocIan Lynagh2012-06-121-4/+1
|
* Pass DynFlags down to showPprIan Lynagh2012-06-121-2/+2
|
* Pass DynFlags down to showSDocDumpIan Lynagh2012-06-121-2/+2
| | | | | To help with this, we now also pass DynFlags around inside the SpecM monad.
* Pass DynFlags down to showSDocUnqualIan Lynagh2012-06-111-2/+2
|