Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Doc ann
- class Pretty a where
- pretty :: a -> Doc ann
- prettyList :: [a] -> Doc ann
- class PrettyBy config a where
- prettyBy :: config -> a -> Doc ann
- prettyListBy :: config -> [a] -> Doc ann
- newtype IgnorePrettyConfig a = IgnorePrettyConfig {
- unIgnorePrettyConfig :: a
- data AttachPrettyConfig config a = AttachPrettyConfig !config !a
- class Render str where
- type PrettyParens = PrettyBy RenderContext
- display :: forall str a. (Pretty a, Render str) => a -> str
- displayBy :: forall str a config. (PrettyBy config a, Render str) => config -> a -> str
- juxtRenderContext :: RenderContext
- prettyPlc :: PrettyPlc a => a -> Doc ann
- displayPlc :: (PrettyPlc a, Render str) => a -> str
- prettyPlcSimple :: PrettyPlc a => a -> Doc ann
- displayPlcSimple :: (PrettyPlc a, Render str) => a -> str
- data CondensedErrors
- type DefaultPrettyPlcStrategy a = (PrettyClassic a, PrettyReadable a)
- newtype PrettyConfigPlcOptions = PrettyConfigPlcOptions {}
- data PrettyConfigPlcStrategy
- data PrettyConfigPlc = PrettyConfigPlc {}
- type PrettyPlc = PrettyBy PrettyConfigPlc
- prettyConfigPlcOptions :: PrettyConfigPlcOptions
- prettyConfigPlcClassic :: PrettyConfigPlcOptions -> PrettyConfigPlc
- prettyConfigPlcClassicSimple :: PrettyConfigPlcOptions -> PrettyConfigPlc
- prettyConfigPlcReadable :: PrettyConfigPlcOptions -> PrettyConfigPlc
- prettyConfigPlcReadableSimple :: PrettyConfigPlcOptions -> PrettyConfigPlc
- prettyPlcClassic :: PrettyPlc a => a -> Doc ann
- prettyPlcClassicSimple :: PrettyPlc a => a -> Doc ann
- prettyPlcReadable :: PrettyPlc a => a -> Doc ann
- prettyPlcReadableSimple :: PrettyPlc a => a -> Doc ann
- prettyPlcCondensedErrorBy :: PrettyPlc a => (PrettyConfigPlcOptions -> PrettyConfigPlc) -> a -> Doc ann
- displayPlcCondensedErrorClassic :: (PrettyPlc a, Render str) => a -> str
- newtype PrettyConfigName = PrettyConfigName {}
- class HasPrettyConfigName config where
- toPrettyConfigName :: config -> PrettyConfigName
- prettyConfigName :: PrettyConfigName
- prettyConfigNameSimple :: PrettyConfigName
- data PrettyConfigClassic configName = PrettyConfigClassic {
- _pccConfigName :: configName
- _pccDisplayAnn :: Bool
- type PrettyClassicBy configName = PrettyBy (PrettyConfigClassic configName)
- type PrettyClassic = PrettyClassicBy PrettyConfigName
- consAnnIf :: Pretty ann => PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
- prettyClassic :: PrettyClassic a => a -> Doc ann
- prettyClassicSimple :: PrettyClassic a => a -> Doc ann
- data ShowKinds
- data PrettyConfigReadable configName = PrettyConfigReadable {
- _pcrConfigName :: configName
- _pcrRenderContext :: RenderContext
- _pcrShowKinds :: ShowKinds
- prettyReadable :: PrettyReadable a => a -> Doc ann
- prettyReadableSimple :: PrettyReadable a => a -> Doc ann
- pcrConfigName :: forall configName configName. Lens (PrettyConfigReadable configName) (PrettyConfigReadable configName) configName configName
- pcrRenderContext :: forall configName. Lens' (PrettyConfigReadable configName) RenderContext
- pcrShowKinds :: forall configName. Lens' (PrettyConfigReadable configName) ShowKinds
- type PrettyReadableBy configName = PrettyBy (PrettyConfigReadable configName)
- type PrettyReadable = PrettyReadableBy PrettyConfigName
- newtype AsReadable a = AsReadable {
- unAsReadable :: a
- data Parened a = Parened {
- parenOpening :: String
- parenClosing :: String
- parenedValue :: a
- inBraces :: a -> Parened a
- topPrettyConfigReadable :: configName -> ShowKinds -> PrettyConfigReadable configName
- botPrettyConfigReadable :: configName -> ShowKinds -> PrettyConfigReadable configName
- binderFixity :: Fixity
- arrowFixity :: Fixity
- iterTyForallPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName arg, PrettyReadableBy configName body) => [arg] -> body -> m (Doc ann)
- iterLamAbsPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName arg, PrettyReadableBy configName body) => [arg] -> body -> m (Doc ann)
- iterTyAbsPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName arg, PrettyReadableBy configName body) => [arg] -> body -> m (Doc ann)
- iterArrowPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName a) => [a] -> a -> m (Doc ann)
- iterAppDocM :: MonadPrettyContext config env m => (AnyToDoc config ann -> AnyToDoc config ann -> NonEmpty (Doc ann)) -> m (Doc ann)
- iterInterAppPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName fun, PrettyReadableBy configName ty, PrettyReadableBy configName term) => fun -> [Either ty term] -> m (Doc ann)
- iterAppPrettyM :: (MonadPrettyContext config env m, PrettyBy config fun, PrettyBy config term) => fun -> [term] -> m (Doc ann)
- prettyBytes :: ByteString -> Doc ann
- newtype ConstConfig = ConstConfig {
- unConstConfig :: RenderContext
- type PrettyConst = PrettyBy ConstConfig
- type PrettyUni uni = (PrettyParens (SomeTypeIn uni), Closed uni, uni `Everywhere` PrettyConst)
- type ThrowableBuiltins uni fun = (PrettyUni uni, Pretty fun, Typeable uni, Typeable fun)
- prettyConst :: PrettyConst a => RenderContext -> a -> Doc ann
Basic types and functions
Instances
Instances
class PrettyBy config a where #
Nothing
Instances
newtype IgnorePrettyConfig a #
Instances
Pretty a => PrettyBy config (IgnorePrettyConfig a) | |
Defined in Text.PrettyBy.Internal prettyBy :: config -> IgnorePrettyConfig a -> Doc ann # prettyListBy :: config -> [IgnorePrettyConfig a] -> Doc ann # |
data AttachPrettyConfig config a #
AttachPrettyConfig !config !a |
Instances
PrettyBy config a => Pretty (AttachPrettyConfig config a) | |
Defined in Text.PrettyBy.Internal pretty :: AttachPrettyConfig config a -> Doc ann # prettyList :: [AttachPrettyConfig config a] -> Doc ann # |
type PrettyParens = PrettyBy RenderContext Source #
For pretty-printing a value with a minimum amount of parens.
juxtRenderContext :: RenderContext Source #
An initial RenderContextOver
.
An expression printed in this context gets enclosed in parens unless its outermost operator (if
any) binds even stronger than function application.
Defaults
prettyPlc :: PrettyPlc a => a -> Doc ann Source #
Pretty-print a value in the default mode using the classic view.
displayPlc :: (PrettyPlc a, Render str) => a -> str Source #
Render a value to String
in the default mode using the classic view.
prettyPlcSimple :: PrettyPlc a => a -> Doc ann Source #
Pretty-print a value in the debug mode using the classic view.
displayPlcSimple :: (PrettyPlc a, Render str) => a -> str Source #
Render a value to String
in the debug mode using the classic view.
Global configuration
data CondensedErrors Source #
Whether to pretty-print PLC errors in full or with some information omitted.
Instances
Show CondensedErrors Source # | |
Defined in PlutusCore.Pretty.Plc | |
Eq CondensedErrors Source # | |
Defined in PlutusCore.Pretty.Plc (==) :: CondensedErrors -> CondensedErrors -> Bool Source # (/=) :: CondensedErrors -> CondensedErrors -> Bool Source # |
type DefaultPrettyPlcStrategy a = (PrettyClassic a, PrettyReadable a) Source #
A constraint that allows to derive PrettyBy PrettyConfigPlc
instances, see below.
newtype PrettyConfigPlcOptions Source #
Options for pretty-printing PLC entities.
Instances
Show PrettyConfigPlcOptions Source # | |
Defined in PlutusCore.Pretty.Plc |
data PrettyConfigPlcStrategy Source #
Strategy for pretty-printing PLC entities.
PrettyConfigPlcClassic (PrettyConfigClassic PrettyConfigName) | |
PrettyConfigPlcReadable (PrettyConfigReadable PrettyConfigName) |
Instances
Show PrettyConfigPlcStrategy Source # | |
Defined in PlutusCore.Pretty.Plc | |
HasPrettyConfigName PrettyConfigPlcStrategy Source # | |
Defined in PlutusCore.Pretty.Plc | |
DefaultPrettyPlcStrategy a => PrettyBy PrettyConfigPlcStrategy (PrettyAny a) Source # | |
Defined in PlutusCore.Pretty.Plc prettyBy :: PrettyConfigPlcStrategy -> PrettyAny a -> Doc ann # prettyListBy :: PrettyConfigPlcStrategy -> [PrettyAny a] -> Doc ann # |
data PrettyConfigPlc Source #
Global configuration used for pretty-printing PLC entities.
Instances
type PrettyPlc = PrettyBy PrettyConfigPlc Source #
The "pretty-printable PLC entity" constraint.
prettyConfigPlcOptions :: PrettyConfigPlcOptions Source #
The PrettyConfigPlcOptions
used by default:
print errors in full.
prettyConfigPlcClassic :: PrettyConfigPlcOptions -> PrettyConfigPlc Source #
The PrettyConfigPlc
used by default:
use the classic view and print neither Unique
s, nor name attachments.
prettyConfigPlcClassicSimple :: PrettyConfigPlcOptions -> PrettyConfigPlc Source #
The PrettyConfigPlc
used for debugging:
use the classic view and print Unique
s, but not name attachments.
prettyConfigPlcReadable :: PrettyConfigPlcOptions -> PrettyConfigPlc Source #
The PrettyConfigPlc
used by default and for readability:
use the refined view and print Unique
s but not name attachments.
prettyConfigPlcReadableSimple :: PrettyConfigPlcOptions -> PrettyConfigPlc Source #
The PrettyConfigPlc
used for debugging and readability:
use the refined view and print neither Unique
s nor name attachments.
Custom functions for PLC types.
prettyPlcClassic :: PrettyPlc a => a -> Doc ann Source #
Pretty-print a PLC value in the default mode using the classic view.
prettyPlcClassicSimple :: PrettyPlc a => a -> Doc ann Source #
Pretty-print a PLC value without unique indices using the classic view.
prettyPlcReadable :: PrettyPlc a => a -> Doc ann Source #
Pretty-print a PLC value in the default mode using the readable view.
prettyPlcReadableSimple :: PrettyPlc a => a -> Doc ann Source #
Pretty-print a PLC value without unique indices using the readable view.
prettyPlcCondensedErrorBy :: PrettyPlc a => (PrettyConfigPlcOptions -> PrettyConfigPlc) -> a -> Doc ann Source #
Pretty-print a PLC value using the condensed way (see CondensedErrors
)
of pretty-printing PLC errors (in case there are any).
displayPlcCondensedErrorClassic :: (PrettyPlc a, Render str) => a -> str Source #
Render an error to String
in the condensed manner using the classic view.
Names
newtype PrettyConfigName Source #
A config that determines how to pretty-print a PLC name.
PrettyConfigName | |
|
Instances
class HasPrettyConfigName config where Source #
A class of configs from which a PrettyConfigName
can be extracted.
toPrettyConfigName :: config -> PrettyConfigName Source #
Instances
HasPrettyConfigName PrettyConfigPlc Source # | |
Defined in PlutusCore.Pretty.Plc | |
HasPrettyConfigName PrettyConfigPlcStrategy Source # | |
Defined in PlutusCore.Pretty.Plc | |
configName ~ PrettyConfigName => HasPrettyConfigName (PrettyConfigClassic configName) Source # | |
Defined in PlutusCore.Pretty.Classic toPrettyConfigName :: PrettyConfigClassic configName -> PrettyConfigName Source # | |
configName ~ PrettyConfigName => HasPrettyConfigName (PrettyConfigReadable configName) Source # | |
Defined in PlutusCore.Pretty.Readable toPrettyConfigName :: PrettyConfigReadable configName -> PrettyConfigName Source # | |
HasPrettyConfigName (Sole PrettyConfigName) Source # | |
Defined in PlutusCore.Pretty.ConfigName toPrettyConfigName :: Sole PrettyConfigName -> PrettyConfigName Source # |
prettyConfigName :: PrettyConfigName Source #
The PrettyConfigName
used by default: print Unique
indexes after nams.
prettyConfigNameSimple :: PrettyConfigName Source #
The PrettyConfigName
to be used when Unique
indices don't matter. Easier to read.
Classic view
data PrettyConfigClassic configName Source #
Configuration for the classic pretty-printing.
PrettyConfigClassic | |
|
Instances
type PrettyClassicBy configName = PrettyBy (PrettyConfigClassic configName) Source #
The "classically pretty-printable" constraint.
consAnnIf :: Pretty ann => PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann] Source #
Add a pretty-printed annotation to a list of Doc
s if the given config enables pretty-printing
of annotations.
prettyClassic :: PrettyClassic a => a -> Doc ann Source #
Pretty-print a value in the default mode using the classic view.
prettyClassicSimple :: PrettyClassic a => a -> Doc ann Source #
Pretty-print a value in the simple mode using the classic view.
Readable view
data PrettyConfigReadable configName Source #
Configuration for the readable pretty-printing.
PrettyConfigReadable | |
|
Instances
prettyReadable :: PrettyReadable a => a -> Doc ann Source #
Pretty-print something with the PrettyConfigReadable
config.
prettyReadableSimple :: PrettyReadable a => a -> Doc ann Source #
Pretty-print something with the PrettyConfigReadableSimple
config.
pcrConfigName :: forall configName configName. Lens (PrettyConfigReadable configName) (PrettyConfigReadable configName) configName configName Source #
pcrRenderContext :: forall configName. Lens' (PrettyConfigReadable configName) RenderContext Source #
pcrShowKinds :: forall configName. Lens' (PrettyConfigReadable configName) ShowKinds Source #
type PrettyReadableBy configName = PrettyBy (PrettyConfigReadable configName) Source #
The "readably pretty-printable" constraint.
newtype AsReadable a Source #
For rendering things in a readable manner regardless of the pretty-printing function chosen.
I.e. all of show
, pretty
, prettyClassic
will use PrettyReadable
instead of doing what
they normally do. prettyBy config (AsReadable x)
requires config
to have a PrettyConfigName
and respects it.
This wrapper can be particularly useful if you want to apply a function having a Show
or
Pretty
or PrettyClassic
or PrettyPlc
or whatever constraint, but want to get the argument
rendered in a readable manner instead.
AsReadable | |
|
Instances
(HasPrettyConfigName config, PrettyReadable a) => DefaultPrettyBy config (AsReadable a) Source # | |
Defined in PlutusCore.Pretty.Readable defaultPrettyBy :: config -> AsReadable a -> Doc ann defaultPrettyListBy :: config -> [AsReadable a] -> Doc ann | |
PrettyDefaultBy config (AsReadable a) => PrettyBy config (AsReadable a) Source # | |
Defined in PlutusCore.Pretty.Readable prettyBy :: config -> AsReadable a -> Doc ann # prettyListBy :: config -> [AsReadable a] -> Doc ann # | |
PrettyReadable a => Show (AsReadable a) Source # | |
Defined in PlutusCore.Pretty.Readable | |
PrettyReadable a => Pretty (AsReadable a) Source # | |
Defined in PlutusCore.Pretty.Readable pretty :: AsReadable a -> Doc ann # prettyList :: [AsReadable a] -> Doc ann # |
A value of type a
to render in parens using the readable pretty-printer.
Parened | |
|
Instances
PrettyReadableBy configName a => PrettyBy (PrettyConfigReadable configName) (Parened a) Source # | |
Defined in PlutusCore.Pretty.Readable prettyBy :: PrettyConfigReadable configName -> Parened a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Parened a] -> Doc ann # |
inBraces :: a -> Parened a Source #
Enclose the given value, so that it's rendered inside of braces with no additional parens
regardless of the RenderContextOver
.
topPrettyConfigReadable :: configName -> ShowKinds -> PrettyConfigReadable configName Source #
A PrettyConfigReadable
with the fixity specified to topFixity
.
botPrettyConfigReadable :: configName -> ShowKinds -> PrettyConfigReadable configName Source #
A PrettyConfigReadable
with the fixity specified to botFixity
.
binderFixity :: Fixity Source #
The fixity of a binder.
arrowFixity :: Fixity Source #
The fixity of (->)
.
iterTyForallPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName arg, PrettyReadableBy configName body) => [arg] -> body -> m (Doc ann) Source #
Lay out an iterated TyForall
via iterBinderPrettyM
.
iterLamAbsPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName arg, PrettyReadableBy configName body) => [arg] -> body -> m (Doc ann) Source #
Lay out an iterated LamAbs
via iterBinderPrettyM
.
iterTyAbsPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName arg, PrettyReadableBy configName body) => [arg] -> body -> m (Doc ann) Source #
Lay out an iterated TyAbs
via iterBinderPrettyM
.
iterArrowPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName a) => [a] -> a -> m (Doc ann) Source #
Lay out an iterated ->
.
iterAppDocM :: MonadPrettyContext config env m => (AnyToDoc config ann -> AnyToDoc config ann -> NonEmpty (Doc ann)) -> m (Doc ann) Source #
Lay out an iteration application, providing to the caller a function to render the head of the application and a function to render each of the arguments.
iterInterAppPrettyM :: (MonadPrettyReadable configName env m, PrettyReadableBy configName fun, PrettyReadableBy configName ty, PrettyReadableBy configName term) => fun -> [Either ty term] -> m (Doc ann) Source #
iterAppPrettyM :: (MonadPrettyContext config env m, PrettyBy config fun, PrettyBy config term) => fun -> [term] -> m (Doc ann) Source #
Lay out iterated function applications either as
foo x y z
or as
foo x y z
Utils
prettyBytes :: ByteString -> Doc ann Source #
newtype ConstConfig Source #
The type of configs used for pretty-printing constants. Has a RenderContextOver
inside, so that
we don't add redundant parens to the output.
ConstConfig | |
|
Instances
type PrettyConst = PrettyBy ConstConfig Source #
type PrettyUni uni = (PrettyParens (SomeTypeIn uni), Closed uni, uni `Everywhere` PrettyConst) Source #
The set of constraints we need to be able to print built-in types and their values.
type ThrowableBuiltins uni fun = (PrettyUni uni, Pretty fun, Typeable uni, Typeable fun) Source #
The set of constraints we need to be able to throw exceptions with things with built-in types and functions in them.
prettyConst :: PrettyConst a => RenderContext -> a -> Doc ann Source #