| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Plutarch.Extra.Record
Synopsis
- mkRecord :: forall (r :: [PLabeledType]) (s :: S). RecordMorphism s '[] r -> Term s (PDataRecord r)
- mkRecordConstr :: forall (r :: [PLabeledType]) (s :: S) (pt :: S -> Type). PlutusType pt => (forall s'. Term s' (PDataRecord r) -> pt s') -> RecordMorphism s '[] r -> Term s pt
- (.=) :: forall (sym :: Symbol) (a :: S -> Type) (as :: [PLabeledType]) (s :: S). FieldName sym -> Term s (PAsData a) -> RecordMorphism s as ((sym := a) ': as)
- (.&) :: forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType]) (c :: [PLabeledType]). RecordMorphism s b c -> RecordMorphism s a b -> RecordMorphism s a c
- data RecordMorphism (s :: S) (as :: [PLabeledType]) (bs :: [PLabeledType])
- data FieldName (sym :: Symbol)
Documentation
mkRecord :: forall (r :: [PLabeledType]) (s :: S). RecordMorphism s '[] r -> Term s (PDataRecord r) Source #
Turn a constant RecordMorphism into a fully built PDataRecord.
Since: 1.3.0
Arguments
| :: forall (r :: [PLabeledType]) (s :: S) (pt :: S -> Type). PlutusType pt | |
| => (forall s'. Term s' (PDataRecord r) -> pt s') | The constructor. This is just the Haskell-level constructor for the type.
For |
| -> RecordMorphism s '[] r | The morphism that builds the record. |
| -> Term s pt |
mkRecord but for known data-types.
This allows you to dynamically construct a record type constructor.
Example:
mkRecordConstrPScriptContext( #txInfo.='(Your PTxInfo)'.&#purpose.='(Your PScriptPurpose)' )
Is the same as
pconstant(ScriptContext'(Your TxInfo)' '(Your ScriptPurpose)')
Since: 1.3.0
Arguments
| :: forall (sym :: Symbol) (a :: S -> Type) (as :: [PLabeledType]) (s :: S). FieldName sym | The field name. You can use |
| -> Term s (PAsData a) | The value at that field. This must be |
| -> RecordMorphism s as ((sym := a) ': as) |
Cons a labeled type as a RecordMorphism.
Since: 3.1.0
(.&) :: forall (s :: S) (a :: [PLabeledType]) (b :: [PLabeledType]) (c :: [PLabeledType]). RecordMorphism s b c -> RecordMorphism s a b -> RecordMorphism s a c infixr 6 Source #
Compose two RecordMorphisms.
Since: 1.3.0
data RecordMorphism (s :: S) (as :: [PLabeledType]) (bs :: [PLabeledType]) Source #
A morphism from one PDataRecord to another, representing some sort of consing of data.
Since: 1.3.0
Instances
| Category (RecordMorphism s :: [PLabeledType] -> [PLabeledType] -> TYPE LiftedRep) Source # | Since: 1.3.0 |
Defined in Plutarch.Extra.Record Methods id :: forall (a :: k). RecordMorphism s a a Source # (.) :: forall (b :: k) (c :: k) (a :: k). RecordMorphism s b c -> RecordMorphism s a b -> RecordMorphism s a c Source # | |
data FieldName (sym :: Symbol) Source #
Like Proxy but local to this module.
Since: 1.3.0
Instances
| sym ~ sym' => IsLabel sym (FieldName sym) Source # | The use of two different For example, Since: 1.3.0 |
Defined in Plutarch.Extra.Record | |