plutarch-1.9.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Plutarch.Convert

Description

Conversions between various types.

@since WIP

Synopsis

Types

data PEndianness (s :: S) Source #

Type designating whether a conversion should be most-significant-first or most-significant-last. See CIP-121 for more details on this.

@since WIP

Instances

Instances details
PEq PEndianness Source #

@since WIP

Instance details

Defined in Plutarch.Convert

Methods

(#==) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

POrd PEndianness Source #

@since WIP

Instance details

Defined in Plutarch.Convert

Methods

pmax :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PEndianness Source #

pmin :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PEndianness Source #

PPartialOrd PEndianness Source #

@since WIP

Instance details

Defined in Plutarch.Convert

Methods

(#<=) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

(#<) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

(#>=) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

(#>) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source #

DerivePlutusType PEndianness Source #

@since WIP

Instance details

Defined in Plutarch.Convert

Associated Types

type DPTStrat PEndianness Source #

PlutusType PEndianness Source # 
Instance details

Defined in Plutarch.Convert

Methods

pcon' :: forall (s :: S). PEndianness s -> Term s (PInner PEndianness) Source #

pmatch' :: forall (s :: S) (b :: PType). Term s (PInner PEndianness) -> (PEndianness s -> Term s b) -> Term s b Source #

Generic (PEndianness s) Source # 
Instance details

Defined in Plutarch.Convert

Associated Types

type Rep (PEndianness s) :: Type -> Type Source #

type DPTStrat PEndianness Source # 
Instance details

Defined in Plutarch.Convert

type PContravariant' PEndianness Source # 
Instance details

Defined in Plutarch.Convert

type PCovariant' PEndianness Source # 
Instance details

Defined in Plutarch.Convert

type PInner PEndianness Source #

@since WIP

Instance details

Defined in Plutarch.Convert

type PVariant' PEndianness Source # 
Instance details

Defined in Plutarch.Convert

type Rep (PEndianness s) Source #

@since WIP

Instance details

Defined in Plutarch.Convert

type Rep (PEndianness s) = D1 ('MetaData "PEndianness" "Plutarch.Convert" "plutarch-1.9.0-DaxzFvLNVysDL1hkJ4YFrw" 'True) (C1 ('MetaCons "PEndianness" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PBool))))

Functions

pmostSignificantFirst :: forall (s :: S). Term s PEndianness Source #

Indicates the conversion should be most-significant-first.

@since WIP

pmostSignificantLast :: forall (s :: S). Term s PEndianness Source #

Indicates the conversion should be most-significant-last.

@since WIP

pbyteStringToInteger :: forall (s :: S). Term s PEndianness -> Term s (PByteString :--> PInteger) Source #

Convert a PByteString into a PInteger, as per CIP-121.

@since WIP

pintegerToByteString :: forall (s :: S). Term s PEndianness -> Term s (PInteger :--> PByteString) Source #

Convert a (non-negative) PInteger into a PByteString. This will produce a result of the minimal size required: if you want to specify a size, use pintegerToByteStringSized. For details, see CIP-121.

Note

This conversion is unsafe, as it will error when given a non-negative integer.

pintegerToByteStringSized :: forall (s :: S). Term s PEndianness -> Term s (PPositive :--> (PInteger :--> PByteString)) Source #

As pintegerToByteString, but allows specifying a required size. If a size larger than the minimum is specified, the result will be padded with zero bytes, positioned according to the endianness argument.

For more details, see CIP-121.

Note

This conversion is unsafe. In addition to the reasons for punsafeIntegerToByteString being unsafe, this will also error if the requested size is too large (currently 8192 is the limit) or too small to fit the specified PInteger.