pire-0.2.5

Copyright(c) Andreas Reuleaux 2015 - 2018
LicenseBSD2
MaintainerAndreas Reuleaux <rx@a-rx.info>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

PrettyCommon

Description

pretty printing: common/basic functions

Synopsis

Documentation

module PrettyCore

say :: Doc ann -> IO () Source #

sayLn :: Doc ann -> IO () Source #

pretty print to stdout with a linebreak after.

ppr :: Show a => a -> IO () Source #

pp :: PrettyAnn a => a -> IO () Source #

"pretty print" (wo/ type annotations)

recall that lam creates a lambda without type annotations (thus no difference when printing below):

>>> lam "x" $ V "f" :@ V "x"
Lam "x" Nothing (Scope (V (F (V "f")) :@ V (B ())))

lam_ however creates a lambda with a type annotation (thus printed differently with pp/pp', resp. qq/qq'):

>>> lam_ "x" (V "T") $ V "f" :@ V "x"
Lam "x" (Just (V "T")) (Scope (V (F (V "f")) :@ V (B ())))

pp not taking type annotations into account, no difference can be seen here:

>>> pp $ lam "x" $ V "f" :@ V "x"
\x . f x
>>> pp $ lam_ "x" (V "T") $ V "f" :@ V "x"
\x. f x

pp' :: PrettyAnn a => a -> IO () Source #

"pretty print" (w/ type annotations)

here the difference becomes evident:

>>> pp' $ lam "x" $ V "f" :@ V "x"
\x . f x
>>> pp' $ lam_ "x" (V "T") $ V "f" :@ V "x"
\(x: T). f x

qq :: PrettyAnn a => a -> IO () Source #

pretty print in color (wo/ type annotations)

qq' :: PrettyAnn a => a -> IO () Source #

pretty print in color (w/ type annotations)

pps :: Pretty a => a -> String Source #

pp2 :: Pretty2 a => a -> IO () Source #

"pretty print" (taking capture avoiding substitution into account)

cc :: PrettyCode a => a -> IO () Source #

cc: pretty print code in color, aka "color code"

very experimental (and only for OldSyntax/OldPretty so far), yet to be refined