plutus-tx-1.0.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellNone
LanguageHaskell2010

PlutusTx.IsData.Class

Synopsis

Documentation

class ToData (a :: Type) where Source #

A typeclass for types that can be converted to and from BuiltinData.

Methods

toBuiltinData :: a -> BuiltinData Source #

Convert a value to BuiltinData.

Instances

Instances details
ToData Bool Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(TypeError ('Text "Int is not supported, use Integer instead") :: Constraint) => ToData Int Source # 
Instance details

Defined in PlutusTx.IsData.Class

ToData Integer Source # 
Instance details

Defined in PlutusTx.IsData.Class

ToData () Source # 
Instance details

Defined in PlutusTx.IsData.Instances

ToData Void Source # 
Instance details

Defined in PlutusTx.IsData.Class

ToData BuiltinData Source # 
Instance details

Defined in PlutusTx.IsData.Class

ToData BuiltinByteString Source # 
Instance details

Defined in PlutusTx.IsData.Class

ToData Rational Source # 
Instance details

Defined in PlutusTx.Ratio

ToData Sqrt Source # 
Instance details

Defined in PlutusTx.Sqrt

ToData a => ToData [a] Source # 
Instance details

Defined in PlutusTx.IsData.Class

ToData a => ToData (Maybe a) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(ToData a, ToData b) => ToData (Either a b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(ToData a, ToData b) => ToData (a, b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

toBuiltinData :: (a, b) -> BuiltinData Source #

(ToData k, ToData v) => ToData (Map k v) Source # 
Instance details

Defined in PlutusTx.AssocMap

(ToData a, ToData b, ToData c) => ToData (a, b, c) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

toBuiltinData :: (a, b, c) -> BuiltinData Source #

(ToData a, ToData b, ToData c, ToData d) => ToData (a, b, c, d) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

toBuiltinData :: (a, b, c, d) -> BuiltinData Source #

class FromData (a :: Type) where Source #

Methods

fromBuiltinData :: BuiltinData -> Maybe a Source #

Convert a value from BuiltinData, returning Nothing if this fails.

Instances

Instances details
FromData Bool Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(TypeError ('Text "Int is not supported, use Integer instead") :: Constraint) => FromData Int Source # 
Instance details

Defined in PlutusTx.IsData.Class

FromData Integer Source # 
Instance details

Defined in PlutusTx.IsData.Class

FromData () Source # 
Instance details

Defined in PlutusTx.IsData.Instances

FromData Void Source # 
Instance details

Defined in PlutusTx.IsData.Class

FromData BuiltinData Source # 
Instance details

Defined in PlutusTx.IsData.Class

FromData BuiltinByteString Source # 
Instance details

Defined in PlutusTx.IsData.Class

FromData Rational Source # 
Instance details

Defined in PlutusTx.Ratio

FromData Sqrt Source # 
Instance details

Defined in PlutusTx.Sqrt

FromData a => FromData [a] Source # 
Instance details

Defined in PlutusTx.IsData.Class

FromData a => FromData (Maybe a) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(FromData a, FromData b) => FromData (Either a b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(FromData a, FromData b) => FromData (a, b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(FromData k, FromData v) => FromData (Map k v) Source # 
Instance details

Defined in PlutusTx.AssocMap

(FromData a, FromData b, FromData c) => FromData (a, b, c) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

fromBuiltinData :: BuiltinData -> Maybe (a, b, c) Source #

(FromData a, FromData b, FromData c, FromData d) => FromData (a, b, c, d) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

fromBuiltinData :: BuiltinData -> Maybe (a, b, c, d) Source #

class UnsafeFromData (a :: Type) where Source #

Methods

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!

Instances

Instances details
UnsafeFromData Bool Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(TypeError ('Text "Int is not supported, use Integer instead") :: Constraint) => UnsafeFromData Int Source # 
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData Integer Source # 
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData () Source # 
Instance details

Defined in PlutusTx.IsData.Instances

UnsafeFromData Void Source # 
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData BuiltinData Source # 
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData BuiltinByteString Source # 
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData Rational Source # 
Instance details

Defined in PlutusTx.Ratio

UnsafeFromData Sqrt Source # 
Instance details

Defined in PlutusTx.Sqrt

UnsafeFromData a => UnsafeFromData [a] Source # 
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData a => UnsafeFromData (Maybe a) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(UnsafeFromData a, UnsafeFromData b) => UnsafeFromData (Either a b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(UnsafeFromData a, UnsafeFromData b) => UnsafeFromData (a, b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(UnsafeFromData k, UnsafeFromData v) => UnsafeFromData (Map k v) Source # 
Instance details

Defined in PlutusTx.AssocMap

(UnsafeFromData a, UnsafeFromData b, UnsafeFromData c) => UnsafeFromData (a, b, c) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

unsafeFromBuiltinData :: BuiltinData -> (a, b, c) Source #

(UnsafeFromData a, UnsafeFromData b, UnsafeFromData c, UnsafeFromData d) => UnsafeFromData (a, b, c, d) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

unsafeFromBuiltinData :: BuiltinData -> (a, b, c, d) Source #

toData :: ToData a => a -> Data Source #

Convert a value to Data.

fromData :: FromData a => Data -> Maybe a Source #

Convert a value from Data, returning Nothing if this fails.