cryptol-2.2.6: Cryptol: The Language of Cryptography

Copyright | (c) 2013-2015 Galois, Inc.
License | BSD3
Maintainer | cryptol@galois.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Cryptol.Utils.PP

Description

Synopsis

- class PP a where
  - ppPrec :: Int -> a -> Doc
- pp :: PP a => a -> Doc
- pretty :: PP a => a -> String
- optParens :: Bool -> Doc -> Doc
- ppInfix :: (PP thing, PP op) => Int -> (thing -> Maybe (Infix op thing)) -> Infix op thing -> Doc
- data Assoc
  - = LeftAssoc
  - | RightAssoc
  - | NonAssoc
- data Infix op thing = Infix {
  - ieOp :: op
  - ieLeft :: thing
  - ieRight :: thing
  - iePrec :: Int
  - ieAssoc :: Assoc
  }
- module Text.PrettyPrint
- ordinal :: (Integral a, Show a, Eq a) => a -> Doc
- ordSuffix :: (Integral a, Eq a) => a -> String
- commaSep :: [Doc] -> Doc

# Documentation

class PP a where Source

Methods

ppPrec :: Int -> a -> Doc Source

Instances

PP Range Source |
PP Position Source |
PP Token Source |
PP ECon Source |
PP TFun Source |
PP Prop Source |
PP Type Source |
PP TParam Source |
PP Kind Source |
PP Schema Source |
PP Pattern Source |
PP Match Source |
PP Selector Source |
PP TypeInst Source |
PP Expr Source |
PP Literal Source |
PP Newtype Source |
PP Pragma Source |
PP Bind Source |
PP TySyn Source |
PP ImportSpec Source |
PP Import Source |
PP Decl Source |
PP TopDecl Source |
PP Module Source |
PP Program Source |
PP QName Source |
PP Name Source |
PP ModName Source |
PP Decl Source |
PP DeclGroup Source |
PP Match Source |
PP Expr Source |
PP UserTC Source |
PP TC Source |
PP PC Source |
PP TCon Source |
PP Type Source |
PP TParam Source |
PP TySyn Source |
PP Schema Source |
PP Kind Source |
PP Module Source |
PP EvalError Source |
PP Subst Source |
PP NameOrigin Source |
PP Error Source |
PP ParseError Source |
PP RenamerWarning Source |
PP RenamerError Source |
PP TyFunName Source |
PP ConstraintSource Source |
PP Error Source |
PP Warning Source |
PP Solved Source |
PP ModuleWarning Source |
PP ModuleError Source |
PP ImportSource Source |
PP Smoke Source |
PP REPLException Source |
PP a => PP (Located a) Source |
PP (WithNames Decl) Source |
PP (WithNames DeclGroup) Source |
PP (WithNames Match) Source |
PP (WithNames Expr) Source |
PP (WithNames TVar) Source |
PP (WithNames Type) Source |
PP (WithNames TParam) Source |
PP (WithNames TySyn) Source |
PP (WithNames Schema) Source |
PP (WithNames Module) Source |
PP (WithNames Subst) Source |
PP (WithNames Error) Source |
PP (WithNames Warning) Source |
PP (WithNames DelayedCt) Source |
PP (WithNames Goal) Source |
PP a => PP (TopLevel a) Source |
PP (WithBase Value) Source |
PP (WithBase EvalEnv) Source |

pp :: PP a => a -> Doc Source

pretty :: PP a => a -> String Source

optParens :: Bool -> Doc -> Doc Source

ppInfix Source

Arguments

:: (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.

data Assoc Source

Information about associativity.

Constructors

LeftAssoc |
RightAssoc |
NonAssoc |

Instances

Eq Assoc Source |
Show Assoc Source |

data Infix op thing Source

Information about an infix expression of some sort.

Constructors

Infix |

Fields

ieOp :: op

  operator

ieLeft :: thing

  left argument

ieRight :: thing

  right argumrnt

iePrec :: Int

  operator precedence

ieAssoc :: Assoc

  operator associativity

module Text.PrettyPrint

ordinal :: (Integral a, Show a, Eq a) => a -> Doc Source

Display a numeric values as an ordinar (e.g., 2nd)

ordSuffix :: (Integral a, Eq a) => a -> String Source

The suffix to use when displaying a number as an oridinal

commaSep :: [Doc] -> Doc Source