plutus-tx
Safe HaskellNone
LanguageHaskell2010

PlutusTx.Blueprint.TH

Synopsis

Documentation

makeIsDataSchemaIndexed :: Name -> [(Name, Natural)] -> Q [InstanceDec] Source #

Generate a ToData, FromData, UnsafeFromData, HasBlueprintSchema instances for a type, using an explicit mapping of constructor names to indices. Use this for types where you need to keep the representation stable.

Note: Requires ViewPatterns, FlexibleInstances, UndecidableInstances, MultiParamTypeClasses, TypeApplications language extensions and an `import PlutusTx.Blueprint.Definition (definitionRef)`.

unstableMakeIsDataSchema :: Name -> Q [Dec] Source #

Generate a ToData, FromData, UnsafeFromData, HasBlueprintSchema instances for a type, using an implicit mapping of constructor names to indices [0..] As the name suggests the representation can become unstable when constructors are added/removed.

Note: Requires ViewPatterns, FlexibleInstances, UndecidableInstances, MultiParamTypeClasses, TypeApplications language extensions and an `import PlutusTx.Blueprint.Definition (definitionRef)`.

mkSchemaClause Source #

Arguments

:: Type

The type for the HasBlueprintSchema instance.

-> [(ConstructorInfo, SchemaInfo, Natural)]

The constructors of the type with their schema infos and indices.

-> ClauseQ

The clause for the schema function.

Make a clause for the schema function.

lookupAnn :: Data a => Name -> Q [a] Source #