cardano-ledger-core-1.21.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellNone
LanguageHaskell2010

Cardano.Ledger.Huddle.Gen

Synopsis

MonadGen

Custom core

Term generators

data Term Source #

A general CBOR term, which can be used to serialise or deserialise arbitrary CBOR terms for interoperability or debugging. This type is essentially a direct reflection of the CBOR abstract syntax tree as a Haskell data type.

The Term type also comes with a Serialise instance, so you can easily use decode :: Decoder Term to directly decode any arbitrary CBOR value into Haskell with ease, and likewise with encode.

Since: cborg-0.2.0.0

Instances

Instances details
EncCBOR Term 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORTermEncoding Source #

Read Term 
Instance details

Defined in Codec.CBOR.Term

Show Term 
Instance details

Defined in Codec.CBOR.Term

Methods

showsPrecIntTermShowS #

showTermString #

showList ∷ [Term] → ShowS #

Eq Term 
Instance details

Defined in Codec.CBOR.Term

Methods

(==)TermTermBool #

(/=)TermTermBool #

Ord Term 
Instance details

Defined in Codec.CBOR.Term

Methods

compareTermTermOrdering #

(<)TermTermBool #

(<=)TermTermBool #

(>)TermTermBool #

(>=)TermTermBool #

maxTermTermTerm #

minTermTermTerm #

data RuleTerm Source #

Instances

Instances details
Show RuleTerm 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Custom.Core

Methods

showsPrecIntRuleTermShowS #

showRuleTermString #

showList ∷ [RuleTerm] → ShowS #

Eq RuleTerm 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Custom.Core

Methods

(==)RuleTermRuleTermBool #

(/=)RuleTermRuleTermBool #

Ord RuleTerm 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Custom.Core

newtype Name Source #

A name can consist of any of the characters from the set {A to Z, "a" to "z", "0" to "9", "_", "-", "", ".", "$"}, starting with an alphabetic character (including "", "_", "$") and ending in such a character or a digit.

  • Names are case sensitive.
  • It is preferred style to start a name with a lowercase letter.
  • The hyphen is preferred over the underscore (except in a "bareword" (Section 3.5.1), where the semantics may actually require an underscore).
  • The period may be useful for larger specifications, to express some module structure (as in "tcp.throughput" vs. "udp.throughput").
  • A number of names are predefined in the CDDL prelude, as listed in Appendix D.
  • Rule names (types or groups) do not appear in the actual CBOR encoding, but names used as "barewords" in member keys do.

Constructors

Name 

Fields

Instances

Instances details
HasName Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

getNameNameName Source #

CollectComments Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Monoid Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

memptyName #

mappendNameNameName #

mconcat ∷ [Name] → Name #

Semigroup Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

(<>)NameNameName #

sconcatNonEmpty NameName #

stimesIntegral b ⇒ b → NameName #

IsString Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

fromStringStringName #

Generic Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Associated Types

type Rep Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

type Rep Name = D1 ('MetaData "Name" "Codec.CBOR.Cuddle.CDDL" "cuddle-1.8.0.0-589000b3831fbdccb1c817862170cd1748bf46cf98935daf4760cdf57152228a" 'True) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "unName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

fromNameRep Name x #

toRep Name x → Name #

Show Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

showsPrecIntNameShowS #

showNameString #

showList ∷ [Name] → ShowS #

Eq Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

(==)NameNameBool #

(/=)NameNameBool #

Ord Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

compareNameNameOrdering #

(<)NameNameBool #

(<=)NameNameBool #

(>)NameNameBool #

(>=)NameNameBool #

maxNameNameName #

minNameNameName #

Hashable Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

Methods

hashWithSaltIntNameInt Source #

hashNameInt Source #

Pretty Name 
Instance details

Defined in Codec.CBOR.Cuddle.Pretty

Methods

prettyNameDoc ann Source #

prettyList ∷ [Name] → Doc ann Source #

HasSink "synth" MonoState MonoM 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

yield_Proxy# "synth" → MonoState → MonoM () Source #

HasSource "synth" MonoState MonoM 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

await_Proxy# "synth" → MonoM MonoState Source #

HasState "synth" MonoState MonoM 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

state_Proxy# "synth" → (MonoState → (a, MonoState)) → MonoM a Source #

HasReader "global" (Map Name (ProvidedParameters (CTree DistReferenced))) MonoM 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

local_Proxy# "global" → (Map Name (ProvidedParameters (CTree DistReferenced)) → Map Name (ProvidedParameters (CTree DistReferenced))) → MonoM a → MonoM a Source #

reader_Proxy# "global" → (Map Name (ProvidedParameters (CTree DistReferenced)) → a) → MonoM a Source #

HasReader "local" (Map Name (CTree MonoReferenced)) MonoM 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

local_Proxy# "local" → (Map Name (CTree MonoReferenced) → Map Name (CTree MonoReferenced)) → MonoM a → MonoM a Source #

reader_Proxy# "local" → (Map Name (CTree MonoReferenced) → a) → MonoM a Source #

HasSource "global" (Map Name (ProvidedParameters (CTree DistReferenced))) MonoM 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

await_Proxy# "global" → MonoM (Map Name (ProvidedParameters (CTree DistReferenced))) Source #

HasSource "local" (Map Name (CTree MonoReferenced)) MonoM 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

await_Proxy# "local" → MonoM (Map Name (CTree MonoReferenced)) Source #

type Rep Name 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL

type Rep Name = D1 ('MetaData "Name" "Codec.CBOR.Cuddle.CDDL" "cuddle-1.8.0.0-589000b3831fbdccb1c817862170cd1748bf46cf98935daf4760cdf57152228a" 'True) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "unName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

genRule ∷ ∀ (rule ∷ Symbol) era. HuddleRule rule era ⇒ CBORGen Term Source #

A function for generating a term from a rule. The HuddleRule constraint ensures that the rule is actually defined in that era.

generateFromNameHasCallStackNameCBORGen Term Source #

Generate a CBOR Term corresponding to a top-level name.

Since we apply this to a monomorphised CTree, the names must be monomorphic terms in the original CDDL.

This will throw an error if the generated item does not correspond to a single CBOR term (e.g. if the name resolves to a group, which cannot be generated outside a context).

generateFromGRefHasCallStackGRefCBORGen RuleTerm Source #

Generate a RuleTerm for the type bound to the given generic parameter at the enclosing rule. Use this from inside a custom generator attached to a generic rule.

Term validators

validateFromNameHasCallStackNameTermValidator () Source #

Validate a CBOR Term against a top-level rule from inside a custom validator.

validateFromGRefHasCallStackGRefTermValidator () Source #

Validate a CBOR Term against the type bound to the given generic parameter at the enclosing rule. Use this from inside a custom validator attached to a generic rule.

Lifted generators

arbitrary ∷ ∀ a m. (MonadGen m, Arbitrary a) ⇒ m a Source #

scaleMonadGen m ⇒ (IntInt) → m a → m a Source #

shuffleMonadGen m ⇒ [a] → m [a] Source #

Antigen

antiVectorOfUniqueEq a ⇒ IntAntiGen a → AntiGen (Maybe [a]) Source #

Generate a list of n pairwise-distinct elements. Returns Nothing if the underlying generator could not produce enough distinct elements within the per-element retry budget.

antiVectorOfUniqueBy ∷ (a → a → Bool) → IntAntiGen a → AntiGen (Maybe [a]) Source #

Like antiVectorOfUnique, but takes a user-supplied equivalence relation.

antiVectorOfUniqueOnEq b ⇒ (a → b) → IntAntiGen a → AntiGen (Maybe [a]) Source #

Like antiVectorOfUnique, but compares elements by a key projection.