{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -O0 #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# HLINT ignore "Use newtype instead of data" #-}
module PlutusTx.Builtins.Internal where
import Codec.Serialise
import Control.DeepSeq (NFData (..))
import Data.ByteArray qualified as BA
import Data.ByteString qualified as BS
import Data.ByteString.Lazy qualified as BSL
import Data.Coerce (coerce)
import Data.Data (Data)
import Data.Foldable qualified as Foldable
import Data.Hashable (Hashable (..))
import Data.Kind (Type)
import Data.Text as Text (Text, empty)
import Data.Text.Encoding as Text (decodeUtf8, encodeUtf8)
import GHC.Generics (Generic)
import PlutusCore.Bitwise qualified as Bitwise
import PlutusCore.Builtin (BuiltinResult (..))
import PlutusCore.Crypto.BLS12_381.G1 qualified as BLS12_381.G1
import PlutusCore.Crypto.BLS12_381.G2 qualified as BLS12_381.G2
import PlutusCore.Crypto.BLS12_381.Pairing qualified as BLS12_381.Pairing
import PlutusCore.Crypto.Ed25519 qualified
import PlutusCore.Crypto.ExpMod as ExpMod
import PlutusCore.Crypto.Hash qualified as Hash
import PlutusCore.Crypto.Secp256k1 qualified
import PlutusCore.Data qualified as PLC
import PlutusCore.Pretty (Pretty (..), display)
import Prettyprinter (viaShow)
import Prelude as Haskell
error :: BuiltinUnit -> a
error :: forall a. BuiltinUnit -> a
error = [Char] -> BuiltinUnit -> a
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"PlutusTx.Builtins.Internal.error"
{-# OPAQUE error #-}
data BuiltinBool = BuiltinBool ~Bool deriving stock Typeable BuiltinBool
Typeable BuiltinBool =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinBool -> c BuiltinBool)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinBool)
-> (BuiltinBool -> Constr)
-> (BuiltinBool -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinBool))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinBool))
-> ((forall b. Data b => b -> b) -> BuiltinBool -> BuiltinBool)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r)
-> (forall u. (forall d. Data d => d -> u) -> BuiltinBool -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinBool -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool)
-> Data BuiltinBool
BuiltinBool -> Constr
BuiltinBool -> DataType
(forall b. Data b => b -> b) -> BuiltinBool -> BuiltinBool
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BuiltinBool -> u
forall u. (forall d. Data d => d -> u) -> BuiltinBool -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinBool
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinBool -> c BuiltinBool
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinBool)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinBool)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinBool -> c BuiltinBool
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinBool -> c BuiltinBool
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinBool
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinBool
$ctoConstr :: BuiltinBool -> Constr
toConstr :: BuiltinBool -> Constr
$cdataTypeOf :: BuiltinBool -> DataType
dataTypeOf :: BuiltinBool -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinBool)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinBool)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinBool)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinBool)
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinBool -> BuiltinBool
gmapT :: (forall b. Data b => b -> b) -> BuiltinBool -> BuiltinBool
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinBool -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinBool -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinBool -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinBool -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
Data
true :: BuiltinBool
true :: BuiltinBool
true = Bool -> BuiltinBool
BuiltinBool Bool
True
{-# OPAQUE true #-}
false :: BuiltinBool
false :: BuiltinBool
false = Bool -> BuiltinBool
BuiltinBool Bool
False
{-# OPAQUE false #-}
ifThenElse :: BuiltinBool -> a -> a -> a
ifThenElse :: forall a. BuiltinBool -> a -> a -> a
ifThenElse (BuiltinBool Bool
b) a
x a
y = if Bool
b then a
x else a
y
{-# OPAQUE ifThenElse #-}
data BuiltinUnit = BuiltinUnit ~() deriving stock Typeable BuiltinUnit
Typeable BuiltinUnit =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinUnit -> c BuiltinUnit)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinUnit)
-> (BuiltinUnit -> Constr)
-> (BuiltinUnit -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinUnit))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinUnit))
-> ((forall b. Data b => b -> b) -> BuiltinUnit -> BuiltinUnit)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r)
-> (forall u. (forall d. Data d => d -> u) -> BuiltinUnit -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinUnit -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit)
-> Data BuiltinUnit
BuiltinUnit -> Constr
BuiltinUnit -> DataType
(forall b. Data b => b -> b) -> BuiltinUnit -> BuiltinUnit
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BuiltinUnit -> u
forall u. (forall d. Data d => d -> u) -> BuiltinUnit -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinUnit
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinUnit -> c BuiltinUnit
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinUnit)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinUnit)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinUnit -> c BuiltinUnit
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinUnit -> c BuiltinUnit
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinUnit
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinUnit
$ctoConstr :: BuiltinUnit -> Constr
toConstr :: BuiltinUnit -> Constr
$cdataTypeOf :: BuiltinUnit -> DataType
dataTypeOf :: BuiltinUnit -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinUnit)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinUnit)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinUnit)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinUnit)
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinUnit -> BuiltinUnit
gmapT :: (forall b. Data b => b -> b) -> BuiltinUnit -> BuiltinUnit
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinUnit -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinUnit -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinUnit -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinUnit -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
Data
unitval :: BuiltinUnit
unitval :: BuiltinUnit
unitval = () -> BuiltinUnit
BuiltinUnit ()
{-# OPAQUE unitval #-}
chooseUnit :: BuiltinUnit -> a -> a
chooseUnit :: forall a. BuiltinUnit -> a -> a
chooseUnit (BuiltinUnit ()) a
a = a
a
{-# OPAQUE chooseUnit #-}
type BuiltinInteger = Integer
addInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
addInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
addInteger = (BuiltinInteger -> BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
forall a b. Coercible a b => a -> b
coerce (forall a. Num a => a -> a -> a
(+) @Integer)
{-# OPAQUE addInteger #-}
subtractInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
subtractInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
subtractInteger = (BuiltinInteger -> BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
forall a b. Coercible a b => a -> b
coerce ((-) @Integer)
{-# OPAQUE subtractInteger #-}
multiplyInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
multiplyInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
multiplyInteger = (BuiltinInteger -> BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
forall a b. Coercible a b => a -> b
coerce (forall a. Num a => a -> a -> a
(*) @Integer)
{-# OPAQUE multiplyInteger #-}
divideInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
divideInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
divideInteger = (BuiltinInteger -> BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
div @Integer)
{-# OPAQUE divideInteger #-}
modInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
modInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
modInteger = (BuiltinInteger -> BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
mod @Integer)
{-# OPAQUE modInteger #-}
quotientInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
quotientInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
quotientInteger = (BuiltinInteger -> BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
quot @Integer)
{-# OPAQUE quotientInteger #-}
remainderInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
remainderInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
remainderInteger = (BuiltinInteger -> BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
rem @Integer)
{-# OPAQUE remainderInteger #-}
lessThanInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanInteger BuiltinInteger
x BuiltinInteger
y = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ (BuiltinInteger -> BuiltinInteger -> Bool)
-> BuiltinInteger -> BuiltinInteger -> Bool
forall a b. Coercible a b => a -> b
coerce (forall a. Ord a => a -> a -> Bool
(<) @Integer) BuiltinInteger
x BuiltinInteger
y
{-# OPAQUE lessThanInteger #-}
lessThanEqualsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanEqualsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanEqualsInteger BuiltinInteger
x BuiltinInteger
y = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ (BuiltinInteger -> BuiltinInteger -> Bool)
-> BuiltinInteger -> BuiltinInteger -> Bool
forall a b. Coercible a b => a -> b
coerce (forall a. Ord a => a -> a -> Bool
(<=) @Integer) BuiltinInteger
x BuiltinInteger
y
{-# OPAQUE lessThanEqualsInteger #-}
equalsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
equalsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
equalsInteger BuiltinInteger
x BuiltinInteger
y = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ (BuiltinInteger -> BuiltinInteger -> Bool)
-> BuiltinInteger -> BuiltinInteger -> Bool
forall a b. Coercible a b => a -> b
coerce (forall a. Eq a => a -> a -> Bool
(==) @Integer) BuiltinInteger
x BuiltinInteger
y
{-# OPAQUE equalsInteger #-}
data BuiltinByteString = BuiltinByteString ~BS.ByteString deriving stock Typeable BuiltinByteString
Typeable BuiltinByteString =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> BuiltinByteString
-> c BuiltinByteString)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinByteString)
-> (BuiltinByteString -> Constr)
-> (BuiltinByteString -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinByteString))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinByteString))
-> ((forall b. Data b => b -> b)
-> BuiltinByteString -> BuiltinByteString)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r)
-> (forall u.
(forall d. Data d => d -> u) -> BuiltinByteString -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinByteString -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString)
-> Data BuiltinByteString
BuiltinByteString -> Constr
BuiltinByteString -> DataType
(forall b. Data b => b -> b)
-> BuiltinByteString -> BuiltinByteString
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinByteString -> u
forall u. (forall d. Data d => d -> u) -> BuiltinByteString -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinByteString
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinByteString -> c BuiltinByteString
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinByteString)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinByteString)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinByteString -> c BuiltinByteString
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinByteString -> c BuiltinByteString
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinByteString
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinByteString
$ctoConstr :: BuiltinByteString -> Constr
toConstr :: BuiltinByteString -> Constr
$cdataTypeOf :: BuiltinByteString -> DataType
dataTypeOf :: BuiltinByteString -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinByteString)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinByteString)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinByteString)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinByteString)
$cgmapT :: (forall b. Data b => b -> b)
-> BuiltinByteString -> BuiltinByteString
gmapT :: (forall b. Data b => b -> b)
-> BuiltinByteString -> BuiltinByteString
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinByteString -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinByteString -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinByteString -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinByteString -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
Data
instance Haskell.Show BuiltinByteString where
show :: BuiltinByteString -> [Char]
show (BuiltinByteString ByteString
bs) = ByteString -> [Char]
forall a. Show a => a -> [Char]
show ByteString
bs
instance Haskell.Eq BuiltinByteString where
== :: BuiltinByteString -> BuiltinByteString -> Bool
(==) (BuiltinByteString ByteString
bs) (BuiltinByteString ByteString
bs') = ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
(==) ByteString
bs ByteString
bs'
instance Haskell.Ord BuiltinByteString where
compare :: BuiltinByteString -> BuiltinByteString -> Ordering
compare (BuiltinByteString ByteString
bs) (BuiltinByteString ByteString
bs') = ByteString -> ByteString -> Ordering
forall a. Ord a => a -> a -> Ordering
compare ByteString
bs ByteString
bs'
instance Haskell.Semigroup BuiltinByteString where
<> :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
(<>) (BuiltinByteString ByteString
bs) (BuiltinByteString ByteString
bs') = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
(<>) ByteString
bs ByteString
bs'
instance Haskell.Monoid BuiltinByteString where
mempty :: BuiltinByteString
mempty = ByteString -> BuiltinByteString
BuiltinByteString ByteString
forall a. Monoid a => a
mempty
instance Hashable BuiltinByteString where
hashWithSalt :: Int -> BuiltinByteString -> Int
hashWithSalt Int
s (BuiltinByteString ByteString
bs )= Int -> ByteString -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s ByteString
bs
instance Serialise BuiltinByteString where
encode :: BuiltinByteString -> Encoding
encode (BuiltinByteString ByteString
bs) = ByteString -> Encoding
forall a. Serialise a => a -> Encoding
encode ByteString
bs
decode :: forall s. Decoder s BuiltinByteString
decode = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> Decoder s ByteString -> Decoder s BuiltinByteString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s ByteString
forall s. Decoder s ByteString
forall a s. Serialise a => Decoder s a
decode
instance NFData BuiltinByteString where
rnf :: BuiltinByteString -> ()
rnf (BuiltinByteString ByteString
bs) = ByteString -> ()
forall a. NFData a => a -> ()
rnf ByteString
bs
instance BA.ByteArrayAccess BuiltinByteString where
length :: BuiltinByteString -> Int
length (BuiltinByteString ByteString
bs) = ByteString -> Int
forall ba. ByteArrayAccess ba => ba -> Int
BA.length ByteString
bs
withByteArray :: forall p a. BuiltinByteString -> (Ptr p -> IO a) -> IO a
withByteArray (BuiltinByteString ByteString
bs) = ByteString -> (Ptr p -> IO a) -> IO a
forall ba p a. ByteArrayAccess ba => ba -> (Ptr p -> IO a) -> IO a
forall p a. ByteString -> (Ptr p -> IO a) -> IO a
BA.withByteArray ByteString
bs
instance BA.ByteArray BuiltinByteString where
allocRet :: forall p a. Int -> (Ptr p -> IO a) -> IO (a, BuiltinByteString)
allocRet Int
i Ptr p -> IO a
p = ((a, ByteString) -> (a, BuiltinByteString))
-> IO (a, ByteString) -> IO (a, BuiltinByteString)
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((ByteString -> BuiltinByteString)
-> (a, ByteString) -> (a, BuiltinByteString)
forall a b. (a -> b) -> (a, a) -> (a, b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> BuiltinByteString
BuiltinByteString) (IO (a, ByteString) -> IO (a, BuiltinByteString))
-> IO (a, ByteString) -> IO (a, BuiltinByteString)
forall a b. (a -> b) -> a -> b
$ Int -> (Ptr p -> IO a) -> IO (a, ByteString)
forall ba p a. ByteArray ba => Int -> (Ptr p -> IO a) -> IO (a, ba)
forall p a. Int -> (Ptr p -> IO a) -> IO (a, ByteString)
BA.allocRet Int
i Ptr p -> IO a
p
instance Pretty BuiltinByteString where
pretty :: forall ann. BuiltinByteString -> Doc ann
pretty = BuiltinByteString -> Doc ann
forall a ann. Show a => a -> Doc ann
viaShow
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString -> ByteString
BS.append ByteString
b1 ByteString
b2
{-# OPAQUE appendByteString #-}
consByteString :: BuiltinInteger -> BuiltinByteString -> BuiltinByteString
consByteString :: BuiltinInteger -> BuiltinByteString -> BuiltinByteString
consByteString BuiltinInteger
n (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString -> ByteString
BS.cons (BuiltinInteger -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
n) ByteString
b
{-# OPAQUE consByteString #-}
sliceByteString :: BuiltinInteger -> BuiltinInteger -> BuiltinByteString -> BuiltinByteString
sliceByteString :: BuiltinInteger
-> BuiltinInteger -> BuiltinByteString -> BuiltinByteString
sliceByteString BuiltinInteger
start BuiltinInteger
n (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ Int -> ByteString -> ByteString
BS.take (BuiltinInteger -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
n) (Int -> ByteString -> ByteString
BS.drop (BuiltinInteger -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
start) ByteString
b)
{-# OPAQUE sliceByteString #-}
lengthOfByteString :: BuiltinByteString -> BuiltinInteger
lengthOfByteString :: BuiltinByteString -> BuiltinInteger
lengthOfByteString (BuiltinByteString ByteString
b) = Int -> BuiltinInteger
forall a. Integral a => a -> BuiltinInteger
toInteger (Int -> BuiltinInteger) -> Int -> BuiltinInteger
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
BS.length ByteString
b
{-# OPAQUE lengthOfByteString #-}
indexByteString :: BuiltinByteString -> BuiltinInteger -> BuiltinInteger
indexByteString :: BuiltinByteString -> BuiltinInteger -> BuiltinInteger
indexByteString (BuiltinByteString ByteString
b) BuiltinInteger
i = Word8 -> BuiltinInteger
forall a. Integral a => a -> BuiltinInteger
toInteger (Word8 -> BuiltinInteger) -> Word8 -> BuiltinInteger
forall a b. (a -> b) -> a -> b
$ HasCallStack => ByteString -> Int -> Word8
ByteString -> Int -> Word8
BS.index ByteString
b (BuiltinInteger -> Int
forall a. Num a => BuiltinInteger -> a
fromInteger BuiltinInteger
i)
{-# OPAQUE indexByteString #-}
emptyByteString :: BuiltinByteString
emptyByteString :: BuiltinByteString
emptyByteString = ByteString -> BuiltinByteString
BuiltinByteString ByteString
BS.empty
{-# OPAQUE emptyByteString #-}
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.sha2_256 ByteString
b
{-# OPAQUE sha2_256 #-}
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.sha3_256 ByteString
b
{-# OPAQUE sha3_256 #-}
blake2b_224 :: BuiltinByteString -> BuiltinByteString
blake2b_224 :: BuiltinByteString -> BuiltinByteString
blake2b_224 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.blake2b_224 ByteString
b
{-# OPAQUE blake2b_224 #-}
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.blake2b_256 ByteString
b
{-# OPAQUE blake2b_256 #-}
keccak_256 :: BuiltinByteString -> BuiltinByteString
keccak_256 :: BuiltinByteString -> BuiltinByteString
keccak_256 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.keccak_256 ByteString
b
{-# OPAQUE keccak_256 #-}
ripemd_160 :: BuiltinByteString -> BuiltinByteString
ripemd_160 :: BuiltinByteString -> BuiltinByteString
ripemd_160 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.ripemd_160 ByteString
b
{-# OPAQUE ripemd_160 #-}
verifyEd25519Signature :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifyEd25519Signature :: BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifyEd25519Signature (BuiltinByteString ByteString
vk) (BuiltinByteString ByteString
msg) (BuiltinByteString ByteString
sig) =
case ByteString -> ByteString -> ByteString -> BuiltinResult Bool
PlutusCore.Crypto.Ed25519.verifyEd25519Signature_V1 ByteString
vk ByteString
msg ByteString
sig of
BuiltinSuccess Bool
b -> Bool -> BuiltinBool
BuiltinBool Bool
b
BuiltinSuccessWithLogs DList Text
logs Bool
b -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ Bool -> BuiltinBool
BuiltinBool Bool
b
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinBool
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"Ed25519 signature verification errored."
{-# OPAQUE verifyEd25519Signature #-}
verifyEcdsaSecp256k1Signature ::
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinBool
verifyEcdsaSecp256k1Signature :: BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifyEcdsaSecp256k1Signature (BuiltinByteString ByteString
vk) (BuiltinByteString ByteString
msg) (BuiltinByteString ByteString
sig) =
case ByteString -> ByteString -> ByteString -> BuiltinResult Bool
PlutusCore.Crypto.Secp256k1.verifyEcdsaSecp256k1Signature ByteString
vk ByteString
msg ByteString
sig of
BuiltinSuccess Bool
b -> Bool -> BuiltinBool
BuiltinBool Bool
b
BuiltinSuccessWithLogs DList Text
logs Bool
b -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ Bool -> BuiltinBool
BuiltinBool Bool
b
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinBool
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"ECDSA SECP256k1 signature verification errored."
{-# OPAQUE verifyEcdsaSecp256k1Signature #-}
verifySchnorrSecp256k1Signature ::
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinBool
verifySchnorrSecp256k1Signature :: BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifySchnorrSecp256k1Signature (BuiltinByteString ByteString
vk) (BuiltinByteString ByteString
msg) (BuiltinByteString ByteString
sig) =
case ByteString -> ByteString -> ByteString -> BuiltinResult Bool
PlutusCore.Crypto.Secp256k1.verifySchnorrSecp256k1Signature ByteString
vk ByteString
msg ByteString
sig of
BuiltinSuccess Bool
b -> Bool -> BuiltinBool
BuiltinBool Bool
b
BuiltinSuccessWithLogs DList Text
logs Bool
b -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ Bool -> BuiltinBool
BuiltinBool Bool
b
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinBool
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"Schnorr SECP256k1 signature verification errored."
{-# OPAQUE verifySchnorrSecp256k1Signature #-}
traceAll :: forall (a :: Type) (f :: Type -> Type) .
(Foldable f) => f Text -> a -> a
traceAll :: forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll f Text
logs a
x = (a -> Text -> a) -> a -> f Text -> a
forall b a. (b -> a -> b) -> b -> f a -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
Foldable.foldl' (\a
acc Text
t -> BuiltinString -> a -> a
forall a. BuiltinString -> a -> a
trace (Text -> BuiltinString
BuiltinString Text
t) a
acc) a
x f Text
logs
equalsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
equalsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
equalsByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ ByteString
b1 ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
b2
{-# OPAQUE equalsByteString #-}
lessThanByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ ByteString
b1 ByteString -> ByteString -> Bool
forall a. Ord a => a -> a -> Bool
< ByteString
b2
{-# OPAQUE lessThanByteString #-}
lessThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanEqualsByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ ByteString
b1 ByteString -> ByteString -> Bool
forall a. Ord a => a -> a -> Bool
<= ByteString
b2
{-# OPAQUE lessThanEqualsByteString #-}
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 (BuiltinByteString ByteString
b) = Text -> BuiltinString
BuiltinString (Text -> BuiltinString) -> Text -> BuiltinString
forall a b. (a -> b) -> a -> b
$ ByteString -> Text
Text.decodeUtf8 ByteString
b
{-# OPAQUE decodeUtf8 #-}
data BuiltinString = BuiltinString ~Text deriving stock Typeable BuiltinString
Typeable BuiltinString =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinString -> c BuiltinString)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinString)
-> (BuiltinString -> Constr)
-> (BuiltinString -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinString))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinString))
-> ((forall b. Data b => b -> b) -> BuiltinString -> BuiltinString)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r)
-> (forall u. (forall d. Data d => d -> u) -> BuiltinString -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinString -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString)
-> Data BuiltinString
BuiltinString -> Constr
BuiltinString -> DataType
(forall b. Data b => b -> b) -> BuiltinString -> BuiltinString
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BuiltinString -> u
forall u. (forall d. Data d => d -> u) -> BuiltinString -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinString
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinString -> c BuiltinString
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinString)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinString)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinString -> c BuiltinString
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinString -> c BuiltinString
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinString
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinString
$ctoConstr :: BuiltinString -> Constr
toConstr :: BuiltinString -> Constr
$cdataTypeOf :: BuiltinString -> DataType
dataTypeOf :: BuiltinString -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinString)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinString)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinString)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinString)
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinString -> BuiltinString
gmapT :: (forall b. Data b => b -> b) -> BuiltinString -> BuiltinString
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinString -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinString -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinString -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinString -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
Data
instance Haskell.Show BuiltinString where
show :: BuiltinString -> [Char]
show (BuiltinString Text
t) = Text -> [Char]
forall a. Show a => a -> [Char]
show Text
t
instance Haskell.Eq BuiltinString where
== :: BuiltinString -> BuiltinString -> Bool
(==) (BuiltinString Text
t) (BuiltinString Text
t') = Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
(==) Text
t Text
t'
instance Haskell.Ord BuiltinString where
compare :: BuiltinString -> BuiltinString -> Ordering
compare (BuiltinString Text
t) (BuiltinString Text
t') = Text -> Text -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Text
t Text
t'
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString (BuiltinString Text
s1) (BuiltinString Text
s2) = Text -> BuiltinString
BuiltinString (Text
s1 Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s2)
{-# OPAQUE appendString #-}
emptyString :: BuiltinString
emptyString :: BuiltinString
emptyString = Text -> BuiltinString
BuiltinString Text
Text.empty
{-# OPAQUE emptyString #-}
equalsString :: BuiltinString -> BuiltinString -> BuiltinBool
equalsString :: BuiltinString -> BuiltinString -> BuiltinBool
equalsString (BuiltinString Text
s1) (BuiltinString Text
s2) = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ Text
s1 Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
s2
{-# OPAQUE equalsString #-}
trace :: BuiltinString -> a -> a
trace :: forall a. BuiltinString -> a -> a
trace BuiltinString
_ a
x = a
x
{-# OPAQUE trace #-}
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 (BuiltinString Text
s) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
Text.encodeUtf8 Text
s
{-# OPAQUE encodeUtf8 #-}
data BuiltinPair a b = BuiltinPair ~(a, b) deriving stock Typeable (BuiltinPair a b)
Typeable (BuiltinPair a b) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinPair a b -> c (BuiltinPair a b))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinPair a b))
-> (BuiltinPair a b -> Constr)
-> (BuiltinPair a b -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinPair a b)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinPair a b)))
-> ((forall b. Data b => b -> b)
-> BuiltinPair a b -> BuiltinPair a b)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r)
-> (forall u.
(forall d. Data d => d -> u) -> BuiltinPair a b -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinPair a b -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b))
-> Data (BuiltinPair a b)
BuiltinPair a b -> Constr
BuiltinPair a b -> DataType
(forall b. Data b => b -> b) -> BuiltinPair a b -> BuiltinPair a b
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinPair a b -> u
forall u. (forall d. Data d => d -> u) -> BuiltinPair a b -> [u]
forall a b. (Data a, Data b) => Typeable (BuiltinPair a b)
forall a b. (Data a, Data b) => BuiltinPair a b -> Constr
forall a b. (Data a, Data b) => BuiltinPair a b -> DataType
forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> BuiltinPair a b -> BuiltinPair a b
forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> BuiltinPair a b -> u
forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> BuiltinPair a b -> [u]
forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
forall a b (c :: * -> *).
(Data a, Data b) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinPair a b)
forall a b (c :: * -> *).
(Data a, Data b) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinPair a b -> c (BuiltinPair a b)
forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinPair a b))
forall a b (t :: * -> * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinPair a b))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinPair a b)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinPair a b -> c (BuiltinPair a b)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinPair a b))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinPair a b))
$cgfoldl :: forall a b (c :: * -> *).
(Data a, Data b) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinPair a b -> c (BuiltinPair a b)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinPair a b -> c (BuiltinPair a b)
$cgunfold :: forall a b (c :: * -> *).
(Data a, Data b) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinPair a b)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinPair a b)
$ctoConstr :: forall a b. (Data a, Data b) => BuiltinPair a b -> Constr
toConstr :: BuiltinPair a b -> Constr
$cdataTypeOf :: forall a b. (Data a, Data b) => BuiltinPair a b -> DataType
dataTypeOf :: BuiltinPair a b -> DataType
$cdataCast1 :: forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinPair a b))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinPair a b))
$cdataCast2 :: forall a b (t :: * -> * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinPair a b))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinPair a b))
$cgmapT :: forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> BuiltinPair a b -> BuiltinPair a b
gmapT :: (forall b. Data b => b -> b) -> BuiltinPair a b -> BuiltinPair a b
$cgmapQl :: forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
$cgmapQr :: forall a b r r'.
(Data a, Data b) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
$cgmapQ :: forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> BuiltinPair a b -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinPair a b -> [u]
$cgmapQi :: forall a b u.
(Data a, Data b) =>
Int -> (forall d. Data d => d -> u) -> BuiltinPair a b -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinPair a b -> u
$cgmapM :: forall a b (m :: * -> *).
(Data a, Data b, Monad m) =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
$cgmapMp :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
$cgmapMo :: forall a b (m :: * -> *).
(Data a, Data b, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
Data
instance (Haskell.Show a, Haskell.Show b) => Haskell.Show (BuiltinPair a b) where
show :: BuiltinPair a b -> [Char]
show (BuiltinPair (a, b)
p) = (a, b) -> [Char]
forall a. Show a => a -> [Char]
show (a, b)
p
instance (Haskell.Eq a, Haskell.Eq b) => Haskell.Eq (BuiltinPair a b) where
== :: BuiltinPair a b -> BuiltinPair a b -> Bool
(==) (BuiltinPair (a, b)
p) (BuiltinPair (a, b)
p') = (a, b) -> (a, b) -> Bool
forall a. Eq a => a -> a -> Bool
(==) (a, b)
p (a, b)
p'
instance (Haskell.Ord a, Haskell.Ord b) => Haskell.Ord (BuiltinPair a b) where
compare :: BuiltinPair a b -> BuiltinPair a b -> Ordering
compare (BuiltinPair (a, b)
p) (BuiltinPair (a, b)
p') = (a, b) -> (a, b) -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (a, b)
p (a, b)
p'
fst :: BuiltinPair a b -> a
fst :: forall a b. BuiltinPair a b -> a
fst (BuiltinPair (a
a, b
_)) = a
a
{-# OPAQUE fst #-}
snd :: BuiltinPair a b -> b
snd :: forall a b. BuiltinPair a b -> b
snd (BuiltinPair (a
_, b
b)) = b
b
{-# OPAQUE snd #-}
mkPairData :: BuiltinData -> BuiltinData -> BuiltinPair BuiltinData BuiltinData
mkPairData :: BuiltinData -> BuiltinData -> BuiltinPair BuiltinData BuiltinData
mkPairData BuiltinData
d1 BuiltinData
d2 = (BuiltinData, BuiltinData) -> BuiltinPair BuiltinData BuiltinData
forall a b. (a, b) -> BuiltinPair a b
BuiltinPair (BuiltinData
d1, BuiltinData
d2)
{-# OPAQUE mkPairData #-}
data BuiltinList a = BuiltinList ~[a] deriving stock Typeable (BuiltinList a)
Typeable (BuiltinList a) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinList a -> c (BuiltinList a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinList a))
-> (BuiltinList a -> Constr)
-> (BuiltinList a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinList a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinList a)))
-> ((forall b. Data b => b -> b) -> BuiltinList a -> BuiltinList a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r)
-> (forall u. (forall d. Data d => d -> u) -> BuiltinList a -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinList a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a))
-> Data (BuiltinList a)
BuiltinList a -> Constr
BuiltinList a -> DataType
(forall b. Data b => b -> b) -> BuiltinList a -> BuiltinList a
forall a. Data a => Typeable (BuiltinList a)
forall a. Data a => BuiltinList a -> Constr
forall a. Data a => BuiltinList a -> DataType
forall a.
Data a =>
(forall b. Data b => b -> b) -> BuiltinList a -> BuiltinList a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> BuiltinList a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> BuiltinList a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinList a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinList a -> c (BuiltinList a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinList a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinList a))
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BuiltinList a -> u
forall u. (forall d. Data d => d -> u) -> BuiltinList a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinList a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinList a -> c (BuiltinList a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinList a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinList a))
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinList a -> c (BuiltinList a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinList a -> c (BuiltinList a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinList a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BuiltinList a)
$ctoConstr :: forall a. Data a => BuiltinList a -> Constr
toConstr :: BuiltinList a -> Constr
$cdataTypeOf :: forall a. Data a => BuiltinList a -> DataType
dataTypeOf :: BuiltinList a -> DataType
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinList a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinList a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinList a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinList a))
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> BuiltinList a -> BuiltinList a
gmapT :: (forall b. Data b => b -> b) -> BuiltinList a -> BuiltinList a
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> BuiltinList a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinList a -> [u]
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> BuiltinList a -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinList a -> u
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
Data
instance Haskell.Show a => Haskell.Show (BuiltinList a) where
show :: BuiltinList a -> [Char]
show (BuiltinList [a]
l) = [a] -> [Char]
forall a. Show a => a -> [Char]
show [a]
l
instance Haskell.Eq a => Haskell.Eq (BuiltinList a) where
== :: BuiltinList a -> BuiltinList a -> Bool
(==) (BuiltinList [a]
l) (BuiltinList [a]
l') = [a] -> [a] -> Bool
forall a. Eq a => a -> a -> Bool
(==) [a]
l [a]
l'
instance Haskell.Ord a => Haskell.Ord (BuiltinList a) where
compare :: BuiltinList a -> BuiltinList a -> Ordering
compare (BuiltinList [a]
l) (BuiltinList [a]
l') = [a] -> [a] -> Ordering
forall a. Ord a => a -> a -> Ordering
compare [a]
l [a]
l'
null :: BuiltinList a -> BuiltinBool
null :: forall a. BuiltinList a -> BuiltinBool
null (BuiltinList (a
_:[a]
_)) = Bool -> BuiltinBool
BuiltinBool Bool
False
null (BuiltinList []) = Bool -> BuiltinBool
BuiltinBool Bool
True
{-# OPAQUE null #-}
head :: BuiltinList a -> a
head :: forall a. BuiltinList a -> a
head (BuiltinList (a
x:[a]
_)) = a
x
head (BuiltinList []) = [Char] -> a
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"empty list"
{-# OPAQUE head #-}
tail :: BuiltinList a -> BuiltinList a
tail :: forall a. BuiltinList a -> BuiltinList a
tail (BuiltinList (a
_:[a]
xs)) = [a] -> BuiltinList a
forall a. [a] -> BuiltinList a
BuiltinList [a]
xs
tail (BuiltinList []) = [Char] -> BuiltinList a
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"empty list"
{-# OPAQUE tail #-}
chooseList :: BuiltinList a -> b -> b -> b
chooseList :: forall a b. BuiltinList a -> b -> b -> b
chooseList (BuiltinList []) b
b1 b
_ = b
b1
chooseList (BuiltinList (a
_:[a]
_)) b
_ b
b2 = b
b2
{-# OPAQUE chooseList #-}
caseList' :: forall a r . r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
caseList' :: forall a r. r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r
caseList' r
nilCase a -> BuiltinList a -> r
_ (BuiltinList []) = r
nilCase
caseList' r
_ a -> BuiltinList a -> r
consCase (BuiltinList (a
x : [a]
xs)) = a -> BuiltinList a -> r
consCase a
x ([a] -> BuiltinList a
forall a. [a] -> BuiltinList a
BuiltinList [a]
xs)
{-# OPAQUE caseList' #-}
mkNilData :: BuiltinUnit -> BuiltinList BuiltinData
mkNilData :: BuiltinUnit -> BuiltinList BuiltinData
mkNilData BuiltinUnit
_ = [BuiltinData] -> BuiltinList BuiltinData
forall a. [a] -> BuiltinList a
BuiltinList []
{-# OPAQUE mkNilData #-}
mkNilPairData :: BuiltinUnit -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
mkNilPairData :: BuiltinUnit -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
mkNilPairData BuiltinUnit
_ = [BuiltinPair BuiltinData BuiltinData]
-> BuiltinList (BuiltinPair BuiltinData BuiltinData)
forall a. [a] -> BuiltinList a
BuiltinList []
{-# OPAQUE mkNilPairData #-}
mkCons :: a -> BuiltinList a -> BuiltinList a
mkCons :: forall a. a -> BuiltinList a -> BuiltinList a
mkCons a
a (BuiltinList [a]
as) = [a] -> BuiltinList a
forall a. [a] -> BuiltinList a
BuiltinList (a
aa -> [a] -> [a]
forall a. a -> [a] -> [a]
:[a]
as)
{-# OPAQUE mkCons #-}
data BuiltinData = BuiltinData ~PLC.Data
deriving stock (Typeable BuiltinData
Typeable BuiltinData =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinData -> c BuiltinData)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinData)
-> (BuiltinData -> Constr)
-> (BuiltinData -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinData))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinData))
-> ((forall b. Data b => b -> b) -> BuiltinData -> BuiltinData)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r)
-> (forall u. (forall d. Data d => d -> u) -> BuiltinData -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinData -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData)
-> Data BuiltinData
BuiltinData -> Constr
BuiltinData -> DataType
(forall b. Data b => b -> b) -> BuiltinData -> BuiltinData
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BuiltinData -> u
forall u. (forall d. Data d => d -> u) -> BuiltinData -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinData
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinData -> c BuiltinData
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinData)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinData)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinData -> c BuiltinData
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinData -> c BuiltinData
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinData
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinData
$ctoConstr :: BuiltinData -> Constr
toConstr :: BuiltinData -> Constr
$cdataTypeOf :: BuiltinData -> DataType
dataTypeOf :: BuiltinData -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinData)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinData)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinData)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinData)
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinData -> BuiltinData
gmapT :: (forall b. Data b => b -> b) -> BuiltinData -> BuiltinData
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinData -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinData -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinData -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinData -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
Data, (forall x. BuiltinData -> Rep BuiltinData x)
-> (forall x. Rep BuiltinData x -> BuiltinData)
-> Generic BuiltinData
forall x. Rep BuiltinData x -> BuiltinData
forall x. BuiltinData -> Rep BuiltinData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BuiltinData -> Rep BuiltinData x
from :: forall x. BuiltinData -> Rep BuiltinData x
$cto :: forall x. Rep BuiltinData x -> BuiltinData
to :: forall x. Rep BuiltinData x -> BuiltinData
Generic)
instance Haskell.Show BuiltinData where
show :: BuiltinData -> [Char]
show (BuiltinData Data
d) = Data -> [Char]
forall a. Show a => a -> [Char]
show Data
d
instance Haskell.Eq BuiltinData where
== :: BuiltinData -> BuiltinData -> Bool
(==) (BuiltinData Data
d) (BuiltinData Data
d') = Data -> Data -> Bool
forall a. Eq a => a -> a -> Bool
(==) Data
d Data
d'
instance Haskell.Ord BuiltinData where
compare :: BuiltinData -> BuiltinData -> Ordering
compare (BuiltinData Data
d) (BuiltinData Data
d') = Data -> Data -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Data
d Data
d'
instance NFData BuiltinData where
rnf :: BuiltinData -> ()
rnf (BuiltinData Data
d) = Data -> ()
forall a. NFData a => a -> ()
rnf Data
d
instance Pretty BuiltinData where
pretty :: forall ann. BuiltinData -> Doc ann
pretty (BuiltinData Data
d) = Data -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Data -> Doc ann
pretty Data
d
builtinDataToData :: BuiltinData -> PLC.Data
builtinDataToData :: BuiltinData -> Data
builtinDataToData (BuiltinData Data
d) = Data
d
{-# OPAQUE builtinDataToData #-}
dataToBuiltinData :: PLC.Data -> BuiltinData
dataToBuiltinData :: Data -> BuiltinData
dataToBuiltinData = Data -> BuiltinData
BuiltinData
{-# OPAQUE dataToBuiltinData #-}
chooseData :: forall a . BuiltinData -> a -> a -> a -> a -> a -> a
chooseData :: forall a. BuiltinData -> a -> a -> a -> a -> a -> a
chooseData (BuiltinData Data
d) a
constrCase a
mapCase a
listCase a
iCase a
bCase = case Data
d of
PLC.Constr{} -> a
constrCase
PLC.Map{} -> a
mapCase
PLC.List{} -> a
listCase
PLC.I{} -> a
iCase
PLC.B{} -> a
bCase
{-# OPAQUE chooseData #-}
caseData'
:: (Integer -> BuiltinList BuiltinData -> r)
-> (BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r)
-> (BuiltinList BuiltinData -> r)
-> (Integer -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
caseData' :: forall r.
(BuiltinInteger -> BuiltinList BuiltinData -> r)
-> (BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r)
-> (BuiltinList BuiltinData -> r)
-> (BuiltinInteger -> r)
-> (BuiltinByteString -> r)
-> BuiltinData
-> r
caseData' BuiltinInteger -> BuiltinList BuiltinData -> r
constrCase BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r
mapCase BuiltinList BuiltinData -> r
listCase BuiltinInteger -> r
iCase BuiltinByteString -> r
bCase (BuiltinData Data
d) = case Data
d of
PLC.Constr BuiltinInteger
i [Data]
ds -> BuiltinInteger -> BuiltinList BuiltinData -> r
constrCase BuiltinInteger
i ([BuiltinData] -> BuiltinList BuiltinData
forall a. [a] -> BuiltinList a
BuiltinList ((Data -> BuiltinData) -> [Data] -> [BuiltinData]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Data -> BuiltinData
dataToBuiltinData [Data]
ds))
PLC.Map [(Data, Data)]
ps -> BuiltinList (BuiltinPair BuiltinData BuiltinData) -> r
mapCase ([BuiltinPair BuiltinData BuiltinData]
-> BuiltinList (BuiltinPair BuiltinData BuiltinData)
forall a. [a] -> BuiltinList a
BuiltinList (((Data, Data) -> BuiltinPair BuiltinData BuiltinData)
-> [(Data, Data)] -> [BuiltinPair BuiltinData BuiltinData]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Data, Data) -> BuiltinPair BuiltinData BuiltinData
p2p [(Data, Data)]
ps))
PLC.List [Data]
ds -> BuiltinList BuiltinData -> r
listCase ([BuiltinData] -> BuiltinList BuiltinData
forall a. [a] -> BuiltinList a
BuiltinList ((Data -> BuiltinData) -> [Data] -> [BuiltinData]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Data -> BuiltinData
dataToBuiltinData [Data]
ds))
PLC.I BuiltinInteger
i -> BuiltinInteger -> r
iCase BuiltinInteger
i
PLC.B ByteString
b -> BuiltinByteString -> r
bCase (ByteString -> BuiltinByteString
BuiltinByteString ByteString
b)
where
p2p :: (Data, Data) -> BuiltinPair BuiltinData BuiltinData
p2p (Data
d1, Data
d2) = (BuiltinData, BuiltinData) -> BuiltinPair BuiltinData BuiltinData
forall a b. (a, b) -> BuiltinPair a b
BuiltinPair (Data -> BuiltinData
dataToBuiltinData Data
d1, Data -> BuiltinData
dataToBuiltinData Data
d2)
{-# OPAQUE caseData' #-}
mkConstr :: BuiltinInteger -> BuiltinList BuiltinData -> BuiltinData
mkConstr :: BuiltinInteger -> BuiltinList BuiltinData -> BuiltinData
mkConstr BuiltinInteger
i (BuiltinList [BuiltinData]
args) = Data -> BuiltinData
BuiltinData (BuiltinInteger -> [Data] -> Data
PLC.Constr BuiltinInteger
i ((BuiltinData -> Data) -> [BuiltinData] -> [Data]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BuiltinData -> Data
builtinDataToData [BuiltinData]
args))
{-# OPAQUE mkConstr #-}
mkMap :: BuiltinList (BuiltinPair BuiltinData BuiltinData) -> BuiltinData
mkMap :: BuiltinList (BuiltinPair BuiltinData BuiltinData) -> BuiltinData
mkMap (BuiltinList [BuiltinPair BuiltinData BuiltinData]
es) = Data -> BuiltinData
BuiltinData ([(Data, Data)] -> Data
PLC.Map ((BuiltinPair BuiltinData BuiltinData -> (Data, Data))
-> [BuiltinPair BuiltinData BuiltinData] -> [(Data, Data)]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BuiltinPair BuiltinData BuiltinData -> (Data, Data)
p2p [BuiltinPair BuiltinData BuiltinData]
es))
where
p2p :: BuiltinPair BuiltinData BuiltinData -> (Data, Data)
p2p (BuiltinPair (BuiltinData
d, BuiltinData
d')) = (BuiltinData -> Data
builtinDataToData BuiltinData
d, BuiltinData -> Data
builtinDataToData BuiltinData
d')
{-# OPAQUE mkMap #-}
mkList :: BuiltinList BuiltinData -> BuiltinData
mkList :: BuiltinList BuiltinData -> BuiltinData
mkList (BuiltinList [BuiltinData]
l) = Data -> BuiltinData
BuiltinData ([Data] -> Data
PLC.List ((BuiltinData -> Data) -> [BuiltinData] -> [Data]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BuiltinData -> Data
builtinDataToData [BuiltinData]
l))
{-# OPAQUE mkList #-}
mkI :: BuiltinInteger -> BuiltinData
mkI :: BuiltinInteger -> BuiltinData
mkI BuiltinInteger
i = Data -> BuiltinData
BuiltinData (BuiltinInteger -> Data
PLC.I BuiltinInteger
i)
{-# OPAQUE mkI #-}
mkB :: BuiltinByteString -> BuiltinData
mkB :: BuiltinByteString -> BuiltinData
mkB (BuiltinByteString ByteString
b) = Data -> BuiltinData
BuiltinData (ByteString -> Data
PLC.B ByteString
b)
{-# OPAQUE mkB #-}
unsafeDataAsConstr :: BuiltinData -> BuiltinPair BuiltinInteger (BuiltinList BuiltinData)
unsafeDataAsConstr :: BuiltinData -> BuiltinPair BuiltinInteger (BuiltinList BuiltinData)
unsafeDataAsConstr (BuiltinData (PLC.Constr BuiltinInteger
i [Data]
args)) = (BuiltinInteger, BuiltinList BuiltinData)
-> BuiltinPair BuiltinInteger (BuiltinList BuiltinData)
forall a b. (a, b) -> BuiltinPair a b
BuiltinPair (BuiltinInteger
i, [BuiltinData] -> BuiltinList BuiltinData
forall a. [a] -> BuiltinList a
BuiltinList ([BuiltinData] -> BuiltinList BuiltinData)
-> [BuiltinData] -> BuiltinList BuiltinData
forall a b. (a -> b) -> a -> b
$ (Data -> BuiltinData) -> [Data] -> [BuiltinData]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Data -> BuiltinData
dataToBuiltinData [Data]
args)
unsafeDataAsConstr BuiltinData
_ = [Char] -> BuiltinPair BuiltinInteger (BuiltinList BuiltinData)
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"not a Constr"
{-# OPAQUE unsafeDataAsConstr #-}
unsafeDataAsMap :: BuiltinData -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
unsafeDataAsMap :: BuiltinData -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
unsafeDataAsMap (BuiltinData (PLC.Map [(Data, Data)]
m)) = [BuiltinPair BuiltinData BuiltinData]
-> BuiltinList (BuiltinPair BuiltinData BuiltinData)
forall a. [a] -> BuiltinList a
BuiltinList (((Data, Data) -> BuiltinPair BuiltinData BuiltinData)
-> [(Data, Data)] -> [BuiltinPair BuiltinData BuiltinData]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Data, Data) -> BuiltinPair BuiltinData BuiltinData
p2p [(Data, Data)]
m)
where
p2p :: (Data, Data) -> BuiltinPair BuiltinData BuiltinData
p2p (Data
d, Data
d') = (BuiltinData, BuiltinData) -> BuiltinPair BuiltinData BuiltinData
forall a b. (a, b) -> BuiltinPair a b
BuiltinPair (Data -> BuiltinData
dataToBuiltinData Data
d, Data -> BuiltinData
dataToBuiltinData Data
d')
unsafeDataAsMap BuiltinData
_ = [Char] -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"not a Map"
{-# OPAQUE unsafeDataAsMap #-}
unsafeDataAsList :: BuiltinData -> BuiltinList BuiltinData
unsafeDataAsList :: BuiltinData -> BuiltinList BuiltinData
unsafeDataAsList (BuiltinData (PLC.List [Data]
l)) = [BuiltinData] -> BuiltinList BuiltinData
forall a. [a] -> BuiltinList a
BuiltinList ((Data -> BuiltinData) -> [Data] -> [BuiltinData]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Data -> BuiltinData
dataToBuiltinData [Data]
l)
unsafeDataAsList BuiltinData
_ = [Char] -> BuiltinList BuiltinData
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"not a List"
{-# OPAQUE unsafeDataAsList #-}
unsafeDataAsI :: BuiltinData -> BuiltinInteger
unsafeDataAsI :: BuiltinData -> BuiltinInteger
unsafeDataAsI (BuiltinData (PLC.I BuiltinInteger
i)) = BuiltinInteger
i
unsafeDataAsI BuiltinData
_ = [Char] -> BuiltinInteger
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"not an I"
{-# OPAQUE unsafeDataAsI #-}
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB (BuiltinData (PLC.B ByteString
b)) = ByteString -> BuiltinByteString
BuiltinByteString ByteString
b
unsafeDataAsB BuiltinData
_ = [Char] -> BuiltinByteString
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"not a B"
{-# OPAQUE unsafeDataAsB #-}
equalsData :: BuiltinData -> BuiltinData -> BuiltinBool
equalsData :: BuiltinData -> BuiltinData -> BuiltinBool
equalsData (BuiltinData Data
b1) (BuiltinData Data
b2) = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ Data
b1 Data -> Data -> Bool
forall a. Eq a => a -> a -> Bool
Haskell.== Data
b2
{-# OPAQUE equalsData #-}
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData (BuiltinData Data
b) = ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
BSL.toStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Data -> ByteString
forall a. Serialise a => a -> ByteString
serialise Data
b
{-# OPAQUE serialiseData #-}
data BuiltinBLS12_381_G1_Element = BuiltinBLS12_381_G1_Element ~BLS12_381.G1.Element
instance Haskell.Show BuiltinBLS12_381_G1_Element where
show :: BuiltinBLS12_381_G1_Element -> [Char]
show (BuiltinBLS12_381_G1_Element Element
a) = Element -> [Char]
forall a. Show a => a -> [Char]
show Element
a
instance Haskell.Eq BuiltinBLS12_381_G1_Element where
== :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element -> Bool
(==) (BuiltinBLS12_381_G1_Element Element
a) (BuiltinBLS12_381_G1_Element Element
b) = Element -> Element -> Bool
forall a. Eq a => a -> a -> Bool
(==) Element
a Element
b
instance NFData BuiltinBLS12_381_G1_Element where
rnf :: BuiltinBLS12_381_G1_Element -> ()
rnf (BuiltinBLS12_381_G1_Element Element
d) = Element -> ()
forall a. NFData a => a -> ()
rnf Element
d
instance Pretty BuiltinBLS12_381_G1_Element where
pretty :: forall ann. BuiltinBLS12_381_G1_Element -> Doc ann
pretty (BuiltinBLS12_381_G1_Element Element
a) = Element -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Element -> Doc ann
pretty Element
a
bls12_381_G1_equals :: BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element -> BuiltinBool
bls12_381_G1_equals :: BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G1_Element -> BuiltinBool
bls12_381_G1_equals BuiltinBLS12_381_G1_Element
a BuiltinBLS12_381_G1_Element
b = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ (BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G1_Element -> Bool)
-> BuiltinBLS12_381_G1_Element
-> BuiltinBLS12_381_G1_Element
-> Bool
forall a b. Coercible a b => a -> b
coerce (forall a. Eq a => a -> a -> Bool
(==) @BuiltinBLS12_381_G1_Element) BuiltinBLS12_381_G1_Element
a BuiltinBLS12_381_G1_Element
b
{-# OPAQUE 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 Element
a) (BuiltinBLS12_381_G1_Element Element
b) = Element -> BuiltinBLS12_381_G1_Element
BuiltinBLS12_381_G1_Element (Element -> Element -> Element
BLS12_381.G1.add Element
a Element
b)
{-# OPAQUE bls12_381_G1_add #-}
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 Element
a) = Element -> BuiltinBLS12_381_G1_Element
BuiltinBLS12_381_G1_Element (Element -> Element
BLS12_381.G1.neg Element
a)
{-# OPAQUE bls12_381_G1_neg #-}
bls12_381_G1_scalarMul :: BuiltinInteger -> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_scalarMul :: BuiltinInteger
-> BuiltinBLS12_381_G1_Element -> BuiltinBLS12_381_G1_Element
bls12_381_G1_scalarMul BuiltinInteger
n (BuiltinBLS12_381_G1_Element Element
a) = Element -> BuiltinBLS12_381_G1_Element
BuiltinBLS12_381_G1_Element (BuiltinInteger -> Element -> Element
BLS12_381.G1.scalarMul BuiltinInteger
n Element
a)
{-# OPAQUE bls12_381_G1_scalarMul #-}
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 Element
a) = ByteString -> BuiltinByteString
BuiltinByteString (Element -> ByteString
BLS12_381.G1.compress Element
a)
{-# OPAQUE 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 ByteString
b) =
case ByteString -> Either BLSTError Element
BLS12_381.G1.uncompress ByteString
b of
Left BLSTError
err -> [Char] -> BuiltinBLS12_381_G1_Element
forall a. HasCallStack => [Char] -> a
Haskell.error ([Char] -> BuiltinBLS12_381_G1_Element)
-> [Char] -> BuiltinBLS12_381_G1_Element
forall a b. (a -> b) -> a -> b
$ [Char]
"BSL12_381 G1 uncompression error: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ BLSTError -> [Char]
forall a. Show a => a -> [Char]
show BLSTError
err
Right Element
a -> Element -> BuiltinBLS12_381_G1_Element
BuiltinBLS12_381_G1_Element Element
a
{-# OPAQUE 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 ByteString
msg) (BuiltinByteString ByteString
dst) =
case ByteString -> ByteString -> Either BLS12_381_Error Element
BLS12_381.G1.hashToGroup ByteString
msg ByteString
dst of
Left BLS12_381_Error
err -> [Char] -> BuiltinBLS12_381_G1_Element
forall a. HasCallStack => [Char] -> a
Haskell.error ([Char] -> BuiltinBLS12_381_G1_Element)
-> [Char] -> BuiltinBLS12_381_G1_Element
forall a b. (a -> b) -> a -> b
$ BLS12_381_Error -> [Char]
forall a. Show a => a -> [Char]
show BLS12_381_Error
err
Right Element
p -> Element -> BuiltinBLS12_381_G1_Element
BuiltinBLS12_381_G1_Element Element
p
{-# OPAQUE bls12_381_G1_hashToGroup #-}
bls12_381_G1_compressed_zero :: BuiltinByteString
bls12_381_G1_compressed_zero :: BuiltinByteString
bls12_381_G1_compressed_zero = ByteString -> BuiltinByteString
BuiltinByteString ByteString
BLS12_381.G1.compressed_zero
{-# OPAQUE bls12_381_G1_compressed_zero #-}
bls12_381_G1_compressed_generator :: BuiltinByteString
bls12_381_G1_compressed_generator :: BuiltinByteString
bls12_381_G1_compressed_generator = ByteString -> BuiltinByteString
BuiltinByteString ByteString
BLS12_381.G1.compressed_generator
{-# OPAQUE bls12_381_G1_compressed_generator #-}
data BuiltinBLS12_381_G2_Element = BuiltinBLS12_381_G2_Element ~BLS12_381.G2.Element
instance Haskell.Show BuiltinBLS12_381_G2_Element where
show :: BuiltinBLS12_381_G2_Element -> [Char]
show (BuiltinBLS12_381_G2_Element Element
a) = Element -> [Char]
forall a. Show a => a -> [Char]
show Element
a
instance Haskell.Eq BuiltinBLS12_381_G2_Element where
== :: BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element -> Bool
(==) (BuiltinBLS12_381_G2_Element Element
a) (BuiltinBLS12_381_G2_Element Element
b) = Element -> Element -> Bool
forall a. Eq a => a -> a -> Bool
(==) Element
a Element
b
instance NFData BuiltinBLS12_381_G2_Element where
rnf :: BuiltinBLS12_381_G2_Element -> ()
rnf (BuiltinBLS12_381_G2_Element Element
d) = Element -> ()
forall a. NFData a => a -> ()
rnf Element
d
instance Pretty BuiltinBLS12_381_G2_Element where
pretty :: forall ann. BuiltinBLS12_381_G2_Element -> Doc ann
pretty (BuiltinBLS12_381_G2_Element Element
a) = Element -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Element -> Doc ann
pretty Element
a
bls12_381_G2_equals :: BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element -> BuiltinBool
bls12_381_G2_equals :: BuiltinBLS12_381_G2_Element
-> BuiltinBLS12_381_G2_Element -> BuiltinBool
bls12_381_G2_equals BuiltinBLS12_381_G2_Element
a BuiltinBLS12_381_G2_Element
b = Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ (BuiltinBLS12_381_G2_Element
-> BuiltinBLS12_381_G2_Element -> Bool)
-> BuiltinBLS12_381_G2_Element
-> BuiltinBLS12_381_G2_Element
-> Bool
forall a b. Coercible a b => a -> b
coerce (forall a. Eq a => a -> a -> Bool
(==) @BuiltinBLS12_381_G2_Element) BuiltinBLS12_381_G2_Element
a BuiltinBLS12_381_G2_Element
b
{-# OPAQUE 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 Element
a) (BuiltinBLS12_381_G2_Element Element
b) = Element -> BuiltinBLS12_381_G2_Element
BuiltinBLS12_381_G2_Element (Element -> Element -> Element
BLS12_381.G2.add Element
a Element
b)
{-# OPAQUE bls12_381_G2_add #-}
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 Element
a) = Element -> BuiltinBLS12_381_G2_Element
BuiltinBLS12_381_G2_Element (Element -> Element
BLS12_381.G2.neg Element
a)
{-# OPAQUE bls12_381_G2_neg #-}
bls12_381_G2_scalarMul :: BuiltinInteger -> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_scalarMul :: BuiltinInteger
-> BuiltinBLS12_381_G2_Element -> BuiltinBLS12_381_G2_Element
bls12_381_G2_scalarMul BuiltinInteger
n (BuiltinBLS12_381_G2_Element Element
a) = Element -> BuiltinBLS12_381_G2_Element
BuiltinBLS12_381_G2_Element (BuiltinInteger -> Element -> Element
BLS12_381.G2.scalarMul BuiltinInteger
n Element
a)
{-# OPAQUE bls12_381_G2_scalarMul #-}
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 Element
a) = ByteString -> BuiltinByteString
BuiltinByteString (Element -> ByteString
BLS12_381.G2.compress Element
a)
{-# OPAQUE 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 ByteString
b) =
case ByteString -> Either BLSTError Element
BLS12_381.G2.uncompress ByteString
b of
Left BLSTError
err -> [Char] -> BuiltinBLS12_381_G2_Element
forall a. HasCallStack => [Char] -> a
Haskell.error ([Char] -> BuiltinBLS12_381_G2_Element)
-> [Char] -> BuiltinBLS12_381_G2_Element
forall a b. (a -> b) -> a -> b
$ [Char]
"BSL12_381 G2 uncompression error: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ BLSTError -> [Char]
forall a. Show a => a -> [Char]
show BLSTError
err
Right Element
a -> Element -> BuiltinBLS12_381_G2_Element
BuiltinBLS12_381_G2_Element Element
a
{-# OPAQUE 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 ByteString
msg) (BuiltinByteString ByteString
dst) =
case ByteString -> ByteString -> Either BLS12_381_Error Element
BLS12_381.G2.hashToGroup ByteString
msg ByteString
dst of
Left BLS12_381_Error
err -> [Char] -> BuiltinBLS12_381_G2_Element
forall a. HasCallStack => [Char] -> a
Haskell.error ([Char] -> BuiltinBLS12_381_G2_Element)
-> [Char] -> BuiltinBLS12_381_G2_Element
forall a b. (a -> b) -> a -> b
$ BLS12_381_Error -> [Char]
forall a. Show a => a -> [Char]
show BLS12_381_Error
err
Right Element
p -> Element -> BuiltinBLS12_381_G2_Element
BuiltinBLS12_381_G2_Element Element
p
{-# OPAQUE bls12_381_G2_hashToGroup #-}
bls12_381_G2_compressed_zero :: BuiltinByteString
bls12_381_G2_compressed_zero :: BuiltinByteString
bls12_381_G2_compressed_zero = ByteString -> BuiltinByteString
BuiltinByteString ByteString
BLS12_381.G2.compressed_zero
{-# OPAQUE bls12_381_G2_compressed_zero #-}
bls12_381_G2_compressed_generator :: BuiltinByteString
bls12_381_G2_compressed_generator :: BuiltinByteString
bls12_381_G2_compressed_generator = ByteString -> BuiltinByteString
BuiltinByteString ByteString
BLS12_381.G2.compressed_generator
{-# OPAQUE bls12_381_G2_compressed_generator #-}
data BuiltinBLS12_381_MlResult = BuiltinBLS12_381_MlResult ~BLS12_381.Pairing.MlResult
instance Haskell.Show BuiltinBLS12_381_MlResult where
show :: BuiltinBLS12_381_MlResult -> [Char]
show (BuiltinBLS12_381_MlResult MlResult
a) = MlResult -> [Char]
forall a. Show a => a -> [Char]
show MlResult
a
instance Haskell.Eq BuiltinBLS12_381_MlResult where
== :: BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult -> Bool
(==) (BuiltinBLS12_381_MlResult MlResult
a) (BuiltinBLS12_381_MlResult MlResult
b) = MlResult -> MlResult -> Bool
forall a. Eq a => a -> a -> Bool
(==) MlResult
a MlResult
b
instance NFData BuiltinBLS12_381_MlResult where
rnf :: BuiltinBLS12_381_MlResult -> ()
rnf (BuiltinBLS12_381_MlResult MlResult
a) = MlResult -> ()
forall a. NFData a => a -> ()
rnf MlResult
a
instance Pretty BuiltinBLS12_381_MlResult where
pretty :: forall ann. BuiltinBLS12_381_MlResult -> Doc ann
pretty (BuiltinBLS12_381_MlResult MlResult
a) = MlResult -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. MlResult -> Doc ann
pretty MlResult
a
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 Element
a) (BuiltinBLS12_381_G2_Element Element
b) =
MlResult -> BuiltinBLS12_381_MlResult
BuiltinBLS12_381_MlResult (MlResult -> BuiltinBLS12_381_MlResult)
-> MlResult -> BuiltinBLS12_381_MlResult
forall a b. (a -> b) -> a -> b
$ Element -> Element -> MlResult
BLS12_381.Pairing.millerLoop Element
a Element
b
{-# OPAQUE 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 MlResult
a) (BuiltinBLS12_381_MlResult MlResult
b)
= MlResult -> BuiltinBLS12_381_MlResult
BuiltinBLS12_381_MlResult (MlResult -> BuiltinBLS12_381_MlResult)
-> MlResult -> BuiltinBLS12_381_MlResult
forall a b. (a -> b) -> a -> b
$ MlResult -> MlResult -> MlResult
BLS12_381.Pairing.mulMlResult MlResult
a MlResult
b
{-# OPAQUE bls12_381_mulMlResult #-}
bls12_381_finalVerify :: BuiltinBLS12_381_MlResult -> BuiltinBLS12_381_MlResult -> BuiltinBool
bls12_381_finalVerify :: BuiltinBLS12_381_MlResult
-> BuiltinBLS12_381_MlResult -> BuiltinBool
bls12_381_finalVerify (BuiltinBLS12_381_MlResult MlResult
a) (BuiltinBLS12_381_MlResult MlResult
b)
= Bool -> BuiltinBool
BuiltinBool (Bool -> BuiltinBool) -> Bool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ MlResult -> MlResult -> Bool
BLS12_381.Pairing.finalVerify MlResult
a MlResult
b
{-# OPAQUE bls12_381_finalVerify #-}
integerToByteString
:: BuiltinBool
-> BuiltinInteger
-> BuiltinInteger
-> BuiltinByteString
integerToByteString :: BuiltinBool
-> BuiltinInteger -> BuiltinInteger -> BuiltinByteString
integerToByteString (BuiltinBool Bool
endiannessArg) BuiltinInteger
paddingArg BuiltinInteger
input =
case Bool
-> BuiltinInteger -> BuiltinInteger -> BuiltinResult ByteString
Bitwise.integerToByteString Bool
endiannessArg BuiltinInteger
paddingArg BuiltinInteger
input of
BuiltinSuccess ByteString
bs -> ByteString -> BuiltinByteString
BuiltinByteString ByteString
bs
BuiltinSuccessWithLogs DList Text
logs ByteString
bs -> DList Text -> BuiltinByteString -> BuiltinByteString
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinByteString -> BuiltinByteString)
-> BuiltinByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> BuiltinByteString
BuiltinByteString ByteString
bs
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinByteString -> BuiltinByteString
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinByteString -> BuiltinByteString)
-> BuiltinByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinByteString
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"Integer to ByteString conversion errored."
{-# OPAQUE integerToByteString #-}
byteStringToInteger
:: BuiltinBool
-> BuiltinByteString
-> BuiltinInteger
byteStringToInteger :: BuiltinBool -> BuiltinByteString -> BuiltinInteger
byteStringToInteger (BuiltinBool Bool
statedEndianness) (BuiltinByteString ByteString
input) =
Bool -> ByteString -> BuiltinInteger
Bitwise.byteStringToInteger Bool
statedEndianness ByteString
input
{-# OPAQUE byteStringToInteger #-}
shiftByteString ::
BuiltinByteString ->
BuiltinInteger ->
BuiltinByteString
shiftByteString :: BuiltinByteString -> BuiltinInteger -> BuiltinByteString
shiftByteString (BuiltinByteString ByteString
bs) =
ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> (BuiltinInteger -> ByteString)
-> BuiltinInteger
-> BuiltinByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> BuiltinInteger -> ByteString
Bitwise.shiftByteString ByteString
bs
{-# OPAQUE shiftByteString #-}
rotateByteString ::
BuiltinByteString ->
BuiltinInteger ->
BuiltinByteString
rotateByteString :: BuiltinByteString -> BuiltinInteger -> BuiltinByteString
rotateByteString (BuiltinByteString ByteString
bs) =
ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> (BuiltinInteger -> ByteString)
-> BuiltinInteger
-> BuiltinByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> BuiltinInteger -> ByteString
Bitwise.rotateByteString ByteString
bs
{-# OPAQUE rotateByteString #-}
countSetBits ::
BuiltinByteString ->
BuiltinInteger
countSetBits :: BuiltinByteString -> BuiltinInteger
countSetBits (BuiltinByteString ByteString
bs) = Int -> BuiltinInteger
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> BuiltinInteger)
-> (ByteString -> Int) -> ByteString -> BuiltinInteger
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int
Bitwise.countSetBits (ByteString -> BuiltinInteger) -> ByteString -> BuiltinInteger
forall a b. (a -> b) -> a -> b
$ ByteString
bs
{-# OPAQUE countSetBits #-}
findFirstSetBit ::
BuiltinByteString ->
BuiltinInteger
findFirstSetBit :: BuiltinByteString -> BuiltinInteger
findFirstSetBit (BuiltinByteString ByteString
bs) =
Int -> BuiltinInteger
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> BuiltinInteger)
-> (ByteString -> Int) -> ByteString -> BuiltinInteger
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int
Bitwise.findFirstSetBit (ByteString -> BuiltinInteger) -> ByteString -> BuiltinInteger
forall a b. (a -> b) -> a -> b
$ ByteString
bs
{-# OPAQUE findFirstSetBit #-}
andByteString ::
BuiltinBool ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString
andByteString :: BuiltinBool
-> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
andByteString (BuiltinBool Bool
isPaddingSemantics) (BuiltinByteString ByteString
data1) (BuiltinByteString ByteString
data2) =
ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> (ByteString -> ByteString) -> ByteString -> BuiltinByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ByteString -> ByteString -> ByteString
Bitwise.andByteString Bool
isPaddingSemantics ByteString
data1 (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString
data2
{-# OPAQUE andByteString #-}
orByteString ::
BuiltinBool ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString
orByteString :: BuiltinBool
-> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
orByteString (BuiltinBool Bool
isPaddingSemantics) (BuiltinByteString ByteString
data1) (BuiltinByteString ByteString
data2) =
ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> (ByteString -> ByteString) -> ByteString -> BuiltinByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ByteString -> ByteString -> ByteString
Bitwise.orByteString Bool
isPaddingSemantics ByteString
data1 (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString
data2
{-# OPAQUE orByteString #-}
xorByteString ::
BuiltinBool ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString
xorByteString :: BuiltinBool
-> BuiltinByteString -> BuiltinByteString -> BuiltinByteString
xorByteString (BuiltinBool Bool
isPaddingSemantics) (BuiltinByteString ByteString
data1) (BuiltinByteString ByteString
data2) =
ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> (ByteString -> ByteString) -> ByteString -> BuiltinByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> ByteString -> ByteString -> ByteString
Bitwise.xorByteString Bool
isPaddingSemantics ByteString
data1 (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString
data2
{-# OPAQUE xorByteString #-}
complementByteString ::
BuiltinByteString ->
BuiltinByteString
complementByteString :: BuiltinByteString -> BuiltinByteString
complementByteString (BuiltinByteString ByteString
bs) =
ByteString -> BuiltinByteString
BuiltinByteString (ByteString -> BuiltinByteString)
-> (ByteString -> ByteString) -> ByteString -> BuiltinByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
Bitwise.complementByteString (ByteString -> BuiltinByteString)
-> ByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString
bs
{-# OPAQUE complementByteString #-}
readBit ::
BuiltinByteString ->
BuiltinInteger ->
BuiltinBool
readBit :: BuiltinByteString -> BuiltinInteger -> BuiltinBool
readBit (BuiltinByteString ByteString
bs) BuiltinInteger
i =
case ByteString -> Int -> BuiltinResult Bool
Bitwise.readBit ByteString
bs (BuiltinInteger -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
i) of
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinBool
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"readBit errored."
BuiltinSuccess Bool
b -> Bool -> BuiltinBool
BuiltinBool Bool
b
BuiltinSuccessWithLogs DList Text
logs Bool
b -> DList Text -> BuiltinBool -> BuiltinBool
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinBool -> BuiltinBool) -> BuiltinBool -> BuiltinBool
forall a b. (a -> b) -> a -> b
$ Bool -> BuiltinBool
BuiltinBool Bool
b
{-# OPAQUE readBit #-}
writeBits ::
BuiltinByteString ->
BuiltinList BuiltinInteger ->
BuiltinBool ->
BuiltinByteString
writeBits :: BuiltinByteString
-> BuiltinList BuiltinInteger -> BuiltinBool -> BuiltinByteString
writeBits (BuiltinByteString ByteString
bs) (BuiltinList [BuiltinInteger]
ixes) (BuiltinBool Bool
bit) =
case ByteString -> [BuiltinInteger] -> Bool -> BuiltinResult ByteString
Bitwise.writeBits ByteString
bs [BuiltinInteger]
ixes Bool
bit of
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinByteString -> BuiltinByteString
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinByteString -> BuiltinByteString)
-> BuiltinByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinByteString
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"writeBits errored."
BuiltinSuccess ByteString
bs' -> ByteString -> BuiltinByteString
BuiltinByteString ByteString
bs'
BuiltinSuccessWithLogs DList Text
logs ByteString
bs' -> DList Text -> BuiltinByteString -> BuiltinByteString
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinByteString -> BuiltinByteString)
-> BuiltinByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> BuiltinByteString
BuiltinByteString ByteString
bs'
{-# OPAQUE writeBits #-}
replicateByte ::
BuiltinInteger ->
BuiltinInteger ->
BuiltinByteString
replicateByte :: BuiltinInteger -> BuiltinInteger -> BuiltinByteString
replicateByte BuiltinInteger
n BuiltinInteger
w8 =
case BuiltinInteger -> Word8 -> BuiltinResult ByteString
Bitwise.replicateByte BuiltinInteger
n (BuiltinInteger -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
w8) of
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinByteString -> BuiltinByteString
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinByteString -> BuiltinByteString)
-> BuiltinByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinByteString
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"byteStringReplicate errored."
BuiltinSuccess ByteString
bs -> ByteString -> BuiltinByteString
BuiltinByteString ByteString
bs
BuiltinSuccessWithLogs DList Text
logs ByteString
bs -> DList Text -> BuiltinByteString -> BuiltinByteString
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinByteString -> BuiltinByteString)
-> BuiltinByteString -> BuiltinByteString
forall a b. (a -> b) -> a -> b
$ ByteString -> BuiltinByteString
BuiltinByteString ByteString
bs
{-# OPAQUE replicateByte #-}
expModInteger ::
BuiltinInteger ->
BuiltinInteger ->
BuiltinInteger ->
BuiltinInteger
expModInteger :: BuiltinInteger
-> BuiltinInteger -> BuiltinInteger -> BuiltinInteger
expModInteger BuiltinInteger
b BuiltinInteger
e BuiltinInteger
m =
case BuiltinInteger
-> BuiltinInteger -> Natural -> BuiltinResult Natural
ExpMod.expMod BuiltinInteger
b BuiltinInteger
e (BuiltinInteger -> Natural
forall a. Num a => BuiltinInteger -> a
fromInteger BuiltinInteger
m) of
BuiltinFailure DList Text
logs BuiltinError
err -> DList Text -> BuiltinInteger -> BuiltinInteger
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll (DList Text
logs DList Text -> DList Text -> DList Text
forall a. Semigroup a => a -> a -> a
<> Text -> DList Text
forall a. a -> DList a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BuiltinError -> Text
forall str a. (Pretty a, Render str) => a -> str
display BuiltinError
err)) (BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger
forall a b. (a -> b) -> a -> b
$
[Char] -> BuiltinInteger
forall a. HasCallStack => [Char] -> a
Haskell.error [Char]
"expModInteger errored."
BuiltinSuccess Natural
bs -> Natural -> BuiltinInteger
forall a. Integral a => a -> BuiltinInteger
toInteger Natural
bs
BuiltinSuccessWithLogs DList Text
logs Natural
bs -> DList Text -> BuiltinInteger -> BuiltinInteger
forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs (BuiltinInteger -> BuiltinInteger)
-> BuiltinInteger -> BuiltinInteger
forall a b. (a -> b) -> a -> b
$ Natural -> BuiltinInteger
forall a. Integral a => a -> BuiltinInteger
toInteger Natural
bs
{-# OPAQUE expModInteger #-}