| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Plutarch.Builtin.ByteString
Synopsis
- newtype PByteString s = PByteString (Term s POpaque)
- newtype PByte (s :: S) = PByte (Term s POpaque)
- newtype PLogicOpSemantics (s :: S) = PLogicOpSemantics (Term s PBool)
- newtype PEndianness (s :: S) = PEndianness (Term s PBool)
- ppadding :: forall (s :: S). Term s PLogicOpSemantics
- ptruncation :: forall (s :: S). Term s PLogicOpSemantics
- pmostSignificantFirst :: forall (s :: S). Term s PEndianness
- pmostSignificantLast :: forall (s :: S). Term s PEndianness
- pandBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString)))
- porBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString)))
- pxorBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString)))
- pcomplementBS :: forall (s :: S). Term s (PByteString :--> PByteString)
- preplicateBS :: forall (s :: S). Term s (PInteger :--> (PByte :--> PByteString))
- pconsBS :: Term s (PByte :--> (PByteString :--> PByteString))
- pbyteToInteger :: Term s (PByte :--> PInteger)
- pintegerToByte :: Term s (PInteger :--> PByte)
- psliceBS :: Term s (PInteger :--> (PInteger :--> (PByteString :--> PByteString)))
- plengthBS :: Term s (PByteString :--> PInteger)
- pindexBS :: Term s (PByteString :--> (PInteger :--> PByte))
- phexByteStr :: HasCallStack => String -> Term s PByteString
- pbyteStringToInteger :: forall (s :: S). Term s (PEndianness :--> (PByteString :--> PInteger))
- pintegerToByteString :: forall (s :: S). Term s (PEndianness :--> (PInteger :--> (PInteger :--> PByteString)))
Documentation
newtype PByteString s Source #
Plutus BuiltinByteString
Constructors
| PByteString (Term s POpaque) |
Instances
newtype 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: 1.10.0
Instances
newtype PLogicOpSemantics (s :: S) Source #
Type designating whether logical operations should use padding or truncation semantics. See CIP-122 for more details on this.
Since: 1.10.0
Constructors
| PLogicOpSemantics (Term s PBool) |
Instances
newtype 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: 1.10.0
Constructors
| PEndianness (Term s PBool) |
Instances
ppadding :: forall (s :: S). Term s PLogicOpSemantics Source #
Indicates that padding semantics should be used.
Since: 1.10.0
ptruncation :: forall (s :: S). Term s PLogicOpSemantics Source #
Indicates that truncation semantics should be used.
Since: 1.10.0
pmostSignificantFirst :: forall (s :: S). Term s PEndianness Source #
Indicates the conversion should be most-significant-first.
Since: 1.10.0
pmostSignificantLast :: forall (s :: S). Term s PEndianness Source #
Indicates the conversion should be most-significant-last.
Since: 1.10.0
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: 1.10.0
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: 1.10.0
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: 1.10.0
pcomplementBS :: forall (s :: S). Term s (PByteString :--> PByteString) Source #
Perform the logical complement of a PByteString, as per
CIP-122.
Since: 1.10.0
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: 1.10.0
pconsBS :: Term s (PByte :--> (PByteString :--> PByteString)) Source #
Prepend a PByte to a 'PByteString.
Since: 1.10.0
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"
plengthBS :: Term s (PByteString :--> PInteger) Source #
Find the length of a PByteString.
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: 1.10.0
phexByteStr :: HasCallStack => String -> Term s PByteString Source #
Interpret a hex string as a PByteString.
pbyteStringToInteger :: forall (s :: S). Term s (PEndianness :--> (PByteString :--> PInteger)) Source #
Convert a PByteString into a PInteger, as per
CIP-121.
Since: 1.10.0
pintegerToByteString :: forall (s :: S). Term s (PEndianness :--> (PInteger :--> (PInteger :--> PByteString))) Source #
Converts a PInteger into a PByteString, given a desired endianness and
target length. For more details, see CIP-121.
Note
This conversion is unsafe. It will fail if any of the following occur:
- The size is negative.
- The size is too large (currently if over 8196 bytes).
- The size won't fit the integer to convert.