Safe Haskell | None |
---|---|
Language | Haskell98 |
Tools for printing out AST.Module
code so that it's actually useful.
- class Show a => PrettyShow a where
- prettyShow :: a -> QTree
- prettyShowList :: [a] -> QTree
- showPretty :: PrettyShow a => a -> String
- showPrettyEx :: PrettyShow a => Int -> String -> PrefixScheme -> a -> String
- newtype PrefixScheme = PrefixScheme (Map String (Maybe String))
- shortPrefixScheme :: PrefixScheme
- longPrefixScheme :: PrefixScheme
- defaultPrefixScheme :: PrefixScheme
- basePrefixScheme :: PrefixScheme
- shortASTPrefixScheme :: PrefixScheme
- longASTPrefixScheme :: PrefixScheme
- imports :: PrefixScheme -> String
Documentation
class Show a => PrettyShow a where Source
a class for simple pretty-printing with indentation a function only of syntactic depth.
Nothing
prettyShow :: a -> QTree Source
prettyShowList :: [a] -> QTree Source
PrettyShow Bool Source | |
PrettyShow Char Source | |
PrettyShow Double Source | |
PrettyShow Float Source | |
PrettyShow Int Source | |
PrettyShow Integer Source | |
PrettyShow Word Source | |
PrettyShow Word16 Source | |
PrettyShow Word32 Source | |
PrettyShow Word64 Source | |
PrettyShow a => PrettyShow [a] Source | |
PrettyShow a => PrettyShow (Set a) Source | |
(PrettyShow a, PrettyShow b) => PrettyShow (a, b) Source | |
(PrettyShow k, PrettyShow a) => PrettyShow (Map k a) Source |
showPretty :: PrettyShow a => a -> String Source
Show an AST.Module
or part thereof both with qualified
identifiers (resolving some ambiguity, making the output usable Haskell) and
with indentation (making the output readable).
:: PrettyShow a | |
=> Int | line length before attempting breaking |
-> String | one unit of indentation |
-> PrefixScheme | prefixes to use for qualifying names |
-> a | |
-> String |
Like showPretty
but allowing configuration of the format
newtype PrefixScheme Source
A PrefixScheme
is a mapping between haskell module names and
the prefixes with which they should be rendered when printing code.
PrefixScheme (Map String (Maybe String)) |
shortPrefixScheme :: PrefixScheme Source
a terse PrefixScheme
, leaving most names unqualified.
longPrefixScheme :: PrefixScheme Source
a conservative PrefixScheme
which qualifies everything.
defaultPrefixScheme :: PrefixScheme Source
the default PrefixScheme
used by showPretty
basePrefixScheme :: PrefixScheme Source
a PrefixScheme
for types not of llvm-general, but nevertheless used
in the AST. Useful for building other PrefixScheme
s.
shortASTPrefixScheme :: PrefixScheme Source
a terse PrefixScheme
for types in the AST, leaving most names unqualified.
Useful for building other PrefixScheme
s. If you think you want to use this, you
probably want shortPrefixScheme
instead.
longASTPrefixScheme :: PrefixScheme Source
a conservative PrefixScheme
for types in the AST which qualifies everything.
Useful for building other PrefixScheme
s. If you think you want to use this, you
probably want longPrefixScheme
instead.
imports :: PrefixScheme -> String Source
print Haskell imports to define the correct prefixes for use with the output
of a given PrefixScheme
.