plutus-tx
Safe HaskellNone
LanguageHaskell2010

PlutusTx.IsData

Synopsis

Documentation

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

Generate a FromData and a ToData instance for a type. This may not be stable in the face of constructor additions, renamings, etc. Use makeIsDataIndexed if you need stability.

makeIsDataIndexed :: Name -> [(Name, Int)] -> Q [Dec] Source #

Generate a ToData, 'FromData and a UnsafeFromData 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.

data AsDataProdType Source #

If generating pattern synonyms for a product type declared with asData, we can avoid the index match, as we know that the type only has one constructor.

mkDestructor :: DatatypeInfo -> Name -> [ConstructorInfo] -> Q [Dec] Source #

unsafeFromDataClause :: [(ConstructorInfo, Int)] -> Q Clause Source #

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

Generates FromData and ToData instances for a type. Requires the type to have exactly one constructor, since instances created by deriveIsDataAsList use a list encoding instead of Constr and thus cannot represent constructor indices.

fromDataClause :: [(ConstructorInfo, Int)] -> Q Clause Source #