Safe Haskell | None |
---|
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
a class for simple pretty-printing with indentation a function only of syntactic depth.
prettyShow :: a -> QTree
prettyShowList :: [a] -> QTree
showPretty :: PrettyShow a => a -> String
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
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
a terse PrefixScheme
, leaving most names unqualified.
longPrefixScheme :: PrefixScheme
a conservative PrefixScheme
which qualifies everything.
defaultPrefixScheme :: PrefixScheme
the default PrefixScheme
used by showPretty
basePrefixScheme :: PrefixScheme
a PrefixScheme
for types not of llvm-general, but nevertheless used
in the AST. Useful for building other PrefixScheme
s.
shortASTPrefixScheme :: PrefixScheme
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
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
print Haskell imports to define the correct prefixes for use with the output
of a given PrefixScheme
.