plutarch-1.9.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Plutarch.ByteString

Synopsis

Types

data PByte (s :: S) Source #

A Plutarch-level representation of bytes.

Note =

This type is intentionally quite restrictive, as it's not really meant to be computed with. Instead, it ensures certain operations' type safety while also allowing more sensible signatures. If you want to do anything with PBytes, we recommend converting them to PIntegers first.

@since WIP

Instances

Instances details
PEq PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Methods

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

PLiftable PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Associated Types

type AsHaskell PByte Source #

type PlutusRepr PByte Source #

POrd PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Methods

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

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

PPartialOrd PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Methods

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

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

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

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

DerivePlutusType PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Associated Types

type DPTStrat PByte Source #

PlutusType PByte Source # 
Instance details

Defined in Plutarch.ByteString

Methods

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

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

Generic (PByte s) Source # 
Instance details

Defined in Plutarch.ByteString

Associated Types

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

Methods

from :: PByte s -> Rep (PByte s) x Source #

to :: Rep (PByte s) x -> PByte s Source #

type AsHaskell PByte Source # 
Instance details

Defined in Plutarch.ByteString

type PlutusRepr PByte Source # 
Instance details

Defined in Plutarch.ByteString

type DPTStrat PByte Source # 
Instance details

Defined in Plutarch.ByteString

type PContravariant' PByte Source # 
Instance details

Defined in Plutarch.ByteString

type PCovariant' PByte Source # 
Instance details

Defined in Plutarch.ByteString

type PInner PByte Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

type PVariant' PByte Source # 
Instance details

Defined in Plutarch.ByteString

type Rep (PByte s) Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

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

data PByteString s Source #

Plutus BuiltinByteString

Instances

Instances details
PIsData PByteString Source # 
Instance details

Defined in Plutarch.Builtin

Methods

pfromDataImpl :: forall (s :: S). Term s (PAsData PByteString) -> Term s PByteString Source #

pdataImpl :: forall (s :: S). Term s PByteString -> Term s PData Source #

PEq PByteString Source # 
Instance details

Defined in Plutarch.ByteString

Methods

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

PLiftable PByteString Source # 
Instance details

Defined in Plutarch.ByteString

POrd PByteString Source # 
Instance details

Defined in Plutarch.ByteString

Methods

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

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

PPartialOrd PByteString Source # 
Instance details

Defined in Plutarch.ByteString

Methods

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

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

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

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

DerivePlutusType PByteString Source # 
Instance details

Defined in Plutarch.ByteString

Associated Types

type DPTStrat PByteString Source #

PlutusType PByteString Source # 
Instance details

Defined in Plutarch.ByteString

Methods

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

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

PShow PByteString Source # 
Instance details

Defined in Plutarch.Show

Methods

pshow' :: forall (s :: S). Bool -> Term s PByteString -> Term s PString Source #

PTryFrom PData (PAsData PByteString) Source # 
Instance details

Defined in Plutarch.Builtin

Methods

ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s (PAsData PByteString), Reduce (PTryFromExcess PData (PAsData PByteString) s)) -> Term s r) -> Term s r Source #

Generic (PByteString s) Source # 
Instance details

Defined in Plutarch.ByteString

Associated Types

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

PLiftable (PAsData PByteString) Source # 
Instance details

Defined in Plutarch.Builtin

Monoid (Term s PByteString) Source # 
Instance details

Defined in Plutarch.ByteString

Semigroup (Term s PByteString) Source # 
Instance details

Defined in Plutarch.ByteString

type AsHaskell PByteString Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

type PlutusRepr PByteString Source # 
Instance details

Defined in Plutarch.ByteString

type DPTStrat PByteString Source # 
Instance details

Defined in Plutarch.ByteString

type PContravariant' PByteString Source # 
Instance details

Defined in Plutarch.ByteString

type PCovariant' PByteString Source # 
Instance details

Defined in Plutarch.ByteString

type PInner PByteString Source # 
Instance details

Defined in Plutarch.ByteString

type PVariant' PByteString Source # 
Instance details

Defined in Plutarch.ByteString

type PTryFromExcess PData (PAsData PByteString) Source # 
Instance details

Defined in Plutarch.Builtin

type Rep (PByteString s) Source # 
Instance details

Defined in Plutarch.ByteString

type Rep (PByteString s) = D1 ('MetaData "PByteString" "Plutarch.ByteString" "plutarch-1.9.0-DaxzFvLNVysDL1hkJ4YFrw" 'True) (C1 ('MetaCons "PByteString" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s POpaque))))
type AsHaskell (PAsData PByteString) Source # 
Instance details

Defined in Plutarch.Builtin

type PlutusRepr (PAsData PByteString) Source # 
Instance details

Defined in Plutarch.Builtin

data PLogicOpSemantics (s :: S) Source #

Type designating whether logical operations should use padding or truncation semantics. See CIP-122 for more details on this.

@since WIP

Instances

Instances details
PEq PLogicOpSemantics Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Methods

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

POrd PLogicOpSemantics Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

PPartialOrd PLogicOpSemantics Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

DerivePlutusType PLogicOpSemantics Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

Associated Types

type DPTStrat PLogicOpSemantics Source #

PlutusType PLogicOpSemantics Source # 
Instance details

Defined in Plutarch.ByteString

Methods

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

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

Generic (PLogicOpSemantics s) Source # 
Instance details

Defined in Plutarch.ByteString

Associated Types

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

type DPTStrat PLogicOpSemantics Source # 
Instance details

Defined in Plutarch.ByteString

type PContravariant' PLogicOpSemantics Source # 
Instance details

Defined in Plutarch.ByteString

type PCovariant' PLogicOpSemantics Source # 
Instance details

Defined in Plutarch.ByteString

type PInner PLogicOpSemantics Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

type PVariant' PLogicOpSemantics Source # 
Instance details

Defined in Plutarch.ByteString

type Rep (PLogicOpSemantics s) Source #

@since WIP

Instance details

Defined in Plutarch.ByteString

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

Functions

Construction

ppadding :: forall (s :: S). Term s PLogicOpSemantics Source #

Indicates that padding semantics should be used.

@since WIP

ptruncation :: forall (s :: S). Term s PLogicOpSemantics Source #

Indicates that truncation semantics should be used.

@since WIP

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

Construct a PByteString of the specified length (0 if negative) consisting entirely of zero bytes.

@since WIP

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

Construct a PByteString of the specified length (0 if negative) consisting entirely of ones; that is, where every byte is 0xFF.

@since WIP

preplicateBS :: forall (s :: S). Term s (PInteger :--> (PByte :--> PByteString)) Source #

Given a desired length and a PByte, construct a PByteString of the specified length (0 if negative) consisting entirely of that PByte.

@since WIP

Byte-oriented

pallBS :: forall (s :: S). Term s ((PByte :--> PBool) :--> (PByteString :--> PBool)) Source #

Verify that the given predicate holds for every byte in the argument.

@since WIP

pandBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString))) Source #

Perform the logical AND of two PByteStrings, as per CIP-122. The PLogicOpSemantics argument specifies what should be done if the lengths of the two PByteString arguments do not match.

@since WIP

porBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString))) Source #

Perform the logical OR of two PByteStrings, as per CIP-122. The PLogicOpSemantics argument specifies what should be done if the lengths of the two PByteString arguments do not match.

@since WIP

pxorBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString))) Source #

Perform the logical XOR of two PByteStrings, as per CIP-122. The PLogicOpSemantics argument specifies what should be done if the lengths of the two PByteString arguments do not match.

@since WIP

pcomplementBS :: forall (s :: S). Term s (PByteString :--> PByteString) Source #

Perform the logical complement of a PByteString, as per CIP-122.

@since WIP

pconsBS :: Term s (PByte :--> (PByteString :--> PByteString)) Source #

Prepend a PByte to a 'PByteString.

@since WIP

psliceBS :: Term s (PInteger :--> (PInteger :--> (PByteString :--> PByteString))) Source #

Slice a PByteString with given start index and slice length.

>>> (pslice # 2 # 3 phexByteStr "4102afde5b2a") #== phexByteStr "afde5b"

pindexBS :: Term s (PByteString :--> (PInteger :--> PByte)) Source #

Given a valid index into a PByteString, returns the PByte at that index. Will crash if given an out-of-bounds index.

@since WIP

Conversion

pbyteToInteger :: Term s (PByte :--> PInteger) Source #

Convert a PByte into its corresponding PInteger.

@since WIP

pintegerToByte :: Term s (PInteger :--> PByte) Source #

Try to convert a PInteger into its corresponding PByte. This operation is checked, and will error if given a negative PInteger, or one too large to fit into a byte.

@since WIP

punsafeIntegerToByte :: Term s (PInteger :--> PByte) Source #

As pintegerToByte, but unchecked. Be very careful with this: it can potentially break downstream invariants and wreak all manner of hard-to-discover havoc. Only included for reasons of efficiency.

@since WIP

Other

phexByteStr :: HasCallStack => String -> Term s PByteString Source #

Interpret a hex string as a PByteString.