module PlutusTx.Builtins (
BuiltinByteString
, appendByteString
, consByteString
, sliceByteString
, lengthOfByteString
, indexByteString
, emptyByteString
, equalsByteString
, lessThanByteString
, lessThanEqualsByteString
, greaterThanByteString
, greaterThanEqualsByteString
, sha2_256
, sha3_256
, blake2b_224
, blake2b_256
, keccak_256
, ripemd_160
, verifyEd25519Signature
, verifyEcdsaSecp256k1Signature
, verifySchnorrSecp256k1Signature
, decodeUtf8
, Integer
, addInteger
, subtractInteger
, multiplyInteger
, divideInteger
, modInteger
, quotientInteger
, remainderInteger
, greaterThanInteger
, greaterThanEqualsInteger
, lessThanInteger
, lessThanEqualsInteger
, equalsInteger
, expModInteger
, error
, BuiltinData
, chooseData
, matchData
, matchData'
, equalsData
, serialiseData
, mkConstr
, mkMap
, mkList
, mkI
, mkB
, unsafeDataAsConstr
, unsafeDataAsMap
, unsafeDataAsList
, unsafeDataAsI
, unsafeDataAsB
, BI.builtinDataToData
, BI.dataToBuiltinData
, BuiltinString
, appendString
, emptyString
, equalsString
, encodeUtf8
, pairToPair
, mkNil
, mkNilOpaque
, null
, matchList
, matchList'
, headMaybe
, BI.head
, BI.tail
, uncons
, unsafeUncons
, trace
, BuiltinBLS12_381_G1_Element
, bls12_381_G1_equals
, bls12_381_G1_add
, bls12_381_G1_scalarMul
, bls12_381_G1_neg
, bls12_381_G1_compress
, bls12_381_G1_uncompress
, bls12_381_G1_hashToGroup
, bls12_381_G1_compressed_zero
, bls12_381_G1_compressed_generator
, BuiltinBLS12_381_G2_Element
, bls12_381_G2_equals
, bls12_381_G2_add
, bls12_381_G2_scalarMul
, bls12_381_G2_neg
, bls12_381_G2_compress
, bls12_381_G2_uncompress
, bls12_381_G2_hashToGroup
, bls12_381_G2_compressed_zero
, bls12_381_G2_compressed_generator
, BuiltinBLS12_381_MlResult
, bls12_381_millerLoop
, bls12_381_mulMlResult
, bls12_381_finalVerify
, fromOpaque
, toOpaque
, useToOpaque
, useFromOpaque
, fromBuiltin
, toBuiltin
, ByteOrder (..)
, integerToByteString
, byteStringToInteger
, andByteString
, orByteString
, xorByteString
, complementByteString
, readBit
, writeBits
, replicateByte
, shiftByteString
, rotateByteString
, countSetBits
, findFirstSetBit
) where
import Data.Maybe
import PlutusTx.Base (const, uncurry)
import PlutusTx.Bool (Bool (..))
import PlutusTx.Builtins.HasBuiltin
import PlutusTx.Builtins.HasOpaque
import PlutusTx.Builtins.Internal (BuiltinBLS12_381_G1_Element (..),
BuiltinBLS12_381_G2_Element (..), BuiltinBLS12_381_MlResult (..),
BuiltinByteString (..), BuiltinData, BuiltinString)
import PlutusTx.Builtins.Internal qualified as BI
import PlutusTx.Integer (Integer)
import GHC.ByteOrder (ByteOrder (BigEndian, LittleEndian))
{-# INLINABLE appendByteString #-}
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString = BuiltinByteString -> BuiltinByteString -> BuiltinByteString
BI.appendByteString
{-# INLINABLE consByteString #-}
consByteString :: Integer -> BuiltinByteString -> BuiltinByteString
consByteString :: Integer -> BuiltinByteString -> BuiltinByteString
consByteString Integer
n BuiltinByteString
bs = Integer -> BuiltinByteString -> BuiltinByteString
BI.consByteString (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
n) BuiltinByteString
bs
{-# INLINABLE sliceByteString #-}
sliceByteString :: Integer -> Integer -> BuiltinByteString -> BuiltinByteString
sliceByteString :: Integer -> Integer -> BuiltinByteString -> BuiltinByteString
sliceByteString Integer
start Integer
n BuiltinByteString
bs = Integer -> Integer -> BuiltinByteString -> BuiltinByteString
BI.sliceByteString (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
start) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
n) BuiltinByteString
bs
{-# INLINABLE lengthOfByteString #-}
lengthOfByteString :: BuiltinByteString -> Integer
lengthOfByteString :: BuiltinByteString -> Integer
lengthOfByteString = BuiltinByteString -> Integer
BI.lengthOfByteString
{-# INLINABLE indexByteString #-}
indexByteString :: BuiltinByteString -> Integer -> Integer
indexByteString :: BuiltinByteString -> Integer -> Integer
indexByteString BuiltinByteString
b Integer
n = BuiltinByteString -> Integer -> Integer
BI.indexByteString BuiltinByteString
b (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
n)
{-# INLINABLE emptyByteString #-}
emptyByteString :: BuiltinByteString
emptyByteString :: BuiltinByteString
emptyByteString = BuiltinByteString
BI.emptyByteString
{-# INLINABLE sha2_256 #-}
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 = BuiltinByteString -> BuiltinByteString
BI.sha2_256
{-# INLINABLE sha3_256 #-}
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 = BuiltinByteString -> BuiltinByteString
BI.sha3_256
{-# INLINABLE blake2b_224 #-}
blake2b_224 :: BuiltinByteString -> BuiltinByteString
blake2b_224 :: BuiltinByteString -> BuiltinByteString
blake2b_224 = BuiltinByteString -> BuiltinByteString
BI.blake2b_224
{-# INLINABLE blake2b_256 #-}
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 = BuiltinByteString -> BuiltinByteString
BI.blake2b_256
{-# INLINABLE keccak_256 #-}
keccak_256 :: BuiltinByteString -> BuiltinByteString
keccak_256 :: BuiltinByteString -> BuiltinByteString
keccak_256 = BuiltinByteString -> BuiltinByteString
BI.keccak_256
{-# INLINABLE ripemd_160 #-}
ripemd_160 :: BuiltinByteString -> BuiltinByteString
ripemd_160 :: BuiltinByteString -> BuiltinByteString
ripemd_160 = BuiltinByteString -> BuiltinByteString
BI.ripemd_160
{-# INLINABLE verifyEd25519Signature #-}
verifyEd25519Signature
:: BuiltinByteString
-> BuiltinByteString
-> BuiltinByteString
-> Bool
verifyEd25519Signature :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString -> Bool
verifyEd25519Signature BuiltinByteString
pubKey BuiltinByteString
message BuiltinByteString
signature =
BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.verifyEd25519Signature BuiltinByteString
pubKey BuiltinByteString
message BuiltinByteString
signature)
{-# INLINABLE equalsByteString #-}
equalsByteString :: BuiltinByteString -> BuiltinByteString -> Bool
equalsByteString :: BuiltinByteString -> BuiltinByteString -> Bool
equalsByteString BuiltinByteString
x BuiltinByteString
y = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.equalsByteString BuiltinByteString
x BuiltinByteString
y)
{-# INLINABLE lessThanByteString #-}
lessThanByteString :: BuiltinByteString -> BuiltinByteString -> Bool
lessThanByteString :: BuiltinByteString -> BuiltinByteString -> Bool
lessThanByteString BuiltinByteString
x BuiltinByteString
y = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.lessThanByteString BuiltinByteString
x BuiltinByteString
y)
{-# INLINABLE lessThanEqualsByteString #-}
lessThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> Bool
lessThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> Bool
lessThanEqualsByteString BuiltinByteString
x BuiltinByteString
y = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.lessThanEqualsByteString BuiltinByteString
x BuiltinByteString
y)
{-# INLINABLE greaterThanByteString #-}
greaterThanByteString :: BuiltinByteString -> BuiltinByteString -> Bool
greaterThanByteString :: BuiltinByteString -> BuiltinByteString -> Bool
greaterThanByteString BuiltinByteString
x BuiltinByteString
y = BuiltinBool -> Bool -> Bool -> Bool
forall a. BuiltinBool -> a -> a -> a
BI.ifThenElse (BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.lessThanEqualsByteString BuiltinByteString
x BuiltinByteString
y) Bool
False Bool
True
{-# INLINABLE greaterThanEqualsByteString #-}
greaterThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> Bool
greaterThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> Bool
greaterThanEqualsByteString BuiltinByteString
x BuiltinByteString
y = BuiltinBool -> Bool -> Bool -> Bool
forall a. BuiltinBool -> a -> a -> a
BI.ifThenElse (BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.lessThanByteString BuiltinByteString
x BuiltinByteString
y) Bool
False Bool
True
{-# INLINABLE decodeUtf8 #-}
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 = BuiltinByteString -> BuiltinString
BI.decodeUtf8
{-# INLINEABLE verifyEcdsaSecp256k1Signature #-}
verifyEcdsaSecp256k1Signature
:: BuiltinByteString
-> BuiltinByteString
-> BuiltinByteString
-> Bool
verifyEcdsaSecp256k1Signature :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString -> Bool
verifyEcdsaSecp256k1Signature BuiltinByteString
vk BuiltinByteString
msg BuiltinByteString
sig =
BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.verifyEcdsaSecp256k1Signature BuiltinByteString
vk BuiltinByteString
msg BuiltinByteString
sig)
{-# INLINEABLE verifySchnorrSecp256k1Signature #-}
verifySchnorrSecp256k1Signature
:: BuiltinByteString
-> BuiltinByteString
-> BuiltinByteString
-> Bool
verifySchnorrSecp256k1Signature :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString -> Bool
verifySchnorrSecp256k1Signature BuiltinByteString
vk BuiltinByteString
msg BuiltinByteString
sig =
BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
BI.verifySchnorrSecp256k1Signature BuiltinByteString
vk BuiltinByteString
msg BuiltinByteString
sig)
{-# INLINABLE addInteger #-}
addInteger :: Integer -> Integer -> Integer
addInteger :: Integer -> Integer -> Integer
addInteger Integer
x Integer
y = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> Integer
BI.addInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE subtractInteger #-}
subtractInteger :: Integer -> Integer -> Integer
subtractInteger :: Integer -> Integer -> Integer
subtractInteger Integer
x Integer
y = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> Integer
BI.subtractInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE multiplyInteger #-}
multiplyInteger :: Integer -> Integer -> Integer
multiplyInteger :: Integer -> Integer -> Integer
multiplyInteger Integer
x Integer
y = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> Integer
BI.multiplyInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE divideInteger #-}
divideInteger :: Integer -> Integer -> Integer
divideInteger :: Integer -> Integer -> Integer
divideInteger Integer
x Integer
y = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> Integer
BI.divideInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE modInteger #-}
modInteger :: Integer -> Integer -> Integer
modInteger :: Integer -> Integer -> Integer
modInteger Integer
x Integer
y = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> Integer
BI.modInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE quotientInteger #-}
quotientInteger :: Integer -> Integer -> Integer
quotientInteger :: Integer -> Integer -> Integer
quotientInteger Integer
x Integer
y = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> Integer
BI.quotientInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE remainderInteger #-}
remainderInteger :: Integer -> Integer -> Integer
remainderInteger :: Integer -> Integer -> Integer
remainderInteger Integer
x Integer
y = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> Integer
BI.remainderInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE greaterThanInteger #-}
greaterThanInteger :: Integer -> Integer -> Bool
greaterThanInteger :: Integer -> Integer -> Bool
greaterThanInteger Integer
x Integer
y = BuiltinBool -> Bool -> Bool -> Bool
forall a. BuiltinBool -> a -> a -> a
BI.ifThenElse (Integer -> Integer -> BuiltinBool
BI.lessThanEqualsInteger Integer
x Integer
y) Bool
False Bool
True
{-# INLINABLE greaterThanEqualsInteger #-}
greaterThanEqualsInteger :: Integer -> Integer -> Bool
greaterThanEqualsInteger :: Integer -> Integer -> Bool
greaterThanEqualsInteger Integer
x Integer
y = BuiltinBool -> Bool -> Bool -> Bool
forall a. BuiltinBool -> a -> a -> a
BI.ifThenElse (Integer -> Integer -> BuiltinBool
BI.lessThanInteger Integer
x Integer
y) Bool
False Bool
True
{-# INLINABLE lessThanInteger #-}
lessThanInteger :: Integer -> Integer -> Bool
lessThanInteger :: Integer -> Integer -> Bool
lessThanInteger Integer
x Integer
y = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> BuiltinBool
BI.lessThanInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE lessThanEqualsInteger #-}
lessThanEqualsInteger :: Integer -> Integer -> Bool
lessThanEqualsInteger :: Integer -> Integer -> Bool
lessThanEqualsInteger Integer
x Integer
y = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> BuiltinBool
BI.lessThanEqualsInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE equalsInteger #-}
equalsInteger :: Integer -> Integer -> Bool
equalsInteger :: Integer -> Integer -> Bool
equalsInteger Integer
x Integer
y = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (Integer -> Integer -> BuiltinBool
BI.equalsInteger (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
x) (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
y))
{-# INLINABLE error #-}
error :: () -> a
error :: forall a. () -> a
error ()
x = BuiltinUnit -> a
forall a. BuiltinUnit -> a
BI.error (() -> BuiltinUnit
forall a arep. HasToOpaque a arep => a -> arep
toOpaque ()
x)
{-# INLINABLE appendString #-}
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString = BuiltinString -> BuiltinString -> BuiltinString
BI.appendString
{-# INLINABLE emptyString #-}
emptyString :: BuiltinString
emptyString :: BuiltinString
emptyString = BuiltinString
BI.emptyString
{-# INLINABLE equalsString #-}
equalsString :: BuiltinString -> BuiltinString -> Bool
equalsString :: BuiltinString -> BuiltinString -> Bool
equalsString BuiltinString
x BuiltinString
y = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinString -> BuiltinString -> BuiltinBool
BI.equalsString BuiltinString
x BuiltinString
y)
{-# INLINABLE trace #-}
trace :: BuiltinString -> a -> a
trace :: forall a. BuiltinString -> a -> a
trace = BuiltinString -> a -> a
forall a. BuiltinString -> a -> a
BI.trace
{-# INLINABLE encodeUtf8 #-}
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 = BuiltinString -> BuiltinByteString
BI.encodeUtf8
{-# INLINABLE null #-}
null :: forall a. BI.BuiltinList a -> Bool
null :: forall a. BuiltinList a -> Bool
null BuiltinList a
l = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinList a -> BuiltinBool
forall a. BuiltinList a -> BuiltinBool
BI.null BuiltinList a
l)
{-# INLINABLE matchList #-}
matchList :: forall a r . BI.BuiltinList a -> (() -> r) -> (a -> BI.BuiltinList a -> r) -> r
matchList :: forall a r.
BuiltinList a -> (() -> r) -> (a -> BuiltinList a -> r) -> r
matchList BuiltinList a
l () -> r
nilCase a -> BuiltinList a -> r
consCase = BuiltinList a -> (() -> r) -> (() -> r) -> () -> r
forall a b. BuiltinList a -> b -> b -> b
BI.chooseList BuiltinList a
l () -> r
nilCase (\()
_ -> a -> BuiltinList a -> r
consCase (BuiltinList a -> a
forall a. BuiltinList a -> a
BI.head BuiltinList a
l) (BuiltinList a -> BuiltinList a
forall a. BuiltinList a -> BuiltinList a
BI.tail BuiltinList a
l)) ()
{-# INLINABLE matchList' #-}
matchList' :: forall a r . BI.BuiltinList a -> r -> (a -> BI.BuiltinList a -> r) -> r
matchList' :: forall a r. BuiltinList a -> r -> (a -> BuiltinList a -> r) -> r
matchList' BuiltinList a
l r
nilCase a -> BuiltinList a -> r
consCase = BuiltinList a -> (() -> r) -> (() -> r) -> () -> r
forall a b. BuiltinList a -> b -> b -> b
BI.chooseList BuiltinList a
l (r -> () -> r
forall a b. a -> b -> a
const r
nilCase) (\()
_ -> a -> BuiltinList a -> r
consCase (BuiltinList a -> a
forall a. BuiltinList a -> a
BI.head BuiltinList a
l) (BuiltinList a -> BuiltinList a
forall a. BuiltinList a -> BuiltinList a
BI.tail BuiltinList a
l)) ()
{-# INLINE headMaybe #-}
headMaybe :: BI.BuiltinList a -> Maybe a
headMaybe :: forall a. BuiltinList a -> Maybe a
headMaybe BuiltinList a
l = BuiltinList a
-> Maybe a -> (a -> BuiltinList a -> Maybe a) -> Maybe a
forall a r. BuiltinList a -> r -> (a -> BuiltinList a -> r) -> r
matchList' BuiltinList a
l Maybe a
forall a. Maybe a
Nothing (\a
h BuiltinList a
_ -> a -> Maybe a
forall a. a -> Maybe a
Just a
h)
{-# INLINE uncons #-}
uncons :: BI.BuiltinList a -> Maybe (a, BI.BuiltinList a)
uncons :: forall a. BuiltinList a -> Maybe (a, BuiltinList a)
uncons BuiltinList a
l = BuiltinList a
-> Maybe (a, BuiltinList a)
-> (a -> BuiltinList a -> Maybe (a, BuiltinList a))
-> Maybe (a, BuiltinList a)
forall a r. BuiltinList a -> r -> (a -> BuiltinList a -> r) -> r
matchList' BuiltinList a
l Maybe (a, BuiltinList a)
forall a. Maybe a
Nothing (\a
h BuiltinList a
t -> (a, BuiltinList a) -> Maybe (a, BuiltinList a)
forall a. a -> Maybe a
Just (a
h, BuiltinList a
t))
{-# INLINE unsafeUncons #-}
unsafeUncons :: BI.BuiltinList a -> (a, BI.BuiltinList a)
unsafeUncons :: forall a. BuiltinList a -> (a, BuiltinList a)
unsafeUncons BuiltinList a
l = (BuiltinList a -> a
forall a. BuiltinList a -> a
BI.head BuiltinList a
l, BuiltinList a -> BuiltinList a
forall a. BuiltinList a -> BuiltinList a
BI.tail BuiltinList a
l)
{-# INLINE pairToPair #-}
pairToPair :: BI.BuiltinPair a b -> (a, b)
pairToPair :: forall a b. BuiltinPair a b -> (a, b)
pairToPair BuiltinPair a b
tup = (BuiltinPair a b -> a
forall a b. BuiltinPair a b -> a
BI.fst BuiltinPair a b
tup, BuiltinPair a b -> b
forall a b. BuiltinPair a b -> b
BI.snd BuiltinPair a b
tup)
{-# INLINABLE chooseData #-}
chooseData :: forall a . BuiltinData -> a -> a -> a -> a -> a -> a
chooseData :: forall a. BuiltinData -> a -> a -> a -> a -> a -> a
chooseData = BuiltinData -> a -> a -> a -> a -> a -> a
forall a. BuiltinData -> a -> a -> a -> a -> a -> a
BI.chooseData
{-# INLINABLE serialiseData #-}
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData = BuiltinData -> BuiltinByteString
BI.serialiseData
{-# INLINABLE mkConstr #-}
mkConstr :: Integer -> [BuiltinData] -> BuiltinData
mkConstr :: Integer -> [BuiltinData] -> BuiltinData
mkConstr Integer
i [BuiltinData]
args = Integer -> BuiltinList BuiltinData -> BuiltinData
BI.mkConstr (Integer -> Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Integer
i) ([BuiltinData] -> BuiltinList BuiltinData
forall a arep. HasToOpaque a arep => a -> arep
toOpaque [BuiltinData]
args)
{-# INLINABLE mkMap #-}
mkMap :: [(BuiltinData, BuiltinData)] -> BuiltinData
mkMap :: [(BuiltinData, BuiltinData)] -> BuiltinData
mkMap [(BuiltinData, BuiltinData)]
es = BuiltinList (BuiltinPair BuiltinData BuiltinData) -> BuiltinData
BI.mkMap ([(BuiltinData, BuiltinData)]
-> BuiltinList (BuiltinPair BuiltinData BuiltinData)
forall a arep. HasToOpaque a arep => a -> arep
toOpaque [(BuiltinData, BuiltinData)]
es)
{-# INLINABLE mkList #-}
mkList :: [BuiltinData] -> BuiltinData
mkList :: [BuiltinData] -> BuiltinData
mkList [BuiltinData]
l = BuiltinList BuiltinData -> BuiltinData
BI.mkList ([BuiltinData] -> BuiltinList BuiltinData
forall a arep. HasToOpaque a arep => a -> arep
toOpaque [BuiltinData]
l)
{-# INLINABLE mkI #-}
mkI :: Integer -> BuiltinData
mkI :: Integer -> BuiltinData
mkI = Integer -> BuiltinData
BI.mkI
{-# INLINABLE mkB #-}
mkB :: BuiltinByteString -> BuiltinData
mkB :: BuiltinByteString -> BuiltinData
mkB = BuiltinByteString -> BuiltinData
BI.mkB
{-# INLINABLE unsafeDataAsConstr #-}
unsafeDataAsConstr :: BuiltinData -> (Integer, [BuiltinData])
unsafeDataAsConstr :: BuiltinData -> (Integer, [BuiltinData])
unsafeDataAsConstr BuiltinData
d = BuiltinPair Integer (BuiltinList BuiltinData)
-> (Integer, [BuiltinData])
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinData -> BuiltinPair Integer (BuiltinList BuiltinData)
BI.unsafeDataAsConstr BuiltinData
d)
{-# INLINABLE unsafeDataAsMap #-}
unsafeDataAsMap :: BuiltinData -> [(BuiltinData, BuiltinData)]
unsafeDataAsMap :: BuiltinData -> [(BuiltinData, BuiltinData)]
unsafeDataAsMap BuiltinData
d = BuiltinList (BuiltinPair BuiltinData BuiltinData)
-> [(BuiltinData, BuiltinData)]
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinData -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
BI.unsafeDataAsMap BuiltinData
d)
{-# INLINABLE unsafeDataAsList #-}
unsafeDataAsList :: BuiltinData -> [BuiltinData]
unsafeDataAsList :: BuiltinData -> [BuiltinData]
unsafeDataAsList BuiltinData
d = BuiltinList BuiltinData -> [BuiltinData]
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinData -> BuiltinList BuiltinData
BI.unsafeDataAsList BuiltinData
d)
{-# INLINABLE unsafeDataAsI #-}
unsafeDataAsI :: BuiltinData -> Integer
unsafeDataAsI :: BuiltinData -> Integer
unsafeDataAsI BuiltinData
d = Integer -> Integer
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinData -> Integer
BI.unsafeDataAsI BuiltinData
d)
{-# INLINABLE unsafeDataAsB #-}
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB = BuiltinData -> BuiltinByteString
BI.unsafeDataAsB
{-# INLINABLE equalsData #-}
equalsData :: BuiltinData -> BuiltinData -> Bool
equalsData :: BuiltinData -> BuiltinData -> Bool
equalsData BuiltinData
d1 BuiltinData
d2 = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinData -> BuiltinData -> BuiltinBool
BI.equalsData BuiltinData
d1 BuiltinData
d2)
{-# INLINABLE matchData #-}
matchData
:: BuiltinData
-> (Integer -> [BuiltinData] -> r)
-> ([(BuiltinData, BuiltinData)] -> r)
-> ([BuiltinData] -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> r
matchData :: forall r.
BuiltinData
-> (Integer -> [BuiltinData] -> r)
-> ([(BuiltinData, BuiltinData)] -> r)
-> ([BuiltinData] -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> r
matchData BuiltinData
d Integer -> [BuiltinData] -> r
constrCase [(BuiltinData, BuiltinData)] -> r
mapCase [BuiltinData] -> r
listCase Integer -> r
iCase BuiltinByteString -> r
bCase =
BuiltinData
-> (() -> r)
-> (() -> r)
-> (() -> r)
-> (() -> r)
-> (() -> r)
-> ()
-> r
forall a. BuiltinData -> a -> a -> a -> a -> a -> a
chooseData
BuiltinData
d
(\()
_ -> (Integer -> [BuiltinData] -> r) -> (Integer, [BuiltinData]) -> r
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Integer -> [BuiltinData] -> r
constrCase (BuiltinData -> (Integer, [BuiltinData])
unsafeDataAsConstr BuiltinData
d))
(\()
_ -> [(BuiltinData, BuiltinData)] -> r
mapCase (BuiltinData -> [(BuiltinData, BuiltinData)]
unsafeDataAsMap BuiltinData
d))
(\()
_ -> [BuiltinData] -> r
listCase (BuiltinData -> [BuiltinData]
unsafeDataAsList BuiltinData
d))
(\()
_ -> Integer -> r
iCase (BuiltinData -> Integer
unsafeDataAsI BuiltinData
d))
(\()
_ -> BuiltinByteString -> r
bCase (BuiltinData -> BuiltinByteString
unsafeDataAsB BuiltinData
d))
()
{-# INLINABLE matchData' #-}
matchData'
:: BuiltinData
-> (Integer -> BI.BuiltinList BuiltinData -> r)
-> (BI.BuiltinList (BI.BuiltinPair BuiltinData BuiltinData) -> r)
-> (BI.BuiltinList BuiltinData -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> r
matchData' :: forall r.
BuiltinData
-> (Integer -> BuiltinList BuiltinData -> r)
-> (BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r)
-> (BuiltinList BuiltinData -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> r
matchData' BuiltinData
d Integer -> BuiltinList BuiltinData -> r
constrCase BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r
mapCase BuiltinList BuiltinData -> r
listCase Integer -> r
iCase BuiltinByteString -> r
bCase =
BuiltinData
-> (() -> r)
-> (() -> r)
-> (() -> r)
-> (() -> r)
-> (() -> r)
-> ()
-> r
forall a. BuiltinData -> a -> a -> a -> a -> a -> a
chooseData
BuiltinData
d
(\()
_ -> let tup :: BuiltinPair Integer (BuiltinList BuiltinData)
tup = BuiltinData -> BuiltinPair Integer (BuiltinList BuiltinData)
BI.unsafeDataAsConstr BuiltinData
d in Integer -> BuiltinList BuiltinData -> r
constrCase (BuiltinPair Integer (BuiltinList BuiltinData) -> Integer
forall a b. BuiltinPair a b -> a
BI.fst BuiltinPair Integer (BuiltinList BuiltinData)
tup) (BuiltinPair Integer (BuiltinList BuiltinData)
-> BuiltinList BuiltinData
forall a b. BuiltinPair a b -> b
BI.snd BuiltinPair Integer (BuiltinList BuiltinData)
tup))
(\()
_ -> BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r
mapCase (BuiltinData -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
BI.unsafeDataAsMap BuiltinData
d))
(\()
_ -> BuiltinList BuiltinData -> r
listCase (BuiltinData -> BuiltinList BuiltinData
BI.unsafeDataAsList BuiltinData
d))
(\()
_ -> Integer -> r
iCase (BuiltinData -> Integer
unsafeDataAsI BuiltinData
d))
(\()
_ -> BuiltinByteString -> r
bCase (BuiltinData -> BuiltinByteString
unsafeDataAsB BuiltinData
d))
()
{-# INLINABLE bls12_381_G1_equals #-}
bls12_381_G1_equals :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element -> Bool
bls12_381_G1_equals :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element -> Bool
bls12_381_G1_equals BuiltinBLS12_381_G1_Element
a BuiltinBLS12_381_G1_Element
b = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G1_Element -> BuiltinBool
BI.bls12_381_G1_equals BuiltinBLS12_381_G1_Element
a BuiltinBLS12_381_G1_Element
b)
{-# INLINABLE bls12_381_G1_add #-}
bls12_381_G1_add :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_add :: BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_add = BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
BI.bls12_381_G1_add
{-# INLINABLE bls12_381_G1_scalarMul #-}
bls12_381_G1_scalarMul :: Integer -> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_scalarMul :: Integer
-> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_scalarMul = Integer
-> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
BI.bls12_381_G1_scalarMul
{-# INLINABLE bls12_381_G1_neg #-}
bls12_381_G1_neg :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_neg :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_neg = BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
BI.bls12_381_G1_neg
{-# INLINABLE bls12_381_G1_compress #-}
bls12_381_G1_compress :: BuiltinBLS12_381_G1_Element -> BuiltinByteString
bls12_381_G1_compress :: BuiltinBLS12_381_G1_Element -> BuiltinByteString
bls12_381_G1_compress = BuiltinBLS12_381_G1_Element -> BuiltinByteString
BI.bls12_381_G1_compress
{-# INLINABLE bls12_381_G1_uncompress #-}
bls12_381_G1_uncompress :: BuiltinByteString -> BuiltinBLS12_381_G1_Element
bls12_381_G1_uncompress :: BuiltinByteString -> BuiltinBLS12_381_G1_Element
bls12_381_G1_uncompress = BuiltinByteString -> BuiltinBLS12_381_G1_Element
BI.bls12_381_G1_uncompress
{-# INLINABLE bls12_381_G1_hashToGroup #-}
bls12_381_G1_hashToGroup :: BuiltinByteString -> BuiltinByteString -> BuiltinBLS12_381_G1_Element
bls12_381_G1_hashToGroup :: BuiltinByteString
-> BuiltinByteString -> BuiltinBLS12_381_G1_Element
bls12_381_G1_hashToGroup = BuiltinByteString
-> BuiltinByteString -> BuiltinBLS12_381_G1_Element
BI.bls12_381_G1_hashToGroup
{-# INLINABLE bls12_381_G1_compressed_zero #-}
bls12_381_G1_compressed_zero :: BuiltinByteString
bls12_381_G1_compressed_zero :: BuiltinByteString
bls12_381_G1_compressed_zero = BuiltinByteString
BI.bls12_381_G1_compressed_zero
{-# INLINABLE bls12_381_G1_compressed_generator #-}
bls12_381_G1_compressed_generator :: BuiltinByteString
bls12_381_G1_compressed_generator :: BuiltinByteString
bls12_381_G1_compressed_generator = BuiltinByteString
BI.bls12_381_G1_compressed_generator
{-# INLINABLE bls12_381_G2_equals #-}
bls12_381_G2_equals :: BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element -> Bool
bls12_381_G2_equals :: BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element -> Bool
bls12_381_G2_equals BuiltinBLS12_381_G2_Element
a BuiltinBLS12_381_G2_Element
b = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinBLS12_381_G2_Element
-> BuiltinBLS12_381_G2_Element -> BuiltinBool
BI.bls12_381_G2_equals BuiltinBLS12_381_G2_Element
a BuiltinBLS12_381_G2_Element
b)
{-# INLINABLE bls12_381_G2_add #-}
bls12_381_G2_add :: BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_add :: BuiltinBLS12_381_G2_Element
-> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_add = BuiltinBLS12_381_G2_Element
-> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
BI.bls12_381_G2_add
{-# INLINABLE bls12_381_G2_scalarMul #-}
bls12_381_G2_scalarMul :: Integer -> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_scalarMul :: Integer
-> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_scalarMul = Integer
-> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
BI.bls12_381_G2_scalarMul
{-# INLINABLE bls12_381_G2_neg #-}
bls12_381_G2_neg :: BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_neg :: BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_neg = BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
BI.bls12_381_G2_neg
{-# INLINABLE bls12_381_G2_compress #-}
bls12_381_G2_compress :: BuiltinBLS12_381_G2_Element -> BuiltinByteString
bls12_381_G2_compress :: BuiltinBLS12_381_G2_Element -> BuiltinByteString
bls12_381_G2_compress = BuiltinBLS12_381_G2_Element -> BuiltinByteString
BI.bls12_381_G2_compress
{-# INLINABLE bls12_381_G2_uncompress #-}
bls12_381_G2_uncompress :: BuiltinByteString -> BuiltinBLS12_381_G2_Element
bls12_381_G2_uncompress :: BuiltinByteString -> BuiltinBLS12_381_G2_Element
bls12_381_G2_uncompress = BuiltinByteString -> BuiltinBLS12_381_G2_Element
BI.bls12_381_G2_uncompress
{-# INLINABLE bls12_381_G2_hashToGroup #-}
bls12_381_G2_hashToGroup :: BuiltinByteString -> BuiltinByteString -> BuiltinBLS12_381_G2_Element
bls12_381_G2_hashToGroup :: BuiltinByteString
-> BuiltinByteString -> BuiltinBLS12_381_G2_Element
bls12_381_G2_hashToGroup = BuiltinByteString
-> BuiltinByteString -> BuiltinBLS12_381_G2_Element
BI.bls12_381_G2_hashToGroup
{-# INLINABLE bls12_381_G2_compressed_zero #-}
bls12_381_G2_compressed_zero :: BuiltinByteString
bls12_381_G2_compressed_zero :: BuiltinByteString
bls12_381_G2_compressed_zero = BuiltinByteString
BI.bls12_381_G2_compressed_zero
{-# INLINABLE bls12_381_G2_compressed_generator #-}
bls12_381_G2_compressed_generator :: BuiltinByteString
bls12_381_G2_compressed_generator :: BuiltinByteString
bls12_381_G2_compressed_generator = BuiltinByteString
BI.bls12_381_G2_compressed_generator
{-# INLINABLE bls12_381_millerLoop #-}
bls12_381_millerLoop :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_MlResult
bls12_381_millerLoop :: BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_MlResult
bls12_381_millerLoop = BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_MlResult
BI.bls12_381_millerLoop
{-# INLINABLE bls12_381_mulMlResult #-}
bls12_381_mulMlResult :: BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult
bls12_381_mulMlResult :: BuiltinBLS12_381_MlResult
-> BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult
bls12_381_mulMlResult = BuiltinBLS12_381_MlResult
-> BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult
BI.bls12_381_mulMlResult
{-# INLINABLE bls12_381_finalVerify #-}
bls12_381_finalVerify :: BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult -> Bool
bls12_381_finalVerify :: BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult -> Bool
bls12_381_finalVerify BuiltinBLS12_381_MlResult
a BuiltinBLS12_381_MlResult
b = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinBLS12_381_MlResult
-> BuiltinBLS12_381_MlResult -> BuiltinBool
BI.bls12_381_finalVerify BuiltinBLS12_381_MlResult
a BuiltinBLS12_381_MlResult
b)
byteOrderToBool :: ByteOrder -> Bool
byteOrderToBool :: ByteOrder -> Bool
byteOrderToBool ByteOrder
BigEndian = Bool
True
byteOrderToBool ByteOrder
LittleEndian = Bool
False
{-# INLINABLE byteOrderToBool #-}
{-# INLINABLE integerToByteString #-}
integerToByteString :: ByteOrder -> Integer -> Integer -> BuiltinByteString
integerToByteString :: ByteOrder -> Integer -> Integer -> BuiltinByteString
integerToByteString ByteOrder
endianness = BuiltinBool -> Integer -> Integer -> BuiltinByteString
BI.integerToByteString (Bool -> BuiltinBool
forall a arep. HasToOpaque a arep => a -> arep
toOpaque (ByteOrder -> Bool
byteOrderToBool ByteOrder
endianness))
{-# INLINABLE byteStringToInteger #-}
byteStringToInteger :: ByteOrder -> BuiltinByteString -> Integer
byteStringToInteger :: ByteOrder -> BuiltinByteString -> Integer
byteStringToInteger ByteOrder
endianness =
BuiltinBool -> BuiltinByteString -> Integer
BI.byteStringToInteger (Bool -> BuiltinBool
forall a arep. HasToOpaque a arep => a -> arep
toOpaque (ByteOrder -> Bool
byteOrderToBool ByteOrder
endianness))
{-# INLINEABLE shiftByteString #-}
shiftByteString :: BuiltinByteString -> Integer -> BuiltinByteString
shiftByteString :: BuiltinByteString -> Integer -> BuiltinByteString
shiftByteString = BuiltinByteString -> Integer -> BuiltinByteString
BI.shiftByteString
{-# INLINEABLE rotateByteString #-}
rotateByteString :: BuiltinByteString -> Integer -> BuiltinByteString
rotateByteString :: BuiltinByteString -> Integer -> BuiltinByteString
rotateByteString = BuiltinByteString -> Integer -> BuiltinByteString
BI.rotateByteString
{-# INLINEABLE countSetBits #-}
countSetBits :: BuiltinByteString -> Integer
countSetBits :: BuiltinByteString -> Integer
countSetBits = BuiltinByteString -> Integer
BI.countSetBits
{-# INLINEABLE findFirstSetBit #-}
findFirstSetBit :: BuiltinByteString -> Integer
findFirstSetBit :: BuiltinByteString -> Integer
findFirstSetBit = BuiltinByteString -> Integer
BI.findFirstSetBit
{-# INLINEABLE andByteString #-}
andByteString ::
Bool ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString
andByteString :: Bool -> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
andByteString Bool
b = BuiltinBool
-> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
BI.andByteString (Bool -> BuiltinBool
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Bool
b)
{-# INLINEABLE orByteString #-}
orByteString ::
Bool ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString
orByteString :: Bool -> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
orByteString Bool
b = BuiltinBool
-> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
BI.orByteString (Bool -> BuiltinBool
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Bool
b)
{-# INLINEABLE xorByteString #-}
xorByteString ::
Bool ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString
xorByteString :: Bool -> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
xorByteString Bool
b = BuiltinBool
-> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
BI.xorByteString (Bool -> BuiltinBool
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Bool
b)
{-# INLINEABLE complementByteString #-}
complementByteString ::
BuiltinByteString ->
BuiltinByteString
complementByteString :: BuiltinByteString -> BuiltinByteString
complementByteString = BuiltinByteString -> BuiltinByteString
BI.complementByteString
{-# INLINEABLE readBit #-}
readBit ::
BuiltinByteString ->
Integer ->
Bool
readBit :: BuiltinByteString -> Integer -> Bool
readBit BuiltinByteString
bs Integer
i = BuiltinBool -> Bool
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque (BuiltinByteString -> Integer -> BuiltinBool
BI.readBit BuiltinByteString
bs Integer
i)
{-# INLINEABLE writeBits #-}
writeBits ::
BuiltinByteString ->
[Integer] ->
Bool ->
BuiltinByteString
writeBits :: BuiltinByteString -> [Integer] -> Bool -> BuiltinByteString
writeBits BuiltinByteString
bs [Integer]
ixes Bool
bit = BuiltinByteString
-> BuiltinList Integer -> BuiltinBool -> BuiltinByteString
BI.writeBits BuiltinByteString
bs ([Integer] -> BuiltinList Integer
forall a arep. HasToOpaque a arep => a -> arep
toOpaque [Integer]
ixes) (Bool -> BuiltinBool
forall a arep. HasToOpaque a arep => a -> arep
toOpaque Bool
bit)
{-# INLINEABLE replicateByte #-}
replicateByte ::
Integer ->
Integer ->
BuiltinByteString
replicateByte :: Integer -> Integer -> BuiltinByteString
replicateByte = Integer -> Integer -> BuiltinByteString
BI.replicateByte
{-# INLINEABLE expModInteger #-}
expModInteger ::
Integer ->
Integer ->
Integer ->
Integer
expModInteger :: Integer -> Integer -> Integer -> Integer
expModInteger = Integer -> Integer -> Integer -> Integer
BI.expModInteger