cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Pretty.Class

Description

This module provides common functions to help implement pretty-printers in cooked-validators

Synopsis

Documentation

type DocCooked = Doc () Source #

A standard Doc without any annotation

class PrettyCooked a where Source #

Type class of things that can be pretty printed as a single document. You need to implement either prettyCookedOpt or prettyCooked manually, otherwise calling either of them will resulting in a infinite loop.

Minimal complete definition

Nothing

Methods

prettyCookedOpt :: PrettyCookedOpts -> a -> DocCooked Source #

Pretty prints an element based on some PrettyCookedOpts

prettyCooked :: a -> DocCooked Source #

Pretty prints an element directly

Instances

Instances details
PrettyCooked Rational Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked AddTokenLbl Source # 
Instance details

Defined in Cooked.Attack.AddToken

PrettyCooked DatumHijackingLbl Source # 
Instance details

Defined in Cooked.Attack.DatumHijacking

PrettyCooked DoubleSatLbl Source # 
Instance details

Defined in Cooked.Attack.DoubleSat

PrettyCooked DupTokenLbl Source # 
Instance details

Defined in Cooked.Attack.DupToken

PrettyCooked MockChainError Source # 
Instance details

Defined in Cooked.Pretty.MockChain

PrettyCooked DocCooked Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked DatumContent Source # 
Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked TxLabel Source # 
Instance details

Defined in Cooked.Skeleton.Label

PrettyCooked Mint Source #

Prints a minting specification

Example: > #abcdef - Redeemer: red - Reference script at: txOutRef - Foo: 500 - Bar: 1000

Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked TxSkelOut Source # 
Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked TxGovAction Source # 
Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked TxParameterChange Source # 
Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked MalformDatumLbl Source # 
Instance details

Defined in Cooked.Tweak.Outputs

PrettyCooked TamperDatumLbl Source # 
Instance details

Defined in Cooked.Tweak.Outputs

PrettyCooked Wallet Source # 
Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked ValidationError Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked ValidationPhase Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked Address Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked Credential Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked ScriptError Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked POSIXTime Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked AssetClass Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked Value Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked TxOutRef Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked BuiltinData Source # 
Instance details

Defined in Cooked.Pretty.Plutus

PrettyCooked Integer Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked () Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Bool Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Int Source # 
Instance details

Defined in Cooked.Pretty.Class

Show a => PrettyCooked (MockChainReturn a) Source # 
Instance details

Defined in Cooked.Pretty.MockChain

PrettyCooked (Contextualized MockChainLogEntry) Source #

This prints a MockChainLogEntry. In the log, we know a transaction has been validated if the MCLogSubmittedTxSkel is followed by a MCLogNewTx.

Instance details

Defined in Cooked.Pretty.MockChain

PrettyCooked (Contextualized [MockChainLogEntry]) Source # 
Instance details

Defined in Cooked.Pretty.MockChain

Show a => PrettyCooked [MockChainReturn a] Source # 
Instance details

Defined in Cooked.Pretty.MockChain

PrettyCooked (Map Address UtxoPayloadSet) Source #

Pretty print a UtxoState. Print the known wallets first, then unknown pubkeys, then scripts.

Instance details

Defined in Cooked.Pretty.MockChain

class PrettyCookedList a where Source #

Type class of things that can be pretty printed as a list of documents. Similarly to PrettyCooked, at least of the functions from this class needs to be manually implemented to avoid infinite loops.

Minimal complete definition

Nothing

Methods

prettyCookedOptList :: PrettyCookedOpts -> a -> [DocCooked] Source #

Pretty prints an element as a list on some PrettyCookedOpts

prettyCookedOptListMaybe :: PrettyCookedOpts -> a -> [Maybe DocCooked] Source #

Pretty prints an element as a list of optional documents

prettyCookedList :: a -> [DocCooked] Source #

Pretty prints an elements as a list

Instances

Instances details
PrettyCookedList UtxoPayloadSet Source #

Pretty prints the state of an address, that is the list of UTxOs (including value and datum), grouped

Instance details

Defined in Cooked.Pretty.MockChain

PrettyCookedList UtxoState Source # 
Instance details

Defined in Cooked.Pretty.MockChain

PrettyCookedList TxOpts Source #

Pretty-print a list of transaction skeleton options, only printing an option if its value is non-default.

Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCookedList TxSkelOut Source # 
Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCookedList TxSkelProposal Source # 
Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCookedList TxSkelRedeemer Source #

Prints a list of docs corresponding to an instance of TxSkelRedeemer

Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked a => PrettyCookedList (Set a) Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCookedList (Contextualized TxSkel) Source #

Prints a Contextualized TxSkel

Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCookedList (Contextualized TxOutRef) Source #

Resolves a TxOutRef from a given context, builds a doc cooked for its address and value, and also builds a possibly empty list for its datum and reference script when they exist.

Instance details

Defined in Cooked.Pretty.Skeleton

PrettyCooked a => PrettyCookedList [a] Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCookedList (TxOpts, [Wallet]) Source #

Prints a list of pubkeys with a flag next to the balancing wallet

Instance details

Defined in Cooked.Pretty.Skeleton

class PrettyCookedMaybe a where Source #

Type class of things that can be optionally pretty printed as a document

Minimal complete definition

Nothing

Methods

prettyCookedOptMaybe :: PrettyCookedOpts -> a -> Maybe DocCooked Source #

Pretty prints an optional document on some PrettyCookedOpts

prettyCookedMaybe :: a -> Maybe DocCooked Source #

Pretty prints an option document

printCookedOpt :: PrettyCooked a => PrettyCookedOpts -> a -> IO () Source #

Use this in the REPL as an alternative to the default print function when dealing with pretty-printable cooked values.

For example, printCookedOpt def runMockChain i0 foo

printCooked :: PrettyCooked a => a -> IO () Source #

Version of printCookedOpt that uses default pretty printing options.

renderString :: (a -> DocCooked) -> a -> String Source #

Use this to convert a pretty-printer to a regular show function using default layout options. This is used in Testing because Tasty uses strings.

prettyHash :: ToHash a => PrettyCookedOpts -> a -> DocCooked Source #

Pretty prints hashable elements based on pcOptHashes in the PrettyCookedOpts. This cannot be made an instance as it would be undecidable (the hope was (ToHash a) => PrettyCooked a)

prettyItemize :: PrettyCookedList a => PrettyCookedOpts -> DocCooked -> DocCooked -> a -> DocCooked Source #

Print an item list with a title

>>> prettyCookedOpts opts "Foo" "-" ["bar1", "bar2", "bar3"]
Foo
  - bar1
  - bar2
  - bar3

prettyItemizeNoTitle :: PrettyCookedList a => PrettyCookedOpts -> DocCooked -> a -> DocCooked Source #

Print an item list without a title

prettyItemizeNonEmpty :: PrettyCookedList a => PrettyCookedOpts -> DocCooked -> DocCooked -> a -> Maybe DocCooked Source #

Print an item list with a title, but only when the list is non-empty