| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusCore.Pretty
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 Text.PrettyBy.Fixity
Basic types and functions
The abstract data type represents pretty documents that have
been annotated with data of type Doc annann.
More specifically, a value of type represents a non-empty set of
possible layouts of a document. The layout functions select one of these
possibilities, taking into account things like the width of the output
document.Doc
The annotation is an arbitrary piece of data associated with (part of) a document. Annotations may be used by the rendering backends in order to display output differently, such as
- color information (e.g. when rendering to the terminal)
- mouseover text (e.g. when rendering to rich HTML)
- whether to show something or not (to allow simple or detailed versions)
The simplest way to display a Doc is via the Show class.
>>>putStrLn (show (vsep ["hello", "world"]))hello world
Instances
| Functor Doc | Alter the document’s annotations. This instance makes |
| IsString (Doc ann) |
This instance uses the
|
Defined in hcat [x, y]
| |
Defined in defaultLayoutOptions, ignoring all annotations. | |
Defined in Text)) PageWidth -> Doc ann)))) :+: (C1 ('MetaCons "Nesting" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Int -> Doc ann))) :+: C1 ('MetaCons "Annotated" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann))))))) | |
Minimal complete definition
Methods
>>>pretty 1 <+> pretty "hello" <+> pretty 1.2341 hello 1.234
prettyList :: [a] -> Doc ann #
is only used to define the prettyListinstance
. In normal circumstances only the Pretty a => Pretty [a]
function is used.pretty
>>>prettyList [1, 23, 456][1, 23, 456]
Instances
| Pretty Void | Finding a good example for printing something that does not exist is hard, so here is an example of printing a list full of nothing.
| |
Defined in Text | Automatically converts all newlines to
Note that
| |
| Pretty Prettyprinter.Internal | ||
| Pretty Integer |
| |
Defined in Prettyprinter.Internal | ||
| Pretty () |
The argument is not used:
| |
Defined in Prettyprinter.Internal | ||
| Pretty Bool |
| |
Defined in line as a more readable alternative.
| ||
Defined in Prettyprinter.Internal | ||
| Pretty Double |
| |
Defined in Prettyprinter.Internal | ||
| Pretty Float |
| |
Defined in Prettyprinter.Internal | ||
| Pretty Int |
| |
Defined in Prettyprinter.Internal | ||
| Pretty a => Pretty (Identity a) |
| |
Defined in Prettyprinter.Internal | ||
| Pretty a => Pretty (Spine a) # |
| |
Defined in PlutusCore.Builtin.KnownType | ||
| Pretty (BuiltinSemanticsVariant DefaultFun) # | ||
Defined in PlutusCore.Default.Builtins Methods pretty :: BuiltinSemanticsVariant DefaultFun -> Doc ann # prettyList :: [BuiltinSemanticsVariant DefaultFun] -> Doc ann # | ||
| Pretty ann => Pretty (Kind ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Default | ||
| Pretty a => Pretty (Normalized a) # | ||
Defined in PlutusCore.Core.Type | ||
| Pretty (DefaultUni a) # | This always pretty-prints parens around type applications (e.g. | |
Defined in PlutusCore.Default.Universe | ||
| Pretty ann => Pretty (UniqueError ann) # | ||
Defined in PlutusCore.Error | ||
| PrettyClassic a => Pretty (EvaluationResult a) # | ||
Defined in PlutusCore.Evaluation.Result | ||
| PrettyReadable a => Pretty (AsReadable a) # | ||
Defined in PlutusCore.Pretty.Readable | ||
| Pretty (SomeTypeIn DefaultUni) # | ||
Defined in PlutusCore.Default.Universe Methods pretty :: SomeTypeIn DefaultUni -> Doc ann # prettyList :: [SomeTypeIn DefaultUni] -> Doc ann # | ||
| Pretty (SomeTypeIn uni) => Pretty (SomeTypeIn (Kinded uni)) # | ||
Defined in PlutusCore.Pretty.PrettyConst Methods pretty :: SomeTypeIn (Kinded uni) -> Doc ann # prettyList :: [SomeTypeIn (Kinded uni)] -> Doc ann # | ||
| (Show fun, Ord fun) => Pretty (CekExTally fun) # | ||
| (Show fun, Ord fun) => Pretty (TallyingSt fun) # | ||
| Show fun => Pretty (ExBudgetCategory fun) # | ||
| Pretty a => Pretty (Maybe a) | Ignore
| |
Defined in Prettyprinter.Internal | ||
| Pretty a => Pretty [a] |
| |
Defined in AttachDefaultPrettyConfig config a] -> Doc ann # | ||
| PrettyBy config a => Pretty (AttachPrettyConfig config a) |
| |
Defined in Text.PrettyBy.Internal Methods pretty :: AttachPrettyConfig config a -> Doc ann # prettyList :: [AttachPrettyConfig config a] -> Doc ann # | ||
| (Closed uni, Everywhere uni PrettyConst) => Pretty (Some (ValueOf uni)) # | ||
| (Pretty a1, Pretty a2) => Pretty (a1, a2) |
| |
Defined in Prettyprinter.Internal | ||
| (Pretty err, Pretty a, Pretty b) => Pretty (HeadSpine err a b) # |
| |
Defined in PlutusCore.Builtin.KnownType | ||
| (PrettyClassic tyname, PrettyParens (SomeTypeIn uni), Pretty ann) => Pretty (Type tyname uni ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Default | ||
| Pretty (CekState uni fun ann) # | ||
| (Pretty a1, Pretty a2, Pretty a3) => Pretty (a1, a2, a3) |
| |
Defined in Prettyprinter.Internal | ||
| (PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) => Pretty (Program name uni fun ann) # | ||
| (PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) => Pretty (Term name uni fun ann) # | ||
| (PrettyClassic tyname, PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) => Pretty (Program tyname name uni fun ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Default | ||
| (PrettyClassic tyname, PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) => Pretty (Term tyname name uni fun ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Default | ||
class PrettyBy config a where #
A class for pretty-printing values in a configurable manner.
A basic example:
>>>data Case = UpperCase | LowerCase>>>data D = D>>>instance PrettyBy Case D where prettyBy UpperCase D = "D"; prettyBy LowerCase D = "d">>>prettyBy UpperCase DD>>>prettyBy LowerCase Dd
The library provides instances for common types like Integer or Bool, so you can't define
your own PrettyBy SomeConfig Integer instance. And for the same reason you should not define
instances like PrettyBy SomeAnotherConfig a for universally quantified a, because such an
instance would overlap with the existing ones. Take for example
>>>data ViaShow = ViaShow>>>instance Show a => PrettyBy ViaShow a where prettyBy ViaShow = pretty . show
with such an instance prettyBy ViaShow (1 :: Int) throws an error about overlapping instances:
• Overlapping instances for PrettyBy ViaShow Int
arising from a use of ‘prettyBy’
Matching instances:
instance PrettyDefaultBy config Int => PrettyBy config Int
instance [safe] Show a => PrettyBy ViaShow aThere's a newtype provided specifically for the purpose of defining a PrettyBy instance for
any a: PrettyAny. Read its docs for details on when you might want to use it.
The PrettyBy instance for common types is defined in a way that allows to override default
pretty-printing behaviour, read the docs of HasPrettyDefaults for details.
Minimal complete definition
Nothing
Methods
prettyBy :: config -> a -> Doc ann #
Pretty-print a value of type a the way a config specifies it.
The default implementation of prettyBy is in terms of pretty, defaultPrettyFunctorBy
or defaultPrettyBifunctorBy depending on the kind of the data type that you're providing
an instance for. For example, the default implementation of prettyBy for a monomorphic type
is going to be "ignore the config and call pretty over the value":
>>>newtype N = N Int deriving newtype (Pretty)>>>instance PrettyBy () N>>>prettyBy () (N 42)42
The default implementation of prettyBy for a Functor is going to be in terms of
defaultPrettyFunctorBy:
>>>newtype N a = N a deriving stock (Functor) deriving newtype (Pretty)>>>instance PrettyBy () a => PrettyBy () (N a)>>>prettyBy () (N (42 :: Int))42
It's fine for the data type to have a phantom parameter as long as the data type is still a
defaultPrettyFunctorBy is used
again:
>>>newtype N a = N Int deriving stock (Functor) deriving newtype (Pretty)>>>instance PrettyBy () (N b)>>>prettyBy () (N 42)42
If the data type has a single parameter of any other kind, then it's not a functor and so
like in the monomorphic case pretty is used:
>>>newtype N (b :: Bool) = N Int deriving newtype (Pretty)>>>instance PrettyBy () (N b)>>>prettyBy () (N 42)42
Same applies to a data type with two parameters: if both the parameters are of kind Type,
then the data type is assumed to be a defaultPrettyBifunctorBy is
used. If the right parameter is of kind Type and the left parameter is of any other kind,
then we fallback to assuming the data type is a Functor and defining prettyBy as
defaultPrettyFunctorBy. If both the parameters are not of kind Type, we fallback to
implementing prettyBy in terms of pretty like in the monomorphic case.
Note that in all those cases a Pretty instance for the data type has to already exist,
so that we can derive a PrettyBy one in terms of it. If it doesn't exist or if your data
type is not supported (for example, if it has three or more parameters of kind Type), then
you'll need to provide the implementation manually.
prettyListBy :: config -> [a] -> Doc ann #
prettyListBy is used to define the default PrettyBy instance for [a] and NonEmpty a.
In normal circumstances only the prettyBy function is used.
The default implementation of prettyListBy is in terms of defaultPrettyFunctorBy.
Instances
| PrettyBy PrettyConfigPlc DefaultFun # | ||
Defined in PlutusCore.Default.Builtins Methods prettyBy :: PrettyConfigPlc -> DefaultFun -> Doc ann # prettyListBy :: PrettyConfigPlc -> [DefaultFun] -> Doc ann # | ||
| PrettyBy ConstConfig ByteString # | ||
Defined in PlutusCore.Pretty.PrettyConst Methods prettyBy :: ConstConfig -> ByteString -> Doc ann # prettyListBy :: ConstConfig -> [ByteString] -> Doc ann # | ||
| PrettyBy ConstConfig Element # | ||
Defined in PlutusCore.Crypto.BLS12_381.G1 Methods prettyBy :: ConstConfig -> Element -> Doc ann # prettyListBy :: ConstConfig -> [Element] -> Doc ann # | ||
| PrettyBy ConstConfig Element # | ||
Defined in PlutusCore.Crypto.BLS12_381.G2 Methods prettyBy :: ConstConfig -> Element -> Doc ann # prettyListBy :: ConstConfig -> [Element] -> Doc ann # | ||
| PrettyBy ConstConfig MlResult # | ||
Defined in PlutusCore.Crypto.BLS12_381.Pairing Methods prettyBy :: ConstConfig -> MlResult -> Doc ann # prettyListBy :: ConstConfig -> [MlResult] -> Doc ann # | ||
| PrettyBy ConstConfig Data # | ||
Defined in PlutusCore.Pretty.PrettyConst Methods prettyBy :: ConstConfig -> Data -> Doc ann # prettyListBy :: ConstConfig -> [Data] -> Doc ann # | ||
| PrettyBy ConstConfig K # | ||
Defined in PlutusCore.Pretty.PrettyConst | ||
| PrettyBy ConstConfig Quantity # | ||
Defined in PlutusCore.Pretty.PrettyConst Methods prettyBy :: ConstConfig -> Quantity -> Doc ann # prettyListBy :: ConstConfig -> [Quantity] -> Doc ann # | ||
| PrettyBy ConstConfig Value # | ||
Defined in PlutusCore.Pretty.PrettyConst Methods prettyBy :: ConstConfig -> Value -> Doc ann # prettyListBy :: ConstConfig -> [Value] -> Doc ann # | ||
| PrettyDefaultBy config Void => PrettyBy config Void |
| |
Defined in Text | Automatically converts all newlines to
| |
| PrettyDefaultBy config Text.PrettyBy.Internal | ||
| PrettyDefaultBy config Integer => PrettyBy config Integer |
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config Natural => PrettyBy config Natural |
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config () => PrettyBy config () |
The argument is not used:
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config Bool => PrettyBy config Bool |
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config Char => PrettyBy config Char | By default a
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config Double => PrettyBy config Double |
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config Float => PrettyBy config Float |
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config Int => PrettyBy config Int |
| |
Defined in RenderContext -> [SomeTypeIn DefaultUni] -> Doc ann # | ||
| PrettyDefaultBy config (Identity a) => PrettyBy config (Identity a) |
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config (NonEmpty a) => PrettyBy config (NonEmpty a) |
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config (Set a) => PrettyBy config (Set a) # | ||
Defined in PlutusCore.Pretty.Extra | ||
| PrettyDefaultBy config (Spine a) => PrettyBy config (Spine a) # | ||
Defined in PlutusCore.Builtin.KnownType | ||
| PrettyBy config (t NameAnn) => PrettyBy config (ScopeCheckError t) # | ||
Defined in PlutusCore.Check.Scoping Methods prettyBy :: config -> ScopeCheckError t -> Doc ann # prettyListBy :: config -> [ScopeCheckError t] -> Doc ann # | ||
| PrettyBy config a => PrettyBy config (Normalized a) # | ||
Defined in PlutusCore.Core.Type Methods prettyBy :: config -> Normalized a -> Doc ann # prettyListBy :: config -> [Normalized a] -> Doc ann # | ||
| (HasPrettyDefaults config ~ 'True, Pretty fun) => PrettyBy config (MachineError fun) # | ||
Defined in PlutusCore.Evaluation.Machine.Exception Methods prettyBy :: config -> MachineError fun -> Doc ann # prettyListBy :: config -> [MachineError fun] -> Doc ann # | ||
| PrettyBy config a => PrettyBy config (EvaluationResult a) # | ||
Defined in PlutusCore.Evaluation.Result Methods prettyBy :: config -> EvaluationResult a -> Doc ann # prettyListBy :: config -> [EvaluationResult a] -> Doc ann # | ||
| PrettyDefaultBy config (AsReadable a) => PrettyBy config (AsReadable a) # | ||
Defined in PlutusCore.Pretty.Readable Methods prettyBy :: config -> AsReadable a -> Doc ann # prettyListBy :: config -> [AsReadable a] -> Doc ann # | ||
| (Show fun, Ord fun) => PrettyBy config (CekExTally fun) # | ||
Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode Methods prettyBy :: config -> CekExTally fun -> Doc ann # prettyListBy :: config -> [CekExTally fun] -> Doc ann # | ||
| (Show fun, Ord fun) => PrettyBy config (TallyingSt fun) # | ||
Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode Methods prettyBy :: config -> TallyingSt fun -> Doc ann # prettyListBy :: config -> [TallyingSt fun] -> Doc ann # | ||
| Pretty a => PrettyBy config (IgnorePrettyConfig a) |
| |
| PrettyDefaultBy config (Maybe a) => PrettyBy config (Maybe a) | By default a
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config [a] => PrettyBy config [a] |
| |
Defined in Text.PrettyBy.Internal | ||
| (PrettyUni uni, Pretty fun) => PrettyBy PrettyConfigPlc (CkValue uni fun) # | ||
Defined in PlutusCore.Evaluation.Machine.Ck Methods prettyBy :: PrettyConfigPlc -> CkValue uni fun -> Doc ann # prettyListBy :: PrettyConfigPlc -> [CkValue uni fun] -> Doc ann # | ||
| (PrettyUni uni, Pretty fun) => PrettyBy PrettyConfigPlc (DischargeResult uni fun) # | ||
Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal Methods prettyBy :: PrettyConfigPlc -> DischargeResult uni fun -> Doc ann # prettyListBy :: PrettyConfigPlc -> [DischargeResult uni fun] -> Doc ann # | ||
| (Closed uni, Everywhere uni PrettyConst) => PrettyBy ConstConfig (ValueOf uni a) # | ||
Defined in PlutusCore.Pretty.PrettyConst Methods prettyBy :: ConstConfig -> ValueOf uni a -> Doc ann # prettyListBy :: ConstConfig -> [ValueOf uni a] -> Doc ann # | ||
| (Closed uni, Everywhere uni PrettyConst) => PrettyBy ConstConfig (Some (ValueOf uni)) # | ||
Defined in PlutusCore.Pretty.PrettyConst Methods prettyBy :: ConstConfig -> Some (ValueOf uni) -> Doc ann # prettyListBy :: ConstConfig -> [Some (ValueOf uni)] -> Doc ann # | ||
| PrettyDefaultBy config (Either a b) => PrettyBy config (Either a b) # | An instance extending the set of types supporting default pretty-printing with | |
Defined in PlutusPrelude | ||
| PrettyDefaultBy config (Map k v) => PrettyBy config (Map k v) # | ||
Defined in PlutusCore.Pretty.Extra | ||
| (HasPrettyDefaults config ~ 'True, PrettyBy config structural, Pretty operational) => PrettyBy config (EvaluationError structural operational) # | ||
Defined in PlutusCore.Evaluation.Error Methods prettyBy :: config -> EvaluationError structural operational -> Doc ann # prettyListBy :: config -> [EvaluationError structural operational] -> Doc ann # | ||
| (PrettyBy config cause, PrettyBy config err) => PrettyBy config (ErrorWithCause err cause) # | ||
Defined in PlutusCore.Evaluation.ErrorWithCause Methods prettyBy :: config -> ErrorWithCause err cause -> Doc ann # prettyListBy :: config -> [ErrorWithCause err cause] -> Doc ann # | ||
| PrettyDefaultBy config (a, b) => PrettyBy config (a, b) |
| |
Defined in Text.PrettyBy.Internal | ||
| DefaultPrettyPlcStrategy (Type tyname uni ann) => PrettyBy PrettyConfigPlc (Type tyname uni ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Plc Methods prettyBy :: PrettyConfigPlc -> Type tyname uni ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Type tyname uni ann] -> Doc ann0 # | ||
| (PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy PrettyConfigPlc (Error uni fun ann) # | ||
Defined in PlutusCore.Error Methods prettyBy :: PrettyConfigPlc -> Error uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Error uni fun ann] -> Doc ann0 # | ||
| (PrettyUni uni, Pretty fun) => PrettyBy PrettyConfigPlc (CekValue uni fun ann) # | ||
Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal Methods prettyBy :: PrettyConfigPlc -> CekValue uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [CekValue uni fun ann] -> Doc ann0 # | ||
| PrettyDefaultBy config (Const a b) => PrettyBy config (Const a b) | Non-polykinded, because
| |
Defined in Text.PrettyBy.Internal | ||
| PrettyDefaultBy config (HeadSpine err a b) => PrettyBy config (HeadSpine err a b) # | ||
Defined in PlutusCore.Builtin.KnownType | ||
| PrettyDefaultBy config (a, b, c) => PrettyBy config (a, b, c) |
| |
Defined in Text.PrettyBy.Internal | ||
| (Pretty term, PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy PrettyConfigPlc (TypeError term uni fun ann) # | ||
Defined in PlutusCore.Error Methods prettyBy :: PrettyConfigPlc -> TypeError term uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [TypeError term uni fun ann] -> Doc ann0 # | ||
| DefaultPrettyPlcStrategy (UnrestrictedProgram name uni fun ann) => PrettyBy PrettyConfigPlc (UnrestrictedProgram name uni fun ann) # | ||
Defined in UntypedPlutusCore.Core.Instance.Flat Methods prettyBy :: PrettyConfigPlc -> UnrestrictedProgram name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [UnrestrictedProgram name uni fun ann] -> Doc ann0 # | ||
| DefaultPrettyPlcStrategy (Program name uni fun ann) => PrettyBy PrettyConfigPlc (Program name uni fun ann) # | ||
Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc Methods prettyBy :: PrettyConfigPlc -> Program name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Program name uni fun ann] -> Doc ann0 # | ||
| DefaultPrettyPlcStrategy (Term name uni fun ann) => PrettyBy PrettyConfigPlc (Term name uni fun ann) # | ||
Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc Methods prettyBy :: PrettyConfigPlc -> Term name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Term name uni fun ann] -> Doc ann0 # | ||
| PrettyBy config (Term name uni fun a) => PrettyBy config (EvalOrder name uni fun a) # | ||
Defined in UntypedPlutusCore.Purity | ||
| PrettyBy config (Term name uni fun a) => PrettyBy config (EvalTerm name uni fun a) # | ||
Defined in UntypedPlutusCore.Purity | ||
| DefaultPrettyPlcStrategy (Program tyname name uni fun ann) => PrettyBy PrettyConfigPlc (Program tyname name uni fun ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Plc Methods prettyBy :: PrettyConfigPlc -> Program tyname name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Program tyname name uni fun ann] -> Doc ann0 # | ||
| DefaultPrettyPlcStrategy (Term tyname name uni fun ann) => PrettyBy PrettyConfigPlc (Term tyname name uni fun ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Plc Methods prettyBy :: PrettyConfigPlc -> Term tyname name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Term tyname name uni fun ann] -> Doc ann0 # | ||
| (Pretty ann, PrettyBy config (Type tyname uni ann), PrettyBy config (Term tyname name uni fun ann)) => PrettyBy config (NormCheckError tyname name uni fun ann) # | ||
Defined in PlutusCore.Error Methods prettyBy :: config -> NormCheckError tyname name uni fun ann -> Doc ann0 # prettyListBy :: config -> [NormCheckError tyname name uni fun ann] -> Doc ann0 # | ||
| Pretty ann => PrettyBy (PrettyConfigClassic configName) (Kind ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Kind ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Kind ann] -> Doc ann0 # | ||
| PrettyBy (PrettyConfigReadable configName) (Kind a) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Kind a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Kind a] -> Doc ann # | ||
| PrettyReadableBy configName a => PrettyBy (PrettyConfigReadable configName) (Parened a) # | ||
Defined in PlutusCore.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Parened a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Parened a] -> Doc ann # | ||
| PrettyReadableBy configName tyname => PrettyBy (PrettyConfigReadable configName) (TyVarDecl tyname ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> TyVarDecl tyname ann -> Doc ann0 # prettyListBy :: PrettyConfigReadable configName -> [TyVarDecl tyname ann] -> Doc ann0 # | ||
| (PrettyClassicBy configName tyname, PrettyParens (SomeTypeIn uni), Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Type tyname uni ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Type tyname uni ann] -> Doc ann0 # | ||
| (PrettyReadableBy configName tyname, PrettyParens (SomeTypeIn uni)) => PrettyBy (PrettyConfigReadable configName) (Type tyname uni a) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Type tyname uni a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Type tyname uni a] -> Doc ann # | ||
| (PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy (PrettyConfigClassic PrettyConfigName) (UnrestrictedProgram name uni fun ann) # | ||
Defined in UntypedPlutusCore.Core.Instance.Flat Methods prettyBy :: PrettyConfigClassic PrettyConfigName -> UnrestrictedProgram name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic PrettyConfigName -> [UnrestrictedProgram name uni fun ann] -> Doc ann0 # | ||
| (PrettyClassicBy configName (Term name uni fun ann), Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Program name uni fun ann) # | ||
Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Program name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Program name uni fun ann] -> Doc ann0 # | ||
| (PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Term name uni fun ann) # | ||
Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Term name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Term name uni fun ann] -> Doc ann0 # | ||
| (PrettyReadable name, PrettyUni uni, Pretty fun) => PrettyBy (PrettyConfigReadable PrettyConfigName) (UnrestrictedProgram name uni fun ann) # | ||
Defined in UntypedPlutusCore.Core.Instance.Flat Methods prettyBy :: PrettyConfigReadable PrettyConfigName -> UnrestrictedProgram name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigReadable PrettyConfigName -> [UnrestrictedProgram name uni fun ann] -> Doc ann0 # | ||
| (PrettyReadableBy configName tyname, PrettyReadableBy configName name, PrettyUni uni) => PrettyBy (PrettyConfigReadable configName) (VarDecl tyname name uni ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> VarDecl tyname name uni ann -> Doc ann0 # prettyListBy :: PrettyConfigReadable configName -> [VarDecl tyname name uni ann] -> Doc ann0 # | ||
| PrettyReadableBy configName (Term name uni fun a) => PrettyBy (PrettyConfigReadable configName) (Program name uni fun a) # | ||
Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Program name uni fun a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Program name uni fun a] -> Doc ann # | ||
| (PrettyReadableBy configName name, PrettyUni uni, Pretty fun, Show configName) => PrettyBy (PrettyConfigReadable configName) (Term name uni fun a) # | ||
Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Term name uni fun a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Term name uni fun a] -> Doc ann # | ||
| (PrettyClassicBy configName (Term tyname name uni fun ann), Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Program tyname name uni fun ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Program tyname name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Program tyname name uni fun ann] -> Doc ann0 # | ||
| (PrettyClassicBy configName tyname, PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Term tyname name uni fun ann) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Term tyname name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Term tyname name uni fun ann] -> Doc ann0 # | ||
| PrettyReadableBy configName (Term tyname name uni fun a) => PrettyBy (PrettyConfigReadable configName) (Program tyname name uni fun a) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Program tyname name uni fun a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Program tyname name uni fun a] -> Doc ann # | ||
| (PrettyReadableBy configName tyname, PrettyReadableBy configName name, PrettyUni uni, Pretty fun) => PrettyBy (PrettyConfigReadable configName) (Term tyname name uni fun a) # | ||
Defined in PlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Term tyname name uni fun a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Term tyname name uni fun a] -> Doc ann # | ||
newtype IgnorePrettyConfig a #
A newtype wrapper around a whose point is to provide a PrettyBy config instance
for anything that has a Pretty instance.
Constructors
| IgnorePrettyConfig | |
Fields
| |
Instances
| Pretty a => PrettyBy config (IgnorePrettyConfig a) |
|
Defined in Text.PrettyBy.Internal Methods prettyBy :: config -> IgnorePrettyConfig a -> Doc ann # prettyListBy :: config -> [IgnorePrettyConfig a] -> Doc ann # | |
data AttachPrettyConfig config a #
A config together with some value. The point is to provide a Pretty instance
for anything that has a PrettyBy config instance.
Constructors
| AttachPrettyConfig !config !a |
Instances
prettyConfigName :: PrettyConfigName #
The PrettyConfigName used by default: print Unique indexes after nams.
prettyConfigNameSimple :: PrettyConfigName #
The PrettyConfigName to be used when Unique indices don't matter. Easier to read.
Classic view
data PrettyConfigClassic configName #
Configuration for the classic pretty-printing.
Constructors
| PrettyConfigClassic | |
Fields
| |
Instances
| Show configName => Show (PrettyConfigClassic configName) # | |
Defined in PlutusCore.Pretty.Classic Methods showsPrec :: Int -> PrettyConfigClassic configName -> ShowS # show :: PrettyConfigClassic configName -> String # showList :: [PrettyConfigClassic configName] -> ShowS # | |
| configName ~ PrettyConfigName => HasPrettyConfigName (PrettyConfigClassic configName) # | |
Defined in PlutusCore.Pretty.Classic Methods toPrettyConfigName :: PrettyConfigClassic configName -> PrettyConfigName # | |
| Pretty ann => PrettyBy (PrettyConfigClassic configName) (Kind ann) # | |
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Kind ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Kind ann] -> Doc ann0 # | |
| (PrettyClassicBy configName tyname, PrettyParens (SomeTypeIn uni), Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Type tyname uni ann) # | |
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Type tyname uni ann] -> Doc ann0 # | |
| (PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy (PrettyConfigClassic PrettyConfigName) (UnrestrictedProgram name uni fun ann) # | |
Defined in UntypedPlutusCore.Core.Instance.Flat Methods prettyBy :: PrettyConfigClassic PrettyConfigName -> UnrestrictedProgram name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic PrettyConfigName -> [UnrestrictedProgram name uni fun ann] -> Doc ann0 # | |
| (PrettyClassicBy configName (Term name uni fun ann), Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Program name uni fun ann) # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Program name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Program name uni fun ann] -> Doc ann0 # | |
| (PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Term name uni fun ann) # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Term name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Term name uni fun ann] -> Doc ann0 # | |
| (PrettyClassicBy configName (Term tyname name uni fun ann), Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Program tyname name uni fun ann) # | |
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Program tyname name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Program tyname name uni fun ann] -> Doc ann0 # | |
| (PrettyClassicBy configName tyname, PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Term tyname name uni fun ann) # | |
Defined in PlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Term tyname name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Term tyname name uni fun ann] -> Doc ann0 # | |
| type HasPrettyDefaults (PrettyConfigClassic _1) # | |
Defined in PlutusCore.Pretty.Classic | |
type PrettyClassicBy configName = PrettyBy (PrettyConfigClassic configName) #
The "classically pretty-printable" constraint.
consAnnIf :: Pretty ann => PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann] #
Add a pretty-printed annotation to a list of Docs if the given config enables pretty-printing
of annotations.
prettyClassic :: PrettyClassic a => a -> Doc ann #
Pretty-print a value in the default mode using the classic view.
prettyClassicSimple :: PrettyClassic a => a -> Doc ann #
Pretty-print a value in the simple mode using the classic view.
Readable view
Constructors
| ShowKindsYes | |
| ShowKindsNonType | |
| ShowKindsNo |
Instances
| RenderContext # pcrShowKinds :: forall configName. Lens' (PrettyConfigReadable configName) ShowKinds # type PrettyReadableBy configName = PrettyBy (PrettyConfigReadable configName) # The "readably pretty-printable" constraint. newtype AsReadable a # For rendering things in a readable manner regardless of the pretty-printing function chosen.
I.e. all of This wrapper can be particularly useful if you want to apply a function having a Constructors
Instances
A value of type Constructors
Instances
Enclose the given value, so that it's rendered inside of braces with no additional parens
regardless of the 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) # Lay out interleaved function applications either as foo {a} x {b} y zor as foo
{a}
x
{b}
y
z
Lay out iterated function applications either as foo x y z or as foo x y z UtilsprettyBytes :: RenderContext inside, so that we don't add redundant parens to the output. Constructors
type PrettyConst = PrettyBy ConstConfig # type PrettyUni uni = (PrettyParens (SomeTypeIn uni), Closed uni, uni `Everywhere` PrettyConst) # The set of constraints we need to be able to print built-in types and their values. | ||||||||||||||||||||||||||||||||||||||||||||||||