Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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
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 PByte
s,
we recommend converting them to PInteger
s first.
@since WIP
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 WIP
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 WIP
PEndianness (Term s PBool) |
Instances
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
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
pandBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString))) Source #
Perform the logical AND of two PByteString
s, 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 PByteString
s, 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 PByteString
s, 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
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
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"
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 WIP
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 WIP
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.