Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data PByte (s :: S)
- data PByteString s
- data PLogicOpSemantics (s :: S)
- ppadding :: forall (s :: S). Term s PLogicOpSemantics
- ptruncation :: forall (s :: S). Term s PLogicOpSemantics
- pzeroesBS :: forall (s :: S). Term s (PInteger :--> PByteString)
- ponesBS :: forall (s :: S). Term s (PInteger :--> PByteString)
- preplicateBS :: forall (s :: S). Term s (PInteger :--> (PByte :--> PByteString))
- pallBS :: forall (s :: S). Term s ((PByte :--> PBool) :--> (PByteString :--> PBool))
- 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)
- pconsBS :: Term s (PByte :--> (PByteString :--> PByteString))
- psliceBS :: Term s (PInteger :--> (PInteger :--> (PByteString :--> PByteString)))
- plengthBS :: Term s (PByteString :--> PInteger)
- pindexBS :: Term s (PByteString :--> (PInteger :--> PByte))
- pbyteToInteger :: Term s (PByte :--> PInteger)
- pintegerToByte :: Term s (PInteger :--> PByte)
- punsafeIntegerToByte :: Term s (PInteger :--> PByte)
- phexByteStr :: HasCallStack => String -> Term s PByteString
Types
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
data PByteString s Source #
Plutus BuiltinByteString
Instances
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
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 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
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
Conversion
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.