| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Plutarch.Builtin.ByteString
Synopsis
- newtype PByteString (s :: 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 :: forall (s :: S). Term s (PByte :--> (PByteString :--> PByteString))
- pbyteToInteger :: forall (s :: S). Term s (PByte :--> PInteger)
- pintegerToByte :: forall (s :: S). Term s (PInteger :--> PByte)
- psliceBS :: forall (s :: S). Term s (PInteger :--> (PInteger :--> (PByteString :--> PByteString)))
- plengthBS :: forall (s :: S). Term s (PByteString :--> PInteger)
- pindexBS :: forall (s :: S). Term s (PByteString :--> (PInteger :--> PByte))
- phexByteStr :: forall (s :: S). 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 :: 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
| PEq PByte Source # | Since: 1.10.0 | ||||||||
| PLiftable PByte Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PByte -> PlutusRepr PByte Source # reprToHask :: PlutusRepr PByte -> Either LiftError (AsHaskell PByte) Source # reprToPlut :: forall (s :: S). PlutusRepr PByte -> PLifted s PByte Source # plutToRepr :: (forall (s :: S). PLifted s PByte) -> Either LiftError (PlutusRepr PByte) Source # | |||||||||
| POrd PByte Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Ord 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 # 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 # | |||||||||
| PlutusType PByte Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| Generic (PByte s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString Associated Types
| |||||||||
| Generic (PByte s) Source # | |||||||||
| type AsHaskell PByte Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr PByte Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner PByte Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type Rep (PByte s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Builtin.ByteString | |||||||||
| type Code (PByte s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString | |||||||||
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
| PEq PLogicOpSemantics Source # | |||||
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # | |||||
| POrd PLogicOpSemantics Source # | |||||
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # (#<) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # pmax :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PLogicOpSemantics Source # pmin :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PLogicOpSemantics Source # | |||||
| PlutusType PLogicOpSemantics Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PLogicOpSemantics s -> Term s (PInner PLogicOpSemantics) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PLogicOpSemantics) -> (PLogicOpSemantics s -> Term s b) -> Term s b Source # | |||||
| Generic (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString Associated Types
Methods from :: PLogicOpSemantics s -> Rep (PLogicOpSemantics s) x Source # to :: Rep (PLogicOpSemantics s) x -> PLogicOpSemantics s Source # | |||||
| Generic (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString Associated Types
Methods from :: PLogicOpSemantics s -> Rep (PLogicOpSemantics s) to :: Rep (PLogicOpSemantics s) -> PLogicOpSemantics s | |||||
| type PInner PLogicOpSemantics Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.PlutusType | |||||
| type Rep (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString type Rep (PLogicOpSemantics s) = D1 ('MetaData "PLogicOpSemantics" "Plutarch.Builtin.ByteString" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "PLogicOpSemantics" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PBool)))) | |||||
| type Code (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString | |||||
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
| PEq PEndianness Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source # | |||||
| POrd PEndianness Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.Ord 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 # 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 # | |||||
| PlutusType PEndianness Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PEndianness s -> Term s (PInner PEndianness) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PEndianness) -> (PEndianness s -> Term s b) -> Term s b Source # | |||||
| Generic (PEndianness s) Source # | |||||
Defined in Plutarch.Builtin.ByteString Associated Types
Methods from :: PEndianness s -> Rep (PEndianness s) x Source # to :: Rep (PEndianness s) x -> PEndianness s Source # | |||||
| Generic (PEndianness s) Source # | |||||
Defined in Plutarch.Builtin.ByteString Associated Types
| |||||
| type PInner PEndianness Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.PlutusType | |||||
| type Rep (PEndianness s) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Builtin.ByteString type Rep (PEndianness s) = D1 ('MetaData "PEndianness" "Plutarch.Builtin.ByteString" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "PEndianness" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PBool)))) | |||||
| type Code (PEndianness s) Source # | |||||
Defined in Plutarch.Builtin.ByteString | |||||
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 :: forall (s :: S). Term s (PByte :--> (PByteString :--> PByteString)) Source #
Prepend a PByte to a 'PByteString.
Since: 1.10.0
psliceBS :: forall (s :: S). 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 :: forall (s :: S). Term s (PByteString :--> PInteger) Source #
Find the length of a PByteString.
pindexBS :: forall (s :: S). 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 :: forall (s :: S). 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.