plutus-core-1.38.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Pretty

Synopsis

Basic types and functions

data Doc ann Source #

The abstract data type Doc ann represents pretty documents that have been annotated with data of type ann.

More specifically, a value of type Doc 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.

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

Instances details
Functor Doc

Alter the document’s annotations.

This instance makes Doc more flexible (because it can be used in Functor-polymorphic values), but fmap is much less readable compared to using reAnnotate in code that only works for Doc anyway. Consider using the latter when the type does not matter.

Instance details

Defined in Prettyprinter.Internal

Methods

fmap ∷ (a → b) → Doc a → Doc b Source #

(<$) ∷ a → Doc b → Doc a Source #

IsString (Doc ann)
>>> pretty ("hello\nworld")
hello
world

This instance uses the Pretty Doc instance, and uses the same newline to line conversion.

Instance details

Defined in Prettyprinter.Internal

Methods

fromStringStringDoc ann Source #

Monoid (Doc ann)
mempty = emptyDoc
mconcat = hcat
>>> mappend "hello" "world" :: Doc ann
helloworld
Instance details

Defined in Prettyprinter.Internal

Methods

memptyDoc ann Source #

mappendDoc ann → Doc ann → Doc ann Source #

mconcat ∷ [Doc ann] → Doc ann Source #

Semigroup (Doc ann)
x <> y = hcat [x, y]
>>> "hello" <> "world" :: Doc ann
helloworld
Instance details

Defined in Prettyprinter.Internal

Methods

(<>)Doc ann → Doc ann → Doc ann Source #

sconcatNonEmpty (Doc ann) → Doc ann Source #

stimesIntegral b ⇒ b → Doc ann → Doc ann Source #

Generic (Doc ann) 
Instance details

Defined in Prettyprinter.Internal

Associated Types

type Rep (Doc ann) ∷ TypeType Source #

Methods

fromDoc ann → Rep (Doc ann) x Source #

toRep (Doc ann) x → Doc ann Source #

Show (Doc ann)

(show doc) prettyprints document doc with defaultLayoutOptions, ignoring all annotations.

Instance details

Defined in Prettyprinter.Internal

Methods

showsPrecIntDoc ann → ShowS Source #

showDoc ann → String Source #

showList ∷ [Doc ann] → ShowS Source #

type Rep (Doc ann) 
Instance details

Defined in Prettyprinter.Internal

type Rep (Doc ann) = D1 ('MetaData "Doc" "Prettyprinter.Internal" "prettyprinter-1.7.1-60yVE7QePDs8FHIPsacPFF" 'False) (((C1 ('MetaCons "Fail" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "Empty" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Char" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Char)))) :+: (C1 ('MetaCons "Text" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "Line" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "FlatAlt" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)))))) :+: ((C1 ('MetaCons "Cat" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann))) :+: (C1 ('MetaCons "Nest" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann))) :+: C1 ('MetaCons "Union" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann))))) :+: ((C1 ('MetaCons "Column" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IntDoc ann))) :+: C1 ('MetaCons "WithPageWidth" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PageWidthDoc ann)))) :+: (C1 ('MetaCons "Nesting" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IntDoc ann))) :+: C1 ('MetaCons "Annotated" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)))))))

class Pretty a where Source #

Overloaded conversion to Doc.

Laws:

  1. output should be pretty. :-)

Minimal complete definition

pretty

Methods

pretty ∷ a → Doc ann Source #

>>> pretty 1 <+> pretty "hello" <+> pretty 1.234
1 hello 1.234

prettyList ∷ [a] → Doc ann Source #

prettyList is only used to define the instance Pretty a => Pretty [a]. In normal circumstances only the pretty function is used.

>>> prettyList [1, 23, 456]
[1, 23, 456]

Instances

Instances details
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.

>>> pretty ([] :: [Void])
[]
Instance details

Defined in Prettyprinter.Internal

Methods

prettyVoidDoc ann Source #

prettyList ∷ [Void] → Doc ann Source #

Pretty Int16 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyInt16Doc ann Source #

prettyList ∷ [Int16] → Doc ann Source #

Pretty Int32 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyInt32Doc ann Source #

prettyList ∷ [Int32] → Doc ann Source #

Pretty Int64 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyInt64Doc ann Source #

prettyList ∷ [Int64] → Doc ann Source #

Pretty Int8 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyInt8Doc ann Source #

prettyList ∷ [Int8] → Doc ann Source #

Pretty Word16 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyWord16Doc ann Source #

prettyList ∷ [Word16] → Doc ann Source #

Pretty Word32 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyWord32Doc ann Source #

prettyList ∷ [Word32] → Doc ann Source #

Pretty Word64 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyWord64Doc ann Source #

prettyList ∷ [Word64] → Doc ann Source #

Pretty Word8 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyWord8Doc ann Source #

prettyList ∷ [Word8] → Doc ann Source #

Pretty SourcePos Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettySourcePosDoc ann Source #

prettyList ∷ [SourcePos] → Doc ann Source #

Pretty DeserialiseFailureInfo Source # 
Instance details

Defined in Codec.Extras.SerialiseViaFlat

Pretty DeserialiseFailureReason Source # 
Instance details

Defined in Codec.Extras.SerialiseViaFlat

Pretty Ann Source # 
Instance details

Defined in PlutusCore.Annotation

Methods

prettyAnnDoc ann Source #

prettyList ∷ [Ann] → Doc ann Source #

Pretty SrcSpan Source # 
Instance details

Defined in PlutusCore.Annotation

Methods

prettySrcSpanDoc ann Source #

prettyList ∷ [SrcSpan] → Doc ann Source #

Pretty SrcSpans Source # 
Instance details

Defined in PlutusCore.Annotation

Methods

prettySrcSpansDoc ann Source #

prettyList ∷ [SrcSpans] → Doc ann Source #

Pretty Param Source # 
Instance details

Defined in PlutusCore.Arity

Methods

prettyParamDoc ann Source #

prettyList ∷ [Param] → Doc ann Source #

Pretty BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Methods

prettyBuiltinErrorDoc ann Source #

prettyList ∷ [BuiltinError] → Doc ann Source #

Pretty UnliftingError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Pretty UnliftingEvaluationError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Pretty NameAnn Source # 
Instance details

Defined in PlutusCore.Check.Scoping

Methods

prettyNameAnnDoc ann Source #

prettyList ∷ [NameAnn] → Doc ann Source #

Pretty ScopeError Source # 
Instance details

Defined in PlutusCore.Check.Scoping

Methods

prettyScopeErrorDoc ann Source #

prettyList ∷ [ScopeError] → Doc ann Source #

Pretty Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

prettyElementDoc ann Source #

prettyList ∷ [Element] → Doc ann Source #

Pretty Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G2

Methods

prettyElementDoc ann Source #

prettyList ∷ [Element] → Doc ann Source #

Pretty MlResult Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.Pairing

Methods

prettyMlResultDoc ann Source #

prettyList ∷ [MlResult] → Doc ann Source #

Pretty Data Source # 
Instance details

Defined in PlutusCore.Data

Methods

prettyDataDoc ann Source #

prettyList ∷ [Data] → Doc ann Source #

Pretty FreeVariableError Source # 
Instance details

Defined in PlutusCore.DeBruijn.Internal

Pretty Index Source # 
Instance details

Defined in PlutusCore.DeBruijn.Internal

Methods

prettyIndexDoc ann Source #

prettyList ∷ [Index] → Doc ann Source #

Pretty DefaultFun Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Methods

prettyDefaultFunDoc ann Source #

prettyList ∷ [DefaultFun] → Doc ann Source #

Pretty ParserError Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettyParserErrorDoc ann Source #

prettyList ∷ [ParserError] → Doc ann Source #

Pretty ParserErrorBundle Source # 
Instance details

Defined in PlutusCore.Error

Pretty CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Pretty CostModelApplyWarn Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Pretty ExBudget Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExBudget

Methods

prettyExBudgetDoc ann Source #

prettyList ∷ [ExBudget] → Doc ann Source #

Pretty ExRestrictingBudget Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExBudget

Pretty ExCPU Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemory

Methods

prettyExCPUDoc ann Source #

prettyList ∷ [ExCPU] → Doc ann Source #

Pretty ExMemory Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemory

Methods

prettyExMemoryDoc ann Source #

prettyList ∷ [ExMemory] → Doc ann Source #

Pretty ExtensionFun Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Methods

prettyExtensionFunDoc ann Source #

prettyList ∷ [ExtensionFun] → Doc ann Source #

Pretty Name Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Default

Methods

prettyNameDoc ann Source #

prettyList ∷ [Name] → Doc ann Source #

Pretty TyName Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Default

Methods

prettyTyNameDoc ann Source #

prettyList ∷ [TyName] → Doc ann Source #

Pretty Unique Source # 
Instance details

Defined in PlutusCore.Name.Unique

Methods

prettyUniqueDoc ann Source #

prettyList ∷ [Unique] → Doc ann Source #

Pretty Size Source # 
Instance details

Defined in PlutusCore.Size

Methods

prettySizeDoc ann Source #

prettyList ∷ [Size] → Doc ann Source #

Pretty Version Source # 
Instance details

Defined in PlutusCore.Version

Methods

prettyVersionDoc ann Source #

prettyList ∷ [Version] → Doc ann Source #

Pretty CountingSt Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Methods

prettyCountingStDoc ann Source #

prettyList ∷ [CountingSt] → Doc ann Source #

Pretty RestrictingSt Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Pretty CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

prettyCekUserErrorDoc ann Source #

prettyList ∷ [CekUserError] → Doc ann Source #

Pretty Purity Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

prettyPurityDoc ann Source #

prettyList ∷ [Purity] → Doc ann Source #

Pretty Text

Automatically converts all newlines to line.

>>> pretty ("hello\nworld" :: Text)
hello
world

Note that line can be undone by group:

>>> group (pretty ("hello\nworld" :: Text))
hello world

Manually use hardline if you definitely want newlines.

Instance details

Defined in Prettyprinter.Internal

Methods

prettyTextDoc ann Source #

prettyList ∷ [Text] → Doc ann Source #

Pretty Text

(lazy Doc instance, identical to the strict version)

Instance details

Defined in Prettyprinter.Internal

Methods

prettyTextDoc ann Source #

prettyList ∷ [Text] → Doc ann Source #

Pretty Integer
>>> pretty (2^123 :: Integer)
10633823966279326983230456482242756608
Instance details

Defined in Prettyprinter.Internal

Methods

prettyIntegerDoc ann Source #

prettyList ∷ [Integer] → Doc ann Source #

Pretty Natural 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyNaturalDoc ann Source #

prettyList ∷ [Natural] → Doc ann Source #

Pretty ()
>>> pretty ()
()

The argument is not used:

>>> pretty (error "Strict?" :: ())
()
Instance details

Defined in Prettyprinter.Internal

Methods

pretty ∷ () → Doc ann Source #

prettyList ∷ [()] → Doc ann Source #

Pretty Bool
>>> pretty True
True
Instance details

Defined in Prettyprinter.Internal

Methods

prettyBoolDoc ann Source #

prettyList ∷ [Bool] → Doc ann Source #

Pretty Char

Instead of (pretty 'n'), consider using line as a more readable alternative.

>>> pretty 'f' <> pretty 'o' <> pretty 'o'
foo
>>> pretty ("string" :: String)
string
Instance details

Defined in Prettyprinter.Internal

Methods

prettyCharDoc ann Source #

prettyList ∷ [Char] → Doc ann Source #

Pretty Double
>>> pretty (exp 1 :: Double)
2.71828182845904...
Instance details

Defined in Prettyprinter.Internal

Methods

prettyDoubleDoc ann Source #

prettyList ∷ [Double] → Doc ann Source #

Pretty Float
>>> pretty (pi :: Float)
3.1415927
Instance details

Defined in Prettyprinter.Internal

Methods

prettyFloatDoc ann Source #

prettyList ∷ [Float] → Doc ann Source #

Pretty Int
>>> pretty (123 :: Int)
123
Instance details

Defined in Prettyprinter.Internal

Methods

prettyIntDoc ann Source #

prettyList ∷ [Int] → Doc ann Source #

Pretty Word 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyWordDoc ann Source #

prettyList ∷ [Word] → Doc ann Source #

Pretty a ⇒ Pretty (Identity a)
>>> pretty (Identity 1)
1
Instance details

Defined in Prettyprinter.Internal

Methods

prettyIdentity a → Doc ann Source #

prettyList ∷ [Identity a] → Doc ann Source #

Pretty a ⇒ Pretty (NonEmpty a) 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyNonEmpty a → Doc ann Source #

prettyList ∷ [NonEmpty a] → Doc ann Source #

Pretty a ⇒ Pretty (HeadSpine a) Source #
>>> import Text.Pretty
>>> pretty (HeadOnly 'z')
z
>>> pretty (HeadSpine 'f' (SpineCons 'x' $ SpineLast 'y'))
f `applyN` [x, y]
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

prettyHeadSpine a → Doc ann Source #

prettyList ∷ [HeadSpine a] → Doc ann Source #

Pretty a ⇒ Pretty (Spine a) Source #
>>> import Text.Pretty
>>> pretty (SpineCons 'a' $ SpineLast 'b')
[a, b]
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

prettySpine a → Doc ann Source #

prettyList ∷ [Spine a] → Doc ann Source #

Pretty (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Pretty ann ⇒ Pretty (Kind ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Default

Methods

prettyKind ann → Doc ann0 Source #

prettyList ∷ [Kind ann] → Doc ann0 Source #

Pretty a ⇒ Pretty (Normalized a) Source # 
Instance details

Defined in PlutusCore.Core.Type

Methods

prettyNormalized a → Doc ann Source #

prettyList ∷ [Normalized a] → Doc ann Source #

Pretty (DefaultUni a) Source #

This always pretty-prints parens around type applications (e.g. (list bool)) and doesn't pretty-print them otherwise (e.g. integer).

Instance details

Defined in PlutusCore.Default.Universe

Methods

prettyDefaultUni a → Doc ann Source #

prettyList ∷ [DefaultUni a] → Doc ann Source #

Pretty ann ⇒ Pretty (UniqueError ann) Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettyUniqueError ann → Doc ann0 Source #

prettyList ∷ [UniqueError ann] → Doc ann0 Source #

PrettyClassic a ⇒ Pretty (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

PrettyReadable a ⇒ Pretty (AsReadable a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

prettyAsReadable a → Doc ann Source #

prettyList ∷ [AsReadable a] → Doc ann Source #

Pretty (SomeTypeIn DefaultUni) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Pretty (SomeTypeIn uni) ⇒ Pretty (SomeTypeIn (Kinded uni)) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettySomeTypeIn (Kinded uni) → Doc ann Source #

prettyList ∷ [SomeTypeIn (Kinded uni)] → Doc ann Source #

(Show fun, Ord fun) ⇒ Pretty (CekExTally fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Methods

prettyCekExTally fun → Doc ann Source #

prettyList ∷ [CekExTally fun] → Doc ann Source #

(Show fun, Ord fun) ⇒ Pretty (TallyingSt fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Methods

prettyTallyingSt fun → Doc ann Source #

prettyList ∷ [TallyingSt fun] → Doc ann Source #

Show fun ⇒ Pretty (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

prettyExBudgetCategory fun → Doc ann Source #

prettyList ∷ [ExBudgetCategory fun] → Doc ann Source #

Pretty a ⇒ Pretty (Maybe a)

Ignore Nothings, print Just contents.

>>> pretty (Just True)
True
>>> braces (pretty (Nothing :: Maybe Bool))
{}
>>> pretty [Just 1, Nothing, Just 3, Nothing]
[1, 3]
Instance details

Defined in Prettyprinter.Internal

Methods

prettyMaybe a → Doc ann Source #

prettyList ∷ [Maybe a] → Doc ann Source #

Pretty a ⇒ Pretty [a]
>>> pretty [1,2,3]
[1, 2, 3]
Instance details

Defined in Prettyprinter.Internal

Methods

pretty ∷ [a] → Doc ann Source #

prettyList ∷ [[a]] → Doc ann Source #

(Pretty a, Pretty b) ⇒ Pretty (Either a b) Source # 
Instance details

Defined in PlutusPrelude

Methods

prettyEither a b → Doc ann Source #

prettyList ∷ [Either a b] → Doc ann Source #

(Pretty structural, Pretty operational) ⇒ Pretty (EvaluationError structural operational) Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

prettyEvaluationError structural operational → Doc ann Source #

prettyList ∷ [EvaluationError structural operational] → Doc ann Source #

(Pretty err, Pretty cause) ⇒ Pretty (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

prettyErrorWithCause err cause → Doc ann Source #

prettyList ∷ [ErrorWithCause err cause] → Doc ann Source #

(Closed uni, Everywhere uni PrettyConst) ⇒ Pretty (ValueOf uni a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyValueOf uni a → Doc ann Source #

prettyList ∷ [ValueOf uni a] → Doc ann Source #

DefaultPrettyBy config a ⇒ Pretty (AttachDefaultPrettyConfig config a) 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyAttachDefaultPrettyConfig config a → Doc ann Source #

prettyList ∷ [AttachDefaultPrettyConfig config a] → Doc ann Source #

PrettyBy config a ⇒ Pretty (AttachPrettyConfig config a)
>>> data Cfg = Cfg
>>> data D = D
>>> instance PrettyBy Cfg D where prettyBy Cfg D = "D"
>>> pretty $ AttachPrettyConfig Cfg D
D
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyAttachPrettyConfig config a → Doc ann Source #

prettyList ∷ [AttachPrettyConfig config a] → Doc ann Source #

(Closed uni, Everywhere uni PrettyConst) ⇒ Pretty (Some (ValueOf uni)) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettySome (ValueOf uni) → Doc ann Source #

prettyList ∷ [Some (ValueOf uni)] → Doc ann Source #

(Pretty a1, Pretty a2) ⇒ Pretty (a1, a2)
>>> pretty (123, "hello")
(123, hello)
Instance details

Defined in Prettyprinter.Internal

Methods

pretty ∷ (a1, a2) → Doc ann Source #

prettyList ∷ [(a1, a2)] → Doc ann Source #

Pretty a ⇒ Pretty (Const a b) 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyConst a b → Doc ann Source #

prettyList ∷ [Const a b] → Doc ann Source #

(PrettyClassic tyname, PrettyParens (SomeTypeIn uni), Pretty ann) ⇒ Pretty (Type tyname uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Default

Methods

prettyType tyname uni ann → Doc ann0 Source #

prettyList ∷ [Type tyname uni ann] → Doc ann0 Source #

Pretty (CekState uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.SteppableCek.Internal

Methods

prettyCekState uni fun ann → Doc ann0 Source #

prettyList ∷ [CekState uni fun ann] → Doc ann0 Source #

(Pretty a1, Pretty a2, Pretty a3) ⇒ Pretty (a1, a2, a3)
>>> pretty (123, "hello", False)
(123, hello, False)
Instance details

Defined in Prettyprinter.Internal

Methods

pretty ∷ (a1, a2, a3) → Doc ann Source #

prettyList ∷ [(a1, a2, a3)] → Doc ann Source #

(PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ Pretty (Program name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Default

Methods

prettyProgram name uni fun ann → Doc ann0 Source #

prettyList ∷ [Program name uni fun ann] → Doc ann0 Source #

(PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ Pretty (Term name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Default

Methods

prettyTerm name uni fun ann → Doc ann0 Source #

prettyList ∷ [Term name uni fun ann] → Doc ann0 Source #

(PrettyClassic tyname, PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ Pretty (Program tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Default

Methods

prettyProgram tyname name uni fun ann → Doc ann0 Source #

prettyList ∷ [Program tyname name uni fun ann] → Doc ann0 Source #

(PrettyClassic tyname, PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ Pretty (Term tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Default

Methods

prettyTerm tyname name uni fun ann → Doc ann0 Source #

prettyList ∷ [Term tyname name uni fun ann] → Doc ann0 Source #

class PrettyBy config a where Source #

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 D
D
>>> prettyBy LowerCase D
d

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 a

There'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 Source #

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 Functor (i.e. the parameter has to be of kind Type). Then 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 Bifunctor and hence 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 Source #

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

Instances details
PrettyBy PrettyConfigPlc DefaultFun Source # 
Instance details

Defined in PlutusCore.Default.Builtins

PrettyBy ConstConfig ByteString Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

PrettyBy ConstConfig Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

prettyByConstConfigElementDoc ann Source #

prettyListByConstConfig → [Element] → Doc ann Source #

PrettyBy ConstConfig Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G2

Methods

prettyByConstConfigElementDoc ann Source #

prettyListByConstConfig → [Element] → Doc ann Source #

PrettyBy ConstConfig MlResult Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.Pairing

PrettyBy ConstConfig Data Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigDataDoc ann Source #

prettyListByConstConfig → [Data] → Doc ann Source #

PrettyDefaultBy config VoidPrettyBy config Void
>>> prettyBy () ([] :: [Void])
[]
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → VoidDoc ann Source #

prettyListBy ∷ config → [Void] → Doc ann Source #

PrettyDefaultBy config Int16PrettyBy config Int16 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Int16Doc ann Source #

prettyListBy ∷ config → [Int16] → Doc ann Source #

PrettyDefaultBy config Int32PrettyBy config Int32 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Int32Doc ann Source #

prettyListBy ∷ config → [Int32] → Doc ann Source #

PrettyDefaultBy config Int64PrettyBy config Int64 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Int64Doc ann Source #

prettyListBy ∷ config → [Int64] → Doc ann Source #

PrettyDefaultBy config Int8PrettyBy config Int8 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Int8Doc ann Source #

prettyListBy ∷ config → [Int8] → Doc ann Source #

PrettyDefaultBy config Word16PrettyBy config Word16 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Word16Doc ann Source #

prettyListBy ∷ config → [Word16] → Doc ann Source #

PrettyDefaultBy config Word32PrettyBy config Word32 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Word32Doc ann Source #

prettyListBy ∷ config → [Word32] → Doc ann Source #

PrettyDefaultBy config Word64PrettyBy config Word64 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Word64Doc ann Source #

prettyListBy ∷ config → [Word64] → Doc ann Source #

PrettyDefaultBy config Word8PrettyBy config Word8 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Word8Doc ann Source #

prettyListBy ∷ config → [Word8] → Doc ann Source #

HasPrettyConfigName config ⇒ PrettyBy config DeBruijn Source # 
Instance details

Defined in PlutusCore.DeBruijn.Internal

Methods

prettyBy ∷ config → DeBruijnDoc ann Source #

prettyListBy ∷ config → [DeBruijn] → Doc ann Source #

HasPrettyConfigName config ⇒ PrettyBy config FakeNamedDeBruijn Source # 
Instance details

Defined in PlutusCore.DeBruijn.Internal

Methods

prettyBy ∷ config → FakeNamedDeBruijnDoc ann Source #

prettyListBy ∷ config → [FakeNamedDeBruijn] → Doc ann Source #

HasPrettyConfigName config ⇒ PrettyBy config NamedDeBruijn Source # 
Instance details

Defined in PlutusCore.DeBruijn.Internal

Methods

prettyBy ∷ config → NamedDeBruijnDoc ann Source #

prettyListBy ∷ config → [NamedDeBruijn] → Doc ann Source #

HasPrettyConfigName config ⇒ PrettyBy config NamedTyDeBruijn Source # 
Instance details

Defined in PlutusCore.DeBruijn.Internal

Methods

prettyBy ∷ config → NamedTyDeBruijnDoc ann Source #

prettyListBy ∷ config → [NamedTyDeBruijn] → Doc ann Source #

HasPrettyConfigName config ⇒ PrettyBy config TyDeBruijn Source # 
Instance details

Defined in PlutusCore.DeBruijn.Internal

Methods

prettyBy ∷ config → TyDeBruijnDoc ann Source #

prettyListBy ∷ config → [TyDeBruijn] → Doc ann Source #

PrettyBy config ExBudget Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExBudget

Methods

prettyBy ∷ config → ExBudgetDoc ann Source #

prettyListBy ∷ config → [ExBudget] → Doc ann Source #

PrettyBy config ExRestrictingBudget Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExBudget

Methods

prettyBy ∷ config → ExRestrictingBudgetDoc ann Source #

prettyListBy ∷ config → [ExRestrictingBudget] → Doc ann Source #

PrettyBy config ExCPU Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemory

Methods

prettyBy ∷ config → ExCPUDoc ann Source #

prettyListBy ∷ config → [ExCPU] → Doc ann Source #

PrettyBy config ExMemory Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemory

Methods

prettyBy ∷ config → ExMemoryDoc ann Source #

prettyListBy ∷ config → [ExMemory] → Doc ann Source #

HasPrettyConfigName config ⇒ PrettyBy config Name Source # 
Instance details

Defined in PlutusCore.Name.Unique

Methods

prettyBy ∷ config → NameDoc ann Source #

prettyListBy ∷ config → [Name] → Doc ann Source #

HasPrettyConfigName config ⇒ PrettyBy config TyName Source # 
Instance details

Defined in PlutusCore.Name.Unique

Methods

prettyBy ∷ config → TyNameDoc ann Source #

prettyListBy ∷ config → [TyName] → Doc ann Source #

PrettyBy config CountingSt Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Methods

prettyBy ∷ config → CountingStDoc ann Source #

prettyListBy ∷ config → [CountingSt] → Doc ann Source #

PrettyBy config RestrictingSt Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Methods

prettyBy ∷ config → RestrictingStDoc ann Source #

prettyListBy ∷ config → [RestrictingSt] → Doc ann Source #

PrettyDefaultBy config TextPrettyBy config Text

Automatically converts all newlines to line.

>>> prettyBy () ("hello\nworld" :: Strict.Text)
hello
world
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → TextDoc ann Source #

prettyListBy ∷ config → [Text] → Doc ann Source #

PrettyDefaultBy config TextPrettyBy config Text

An instance for lazy Text. Identitical to the strict one.

Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → TextDoc ann Source #

prettyListBy ∷ config → [Text] → Doc ann Source #

PrettyDefaultBy config IntegerPrettyBy config Integer
>>> prettyBy () (2^(123 :: Int) :: Integer)
10633823966279326983230456482242756608
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → IntegerDoc ann Source #

prettyListBy ∷ config → [Integer] → Doc ann Source #

PrettyDefaultBy config NaturalPrettyBy config Natural
>>> prettyBy () (123 :: Natural)
123
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → NaturalDoc ann Source #

prettyListBy ∷ config → [Natural] → Doc ann Source #

PrettyDefaultBy config () ⇒ PrettyBy config ()
>>> prettyBy () ()
()

The argument is not used:

>>> prettyBy () (error "Strict?" :: ())
()
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → () → Doc ann Source #

prettyListBy ∷ config → [()] → Doc ann Source #

PrettyDefaultBy config BoolPrettyBy config Bool
>>> prettyBy () True
True
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → BoolDoc ann Source #

prettyListBy ∷ config → [Bool] → Doc ann Source #

PrettyDefaultBy config CharPrettyBy config Char

By default a String (i.e. [Char]) is converted to a Text first and then pretty-printed. So make sure that if you have any non-default pretty-printing for Char or Text, they're in sync.

>>> prettyBy () 'a'
a
>>> prettyBy () "abc"
abc
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → CharDoc ann Source #

prettyListBy ∷ config → [Char] → Doc ann Source #

PrettyDefaultBy config DoublePrettyBy config Double
>>> prettyBy () (pi :: Double)
3.141592653589793
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → DoubleDoc ann Source #

prettyListBy ∷ config → [Double] → Doc ann Source #

PrettyDefaultBy config FloatPrettyBy config Float
>>> prettyBy () (pi :: Float)
3.1415927
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → FloatDoc ann Source #

prettyListBy ∷ config → [Float] → Doc ann Source #

PrettyDefaultBy config IntPrettyBy config Int
>>> prettyBy () (123 :: Int)
123
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → IntDoc ann Source #

prettyListBy ∷ config → [Int] → Doc ann Source #

PrettyDefaultBy config WordPrettyBy config Word 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → WordDoc ann Source #

prettyListBy ∷ config → [Word] → Doc ann Source #

DefaultPrettyPlcStrategy (Kind ann) ⇒ PrettyBy PrettyConfigPlc (Kind ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcKind ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Kind ann] → Doc ann0 Source #

PrettyBy PrettyConfigPlc a ⇒ PrettyBy PrettyConfigPlc (ExpectedShapeOr a) Source # 
Instance details

Defined in PlutusCore.Error

DefaultPrettyPlcStrategy a ⇒ PrettyBy PrettyConfigPlc (PrettyAny a) Source # 
Instance details

Defined in PlutusCore.Pretty.Plc

DefaultPrettyPlcStrategy a ⇒ PrettyBy PrettyConfigPlcStrategy (PrettyAny a) Source # 
Instance details

Defined in PlutusCore.Pretty.Plc

PrettyConst a ⇒ PrettyBy ConstConfig (NoParens a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigNoParens a → Doc ann Source #

prettyListByConstConfig → [NoParens a] → Doc ann Source #

DefaultPrettyBy ConstConfig (PrettyAny a) ⇒ PrettyBy ConstConfig (PrettyAny a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigPrettyAny a → Doc ann Source #

prettyListByConstConfig → [PrettyAny a] → Doc ann Source #

PrettyBy RenderContext (DefaultUni a) Source # 
Instance details

Defined in PlutusCore.Default.Universe

PrettyBy RenderContext (SomeTypeIn DefaultUni) Source # 
Instance details

Defined in PlutusCore.Default.Universe

PrettyDefaultBy config (Identity a) ⇒ PrettyBy config (Identity a)
>>> prettyBy () (Identity True)
True
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Identity a → Doc ann Source #

prettyListBy ∷ config → [Identity a] → Doc ann Source #

PrettyDefaultBy config (NonEmpty a) ⇒ PrettyBy config (NonEmpty a)

prettyBy for NonEmpty a is defined in terms of prettyListBy by default.

>>> prettyBy () (True :| [False])
[True, False]
>>> prettyBy () ('a' :| "bc")
abc
>>> prettyBy () (Just False :| [Nothing, Just True])
[False, True]
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → NonEmpty a → Doc ann Source #

prettyListBy ∷ config → [NonEmpty a] → Doc ann Source #

PrettyDefaultBy config (Set a) ⇒ PrettyBy config (Set a) Source # 
Instance details

Defined in PlutusCore.Pretty.Extra

Methods

prettyBy ∷ config → Set a → Doc ann Source #

prettyListBy ∷ config → [Set a] → Doc ann Source #

PrettyDefaultBy config (HeadSpine a) ⇒ PrettyBy config (HeadSpine a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

prettyBy ∷ config → HeadSpine a → Doc ann Source #

prettyListBy ∷ config → [HeadSpine a] → Doc ann Source #

PrettyDefaultBy config (Spine a) ⇒ PrettyBy config (Spine a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

prettyBy ∷ config → Spine a → Doc ann Source #

prettyListBy ∷ config → [Spine a] → Doc ann Source #

PrettyBy config (t NameAnn) ⇒ PrettyBy config (ScopeCheckError t) Source # 
Instance details

Defined in PlutusCore.Check.Scoping

Methods

prettyBy ∷ config → ScopeCheckError t → Doc ann Source #

prettyListBy ∷ config → [ScopeCheckError t] → Doc ann Source #

PrettyBy config a ⇒ PrettyBy config (Normalized a) Source # 
Instance details

Defined in PlutusCore.Core.Type

Methods

prettyBy ∷ config → Normalized a → Doc ann Source #

prettyListBy ∷ config → [Normalized a] → Doc ann Source #

(HasPrettyDefaults config ~ 'True, Pretty fun) ⇒ PrettyBy config (MachineError fun) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

prettyBy ∷ config → MachineError fun → Doc ann Source #

prettyListBy ∷ config → [MachineError fun] → Doc ann Source #

PrettyBy config a ⇒ PrettyBy config (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Methods

prettyBy ∷ config → EvaluationResult a → Doc ann Source #

prettyListBy ∷ config → [EvaluationResult a] → Doc ann Source #

PrettyDefaultBy config (AsReadable a) ⇒ PrettyBy config (AsReadable a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

prettyBy ∷ config → AsReadable a → Doc ann Source #

prettyListBy ∷ config → [AsReadable a] → Doc ann Source #

(Show fun, Ord fun) ⇒ PrettyBy config (CekExTally fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Methods

prettyBy ∷ config → CekExTally fun → Doc ann Source #

prettyListBy ∷ config → [CekExTally fun] → Doc ann Source #

(Show fun, Ord fun) ⇒ PrettyBy config (TallyingSt fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode

Methods

prettyBy ∷ config → TallyingSt fun → Doc ann Source #

prettyListBy ∷ config → [TallyingSt fun] → Doc ann Source #

Pretty a ⇒ PrettyBy config (IgnorePrettyConfig a)
>>> data Cfg = Cfg
>>> data D = D
>>> instance Pretty D where pretty D = "D"
>>> prettyBy Cfg $ IgnorePrettyConfig D
D
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → IgnorePrettyConfig a → Doc ann Source #

prettyListBy ∷ config → [IgnorePrettyConfig a] → Doc ann Source #

PrettyDefaultBy config a ⇒ PrettyBy config (PrettyCommon a) 
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → PrettyCommon a → Doc ann Source #

prettyListBy ∷ config → [PrettyCommon a] → Doc ann Source #

PrettyDefaultBy config (Maybe a) ⇒ PrettyBy config (Maybe a)

By default a [Maybe a] is converted to [a] first and only then pretty-printed.

>>> braces $ prettyBy () (Just True)
{True}
>>> braces $ prettyBy () (Nothing :: Maybe Bool)
{}
>>> prettyBy () [Just False, Nothing, Just True]
[False, True]
>>> prettyBy () [Nothing, Just 'a', Just 'b', Nothing, Just 'c']
abc
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Maybe a → Doc ann Source #

prettyListBy ∷ config → [Maybe a] → Doc ann Source #

PrettyDefaultBy config [a] ⇒ PrettyBy config [a]

prettyBy for [a] is defined in terms of prettyListBy by default.

>>> prettyBy () [True, False]
[True, False]
>>> prettyBy () "abc"
abc
>>> prettyBy () [Just False, Nothing, Just True]
[False, True]
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → [a] → Doc ann Source #

prettyListBy ∷ config → [[a]] → Doc ann Source #

(PrettyUni uni, Pretty fun) ⇒ PrettyBy PrettyConfigPlc (CkValue uni fun) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Ck

Methods

prettyByPrettyConfigPlcCkValue uni fun → Doc ann Source #

prettyListByPrettyConfigPlc → [CkValue uni fun] → Doc ann Source #

(Closed uni, Everywhere uni PrettyConst) ⇒ PrettyBy ConstConfig (ValueOf uni a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigValueOf uni a → Doc ann Source #

prettyListByConstConfig → [ValueOf uni a] → Doc ann Source #

(Closed uni, Everywhere uni PrettyConst) ⇒ PrettyBy ConstConfig (Some (ValueOf uni)) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigSome (ValueOf uni) → Doc ann Source #

prettyListByConstConfig → [Some (ValueOf uni)] → Doc ann Source #

PrettyDefaultBy config (Either a b) ⇒ PrettyBy config (Either a b) Source #

An instance extending the set of types supporting default pretty-printing with Either.

Instance details

Defined in PlutusPrelude

Methods

prettyBy ∷ config → Either a b → Doc ann Source #

prettyListBy ∷ config → [Either a b] → Doc ann Source #

PrettyDefaultBy config (Map k v) ⇒ PrettyBy config (Map k v) Source # 
Instance details

Defined in PlutusCore.Pretty.Extra

Methods

prettyBy ∷ config → Map k v → Doc ann Source #

prettyListBy ∷ config → [Map k v] → Doc ann Source #

(HasPrettyDefaults config ~ 'True, PrettyBy config structural, Pretty operational) ⇒ PrettyBy config (EvaluationError structural operational) Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

prettyBy ∷ config → EvaluationError structural operational → Doc ann Source #

prettyListBy ∷ config → [EvaluationError structural operational] → Doc ann Source #

(PrettyBy config cause, PrettyBy config err) ⇒ PrettyBy config (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

prettyBy ∷ config → ErrorWithCause err cause → Doc ann Source #

prettyListBy ∷ config → [ErrorWithCause err cause] → Doc ann Source #

PrettyDefaultBy config (a, b) ⇒ PrettyBy config (a, b)
>>> prettyBy () (False, "abc")
(False, abc)
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → (a, b) → Doc ann Source #

prettyListBy ∷ config → [(a, b)] → Doc ann Source #

DefaultPrettyPlcStrategy (Type tyname uni ann) ⇒ PrettyBy PrettyConfigPlc (Type tyname uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcType tyname uni ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Type tyname uni ann] → Doc ann0 Source #

(PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy PrettyConfigPlc (Error uni fun ann) Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettyByPrettyConfigPlcError uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Error uni fun ann] → Doc ann0 Source #

(PrettyUni uni, Pretty fun) ⇒ PrettyBy PrettyConfigPlc (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

prettyByPrettyConfigPlcCekValue uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [CekValue uni fun ann] → Doc ann0 Source #

PrettyDefaultBy config (Const a b) ⇒ PrettyBy config (Const a b)

Non-polykinded, because Pretty (Const a b) is not polykinded either.

>>> prettyBy () (Const 1 :: Const Integer Bool)
1
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Const a b → Doc ann Source #

prettyListBy ∷ config → [Const a b] → Doc ann Source #

PrettyDefaultBy config (a, b, c) ⇒ PrettyBy config (a, b, c)
>>> prettyBy () ('a', "bcd", True)
(a, bcd, True)
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → (a, b, c) → Doc ann Source #

prettyListBy ∷ config → [(a, b, c)] → Doc ann Source #

(Pretty term, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy PrettyConfigPlc (TypeError term uni fun ann) Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettyByPrettyConfigPlcTypeError term uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [TypeError term uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (UnrestrictedProgram name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

Methods

prettyByPrettyConfigPlcUnrestrictedProgram name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [UnrestrictedProgram name uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (Program name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Program name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcProgram name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Program name uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (Term name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Term name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcTerm name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Term name uni fun ann] → Doc ann0 Source #

PrettyBy config (Term name uni fun a) ⇒ PrettyBy config (EvalOrder name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

prettyBy ∷ config → EvalOrder name uni fun a → Doc ann Source #

prettyListBy ∷ config → [EvalOrder name uni fun a] → Doc ann Source #

PrettyBy config (Term name uni fun a) ⇒ PrettyBy config (EvalTerm name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

prettyBy ∷ config → EvalTerm name uni fun a → Doc ann Source #

prettyListBy ∷ config → [EvalTerm name uni fun a] → Doc ann Source #

DefaultPrettyPlcStrategy (Program tyname name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Program tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcProgram tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Program tyname name uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (Term tyname name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Term tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcTerm tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Term tyname name uni fun ann] → Doc ann0 Source #

(Pretty ann, PrettyBy config (Type tyname uni ann), PrettyBy config (Term tyname name uni fun ann)) ⇒ PrettyBy config (NormCheckError tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettyBy ∷ config → NormCheckError tyname name uni fun ann → Doc ann0 Source #

prettyListBy ∷ config → [NormCheckError tyname name uni fun ann] → Doc ann0 Source #

Pretty ann ⇒ PrettyBy (PrettyConfigClassic configName) (Kind ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Kind ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Kind ann] → Doc ann0 Source #

PrettyBy (PrettyConfigReadable configName) (Kind a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Kind a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Kind a] → Doc ann Source #

PrettyReadableBy configName a ⇒ PrettyBy (PrettyConfigReadable configName) (Parened a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Parened a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Parened a] → Doc ann Source #

PrettyReadableBy configName tyname ⇒ PrettyBy (PrettyConfigReadable configName) (TyVarDecl tyname ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → TyVarDecl tyname ann → Doc ann0 Source #

prettyListByPrettyConfigReadable configName → [TyVarDecl tyname ann] → Doc ann0 Source #

(PrettyClassicBy configName tyname, PrettyParens (SomeTypeIn uni), Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Type tyname uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Type tyname uni ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Type tyname uni ann] → Doc ann0 Source #

(PrettyReadableBy configName tyname, PrettyParens (SomeTypeIn uni)) ⇒ PrettyBy (PrettyConfigReadable configName) (Type tyname uni a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Type tyname uni a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Type tyname uni a] → Doc ann Source #

(PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy (PrettyConfigClassic PrettyConfigName) (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

(PrettyClassicBy configName (Term name uni fun ann), Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Program name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Program name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Program name uni fun ann] → Doc ann0 Source #

(PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Term name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Term name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Term name uni fun ann] → Doc ann0 Source #

(PrettyReadable name, PrettyUni uni, Pretty fun) ⇒ PrettyBy (PrettyConfigReadable PrettyConfigName) (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

(PrettyReadableBy configName tyname, PrettyReadableBy configName name, PrettyUni uni) ⇒ PrettyBy (PrettyConfigReadable configName) (VarDecl tyname name uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → VarDecl tyname name uni ann → Doc ann0 Source #

prettyListByPrettyConfigReadable configName → [VarDecl tyname name uni ann] → Doc ann0 Source #

PrettyReadableBy configName (Term name uni fun a) ⇒ PrettyBy (PrettyConfigReadable configName) (Program name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Program name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Program name uni fun a] → Doc ann Source #

(PrettyReadableBy configName name, PrettyUni uni, Pretty fun, Show configName) ⇒ PrettyBy (PrettyConfigReadable configName) (Term name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Term name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Term name uni fun a] → Doc ann Source #

(PrettyClassicBy configName (Term tyname name uni fun ann), Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Program tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Program tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Program tyname name uni fun ann] → Doc ann0 Source #

(PrettyClassicBy configName tyname, PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Term tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Term tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Term tyname name uni fun ann] → Doc ann0 Source #

PrettyReadableBy configName (Term tyname name uni fun a) ⇒ PrettyBy (PrettyConfigReadable configName) (Program tyname name uni fun a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Program tyname name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Program tyname name uni fun a] → Doc ann Source #

(PrettyReadableBy configName tyname, PrettyReadableBy configName name, PrettyUni uni, Pretty fun) ⇒ PrettyBy (PrettyConfigReadable configName) (Term tyname name uni fun a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Term tyname name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Term tyname name uni fun a] → Doc ann Source #

newtype IgnorePrettyConfig a Source #

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

Instances details
Pretty a ⇒ PrettyBy config (IgnorePrettyConfig a)
>>> data Cfg = Cfg
>>> data D = D
>>> instance Pretty D where pretty D = "D"
>>> prettyBy Cfg $ IgnorePrettyConfig D
D
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → IgnorePrettyConfig a → Doc ann Source #

prettyListBy ∷ config → [IgnorePrettyConfig a] → Doc ann Source #

data AttachPrettyConfig config a Source #

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

Instances details
PrettyBy config a ⇒ Pretty (AttachPrettyConfig config a)
>>> data Cfg = Cfg
>>> data D = D
>>> instance PrettyBy Cfg D where prettyBy Cfg D = "D"
>>> pretty $ AttachPrettyConfig Cfg D
D
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyAttachPrettyConfig config a → Doc ann Source #

prettyList ∷ [AttachPrettyConfig config a] → Doc ann Source #

class Render str where Source #

A class for rendering Docs as string types.

Methods

renderDoc ann → str Source #

Render a Doc as a string type.

Instances

Instances details
Render Text 
Instance details

Defined in Text.PrettyBy.Default

Methods

renderDoc ann → Text Source #

Render Text 
Instance details

Defined in Text.PrettyBy.Default

Methods

renderDoc ann → Text Source #

a ~ CharRender [a] 
Instance details

Defined in Text.PrettyBy.Default

Methods

renderDoc ann → [a] Source #

type PrettyParens = PrettyBy RenderContext Source #

For pretty-printing a value with a minimum amount of parens.

display ∷ ∀ str a. (Pretty a, Render str) ⇒ a → str Source #

Pretty-print and render a value as a string type.

displayBy ∷ ∀ str a config. (PrettyBy config a, Render str) ⇒ config → a → str Source #

Pretty-print and render a value as a string type in a configurable way.

juxtRenderContextRenderContext Source #

An initial RenderContext. An expression printed in this context gets enclosed in parens unless its outermost operator (if any) binds even stronger than function application.

Defaults

prettyPlcPrettyPlc 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.

prettyPlcSimplePrettyPlc 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.

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.

data PrettyConfigPlc Source #

Global configuration used for pretty-printing PLC entities.

Instances

Instances details
Show PrettyConfigPlc Source # 
Instance details

Defined in PlutusCore.Pretty.Plc

HasPrettyConfigName PrettyConfigPlc Source # 
Instance details

Defined in PlutusCore.Pretty.Plc

PrettyBy PrettyConfigPlc DefaultFun Source # 
Instance details

Defined in PlutusCore.Default.Builtins

DefaultPrettyPlcStrategy (Kind ann) ⇒ PrettyBy PrettyConfigPlc (Kind ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcKind ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Kind ann] → Doc ann0 Source #

PrettyBy PrettyConfigPlc a ⇒ PrettyBy PrettyConfigPlc (ExpectedShapeOr a) Source # 
Instance details

Defined in PlutusCore.Error

DefaultPrettyPlcStrategy a ⇒ PrettyBy PrettyConfigPlc (PrettyAny a) Source # 
Instance details

Defined in PlutusCore.Pretty.Plc

(PrettyUni uni, Pretty fun) ⇒ PrettyBy PrettyConfigPlc (CkValue uni fun) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Ck

Methods

prettyByPrettyConfigPlcCkValue uni fun → Doc ann Source #

prettyListByPrettyConfigPlc → [CkValue uni fun] → Doc ann Source #

DefaultPrettyPlcStrategy (Type tyname uni ann) ⇒ PrettyBy PrettyConfigPlc (Type tyname uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcType tyname uni ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Type tyname uni ann] → Doc ann0 Source #

(PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy PrettyConfigPlc (Error uni fun ann) Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettyByPrettyConfigPlcError uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Error uni fun ann] → Doc ann0 Source #

(PrettyUni uni, Pretty fun) ⇒ PrettyBy PrettyConfigPlc (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

prettyByPrettyConfigPlcCekValue uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [CekValue uni fun ann] → Doc ann0 Source #

(Pretty term, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy PrettyConfigPlc (TypeError term uni fun ann) Source # 
Instance details

Defined in PlutusCore.Error

Methods

prettyByPrettyConfigPlcTypeError term uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [TypeError term uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (UnrestrictedProgram name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

Methods

prettyByPrettyConfigPlcUnrestrictedProgram name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [UnrestrictedProgram name uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (Program name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Program name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcProgram name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Program name uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (Term name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Term name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcTerm name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Term name uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (Program tyname name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Program tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcProgram tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Program tyname name uni fun ann] → Doc ann0 Source #

DefaultPrettyPlcStrategy (Term tyname name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Term tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Plc

Methods

prettyByPrettyConfigPlcTerm tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [Term tyname name uni fun ann] → Doc ann0 Source #

type HasPrettyDefaults PrettyConfigPlc Source # 
Instance details

Defined in PlutusCore.Pretty.Plc

type PrettyPlc = PrettyBy PrettyConfigPlc Source #

The "pretty-printable PLC entity" constraint.

prettyConfigPlcOptionsPrettyConfigPlcOptions Source #

The PrettyConfigPlcOptions used by default: print errors in full.

prettyConfigPlcClassicPrettyConfigPlcOptionsPrettyConfigPlc Source #

The PrettyConfigPlc used by default: use the classic view and print neither Uniques, nor name attachments.

prettyConfigPlcClassicSimplePrettyConfigPlcOptionsPrettyConfigPlc Source #

The PrettyConfigPlc used for debugging: use the classic view and print Uniques, but not name attachments.

prettyConfigPlcReadablePrettyConfigPlcOptionsPrettyConfigPlc Source #

The PrettyConfigPlc used by default and for readability: use the refined view and print Uniques but not name attachments.

prettyConfigPlcReadableSimplePrettyConfigPlcOptionsPrettyConfigPlc Source #

The PrettyConfigPlc used for debugging and readability: use the refined view and print neither Uniques nor name attachments.

Custom functions for PLC types.

prettyPlcClassicPrettyPlc a ⇒ a → Doc ann Source #

Pretty-print a PLC value in the default mode using the classic view.

prettyPlcClassicSimplePrettyPlc a ⇒ a → Doc ann Source #

Pretty-print a PLC value without unique indices using the classic view.

prettyPlcReadablePrettyPlc a ⇒ a → Doc ann Source #

Pretty-print a PLC value in the default mode using the readable view.

prettyPlcReadableSimplePrettyPlc a ⇒ a → Doc ann Source #

Pretty-print a PLC value without unique indices using the readable view.

prettyPlcCondensedErrorByPrettyPlc a ⇒ (PrettyConfigPlcOptionsPrettyConfigPlc) → 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.

Constructors

PrettyConfigName 

Fields

Instances

Instances details
Show PrettyConfigName Source # 
Instance details

Defined in PlutusCore.Pretty.ConfigName

Eq PrettyConfigName Source # 
Instance details

Defined in PlutusCore.Pretty.ConfigName

HasPrettyConfigName (Sole PrettyConfigName) Source # 
Instance details

Defined in PlutusCore.Pretty.ConfigName

(PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy (PrettyConfigClassic PrettyConfigName) (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

(PrettyReadable name, PrettyUni uni, Pretty fun) ⇒ PrettyBy (PrettyConfigReadable PrettyConfigName) (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

type HasPrettyDefaults PrettyConfigName Source # 
Instance details

Defined in PlutusCore.Pretty.ConfigName

prettyConfigNamePrettyConfigName Source #

The PrettyConfigName used by default: print Unique indexes after nams.

prettyConfigNameSimplePrettyConfigName 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.

Constructors

PrettyConfigClassic 

Fields

Instances

Instances details
Show configName ⇒ Show (PrettyConfigClassic configName) Source # 
Instance details

Defined in PlutusCore.Pretty.Classic

Methods

showsPrecIntPrettyConfigClassic configName → ShowS Source #

showPrettyConfigClassic configName → String Source #

showList ∷ [PrettyConfigClassic configName] → ShowS Source #

configName ~ PrettyConfigNameHasPrettyConfigName (PrettyConfigClassic configName) Source # 
Instance details

Defined in PlutusCore.Pretty.Classic

Pretty ann ⇒ PrettyBy (PrettyConfigClassic configName) (Kind ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Kind ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Kind ann] → Doc ann0 Source #

(PrettyClassicBy configName tyname, PrettyParens (SomeTypeIn uni), Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Type tyname uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Type tyname uni ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Type tyname uni ann] → Doc ann0 Source #

(PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy (PrettyConfigClassic PrettyConfigName) (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

(PrettyClassicBy configName (Term name uni fun ann), Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Program name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Program name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Program name uni fun ann] → Doc ann0 Source #

(PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Term name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Term name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Term name uni fun ann] → Doc ann0 Source #

(PrettyClassicBy configName (Term tyname name uni fun ann), Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Program tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Program tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Program tyname name uni fun ann] → Doc ann0 Source #

(PrettyClassicBy configName tyname, PrettyClassicBy configName name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Term tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Classic

Methods

prettyByPrettyConfigClassic configName → Term tyname name uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigClassic configName → [Term tyname name uni fun ann] → Doc ann0 Source #

type HasPrettyDefaults (PrettyConfigClassic _1) Source # 
Instance details

Defined in PlutusCore.Pretty.Classic

type PrettyClassicBy configName = PrettyBy (PrettyConfigClassic configName) Source #

The "classically pretty-printable" constraint.

consAnnIfPretty ann ⇒ PrettyConfigClassic configName → ann → [Doc dann] → [Doc dann] Source #

Add a pretty-printed annotation to a list of Docs if the given config enables pretty-printing of annotations.

prettyClassicPrettyClassic a ⇒ a → Doc ann Source #

Pretty-print a value in the default mode using the classic view.

prettyClassicSimplePrettyClassic a ⇒ a → Doc ann Source #

Pretty-print a value in the simple mode using the classic view.

Readable view

data ShowKinds Source #

Instances

Instances details
Show ShowKinds Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Default ShowKinds Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

defShowKinds Source #

Eq ShowKinds Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

data PrettyConfigReadable configName Source #

Configuration for the readable pretty-printing.

Instances

Instances details
Show configName ⇒ Show (PrettyConfigReadable configName) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

showsPrecIntPrettyConfigReadable configName → ShowS Source #

showPrettyConfigReadable configName → String Source #

showList ∷ [PrettyConfigReadable configName] → ShowS Source #

configName ~ PrettyConfigNameHasPrettyConfigName (PrettyConfigReadable configName) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

HasRenderContext (PrettyConfigReadable configName) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

PrettyBy (PrettyConfigReadable configName) (Kind a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Kind a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Kind a] → Doc ann Source #

PrettyReadableBy configName a ⇒ PrettyBy (PrettyConfigReadable configName) (Parened a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Parened a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Parened a] → Doc ann Source #

PrettyReadableBy configName tyname ⇒ PrettyBy (PrettyConfigReadable configName) (TyVarDecl tyname ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → TyVarDecl tyname ann → Doc ann0 Source #

prettyListByPrettyConfigReadable configName → [TyVarDecl tyname ann] → Doc ann0 Source #

(PrettyReadableBy configName tyname, PrettyParens (SomeTypeIn uni)) ⇒ PrettyBy (PrettyConfigReadable configName) (Type tyname uni a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Type tyname uni a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Type tyname uni a] → Doc ann Source #

(PrettyReadable name, PrettyUni uni, Pretty fun) ⇒ PrettyBy (PrettyConfigReadable PrettyConfigName) (UnrestrictedProgram name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Flat

(PrettyReadableBy configName tyname, PrettyReadableBy configName name, PrettyUni uni) ⇒ PrettyBy (PrettyConfigReadable configName) (VarDecl tyname name uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → VarDecl tyname name uni ann → Doc ann0 Source #

prettyListByPrettyConfigReadable configName → [VarDecl tyname name uni ann] → Doc ann0 Source #

PrettyReadableBy configName (Term name uni fun a) ⇒ PrettyBy (PrettyConfigReadable configName) (Program name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Program name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Program name uni fun a] → Doc ann Source #

(PrettyReadableBy configName name, PrettyUni uni, Pretty fun, Show configName) ⇒ PrettyBy (PrettyConfigReadable configName) (Term name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Term name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Term name uni fun a] → Doc ann Source #

PrettyReadableBy configName (Term tyname name uni fun a) ⇒ PrettyBy (PrettyConfigReadable configName) (Program tyname name uni fun a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Program tyname name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Program tyname name uni fun a] → Doc ann Source #

(PrettyReadableBy configName tyname, PrettyReadableBy configName name, PrettyUni uni, Pretty fun) ⇒ PrettyBy (PrettyConfigReadable configName) (Term tyname name uni fun a) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Term tyname name uni fun a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Term tyname name uni fun a] → Doc ann Source #

type HasPrettyDefaults (PrettyConfigReadable _1) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

prettyReadablePrettyReadable a ⇒ a → Doc ann Source #

Pretty-print something with the PrettyConfigReadable config.

prettyReadableSimplePrettyReadable a ⇒ a → Doc ann Source #

Pretty-print something with the PrettyConfigReadableSimple config.

pcrConfigName ∷ ∀ configName configName. Lens (PrettyConfigReadable configName) (PrettyConfigReadable configName) configName configName Source #

pcrShowKinds ∷ ∀ 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.

Constructors

AsReadable 

Fields

Instances

Instances details
(HasPrettyConfigName config, PrettyReadable a) ⇒ DefaultPrettyBy config (AsReadable a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

defaultPrettyBy ∷ config → AsReadable a → Doc ann Source #

defaultPrettyListBy ∷ config → [AsReadable a] → Doc ann Source #

PrettyDefaultBy config (AsReadable a) ⇒ PrettyBy config (AsReadable a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

prettyBy ∷ config → AsReadable a → Doc ann Source #

prettyListBy ∷ config → [AsReadable a] → Doc ann Source #

PrettyReadable a ⇒ Show (AsReadable a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

PrettyReadable a ⇒ Pretty (AsReadable a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

prettyAsReadable a → Doc ann Source #

prettyList ∷ [AsReadable a] → Doc ann Source #

data Parened a Source #

A value of type a to render in parens using the readable pretty-printer.

Constructors

Parened 

Instances

Instances details
PrettyReadableBy configName a ⇒ PrettyBy (PrettyConfigReadable configName) (Parened a) Source # 
Instance details

Defined in PlutusCore.Pretty.Readable

Methods

prettyByPrettyConfigReadable configName → Parened a → Doc ann Source #

prettyListByPrettyConfigReadable configName → [Parened a] → Doc ann Source #

inBraces ∷ a → Parened a Source #

Enclose the given value, so that it's rendered inside of braces with no additional parens regardless of the RenderContext.

topPrettyConfigReadable ∷ configName → ShowKindsPrettyConfigReadable configName Source #

A PrettyConfigReadable with the fixity specified to topFixity.

botPrettyConfigReadable ∷ configName → ShowKindsPrettyConfigReadable configName Source #

A PrettyConfigReadable with the fixity specified to botFixity.

binderFixityFixity Source #

The fixity of a binder.

arrowFixityFixity 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 ->.

iterAppDocMMonadPrettyContext 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 #

Lay out interleaved function applications either as

foo {a} x {b} y z

or as

foo
  {a}
  x
  {b}
  y
  z

Lefts are laid out in braces, Rights are laid out without braces.

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

newtype ConstConfig Source #

The type of configs used for pretty-printing constants. Has a RenderContext inside, so that we don't add redundant parens to the output.

Constructors

ConstConfig 

Instances

Instances details
HasRenderContext ConstConfig Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

NonDefaultPrettyBy ConstConfig Text Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

NonDefaultPrettyBy ConstConfig Integer Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

NonDefaultPrettyBy ConstConfig () Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

nonDefaultPrettyByConstConfig → () → Doc ann Source #

nonDefaultPrettyListByConstConfig → [()] → Doc ann Source #

NonDefaultPrettyBy ConstConfig Bool Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

PrettyBy ConstConfig ByteString Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

PrettyBy ConstConfig Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

prettyByConstConfigElementDoc ann Source #

prettyListByConstConfig → [Element] → Doc ann Source #

PrettyBy ConstConfig Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G2

Methods

prettyByConstConfigElementDoc ann Source #

prettyListByConstConfig → [Element] → Doc ann Source #

PrettyBy ConstConfig MlResult Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.Pairing

PrettyBy ConstConfig Data Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigDataDoc ann Source #

prettyListByConstConfig → [Data] → Doc ann Source #

Show a ⇒ DefaultPrettyBy ConstConfig (PrettyAny a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

DefaultPrettyBy ConstConfig (PrettyAny a) ⇒ NonDefaultPrettyBy ConstConfig (PrettyAny a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

PrettyConst a ⇒ NonDefaultPrettyBy ConstConfig [a] Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

nonDefaultPrettyByConstConfig → [a] → Doc ann Source #

nonDefaultPrettyListByConstConfig → [[a]] → Doc ann Source #

PrettyConst a ⇒ PrettyBy ConstConfig (NoParens a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigNoParens a → Doc ann Source #

prettyListByConstConfig → [NoParens a] → Doc ann Source #

DefaultPrettyBy ConstConfig (PrettyAny a) ⇒ PrettyBy ConstConfig (PrettyAny a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigPrettyAny a → Doc ann Source #

prettyListByConstConfig → [PrettyAny a] → Doc ann Source #

(PrettyConst a, PrettyConst b) ⇒ NonDefaultPrettyBy ConstConfig (a, b) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

nonDefaultPrettyByConstConfig → (a, b) → Doc ann Source #

nonDefaultPrettyListByConstConfig → [(a, b)] → Doc ann Source #

(Closed uni, Everywhere uni PrettyConst) ⇒ PrettyBy ConstConfig (ValueOf uni a) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigValueOf uni a → Doc ann Source #

prettyListByConstConfig → [ValueOf uni a] → Doc ann Source #

(Closed uni, Everywhere uni PrettyConst) ⇒ PrettyBy ConstConfig (Some (ValueOf uni)) Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigSome (ValueOf uni) → Doc ann Source #

prettyListByConstConfig → [Some (ValueOf uni)] → Doc ann Source #

type HasPrettyDefaults ConstConfig Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

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.