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
, BuiltinByteStringHex (..)
, BuiltinByteStringUtf8 (..)
, Integer
, addInteger
, subtractInteger
, multiplyInteger
, divideInteger
, modInteger
, quotientInteger
, remainderInteger
, greaterThanInteger
, greaterThanEqualsInteger
, lessThanInteger
, lessThanEqualsInteger
, equalsInteger
, expModInteger
, error
, BuiltinData
, chooseData
, BI.caseData'
, caseData
, 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
, BI.caseList'
, caseList
, 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.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))
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString = BuiltinByteString -> BuiltinByteString -> BuiltinByteString
BI.appendByteString
{-# INLINABLE appendByteString #-}
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 consByteString #-}
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 sliceByteString #-}
lengthOfByteString :: BuiltinByteString -> Integer
lengthOfByteString :: BuiltinByteString -> Integer
lengthOfByteString = BuiltinByteString -> Integer
BI.lengthOfByteString
{-# INLINABLE lengthOfByteString #-}
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 indexByteString #-}
emptyByteString :: BuiltinByteString
emptyByteString :: BuiltinByteString
emptyByteString = BuiltinByteString
BI.emptyByteString
{-# INLINABLE emptyByteString #-}
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 = BuiltinByteString -> BuiltinByteString
BI.sha2_256
{-# INLINABLE sha2_256 #-}
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 = BuiltinByteString -> BuiltinByteString
BI.sha3_256
{-# INLINABLE sha3_256 #-}
blake2b_224 :: BuiltinByteString -> BuiltinByteString
blake2b_224 :: BuiltinByteString -> BuiltinByteString
blake2b_224 = BuiltinByteString -> BuiltinByteString
BI.blake2b_224
{-# INLINABLE blake2b_224 #-}
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 = BuiltinByteString -> BuiltinByteString
BI.blake2b_256
{-# INLINABLE blake2b_256 #-}
keccak_256 :: BuiltinByteString -> BuiltinByteString
keccak_256 :: BuiltinByteString -> BuiltinByteString
keccak_256 = BuiltinByteString -> BuiltinByteString
BI.keccak_256
{-# INLINABLE keccak_256 #-}
ripemd_160 :: BuiltinByteString -> BuiltinByteString
ripemd_160 :: BuiltinByteString -> BuiltinByteString
ripemd_160 = BuiltinByteString -> BuiltinByteString
BI.ripemd_160
{-# INLINABLE ripemd_160 #-}
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 verifyEd25519Signature #-}
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 equalsByteString #-}
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 lessThanByteString #-}
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 lessThanEqualsByteString #-}
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 greaterThanByteString #-}
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 greaterThanEqualsByteString #-}
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 = BuiltinByteString -> BuiltinString
BI.decodeUtf8
{-# INLINABLE decodeUtf8 #-}
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 verifyEcdsaSecp256k1Signature #-}
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)
{-# INLINEABLE verifySchnorrSecp256k1Signature #-}
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 addInteger #-}
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 subtractInteger #-}
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 multiplyInteger #-}
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 divideInteger #-}
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 modInteger #-}
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 quotientInteger #-}
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 remainderInteger #-}
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 greaterThanInteger #-}
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 greaterThanEqualsInteger #-}
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 lessThanInteger #-}
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 lessThanEqualsInteger #-}
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 equalsInteger #-}
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 error #-}
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString = BuiltinString -> BuiltinString -> BuiltinString
BI.appendString
{-# INLINABLE appendString #-}
emptyString :: BuiltinString
emptyString :: BuiltinString
emptyString = BuiltinString
BI.emptyString
{-# INLINABLE emptyString #-}
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 equalsString #-}
trace :: BuiltinString -> a -> a
trace :: forall a. BuiltinString -> a -> a
trace = BuiltinString -> a -> a
forall a. BuiltinString -> a -> a
BI.trace
{-# INLINABLE trace #-}
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 = BuiltinString -> BuiltinByteString
BI.encodeUtf8
{-# INLINABLE encodeUtf8 #-}
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 null #-}
caseList :: forall a r . (() -> r) -> (a -> BI.BuiltinList a -> r) -> BI.BuiltinList a -> r
caseList :: forall a r.
(() -> r) -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
caseList () -> r
nilCase a -> BuiltinList a -> r
consCase BuiltinList a
l = (() -> r)
-> (a -> BuiltinList a -> () -> r) -> BuiltinList a -> () -> r
forall a r. r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
BI.caseList' () -> r
nilCase (\a
x BuiltinList a
xs ()
_ -> a -> BuiltinList a -> r
consCase a
x BuiltinList a
xs) BuiltinList a
l ()
{-# INLINABLE caseList #-}
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 = (() -> r) -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
forall a r.
(() -> r) -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
caseList () -> r
nilCase a -> BuiltinList a -> r
consCase 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 = r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
forall a r. r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
BI.caseList' r
nilCase a -> BuiltinList a -> r
consCase BuiltinList a
l
{-# INLINABLE matchList' #-}
headMaybe :: BI.BuiltinList a -> Maybe a
headMaybe :: forall a. BuiltinList a -> Maybe a
headMaybe = Maybe a
-> (a -> BuiltinList a -> Maybe a) -> BuiltinList a -> Maybe a
forall a r. r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
BI.caseList' Maybe a
forall a. Maybe a
Nothing (\a
h BuiltinList a
_ -> a -> Maybe a
forall a. a -> Maybe a
Just a
h)
{-# INLINE headMaybe #-}
uncons :: BI.BuiltinList a -> Maybe (a, BI.BuiltinList a)
uncons :: forall a. BuiltinList a -> Maybe (a, BuiltinList a)
uncons = Maybe (a, BuiltinList a)
-> (a -> BuiltinList a -> Maybe (a, BuiltinList a))
-> BuiltinList a
-> Maybe (a, BuiltinList a)
forall a r. r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
BI.caseList' 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 uncons #-}
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 unsafeUncons #-}
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)
{-# INLINE pairToPair #-}
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 chooseData #-}
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData = BuiltinData -> BuiltinByteString
BI.serialiseData
{-# INLINABLE serialiseData #-}
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 mkConstr #-}
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 mkMap #-}
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 mkList #-}
mkI :: Integer -> BuiltinData
mkI :: Integer -> BuiltinData
mkI = Integer -> BuiltinData
BI.mkI
{-# INLINABLE mkI #-}
mkB :: BuiltinByteString -> BuiltinData
mkB :: BuiltinByteString -> BuiltinData
mkB = BuiltinByteString -> BuiltinData
BI.mkB
{-# INLINABLE mkB #-}
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 unsafeDataAsConstr #-}
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 unsafeDataAsMap #-}
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 unsafeDataAsList #-}
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 unsafeDataAsI #-}
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB = BuiltinData -> BuiltinByteString
BI.unsafeDataAsB
{-# INLINABLE unsafeDataAsB #-}
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 equalsData #-}
caseData
:: (Integer -> [BuiltinData] -> r)
-> ([(BuiltinData, BuiltinData)] -> r)
-> ([BuiltinData] -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
caseData :: forall r.
(Integer -> [BuiltinData] -> r)
-> ([(BuiltinData, BuiltinData)] -> r)
-> ([BuiltinData] -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
caseData Integer -> [BuiltinData] -> r
constrCase [(BuiltinData, BuiltinData)] -> r
mapCase [BuiltinData] -> r
listCase Integer -> r
iCase BuiltinByteString -> r
bCase =
(Integer -> BuiltinList BuiltinData -> r)
-> (BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r)
-> (BuiltinList BuiltinData -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
forall r.
(Integer -> BuiltinList BuiltinData -> r)
-> (BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r)
-> (BuiltinList BuiltinData -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
BI.caseData'
(\Integer
i BuiltinList BuiltinData
ds -> Integer -> [BuiltinData] -> r
constrCase Integer
i (BuiltinList BuiltinData -> [BuiltinData]
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque BuiltinList BuiltinData
ds))
(\BuiltinList (BuiltinPair BuiltinData BuiltinData)
ps -> [(BuiltinData, BuiltinData)] -> r
mapCase (BuiltinList (BuiltinPair BuiltinData BuiltinData)
-> [(BuiltinData, BuiltinData)]
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque BuiltinList (BuiltinPair BuiltinData BuiltinData)
ps))
(\BuiltinList BuiltinData
ds -> [BuiltinData] -> r
listCase (BuiltinList BuiltinData -> [BuiltinData]
forall arep a. HasFromOpaque arep a => arep -> a
fromOpaque BuiltinList BuiltinData
ds))
Integer -> r
iCase
BuiltinByteString -> r
bCase
{-# INLINABLE caseData #-}
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 =
(Integer -> BuiltinList BuiltinData -> r)
-> (BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r)
-> (BuiltinList BuiltinData -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
forall r.
(Integer -> BuiltinList BuiltinData -> r)
-> (BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r)
-> (BuiltinList BuiltinData -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
BI.caseData' Integer -> BuiltinList BuiltinData -> r
constrCase BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r
mapCase BuiltinList BuiltinData -> r
listCase Integer -> r
iCase BuiltinByteString -> r
bCase BuiltinData
d
{-# 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 =
(Integer -> [BuiltinData] -> r)
-> ([(BuiltinData, BuiltinData)] -> r)
-> ([BuiltinData] -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
forall r.
(Integer -> [BuiltinData] -> r)
-> ([(BuiltinData, BuiltinData)] -> r)
-> ([BuiltinData] -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
caseData Integer -> [BuiltinData] -> r
constrCase [(BuiltinData, BuiltinData)] -> r
mapCase [BuiltinData] -> r
listCase Integer -> r
iCase BuiltinByteString -> r
bCase BuiltinData
d
{-# INLINABLE matchData #-}
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_equals #-}
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_add #-}
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_scalarMul #-}
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_neg #-}
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_compress #-}
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_uncompress #-}
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_hashToGroup #-}
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_zero #-}
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_G1_compressed_generator #-}
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_equals #-}
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_add #-}
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_scalarMul #-}
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_neg #-}
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_compress #-}
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_uncompress #-}
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_hashToGroup #-}
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_zero #-}
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_G2_compressed_generator #-}
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_millerLoop #-}
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_mulMlResult #-}
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)
{-# INLINABLE bls12_381_finalVerify #-}
byteOrderToBool :: ByteOrder -> Bool
byteOrderToBool :: ByteOrder -> Bool
byteOrderToBool ByteOrder
BigEndian = Bool
True
byteOrderToBool ByteOrder
LittleEndian = Bool
False
{-# INLINABLE byteOrderToBool #-}
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 integerToByteString #-}
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))
{-# INLINABLE byteStringToInteger #-}
shiftByteString :: BuiltinByteString -> Integer -> BuiltinByteString
shiftByteString :: BuiltinByteString -> Integer -> BuiltinByteString
shiftByteString = BuiltinByteString -> Integer -> BuiltinByteString
BI.shiftByteString
{-# INLINEABLE shiftByteString #-}
rotateByteString :: BuiltinByteString -> Integer -> BuiltinByteString
rotateByteString :: BuiltinByteString -> Integer -> BuiltinByteString
rotateByteString = BuiltinByteString -> Integer -> BuiltinByteString
BI.rotateByteString
{-# INLINEABLE rotateByteString #-}
countSetBits :: BuiltinByteString -> Integer
countSetBits :: BuiltinByteString -> Integer
countSetBits = BuiltinByteString -> Integer
BI.countSetBits
{-# INLINEABLE countSetBits #-}
findFirstSetBit :: BuiltinByteString -> Integer
findFirstSetBit :: BuiltinByteString -> Integer
findFirstSetBit = BuiltinByteString -> Integer
BI.findFirstSetBit
{-# INLINEABLE findFirstSetBit #-}
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 andByteString #-}
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 orByteString #-}
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 xorByteString #-}
complementByteString ::
BuiltinByteString ->
BuiltinByteString
complementByteString :: BuiltinByteString -> BuiltinByteString
complementByteString = BuiltinByteString -> BuiltinByteString
BI.complementByteString
{-# INLINEABLE complementByteString #-}
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 readBit #-}
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 writeBits #-}
replicateByte ::
Integer ->
Integer ->
BuiltinByteString
replicateByte :: Integer -> Integer -> BuiltinByteString
replicateByte = Integer -> Integer -> BuiltinByteString
BI.replicateByte
{-# INLINEABLE replicateByte #-}
expModInteger ::
Integer ->
Integer ->
Integer ->
Integer
expModInteger :: Integer -> Integer -> Integer -> Integer
expModInteger = Integer -> Integer -> Integer -> Integer
BI.expModInteger
{-# INLINEABLE expModInteger #-}