Safe Haskell | None |
---|---|
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
- 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
.
toBuiltinData :: a -> BuiltinData Source #
Convert a value to BuiltinData
.
Instances
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!