[project @ 1996-03-19 08:58:34 by partain]
[ghc-hetmet.git] / ghc / compiler / utils / PprStyle.lhs
1 %
2 % (c) The AQUA Project, Glasgow University, 1996
3 %
4 \section[PprStyle]{Pretty-printing `styles'}
5
6 \begin{code}
7 #include "HsVersions.h"
8
9 module PprStyle (
10         PprStyle(..),
11         codeStyle
12     ) where
13
14 CHK_Ubiq() -- debugging consistency check
15
16 data PprStyle
17   = PprForUser                  -- Pretty-print in a way that will
18                                 -- make sense to the ordinary user;
19                                 -- must be very close to Haskell
20                                 -- syntax, etc.  ToDo: how diff is
21                                 -- this from what pprInterface must
22                                 -- do?
23   | PprDebug                    -- Standard debugging output
24   | PprShowAll                  -- Debugging output which leaves
25                                 -- nothing to the imagination
26   | PprInterface                -- Interface generation
27   | PprForC                     -- must print out C-acceptable names
28   | PprUnfolding                -- for non-interface intermodule info
29                                 -- the compiler writes/reads
30   | PprForAsm                   -- must print out assembler-acceptable names
31         Bool                    -- prefix CLabel with underscore?
32         (String -> String)      -- format AsmTempLabel
33 \end{code}
34
35 Orthogonal to the above printing styles are (possibly) some
36 command-line flags that affect printing (often carried with the
37 style).  The most likely ones are variations on how much type info is
38 shown.
39
40 The following test decides whether or not we are actually generating
41 code (either C or assembly).
42 \begin{code}
43 codeStyle :: PprStyle -> Bool
44
45 codeStyle PprForC         = True
46 codeStyle (PprForAsm _ _) = True
47 codeStyle _               = False
48 \end{code}
49