Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.08 KB

PByteString.md

File metadata and controls

33 lines (24 loc) · 1.08 KB
imports

module Plutarch.Docs.PByteString (notQuiteTheAnswer, aChar) where 
import Plutarch.Prelude 
import qualified Data.ByteString as BS

PByteString

Plutarch level bytestring terms can be created using phexByteStr and pconstant (pbyteStr is deprecated). phexByteStr interprets a hex string literal as a Term s PByteString and pconstant (pbyteStr) merely converts a ByteString into a Term s PByteString.

notQuiteTheAnswer :: forall s. Term s PByteString
notQuiteTheAnswer = phexByteStr "41"
-- yields a `Term s PByteString`, which represents [65]

aChar :: forall s. Term s PByteString
aChar = pconstant (BS.pack [91])
-- yields a `Term s PByteString`, which represents [91]

Similar to PString, it has a PEq instance. As well as Semigroup and Monoid instances for its terms.

It does not have a PlutusType instance.

This is synonymous to Plutus Core builtin bytestring.