Copyright | (c) 2013-2016 Galois, Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
- data NameDisp
- = EmptyNameDisp
- | NameDisp (ModName -> Ident -> Maybe NameFormat)
- data NameFormat
- neverQualifyMod :: ModName -> NameDisp
- alwaysQualify :: NameDisp
- neverQualify :: NameDisp
- fmtModName :: ModName -> NameFormat -> ModName
- extend :: NameDisp -> NameDisp -> NameDisp
- getNameFormat :: ModName -> Ident -> NameDisp -> NameFormat
- withNameDisp :: (NameDisp -> Doc) -> Doc
- fixNameDisp :: NameDisp -> Doc -> Doc
- newtype Doc = Doc (NameDisp -> Doc)
- runDoc :: NameDisp -> Doc -> Doc
- render :: Doc -> String
- class PP a where
- class PP a => PPName a where
- ppPrefixName :: a -> Doc
- ppInfixName :: a -> Doc
- pp :: PP a => a -> Doc
- pretty :: PP a => a -> String
- optParens :: Bool -> Doc -> Doc
- data Assoc
- data Infix op thing = Infix {}
- commaSep :: [Doc] -> Doc
- ppInfix :: (PP thing, PP op) => Int -> (thing -> Maybe (Infix op thing)) -> Infix op thing -> Doc
- ordinal :: (Integral a, Show a, Eq a) => a -> Doc
- ordSuffix :: (Integral a, Eq a) => a -> String
- liftPJ :: Doc -> Doc
- liftPJ1 :: (Doc -> Doc) -> Doc -> Doc
- liftPJ2 :: (Doc -> Doc -> Doc) -> Doc -> Doc -> Doc
- liftSep :: ([Doc] -> Doc) -> [Doc] -> Doc
- (<>) :: Doc -> Doc -> Doc
- (<+>) :: Doc -> Doc -> Doc
- ($$) :: Doc -> Doc -> Doc
- sep :: [Doc] -> Doc
- fsep :: [Doc] -> Doc
- hsep :: [Doc] -> Doc
- hcat :: [Doc] -> Doc
- vcat :: [Doc] -> Doc
- hang :: Doc -> Int -> Doc -> Doc
- nest :: Int -> Doc -> Doc
- parens :: Doc -> Doc
- braces :: Doc -> Doc
- brackets :: Doc -> Doc
- quotes :: Doc -> Doc
- punctuate :: Doc -> [Doc] -> [Doc]
- text :: String -> Doc
- char :: Char -> Doc
- integer :: Integer -> Doc
- int :: Int -> Doc
- comma :: Doc
- empty :: Doc
- colon :: Doc
Documentation
How to display names, inspired by the GHC Outputable
module. Getting a
value of Nothing
from the NameDisp function indicates that the name is not
in scope.
EmptyNameDisp | |
NameDisp (ModName -> Ident -> Maybe NameFormat) |
neverQualifyMod :: ModName -> NameDisp Source
Never qualify names from this module.
fmtModName :: ModName -> NameFormat -> ModName Source
extend :: NameDisp -> NameDisp -> NameDisp Source
Compose two naming environments, preferring names from the left environment.
getNameFormat :: ModName -> Ident -> NameDisp -> NameFormat Source
Get the format for a name. When Nothing
is returned, the name is not
currently in scope.
withNameDisp :: (NameDisp -> Doc) -> Doc Source
Produce a document in the context of the current NameDisp
.
fixNameDisp :: NameDisp -> Doc -> Doc Source
Fix the way that names are displayed inside of a doc.
class PP a => PPName a where Source
ppPrefixName :: a -> Doc Source
Print a name in prefix: f a b
or (+) a b)
ppInfixName :: a -> Doc Source
Print a name as an infix operator: a + b
Information about associativity.
Information about an infix expression of some sort.
:: (PP thing, PP op) | |
=> Int | Non-infix leaves are printed with this precedence |
-> (thing -> Maybe (Infix op thing)) | pattern to check if sub-thing is also infix |
-> Infix op thing | Pretty print this infix expression |
-> Doc |
Pretty print an infix expression of some sort.
ordinal :: (Integral a, Show a, Eq a) => a -> Doc Source
Display a numeric values as an ordinar (e.g., 2nd)