Safe Haskell | None |
---|---|
Language | Haskell2010 |
PlutusTx.IsData.Class
Synopsis
-
class
ToData
(a ::
Type
)
where
- toBuiltinData :: a -> BuiltinData
-
class
FromData
(a ::
Type
)
where
- fromBuiltinData :: BuiltinData -> Maybe a
-
class
UnsafeFromData
(a ::
Type
)
where
- unsafeFromBuiltinData :: BuiltinData -> a
- toData :: ToData a => a -> Data
- fromData :: FromData a => Data -> Maybe a
Documentation
class ToData (a :: Type ) where Source #
A typeclass for types that can be converted to and from
BuiltinData
.
Instances
class FromData (a :: Type ) where Source #
Methods
fromBuiltinData :: BuiltinData -> Maybe a Source #
Convert a value from
BuiltinData
, returning
Nothing
if this fails.
Instances
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!