cardano-ledger-shelley-1.14.1.0: Shelley Ledger Executable Model
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cardano.Ledger.Shelley.ImpTest

Synopsis

Documentation

data ImpTestM era a Source #

Instances

Instances details
MonadFail (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

failStringImpTestM era a Source #

MonadIO (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

liftIOIO a → ImpTestM era a Source #

Applicative (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

pure ∷ a → ImpTestM era a Source #

(<*>)ImpTestM era (a → b) → ImpTestM era a → ImpTestM era b Source #

liftA2 ∷ (a → b → c) → ImpTestM era a → ImpTestM era b → ImpTestM era c Source #

(*>)ImpTestM era a → ImpTestM era b → ImpTestM era b Source #

(<*)ImpTestM era a → ImpTestM era b → ImpTestM era a Source #

Functor (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

fmap ∷ (a → b) → ImpTestM era a → ImpTestM era b Source #

(<$) ∷ a → ImpTestM era b → ImpTestM era a Source #

Monad (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

(>>=)ImpTestM era a → (a → ImpTestM era b) → ImpTestM era b Source #

(>>)ImpTestM era a → ImpTestM era b → ImpTestM era b Source #

return ∷ a → ImpTestM era a Source #

MonadGen (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

liftGenGen a → ImpTestM era a Source #

variantIntegral n ⇒ n → ImpTestM era a → ImpTestM era a Source #

sized ∷ (IntImpTestM era a) → ImpTestM era a Source #

resizeIntImpTestM era a → ImpTestM era a Source #

chooseRandom a ⇒ (a, a) → ImpTestM era a Source #

MonadUnliftIO (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

withRunInIO ∷ ((∀ a. ImpTestM era a → IO a) → IO b) → ImpTestM era b Source #

HasStatefulGen (StateGenM (ImpTestState era)) (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

MonadReader (ImpTestEnv era) (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

askImpTestM era (ImpTestEnv era) Source #

local ∷ (ImpTestEnv era → ImpTestEnv era) → ImpTestM era a → ImpTestM era a Source #

reader ∷ (ImpTestEnv era → a) → ImpTestM era a Source #

MonadState (ImpTestState era) (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

getImpTestM era (ImpTestState era) Source #

putImpTestState era → ImpTestM era () Source #

state ∷ (ImpTestState era → (a, ImpTestState era)) → ImpTestM era a Source #

MonadWriter [SomeSTSEvent era] (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

writer ∷ (a, [SomeSTSEvent era]) → ImpTestM era a Source #

tell ∷ [SomeSTSEvent era] → ImpTestM era () Source #

listenImpTestM era a → ImpTestM era (a, [SomeSTSEvent era]) Source #

passImpTestM era (a, [SomeSTSEvent era] → [SomeSTSEvent era]) → ImpTestM era a Source #

(Testable a, ShelleyEraImp era) ⇒ Testable (ImpTestM era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

propertyImpTestM era a → Property Source #

propertyForAllShrinkShowGen a0 → (a0 → [a0]) → (a0 → [String]) → (a0 → ImpTestM era a) → Property Source #

(ShelleyEraImp era, Testable prop) ⇒ Example (ImpTestM era prop) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Associated Types

type Arg (ImpTestM era prop) Source #

Methods

evaluateExampleImpTestM era prop → Params → (ActionWith (Arg (ImpTestM era prop)) → IO ()) → ProgressCallbackIO Result Source #

(ShelleyEraImp era, Arbitrary a, Show a, Testable prop) ⇒ Example (a → ImpTestM era prop) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Associated Types

type Arg (a → ImpTestM era prop) Source #

Methods

evaluateExample ∷ (a → ImpTestM era prop) → Params → (ActionWith (Arg (a → ImpTestM era prop)) → IO ()) → ProgressCallbackIO Result Source #

type Arg (ImpTestM era prop) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

type Arg (ImpTestM era prop) = ImpTestState era
type Arg (a → ImpTestM era prop) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

type Arg (a → ImpTestM era prop) = ImpTestState era

data SomeSTSEvent era Source #

Constructors

∀ (rule ∷ Symbol).(Typeable (Event (EraRule rule era)), Eq (Event (EraRule rule era)), ToExpr (Event (EraRule rule era))) ⇒ SomeSTSEvent (Event (EraRule rule era)) 

Instances

Instances details
Eq (SomeSTSEvent era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

(==)SomeSTSEvent era → SomeSTSEvent era → Bool Source #

(/=)SomeSTSEvent era → SomeSTSEvent era → Bool Source #

ToExpr (SomeSTSEvent era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

MonadWriter [SomeSTSEvent era] (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

writer ∷ (a, [SomeSTSEvent era]) → ImpTestM era a Source #

tell ∷ [SomeSTSEvent era] → ImpTestM era () Source #

listenImpTestM era a → ImpTestM era (a, [SomeSTSEvent era]) Source #

passImpTestM era (a, [SomeSTSEvent era] → [SomeSTSEvent era]) → ImpTestM era a Source #

runImpTestMShelleyEraImp era ⇒ Maybe IntImpTestState era → ImpTestM era b → IO (b, ImpTestState era) Source #

runImpTestM_ShelleyEraImp era ⇒ Maybe IntImpTestState era → ImpTestM era b → IO () Source #

evalImpTestMShelleyEraImp era ⇒ Maybe IntImpTestState era → ImpTestM era b → IO b Source #

runImpTestGenMShelleyEraImp era ⇒ ImpTestState era → ImpTestM era b → Gen (IO (b, ImpTestState era)) Source #

runImpTestGenM_ShelleyEraImp era ⇒ ImpTestState era → ImpTestM era b → Gen (IO ()) Source #

evalImpTestGenMShelleyEraImp era ⇒ ImpTestState era → ImpTestM era b → Gen (IO b) Source #

data ImpTestState era Source #

Instances

Instances details
HasSubState (ImpTestState era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Associated Types

type SubState (ImpTestState era) Source #

HasStatefulGen (StateGenM (ImpTestState era)) (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

MonadState (ImpTestState era) (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

getImpTestM era (ImpTestState era) Source #

putImpTestState era → ImpTestM era () Source #

state ∷ (ImpTestState era → (a, ImpTestState era)) → ImpTestM era a Source #

type SubState (ImpTestState era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

type SubState (ImpTestState era) = StateGen QCGen

data ImpTestEnv era Source #

Constructors

ImpTestEnv 

Fields

Instances

Instances details
MonadReader (ImpTestEnv era) (ImpTestM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.ImpTest

Methods

askImpTestM era (ImpTestEnv era) Source #

local ∷ (ImpTestEnv era → ImpTestEnv era) → ImpTestM era a → ImpTestM era a Source #

reader ∷ (ImpTestEnv era → a) → ImpTestM era a Source #

data ImpException Source #

Stores extra information about the failure of the unit test

Constructors

ImpException 

Fields

class (EraGov era, EraUTxO era, EraTxOut era, EraPParams era, ShelleyEraTxCert era, ShelleyEraScript era, ToExpr (Tx era), NFData (Tx era), ToExpr (TxBody era), ToExpr (TxOut era), ToExpr (Value era), ToExpr (PParams era), ToExpr (PParamsHKD Identity era), ToExpr (PParamsHKD StrictMaybe era), Show (NewEpochState era), ToExpr (NewEpochState era), ToExpr (GovState era), Eq (StashedAVVMAddresses era), Show (StashedAVVMAddresses era), ToExpr (StashedAVVMAddresses era), NFData (StashedAVVMAddresses era), Default (StashedAVVMAddresses era), STS (EraRule "BBODY" era), BaseM (EraRule "BBODY" era) ~ ShelleyBase, Environment (EraRule "BBODY" era) ~ BbodyEnv era, State (EraRule "BBODY" era) ~ ShelleyBbodyState era, Signal (EraRule "BBODY" era) ~ Block (BHeaderView (EraCrypto era)) era, State (EraRule "LEDGERS" era) ~ LedgerState era, STS (EraRule "LEDGER" era), BaseM (EraRule "LEDGER" era) ~ ShelleyBase, Signal (EraRule "LEDGER" era) ~ Tx era, State (EraRule "LEDGER" era) ~ LedgerState era, Environment (EraRule "LEDGER" era) ~ LedgerEnv era, Eq (PredicateFailure (EraRule "LEDGER" era)), Show (PredicateFailure (EraRule "LEDGER" era)), ToExpr (PredicateFailure (EraRule "LEDGER" era)), NFData (PredicateFailure (EraRule "LEDGER" era)), EncCBOR (PredicateFailure (EraRule "LEDGER" era)), DecCBOR (PredicateFailure (EraRule "LEDGER" era)), EraRuleEvent "LEDGER" era ~ Event (EraRule "LEDGER" era), Eq (EraRuleEvent "LEDGER" era), ToExpr (EraRuleEvent "LEDGER" era), NFData (EraRuleEvent "LEDGER" era), Typeable (EraRuleEvent "LEDGER" era), STS (EraRule "TICK" era), BaseM (EraRule "TICK" era) ~ ShelleyBase, Signal (EraRule "TICK" era) ~ SlotNo, State (EraRule "TICK" era) ~ NewEpochState era, Environment (EraRule "TICK" era) ~ (), NFData (PredicateFailure (EraRule "TICK" era)), EraRuleEvent "TICK" era ~ Event (EraRule "TICK" era), Eq (EraRuleEvent "TICK" era), ToExpr (EraRuleEvent "TICK" era), NFData (EraRuleEvent "TICK" era), Typeable (EraRuleEvent "TICK" era), ToExpr (PredicateFailure (EraRule "UTXOW" era)), DSIGN (EraCrypto era) ~ Ed25519DSIGN, NFData (VerKeyDSIGN (DSIGN (EraCrypto era))), VRFAlgorithm (VRF (EraCrypto era)), HashAlgorithm (HASH (EraCrypto era)), DSIGNAlgorithm (DSIGN (EraCrypto era)), Signable (DSIGN (EraCrypto era)) (Hash (HASH (EraCrypto era)) EraIndependentTxBody), ADDRHASH (EraCrypto era) ~ Blake2b_224) ⇒ ShelleyEraImp era where Source #

Minimal complete definition

impSatisfyNativeScript, fixupTx

Methods

initGenesis ∷ (HasKeyPairs s (EraCrypto era), MonadState s m, HasStatefulGen (StateGenM s) m) ⇒ m (Genesis era) Source #

default initGenesis ∷ (Monad m, Genesis era ~ NoGenesis era) ⇒ m (Genesis era) Source #

initNewEpochState ∷ (HasKeyPairs s (EraCrypto era), MonadState s m, HasStatefulGen (StateGenM s) m) ⇒ m (NewEpochState era) Source #

initImpTestState ∷ (HasKeyPairs s (EraCrypto era), MonadState s m, HasSubState s, SubState s ~ StateGen QCGen, HasStatefulGen (StateGenM s) m) ⇒ m (ImpTestState era) Source #

impSatisfyNativeScript Source #

Arguments

Set (KeyHash 'Witness (EraCrypto era))

Set of Witnesses that have already been satisfied

NativeScript era 
ImpTestM era (Maybe (Map (KeyHash 'Witness (EraCrypto era)) (KeyPair 'Witness (EraCrypto era)))) 

Try to find a sufficient number of KeyPairs that would satisfy a native script. Whenever script can't be satisfied, Nothing is returned

modifyPParams ∷ (PParams era → PParams era) → ImpTestM era () Source #

This modifer should change not only the current PParams, but also the future PParams. If the future PParams are not updated, then they will overwrite the mofication of the current PParams at the next epoch.

fixupTxHasCallStackTx era → ImpTestM era (Tx era) Source #

data PlutusArgs Source #

Instances

Instances details
Generic PlutusArgs 
Instance details

Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext

Associated Types

type Rep PlutusArgsTypeType Source #

Show PlutusArgs 
Instance details

Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext

NFData PlutusArgs 
Instance details

Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext

Methods

rnfPlutusArgs → () Source #

type Rep PlutusArgs 
Instance details

Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext

type Rep PlutusArgs = D1 ('MetaData "PlutusArgs" "Test.Cardano.Ledger.Plutus.ScriptTestContext" "cardano-ledger-core-1.15.0.0-inplace-testlib" 'False) (C1 ('MetaCons "PlutusArgs" 'PrefixI 'True) (S1 ('MetaSel ('Just "paData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Data) :*: S1 ('MetaSel ('Just "paSpendDatum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Data))))

impWitsVKeyNeededEraUTxO era ⇒ TxBody era → ImpTestM era (Set (BootstrapAddress (EraCrypto era)), Set (KeyHash 'Witness (EraCrypto era))) Source #

Figure out all the Byron Addresses that need witnesses as well as all of the KeyHashes for Shelley Key witnesses that are required.

modifyPrevPParamsEraGov era ⇒ (PParams era → PParams era) → ImpTestM era () Source #

Modify the previous PParams in the current state with the given function. For current and future PParams, use modifyPParams

passEpoch ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ ImpTestM era () Source #

Runs the TICK rule until the next epoch is reached

passNEpochs ∷ ∀ era. ShelleyEraImp era ⇒ NaturalImpTestM era () Source #

Runs the TICK rule until the n epochs are passed

passNEpochsChecking ∷ ∀ era. ShelleyEraImp era ⇒ NaturalImpTestM era () → ImpTestM era () Source #

Runs the TICK rule until the n epochs are passed, running the checks each time.

passTick ∷ ∀ era. (HasCallStack, ShelleyEraImp era) ⇒ ImpTestM era () Source #

Runs the TICK rule once

freshKeyAddr ∷ (HasKeyPairs s c, MonadState s m, HasStatefulGen (StateGenM s) m) ⇒ m (KeyHash r c, Addr c) Source #

Generate a random Addr that uses a KeyHash, add the corresponding KeyPair to the known keys in the Imp state, and return the KeyHash as well as the Addr.

freshKeyAddr_ ∷ (HasKeyPairs s c, MonadState s m, HasStatefulGen (StateGenM s) m) ⇒ m (Addr c) Source #

Generate a random Addr that uses a KeyHash, and add the corresponding KeyPair to the known keys in the Imp state.

freshKeyHash ∷ (HasKeyPairs s c, MonadState s m, HasStatefulGen (StateGenM s) m) ⇒ m (KeyHash r c) Source #

Generates a fresh KeyHash and stores the corresponding KeyPair in the ImpTestState. If you also need the KeyPair consider using freshKeyPair for generation or lookupKeyPair to look up the KeyPair corresponding to the KeyHash

freshKeyPair ∷ (HasKeyPairs s c, MonadState s m, HasStatefulGen (StateGenM s) m) ⇒ m (KeyHash r c, KeyPair r c) Source #

Generate a random KeyPair and add it to the known keys in the Imp state

lookupKeyPair ∷ (HasCallStack, HasKeyPairs s c, MonadState s m) ⇒ KeyHash r c → m (KeyPair r c) Source #

Looks up the KeyPair corresponding to the KeyHash. The KeyHash must be created with freshKeyHash for this to work.

freshByronKeyHash ∷ (HasKeyPairs s c, MonadState s m, HasStatefulGen (StateGenM s) m) ⇒ m (KeyHash r c) Source #

Generates a fresh KeyHash and stores the corresponding ByronKeyPair in the ImpTestState. If you also need the ByronKeyPair consider using freshByronKeyPair for generation or lookupByronKeyPair to look up the ByronKeyPair corresponding to the KeyHash

lookupByronKeyPair ∷ (HasCallStack, HasKeyPairs s c, MonadState s m) ⇒ BootstrapAddress c → m ByronKeyPair Source #

Looks up the keypair corresponding to the BootstrapAddress. The BootstrapAddress must be created with freshBootstrapAddess for this to work.

freshSafeHashEra era ⇒ ImpTestM era (SafeHash (EraCrypto era) a) Source #

Creates a fresh SafeHash

submitTx ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era (Tx era) Source #

submitTx_ ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era () Source #

submitTxAnn ∷ (HasCallStack, ShelleyEraImp era) ⇒ StringTx era → ImpTestM era (Tx era) Source #

submitTxAnn_ ∷ (HasCallStack, ShelleyEraImp era) ⇒ StringTx era → ImpTestM era () Source #

submitFailingTx ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → NonEmpty (PredicateFailure (EraRule "LEDGER" era)) → ImpTestM era () Source #

Submit a transaction that is expected to be rejected with the given predicate failures. The inputs and outputs are automatically balanced.

submitFailingTxM ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → (Tx era → ImpTestM era (NonEmpty (PredicateFailure (EraRule "LEDGER" era)))) → ImpTestM era () Source #

Submit a transaction that is expected to be rejected, and compute the expected predicate failures from the fixed-up tx using the supplied action. The inputs and outputs are automatically balanced.

trySubmitTx ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule "LEDGER" era)), Tx era) (Tx era)) Source #

modifyNES ∷ (NewEpochState era → NewEpochState era) → ImpTestM era () Source #

Modify the current new epoch state with a function

getsNESSimpleGetter (NewEpochState era) a → ImpTestM era a Source #

Get a value from the current new epoch state using the lens

getUTxOImpTestM era (UTxO era) Source #

impAnnNFData a ⇒ StringImpTestM era a → ImpTestM era a Source #

Annotation for when failure happens. All the logging done within annotation will be discarded if there no failures within the annotation.

impAnnDocNFData a ⇒ Doc AnsiStyleImpTestM era a → ImpTestM era a Source #

impLogToExpr ∷ (HasCallStack, ToExpr a) ⇒ ImpTestM era a → ImpTestM era a Source #

Adds the result of an action to the log, which is only shown if the test fails

runImpRule ∷ ∀ rule era. (HasCallStack, KnownSymbol rule, STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase, NFData (State (EraRule rule era)), NFData (Event (EraRule rule era)), ToExpr (Event (EraRule rule era)), Eq (Event (EraRule rule era)), Typeable (Event (EraRule rule era))) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (State (EraRule rule era)) Source #

tryRunImpRule ∷ ∀ rule era. (STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule rule era))) (State (EraRule rule era), [Event (EraRule rule era)])) Source #

shelleyFixupTx ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era) Source #

sendValueTo ∷ (ShelleyEraImp era, HasCallStack) ⇒ Addr (EraCrypto era) → Value era → ImpTestM era (TxIn (EraCrypto era)) Source #

updateAddrTxWits ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era (Tx era) Source #

Adds TxWits that will satisfy all of the required key witnesses

addNativeScriptTxWitsShelleyEraImp era ⇒ Tx era → ImpTestM era (Tx era) Source #

Modifies transaction by adding necessary scripts

addRootTxInShelleyEraImp era ⇒ Tx era → ImpTestM era (Tx era) Source #

This fixup step ensures that there are enough funds in the transaction.

fixupTxOutsShelleyEraImp era ⇒ Tx era → ImpTestM era (Tx era) Source #

fixupFees ∷ (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era) Source #

fixupAuxDataHash ∷ (EraTx era, Applicative m) ⇒ Tx era → m (Tx era) Source #

Adds an auxiliary data hash if auxiliary data present, while the hash of it is not.

defaultInitImpTestState ∷ ∀ era s m. (EraGov era, EraTxOut era, DSIGN (EraCrypto era) ~ Ed25519DSIGN, ADDRHASH (EraCrypto era) ~ Blake2b_224, HasKeyPairs s (EraCrypto era), MonadState s m, HasStatefulGen (StateGenM s) m, HasSubState s, SubState s ~ StateGen QCGen) ⇒ NewEpochState era → m (ImpTestState era) Source #

impEraStartEpochNo ∷ ∀ era. Era era ⇒ EpochNo Source #

For debugging purposes we start the era at the epoch number that matches the starting protocol version for the era times a 100

impSetSeedIntImpTestM era () Source #

Override the QuickCheck generator using a fixed seed.

Logging

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-60fc2444dcacdd48cc73f93e5ef87c40fa69faa308b0e641b05323137692b85e" '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)))))))

data AnsiStyle Source #

Render the annotated document in a certain style. Styles not set in the annotation will use the style of the surrounding document, or the terminal’s default if none has been set yet.

style = color Green <> bold
styledDoc = annotate style "hello world"

Instances

Instances details
Monoid AnsiStyle

mempty does nothing, which is equivalent to inheriting the style of the surrounding doc, or the terminal’s default if no style has been set yet.

Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Semigroup AnsiStyle

Keep the first decision for each of foreground color, background color, boldness, italication, and underlining. If a certain style is not set, the terminal’s default will be used.

Example:

color Red <> color Green

is red because the first color wins, and not bold because (or if) that’s the terminal’s default.

Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Show AnsiStyle 
Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Eq AnsiStyle 
Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Ord AnsiStyle 
Instance details

Defined in Prettyprinter.Render.Terminal.Internal

logDocHasCallStackDoc AnsiStyleImpTestM era () Source #

Adds a Doc to the log, which is only shown if the test fails

logStringHasCallStackStringImpTestM era () Source #

Adds a String to the log, which is only shown if the test fails

logToExpr ∷ (HasCallStack, ToExpr a) ⇒ a → ImpTestM era () Source #

Adds a ToExpr to the log, which is only shown if the test fails

logStakeDistrHasCallStackImpTestM era () Source #

Logs the current stake distribution

logFeeMismatch ∷ (EraGov era, EraUTxO era, HasCallStack) ⇒ Tx era → ImpTestM era () Source #

Combinators

withCustomFixup ∷ ((Tx era → ImpTestM era (Tx era)) → Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #

Compose given function with the configured fixup

withFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #

Replace all fixup with the given function

withNoFixupImpTestM era a → ImpTestM era a Source #

Performs the action without running the fix-up function on any transactions

withPostFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #

Apply given fixup function after the configured fixup

withPreFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #

Apply given fixup function before the configured fixup