Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class ToData (a ∷ Type) where
- toBuiltinData ∷ a → BuiltinData
- class FromData (a ∷ Type) where
- fromBuiltinData ∷ BuiltinData → Maybe a
- class UnsafeFromData (a ∷ Type) where
- toData ∷ ToData a ⇒ a → Data
- fromData ∷ FromData a ⇒ Data → Maybe a
- unsafeFromData ∷ UnsafeFromData a ⇒ Data → a
Documentation
class ToData (a ∷ Type) where Source #
A typeclass for types that can be converted to and from BuiltinData
.
toBuiltinData ∷ a → BuiltinData Source #
Convert a value to BuiltinData
.
Instances
ToData Void Source # | |
Defined in PlutusTx.IsData.Class | |
ToData BuiltinBLS12_381_G1_Element Source # | For the BLS12-381 G1 and G2 types we use the |
Defined in PlutusTx.IsData.Class | |
ToData BuiltinBLS12_381_G2_Element Source # | |
Defined in PlutusTx.IsData.Class | |
(TypeError ('Text "toBuiltinData is not supported for BuiltinBLS12_381_MlResult") ∷ Constraint) ⇒ ToData BuiltinBLS12_381_MlResult Source # | We do not provide instances of any of these classes for BuiltinBLS12_381_MlResult since there is no serialisation format: we expect that values of that type will only occur as the result of on-chain computations. |
Defined in PlutusTx.IsData.Class | |
ToData BuiltinByteString Source # | |
Defined in PlutusTx.IsData.Class | |
ToData BuiltinData Source # | |
Defined in PlutusTx.IsData.Class | |
ToData Rational Source # | |
Defined in PlutusTx.Ratio | |
ToData Sqrt Source # | |
Defined in PlutusTx.Sqrt | |
ToData Integer Source # | |
Defined in PlutusTx.IsData.Class | |
ToData () Source # | |
Defined in PlutusTx.IsData.Instances toBuiltinData ∷ () → BuiltinData Source # | |
ToData Bool Source # | |
Defined in PlutusTx.IsData.Instances | |
(TypeError ('Text "Int is not supported, use Integer instead") ∷ Constraint) ⇒ ToData Int Source # | |
Defined in PlutusTx.IsData.Class | |
ToData (List a) Source # | |
Defined in PlutusTx.Data.List toBuiltinData ∷ List a → BuiltinData Source # | |
ToData a ⇒ ToData (Maybe a) Source # | |
Defined in PlutusTx.IsData.Instances toBuiltinData ∷ Maybe a → BuiltinData Source # | |
ToData a ⇒ ToData [a] Source # | |
Defined in PlutusTx.IsData.Class toBuiltinData ∷ [a] → BuiltinData Source # | |
(ToData a, ToData b) ⇒ ToData (Either a b) Source # | |
Defined in PlutusTx.IsData.Instances toBuiltinData ∷ Either a b → BuiltinData Source # | |
(ToData k, ToData v) ⇒ ToData (Map k v) Source # | Hand-written instances to use the underlying |
Defined in PlutusTx.AssocMap toBuiltinData ∷ Map k v → BuiltinData Source # | |
ToData (Map k a) Source # | |
Defined in PlutusTx.Data.AssocMap toBuiltinData ∷ Map k a → BuiltinData Source # | |
(ToData a, ToData b) ⇒ ToData (These a b) Source # | |
Defined in PlutusTx.IsData.Instances toBuiltinData ∷ These a b → BuiltinData Source # | |
(ToData a, ToData b) ⇒ ToData (a, b) Source # | |
Defined in PlutusTx.IsData.Instances toBuiltinData ∷ (a, b) → BuiltinData Source # | |
(ToData a, ToData b, ToData c) ⇒ ToData (a, b, c) Source # | |
Defined in PlutusTx.IsData.Instances toBuiltinData ∷ (a, b, c) → BuiltinData Source # | |
(ToData a, ToData b, ToData c, ToData d) ⇒ ToData (a, b, c, d) Source # | |
Defined in PlutusTx.IsData.Instances toBuiltinData ∷ (a, b, c, d) → BuiltinData Source # |
class FromData (a ∷ Type) where Source #
fromBuiltinData ∷ BuiltinData → Maybe a Source #
Convert a value from BuiltinData
, returning Nothing
if this fails.
Instances
class UnsafeFromData (a ∷ Type) where Source #
unsafeFromBuiltinData ∷ BuiltinData → a Source #
Convert a value from BuiltinData
, calling error
if this fails.
This is typically much faster than fromBuiltinData
.
When implementing this function, make sure to call unsafeFromBuiltinData
rather than fromBuiltinData
when converting substructures!
This is a simple type without any validation, use with caution.
Instances
unsafeFromData ∷ UnsafeFromData a ⇒ Data → a Source #
Convert a value from Data
, throwing if this fails.