Agda-2.5.3: A dependently typed functional programming language and proof assistant

Safe HaskellSafe
LanguageHaskell2010

Agda.Utils.Pretty

Contents

Description

Pretty printing functions.

Synopsis

Pretty class

class Pretty a where #

While Show is for rendering data in Haskell syntax, Pretty is for displaying data to the world, i.e., the user and the environment.

Atomic data has no inner document structure, so just implement pretty as pretty a = text $ ... a ....

Methods

pretty :: a -> Doc #

prettyPrec :: Int -> a -> Doc #

prettyList :: [a] -> Doc #

Instances

Pretty Bool # 

Methods

pretty :: Bool -> Doc #

prettyPrec :: Int -> Bool -> Doc #

prettyList :: [Bool] -> Doc #

Pretty Char # 

Methods

pretty :: Char -> Doc #

prettyPrec :: Int -> Char -> Doc #

prettyList :: [Char] -> Doc #

Pretty Int # 

Methods

pretty :: Int -> Doc #

prettyPrec :: Int -> Int -> Doc #

prettyList :: [Int] -> Doc #

Pretty Int32 # 

Methods

pretty :: Int32 -> Doc #

prettyPrec :: Int -> Int32 -> Doc #

prettyList :: [Int32] -> Doc #

Pretty Integer # 
Pretty Doc # 

Methods

pretty :: Doc -> Doc #

prettyPrec :: Int -> Doc -> Doc #

prettyList :: [Doc] -> Doc #

Pretty Polarity # 
Pretty Cmp # 

Methods

pretty :: Cmp -> Doc #

prettyPrec :: Int -> Cmp -> Doc #

prettyList :: [Cmp] -> Doc #

Pretty Flex # 

Methods

pretty :: Flex -> Doc #

prettyPrec :: Int -> Flex -> Doc #

prettyList :: [Flex] -> Doc #

Pretty Rigid # 

Methods

pretty :: Rigid -> Doc #

prettyPrec :: Int -> Rigid -> Doc #

prettyList :: [Rigid] -> Doc #

Pretty Offset # 

Methods

pretty :: Offset -> Doc #

prettyPrec :: Int -> Offset -> Doc #

prettyList :: [Offset] -> Doc #

Pretty CPUTime #

Print CPU time in milli (10^-3) seconds.

Pretty AbsolutePath # 
Pretty IntervalWithoutFile # 
Pretty PositionWithoutFile # 
Pretty ParseWarning # 
Pretty ParseError # 
Pretty MetaId # 

Methods

pretty :: MetaId -> Doc #

prettyPrec :: Int -> MetaId -> Doc #

prettyList :: [MetaId] -> Doc #

Pretty Access # 

Methods

pretty :: Access -> Doc #

prettyPrec :: Int -> Access -> Doc #

prettyList :: [Access] -> Doc #

Pretty TopLevelModuleName # 
Pretty QName # 

Methods

pretty :: QName -> Doc #

prettyPrec :: Int -> QName -> Doc #

prettyList :: [QName] -> Doc #

Pretty NamePart # 
Pretty Name # 

Methods

pretty :: Name -> Doc #

prettyPrec :: Int -> Name -> Doc #

prettyList :: [Name] -> Doc #

Pretty AmbiguousQName # 
Pretty ModuleName # 
Pretty QName # 

Methods

pretty :: QName -> Doc #

prettyPrec :: Int -> QName -> Doc #

prettyList :: [QName] -> Doc #

Pretty Name # 

Methods

pretty :: Name -> Doc #

prettyPrec :: Int -> Name -> Doc #

prettyList :: [Name] -> Doc #

Pretty Literal # 
Pretty Precedence # 
Pretty Label # 

Methods

pretty :: Label -> Doc #

prettyPrec :: Int -> Label -> Doc #

prettyList :: [Label] -> Doc #

Pretty Weight # 

Methods

pretty :: Weight -> Doc #

prettyPrec :: Int -> Weight -> Doc #

prettyList :: [Weight] -> Doc #

Pretty Occurrence # 
Pretty Where # 

Methods

pretty :: Where -> Doc #

prettyPrec :: Int -> Where -> Doc #

prettyList :: [Where] -> Doc #

Pretty OccursWhere # 
Pretty Tel # 

Methods

pretty :: Tel -> Doc #

prettyPrec :: Int -> Tel -> Doc #

prettyList :: [Tel] -> Doc #

Pretty Phase # 

Methods

pretty :: Phase -> Doc #

prettyPrec :: Int -> Phase -> Doc #

prettyList :: [Phase] -> Doc #

Pretty AbstractModule # 
Pretty AbstractName # 
Pretty NameSpace # 
Pretty LocalVar #

We show shadowed variables as prefixed by a ".", as not in scope.

Pretty ScopeInfo # 
Pretty NameSpaceId # 
Pretty Scope # 

Methods

pretty :: Scope -> Doc #

prettyPrec :: Int -> Scope -> Doc #

prettyList :: [Scope] -> Doc #

Pretty Order # 

Methods

pretty :: Order -> Doc #

prettyPrec :: Int -> Order -> Doc #

prettyList :: [Order] -> Doc #

Pretty CallMatrix # 
Pretty DBPatVar # 
Pretty Clause # 

Methods

pretty :: Clause -> Doc #

prettyPrec :: Int -> Clause -> Doc #

prettyList :: [Clause] -> Doc #

Pretty LevelAtom # 
Pretty PlusLevel # 
Pretty Level # 

Methods

pretty :: Level -> Doc #

prettyPrec :: Int -> Level -> Doc #

prettyList :: [Level] -> Doc #

Pretty Sort # 

Methods

pretty :: Sort -> Doc #

prettyPrec :: Int -> Sort -> Doc #

prettyList :: [Sort] -> Doc #

Pretty Type # 

Methods

pretty :: Type -> Doc #

prettyPrec :: Int -> Type -> Doc #

prettyList :: [Type] -> Doc #

Pretty Term # 

Methods

pretty :: Term -> Doc #

prettyPrec :: Int -> Term -> Doc #

prettyList :: [Term] -> Doc #

Pretty ConHead # 
Pretty CompiledClauses # 
Pretty ScopeCopyInfo # 
Pretty DeclarationWarning # 
Pretty DeclarationException # 
Pretty CallInfo #

We only show the name of the callee.

Pretty Call # 

Methods

pretty :: Call -> Doc #

prettyPrec :: Int -> Call -> Doc #

prettyList :: [Call] -> Doc #

Pretty TermHead # 
Pretty Defn # 

Methods

pretty :: Defn -> Doc #

prettyPrec :: Int -> Defn -> Doc #

prettyList :: [Defn] -> Doc #

Pretty Polarity # 
Pretty Definition # 
Pretty DisplayTerm # 
Pretty Section # 
Pretty NamedMeta # 
Pretty CompareDirection # 
Pretty Comparison # 
Pretty Interface # 
Pretty ProblemId # 
Pretty ResolvedName # 
Pretty AsBinding # 
Pretty BlockingVar # 
Pretty Node # 

Methods

pretty :: Node -> Doc #

prettyPrec :: Int -> Node -> Doc #

prettyList :: [Node] -> Doc #

Pretty SizeMeta # 
Pretty NamedRigid # 
Pretty Cl # 

Methods

pretty :: Cl -> Doc #

prettyPrec :: Int -> Cl -> Doc #

prettyList :: [Cl] -> Doc #

Pretty CallPath #

Only show intermediate nodes. (Drop last CallInfo).

Pretty a => Pretty [a] # 

Methods

pretty :: [a] -> Doc #

prettyPrec :: Int -> [a] -> Doc #

prettyList :: [[a]] -> Doc #

Pretty a => Pretty (Maybe a) # 

Methods

pretty :: Maybe a -> Doc #

prettyPrec :: Int -> Maybe a -> Doc #

prettyList :: [Maybe a] -> Doc #

Pretty flex => Pretty (PolarityAssignment flex) # 
Pretty a => Pretty (Lisp a) # 

Methods

pretty :: Lisp a -> Doc #

prettyPrec :: Int -> Lisp a -> Doc #

prettyList :: [Lisp a] -> Doc #

(Ord a, Pretty a) => Pretty (Benchmark a) #

Print benchmark as three-column table with totals.

Methods

pretty :: Benchmark a -> Doc #

prettyPrec :: Int -> Benchmark a -> Doc #

prettyList :: [Benchmark a] -> Doc #

(Pretty a, HasRange a) => Pretty (PrintRange a) # 
Pretty a => Pretty (Range' (Maybe a)) # 

Methods

pretty :: Range' (Maybe a) -> Doc #

prettyPrec :: Int -> Range' (Maybe a) -> Doc #

prettyList :: [Range' (Maybe a)] -> Doc #

Pretty a => Pretty (Interval' (Maybe a)) # 
Pretty a => Pretty (Position' (Maybe a)) # 
Pretty a => Pretty (QNamed a) # 

Methods

pretty :: QNamed a -> Doc #

prettyPrec :: Int -> QNamed a -> Doc #

prettyList :: [QNamed a] -> Doc #

Pretty cinfo => Pretty (CMSet cinfo) # 

Methods

pretty :: CMSet cinfo -> Doc #

prettyPrec :: Int -> CMSet cinfo -> Doc #

prettyList :: [CMSet cinfo] -> Doc #

Pretty cinfo => Pretty (CallMatrixAug cinfo) # 

Methods

pretty :: CallMatrixAug cinfo -> Doc #

prettyPrec :: Int -> CallMatrixAug cinfo -> Doc #

prettyList :: [CallMatrixAug cinfo] -> Doc #

Pretty cinfo => Pretty (CallGraph cinfo) #

Displays the recursion behaviour corresponding to a call graph.

Methods

pretty :: CallGraph cinfo -> Doc #

prettyPrec :: Int -> CallGraph cinfo -> Doc #

prettyList :: [CallGraph cinfo] -> Doc #

Pretty a => Pretty (Substitution' a) # 
Pretty a => Pretty (Pattern' a) # 

Methods

pretty :: Pattern' a -> Doc #

prettyPrec :: Int -> Pattern' a -> Doc #

prettyList :: [Pattern' a] -> Doc #

Pretty a => Pretty (Tele (Dom a)) # 

Methods

pretty :: Tele (Dom a) -> Doc #

prettyPrec :: Int -> Tele (Dom a) -> Doc #

prettyList :: [Tele (Dom a)] -> Doc #

Pretty tm => Pretty (Elim' tm) # 

Methods

pretty :: Elim' tm -> Doc #

prettyPrec :: Int -> Elim' tm -> Doc #

prettyList :: [Elim' tm] -> Doc #

Pretty a => Pretty (SplitTreeLabel a) # 
Pretty a => Pretty (SplitTree' a) # 
Pretty a => Pretty (Case a) # 

Methods

pretty :: Case a -> Doc #

prettyPrec :: Int -> Case a -> Doc #

prettyList :: [Case a] -> Doc #

Pretty a => Pretty (WithArity a) # 

Methods

pretty :: WithArity a -> Doc #

prettyPrec :: Int -> WithArity a -> Doc #

prettyList :: [WithArity a] -> Doc #

(Pretty r, Pretty f) => Pretty (Solution r f) # 

Methods

pretty :: Solution r f -> Doc #

prettyPrec :: Int -> Solution r f -> Doc #

prettyList :: [Solution r f] -> Doc #

(Pretty r, Pretty f) => Pretty (Constraint' r f) # 

Methods

pretty :: Constraint' r f -> Doc #

prettyPrec :: Int -> Constraint' r f -> Doc #

prettyList :: [Constraint' r f] -> Doc #

(Pretty r, Pretty f) => Pretty (SizeExpr' r f) # 

Methods

pretty :: SizeExpr' r f -> Doc #

prettyPrec :: Int -> SizeExpr' r f -> Doc #

prettyList :: [SizeExpr' r f] -> Doc #

(Pretty rigid, Pretty flex) => Pretty (Node rigid flex) # 

Methods

pretty :: Node rigid flex -> Doc #

prettyPrec :: Int -> Node rigid flex -> Doc #

prettyList :: [Node rigid flex] -> Doc #

(Integral i, HasZero b, Pretty b) => Pretty (Matrix i b) # 

Methods

pretty :: Matrix i b -> Doc #

prettyPrec :: Int -> Matrix i b -> Doc #

prettyList :: [Matrix i b] -> Doc #

(Pretty a, Pretty b) => Pretty (OutputConstraint' a b) # 
(Pretty s, Pretty t, Pretty e) => Pretty (Edge s t e) # 

Methods

pretty :: Edge s t e -> Doc #

prettyPrec :: Int -> Edge s t e -> Doc #

prettyList :: [Edge s t e] -> Doc #

(Pretty s, Pretty t, Pretty e) => Pretty (Graph s t e) # 

Methods

pretty :: Graph s t e -> Doc #

prettyPrec :: Int -> Graph s t e -> Doc #

prettyList :: [Graph s t e] -> Doc #

prettyShow :: Pretty a => a -> String #

Use instead of show when printing to world.

Pretty instances

Doc utilities

pwords :: String -> [Doc] #

prettyList_ :: Pretty a => [a] -> Doc #

Comma separated list, without the brackets.

mparens :: Bool -> Doc -> Doc #

Apply parens to Doc if boolean is true.

align :: Int -> [(String, Doc)] -> Doc #

align max rows lays out the elements of rows in two columns, with the second components aligned. The alignment column of the second components is at most max characters to the right of the left-most column.

Precondition: max > 0.

multiLineText :: String -> Doc #

Handles strings with newlines properly (preserving indentation)

(<?>) :: Doc -> Doc -> Doc infixl 6 #

a ? b = hang a 2 b

pshow :: Show a => a -> Doc #

pshow = text . pretty

Orphan instances

Data Doc # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Doc -> c Doc #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Doc #

toConstr :: Doc -> Constr #

dataTypeOf :: Doc -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Doc) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Doc) #

gmapT :: (forall b. Data b => b -> b) -> Doc -> Doc #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Doc -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Doc -> r #

gmapQ :: (forall d. Data d => d -> u) -> Doc -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Doc -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Doc -> m Doc #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Doc -> m Doc #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Doc -> m Doc #