{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -O0 #-}
module PlutusTx.Builtins.Internal where
import Codec.Serialise
import Control.DeepSeq (NFData (..))
import Control.Monad.Trans.Writer.Strict (runWriter)
import Crypto qualified
import Data.ByteArray qualified as BA
import Data.ByteString as BS
import Data.ByteString.Hash qualified as Hash
import Data.ByteString.Lazy as BS (toStrict)
import Data.Coerce (coerce)
import 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 PlutusCore.Builtin.Emitter (Emitter (Emitter))
import PlutusCore.Data qualified as PLC
import PlutusCore.Evaluation.Result (EvaluationResult (EvaluationFailure, EvaluationSuccess))
import PlutusCore.Pretty (Pretty (..))
import PlutusTx.Utils (mustBeReplaced)
import Prettyprinter (viaShow)
import Prelude as Haskell
{-# NOINLINE error #-}
error :: BuiltinUnit -> a
error :: forall a. BuiltinUnit -> a
error = forall a. String -> a
mustBeReplaced String
"error"
data BuiltinBool = BuiltinBool Bool deriving stock Typeable BuiltinBool
BuiltinBool -> DataType
BuiltinBool -> Constr
(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)
gmapMo :: 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
gmapMp :: forall (m :: * -> *).
MonadPlus 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
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinBool -> m BuiltinBool
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinBool -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinBool -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinBool -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinBool -> [u]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinBool -> r
gmapT :: (forall b. Data b => b -> b) -> BuiltinBool -> BuiltinBool
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinBool -> BuiltinBool
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinBool)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinBool)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinBool)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinBool)
dataTypeOf :: BuiltinBool -> DataType
$cdataTypeOf :: BuiltinBool -> DataType
toConstr :: BuiltinBool -> Constr
$ctoConstr :: BuiltinBool -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinBool
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinBool
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinBool -> c BuiltinBool
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinBool -> c BuiltinBool
Data
{-# NOINLINE true #-}
true :: BuiltinBool
true :: BuiltinBool
true = Bool -> BuiltinBool
BuiltinBool Bool
True
{-# NOINLINE false #-}
false :: BuiltinBool
false :: BuiltinBool
false = Bool -> BuiltinBool
BuiltinBool Bool
False
{-# NOINLINE ifThenElse #-}
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
data BuiltinUnit = BuiltinUnit () deriving stock Typeable BuiltinUnit
BuiltinUnit -> DataType
BuiltinUnit -> Constr
(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)
gmapMo :: 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
gmapMp :: forall (m :: * -> *).
MonadPlus 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
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinUnit -> m BuiltinUnit
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinUnit -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinUnit -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinUnit -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinUnit -> [u]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinUnit -> r
gmapT :: (forall b. Data b => b -> b) -> BuiltinUnit -> BuiltinUnit
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinUnit -> BuiltinUnit
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinUnit)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinUnit)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinUnit)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinUnit)
dataTypeOf :: BuiltinUnit -> DataType
$cdataTypeOf :: BuiltinUnit -> DataType
toConstr :: BuiltinUnit -> Constr
$ctoConstr :: BuiltinUnit -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinUnit
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinUnit
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinUnit -> c BuiltinUnit
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinUnit -> c BuiltinUnit
Data
{-# NOINLINE unitval #-}
unitval :: BuiltinUnit
unitval :: BuiltinUnit
unitval = () -> BuiltinUnit
BuiltinUnit ()
{-# NOINLINE chooseUnit #-}
chooseUnit :: BuiltinUnit -> a -> a
chooseUnit :: forall a. BuiltinUnit -> a -> a
chooseUnit (BuiltinUnit ()) a
a = a
a
type BuiltinInteger = Integer
{-# NOINLINE addInteger #-}
addInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
addInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
addInteger = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Num a => a -> a -> a
(+) @Integer)
{-# NOINLINE subtractInteger #-}
subtractInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
subtractInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
subtractInteger = coerce :: forall a b. Coercible a b => a -> b
coerce ((-) @Integer)
{-# NOINLINE multiplyInteger #-}
multiplyInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
multiplyInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
multiplyInteger = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Num a => a -> a -> a
(*) @Integer)
{-# NOINLINE divideInteger #-}
divideInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
divideInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
divideInteger = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
div @Integer)
{-# NOINLINE modInteger #-}
modInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
modInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
modInteger = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
mod @Integer)
{-# NOINLINE quotientInteger #-}
quotientInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
quotientInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
quotientInteger = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
quot @Integer)
{-# NOINLINE remainderInteger #-}
remainderInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
remainderInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinInteger
remainderInteger = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Integral a => a -> a -> a
rem @Integer)
{-# NOINLINE lessThanInteger #-}
lessThanInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanInteger BuiltinInteger
x BuiltinInteger
y = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Ord a => a -> a -> Bool
(<) @Integer) BuiltinInteger
x BuiltinInteger
y
{-# NOINLINE lessThanEqualsInteger #-}
lessThanEqualsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanEqualsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
lessThanEqualsInteger BuiltinInteger
x BuiltinInteger
y = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Ord a => a -> a -> Bool
(<=) @Integer) BuiltinInteger
x BuiltinInteger
y
{-# NOINLINE equalsInteger #-}
equalsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
equalsInteger :: BuiltinInteger -> BuiltinInteger -> BuiltinBool
equalsInteger BuiltinInteger
x BuiltinInteger
y = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Eq a => a -> a -> Bool
(==) @Integer) BuiltinInteger
x BuiltinInteger
y
data BuiltinByteString = BuiltinByteString ByteString deriving stock Typeable BuiltinByteString
BuiltinByteString -> DataType
BuiltinByteString -> Constr
(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)
gmapMo :: 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
gmapMp :: forall (m :: * -> *).
MonadPlus 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
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinByteString -> m BuiltinByteString
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinByteString -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BuiltinByteString -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinByteString -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinByteString -> [u]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinByteString -> r
gmapT :: (forall b. Data b => b -> b)
-> BuiltinByteString -> BuiltinByteString
$cgmapT :: (forall b. Data b => b -> b)
-> BuiltinByteString -> BuiltinByteString
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinByteString)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinByteString)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinByteString)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinByteString)
dataTypeOf :: BuiltinByteString -> DataType
$cdataTypeOf :: BuiltinByteString -> DataType
toConstr :: BuiltinByteString -> Constr
$ctoConstr :: BuiltinByteString -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinByteString
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinByteString
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinByteString -> c BuiltinByteString
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinByteString -> c BuiltinByteString
Data
instance Haskell.Show BuiltinByteString where
show :: BuiltinByteString -> String
show (BuiltinByteString ByteString
bs) = forall a. Show a => a -> String
show ByteString
bs
instance Haskell.Eq BuiltinByteString where
== :: BuiltinByteString -> BuiltinByteString -> Bool
(==) (BuiltinByteString ByteString
bs) (BuiltinByteString ByteString
bs') = 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') = 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 forall a b. (a -> b) -> a -> b
$ forall a. Semigroup a => a -> a -> a
(<>) ByteString
bs ByteString
bs'
instance Haskell.Monoid BuiltinByteString where
mempty :: BuiltinByteString
mempty = ByteString -> BuiltinByteString
BuiltinByteString forall a. Monoid a => a
mempty
instance Hashable BuiltinByteString where
hashWithSalt :: Int -> BuiltinByteString -> Int
hashWithSalt Int
s (BuiltinByteString ByteString
bs )= forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s ByteString
bs
instance Serialise BuiltinByteString where
encode :: BuiltinByteString -> Encoding
encode (BuiltinByteString ByteString
bs) = forall a. Serialise a => a -> Encoding
encode ByteString
bs
decode :: forall s. Decoder s BuiltinByteString
decode = ByteString -> BuiltinByteString
BuiltinByteString forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a s. Serialise a => Decoder s a
decode
instance NFData BuiltinByteString where
rnf :: BuiltinByteString -> ()
rnf (BuiltinByteString ByteString
bs) = forall a. NFData a => a -> ()
rnf ByteString
bs
instance BA.ByteArrayAccess BuiltinByteString where
length :: BuiltinByteString -> Int
length (BuiltinByteString ByteString
bs) = 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) = forall ba p a. ByteArrayAccess ba => ba -> (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 = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> BuiltinByteString
BuiltinByteString) forall a b. (a -> b) -> a -> b
$ forall ba p a. ByteArray ba => Int -> (Ptr p -> IO a) -> IO (a, ba)
BA.allocRet Int
i Ptr p -> IO a
p
instance Pretty BuiltinByteString where
pretty :: forall ann. BuiltinByteString -> Doc ann
pretty = forall a ann. Show a => a -> Doc ann
viaShow
{-# NOINLINE appendByteString #-}
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString
appendByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString -> ByteString
BS.append ByteString
b1 ByteString
b2
{-# NOINLINE consByteString #-}
consByteString :: BuiltinInteger -> BuiltinByteString -> BuiltinByteString
consByteString :: BuiltinInteger -> BuiltinByteString -> BuiltinByteString
consByteString BuiltinInteger
n (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString -> ByteString
BS.cons (forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
n) ByteString
b
{-# NOINLINE sliceByteString #-}
sliceByteString :: BuiltinInteger -> BuiltinInteger -> BuiltinByteString -> BuiltinByteString
sliceByteString :: BuiltinInteger
-> BuiltinInteger -> BuiltinByteString -> BuiltinByteString
sliceByteString BuiltinInteger
start BuiltinInteger
n (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ Int -> ByteString -> ByteString
BS.take (forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
n) (Int -> ByteString -> ByteString
BS.drop (forall a b. (Integral a, Num b) => a -> b
fromIntegral BuiltinInteger
start) ByteString
b)
{-# NOINLINE lengthOfByteString #-}
lengthOfByteString :: BuiltinByteString -> BuiltinInteger
lengthOfByteString :: BuiltinByteString -> BuiltinInteger
lengthOfByteString (BuiltinByteString ByteString
b) = forall a. Integral a => a -> BuiltinInteger
toInteger forall a b. (a -> b) -> a -> b
$ ByteString -> Int
BS.length ByteString
b
{-# NOINLINE indexByteString #-}
indexByteString :: BuiltinByteString -> BuiltinInteger -> BuiltinInteger
indexByteString :: BuiltinByteString -> BuiltinInteger -> BuiltinInteger
indexByteString (BuiltinByteString ByteString
b) BuiltinInteger
i = forall a. Integral a => a -> BuiltinInteger
toInteger forall a b. (a -> b) -> a -> b
$ HasCallStack => ByteString -> Int -> Word8
BS.index ByteString
b (forall a. Num a => BuiltinInteger -> a
fromInteger BuiltinInteger
i)
{-# NOINLINE emptyByteString #-}
emptyByteString :: BuiltinByteString
emptyByteString :: BuiltinByteString
emptyByteString = ByteString -> BuiltinByteString
BuiltinByteString ByteString
BS.empty
{-# NOINLINE sha2_256 #-}
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 :: BuiltinByteString -> BuiltinByteString
sha2_256 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.sha2_256 ByteString
b
{-# NOINLINE sha3_256 #-}
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 :: BuiltinByteString -> BuiltinByteString
sha3_256 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.sha3_256 ByteString
b
{-# NOINLINE blake2b_256 #-}
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 :: BuiltinByteString -> BuiltinByteString
blake2b_256 (BuiltinByteString ByteString
b) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
Hash.blake2b_256 ByteString
b
{-# NOINLINE verifyEd25519Signature #-}
verifyEd25519Signature :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifyEd25519Signature :: BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifyEd25519Signature (BuiltinByteString ByteString
vk) (BuiltinByteString ByteString
msg) (BuiltinByteString ByteString
sig) =
case ByteString
-> ByteString -> ByteString -> Emitter (EvaluationResult Bool)
Crypto.verifyEd25519Signature_V1 ByteString
vk ByteString
msg ByteString
sig of
Emitter Writer (DList Text) (EvaluationResult Bool)
f -> case forall w a. Writer w a -> (a, w)
runWriter Writer (DList Text) (EvaluationResult Bool)
f of
(EvaluationResult Bool
res, DList Text
logs) -> forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs forall a b. (a -> b) -> a -> b
$ case EvaluationResult Bool
res of
EvaluationResult Bool
EvaluationFailure -> forall a. String -> a
mustBeReplaced String
"ECDSA SECP256k1 signature verification errored."
EvaluationSuccess Bool
b -> Bool -> BuiltinBool
BuiltinBool Bool
b
{-# NOINLINE verifyEcdsaSecp256k1Signature #-}
verifyEcdsaSecp256k1Signature ::
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinBool
verifyEcdsaSecp256k1Signature :: BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifyEcdsaSecp256k1Signature (BuiltinByteString ByteString
vk) (BuiltinByteString ByteString
msg) (BuiltinByteString ByteString
sig) =
case ByteString
-> ByteString -> ByteString -> Emitter (EvaluationResult Bool)
Crypto.verifyEcdsaSecp256k1Signature ByteString
vk ByteString
msg ByteString
sig of
Emitter Writer (DList Text) (EvaluationResult Bool)
f -> case forall w a. Writer w a -> (a, w)
runWriter Writer (DList Text) (EvaluationResult Bool)
f of
(EvaluationResult Bool
res, DList Text
logs) -> forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs forall a b. (a -> b) -> a -> b
$ case EvaluationResult Bool
res of
EvaluationResult Bool
EvaluationFailure -> forall a. String -> a
mustBeReplaced String
"ECDSA SECP256k1 signature verification errored."
EvaluationSuccess Bool
b -> Bool -> BuiltinBool
BuiltinBool Bool
b
{-# NOINLINE verifySchnorrSecp256k1Signature #-}
verifySchnorrSecp256k1Signature ::
BuiltinByteString ->
BuiltinByteString ->
BuiltinByteString ->
BuiltinBool
verifySchnorrSecp256k1Signature :: BuiltinByteString
-> BuiltinByteString -> BuiltinByteString -> BuiltinBool
verifySchnorrSecp256k1Signature (BuiltinByteString ByteString
vk) (BuiltinByteString ByteString
msg) (BuiltinByteString ByteString
sig) =
case ByteString
-> ByteString -> ByteString -> Emitter (EvaluationResult Bool)
Crypto.verifySchnorrSecp256k1Signature ByteString
vk ByteString
msg ByteString
sig of
Emitter Writer (DList Text) (EvaluationResult Bool)
f -> case forall w a. Writer w a -> (a, w)
runWriter Writer (DList Text) (EvaluationResult Bool)
f of
(EvaluationResult Bool
res, DList Text
logs) -> forall a (f :: * -> *). Foldable f => f Text -> a -> a
traceAll DList Text
logs forall a b. (a -> b) -> a -> b
$ case EvaluationResult Bool
res of
EvaluationResult Bool
EvaluationFailure -> forall a. String -> a
mustBeReplaced String
"Schnorr SECP256k1 signature verification errored."
EvaluationSuccess Bool
b -> Bool -> BuiltinBool
BuiltinBool Bool
b
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 = forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
Foldable.foldl' (\a
acc Text
t -> forall a. BuiltinString -> a -> a
trace (Text -> BuiltinString
BuiltinString Text
t) a
acc) a
x f Text
logs
{-# NOINLINE equalsByteString #-}
equalsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
equalsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
equalsByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ ByteString
b1 forall a. Eq a => a -> a -> Bool
== ByteString
b2
{-# NOINLINE lessThanByteString #-}
lessThanByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ ByteString
b1 forall a. Ord a => a -> a -> Bool
< ByteString
b2
{-# NOINLINE lessThanEqualsByteString #-}
lessThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanEqualsByteString :: BuiltinByteString -> BuiltinByteString -> BuiltinBool
lessThanEqualsByteString (BuiltinByteString ByteString
b1) (BuiltinByteString ByteString
b2) = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ ByteString
b1 forall a. Ord a => a -> a -> Bool
<= ByteString
b2
{-# NOINLINE decodeUtf8 #-}
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 :: BuiltinByteString -> BuiltinString
decodeUtf8 (BuiltinByteString ByteString
b) = Text -> BuiltinString
BuiltinString forall a b. (a -> b) -> a -> b
$ ByteString -> Text
Text.decodeUtf8 ByteString
b
data BuiltinString = BuiltinString Text deriving stock Typeable BuiltinString
BuiltinString -> DataType
BuiltinString -> Constr
(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)
gmapMo :: 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
gmapMp :: forall (m :: * -> *).
MonadPlus 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
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinString -> m BuiltinString
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinString -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinString -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinString -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinString -> [u]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinString -> r
gmapT :: (forall b. Data b => b -> b) -> BuiltinString -> BuiltinString
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinString -> BuiltinString
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinString)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinString)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinString)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinString)
dataTypeOf :: BuiltinString -> DataType
$cdataTypeOf :: BuiltinString -> DataType
toConstr :: BuiltinString -> Constr
$ctoConstr :: BuiltinString -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinString
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinString
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinString -> c BuiltinString
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinString -> c BuiltinString
Data
instance Haskell.Show BuiltinString where
show :: BuiltinString -> String
show (BuiltinString Text
t) = forall a. Show a => a -> String
show Text
t
instance Haskell.Eq BuiltinString where
== :: BuiltinString -> BuiltinString -> Bool
(==) (BuiltinString Text
t) (BuiltinString Text
t') = 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') = forall a. Ord a => a -> a -> Ordering
compare Text
t Text
t'
{-# NOINLINE appendString #-}
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString :: BuiltinString -> BuiltinString -> BuiltinString
appendString (BuiltinString Text
s1) (BuiltinString Text
s2) = Text -> BuiltinString
BuiltinString (Text
s1 forall a. Semigroup a => a -> a -> a
<> Text
s2)
{-# NOINLINE emptyString #-}
emptyString :: BuiltinString
emptyString :: BuiltinString
emptyString = Text -> BuiltinString
BuiltinString Text
Text.empty
{-# NOINLINE equalsString #-}
equalsString :: BuiltinString -> BuiltinString -> BuiltinBool
equalsString :: BuiltinString -> BuiltinString -> BuiltinBool
equalsString (BuiltinString Text
s1) (BuiltinString Text
s2) = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ Text
s1 forall a. Eq a => a -> a -> Bool
== Text
s2
{-# NOINLINE trace #-}
trace :: BuiltinString -> a -> a
trace :: forall a. BuiltinString -> a -> a
trace BuiltinString
_ a
x = a
x
{-# NOINLINE encodeUtf8 #-}
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 :: BuiltinString -> BuiltinByteString
encodeUtf8 (BuiltinString Text
s) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ Text -> ByteString
Text.encodeUtf8 Text
s
data BuiltinPair a b = BuiltinPair (a, b) deriving stock BuiltinPair a b -> DataType
BuiltinPair a b -> Constr
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 {a} {b}. (Data a, Data b) => Typeable (BuiltinPair a b)
forall a b. (Data a, Data b) => BuiltinPair a b -> DataType
forall a b. (Data a, Data b) => BuiltinPair a b -> Constr
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 (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 e. (Data d, Data e) => c (t d e))
-> Maybe (c (BuiltinPair a b))
gmapMo :: 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)
gmapMp :: forall (m :: * -> *).
MonadPlus 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)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinPair a b -> m (BuiltinPair a b)
$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)
gmapQi :: forall u.
Int -> (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
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinPair a b -> [u]
$cgmapQ :: forall a b u.
(Data a, Data b) =>
(forall d. Data d => d -> u) -> BuiltinPair a b -> [u]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
$cgmapQl :: forall a b r r'.
(Data a, Data b) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinPair a b -> r
gmapT :: (forall b. Data b => b -> b) -> BuiltinPair a b -> BuiltinPair a b
$cgmapT :: forall a b.
(Data a, Data b) =>
(forall b. Data b => b -> b) -> BuiltinPair a b -> 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))
$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))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinPair a b))
$cdataCast1 :: forall a b (t :: * -> *) (c :: * -> *).
(Data a, Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinPair a b))
dataTypeOf :: BuiltinPair a b -> DataType
$cdataTypeOf :: forall a b. (Data a, Data b) => BuiltinPair a b -> DataType
toConstr :: BuiltinPair a b -> Constr
$ctoConstr :: forall a b. (Data a, Data b) => BuiltinPair a b -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> 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)
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)
$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)
Data
instance (Haskell.Show a, Haskell.Show b) => Haskell.Show (BuiltinPair a b) where
show :: BuiltinPair a b -> String
show (BuiltinPair (a, b)
p) = forall a. Show a => a -> String
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') = 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') = forall a. Ord a => a -> a -> Ordering
compare (a, b)
p (a, b)
p'
{-# NOINLINE fst #-}
fst :: BuiltinPair a b -> a
fst :: forall a b. BuiltinPair a b -> a
fst (BuiltinPair (a
a, b
_)) = a
a
{-# NOINLINE snd #-}
snd :: BuiltinPair a b -> b
snd :: forall a b. BuiltinPair a b -> b
snd (BuiltinPair (a
_, b
b)) = b
b
{-# NOINLINE mkPairData #-}
mkPairData :: BuiltinData -> BuiltinData -> BuiltinPair BuiltinData BuiltinData
mkPairData :: BuiltinData -> BuiltinData -> BuiltinPair BuiltinData BuiltinData
mkPairData BuiltinData
d1 BuiltinData
d2 = forall a b. (a, b) -> BuiltinPair a b
BuiltinPair (BuiltinData
d1, BuiltinData
d2)
data BuiltinList a = BuiltinList [a] deriving stock BuiltinList a -> DataType
BuiltinList a -> Constr
forall {a}. Data a => Typeable (BuiltinList a)
forall a. Data a => BuiltinList a -> DataType
forall a. Data a => BuiltinList a -> Constr
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 (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))
gmapMo :: 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)
gmapMp :: forall (m :: * -> *).
MonadPlus 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)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> BuiltinList a -> m (BuiltinList a)
gmapQi :: forall u. Int -> (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
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinList a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> BuiltinList a -> [u]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinList a -> r
gmapT :: (forall b. Data b => b -> b) -> BuiltinList a -> BuiltinList a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> BuiltinList a -> BuiltinList a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> 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))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinList a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BuiltinList a))
dataTypeOf :: BuiltinList a -> DataType
$cdataTypeOf :: forall a. Data a => BuiltinList a -> DataType
toConstr :: BuiltinList a -> Constr
$ctoConstr :: forall a. Data a => BuiltinList a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> 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)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinList a -> 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)
Data
instance Haskell.Show a => Haskell.Show (BuiltinList a) where
show :: BuiltinList a -> String
show (BuiltinList [a]
l) = forall a. Show a => a -> String
show [a]
l
instance Haskell.Eq a => Haskell.Eq (BuiltinList a) where
== :: BuiltinList a -> BuiltinList a -> Bool
(==) (BuiltinList [a]
l) (BuiltinList [a]
l') = 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') = forall a. Ord a => a -> a -> Ordering
compare [a]
l [a]
l'
{-# NOINLINE null #-}
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
{-# NOINLINE head #-}
head :: BuiltinList a -> a
head :: forall a. BuiltinList a -> a
head (BuiltinList (a
x:[a]
_)) = a
x
head (BuiltinList []) = forall a. HasCallStack => String -> a
Haskell.error String
"empty list"
{-# NOINLINE tail #-}
tail :: BuiltinList a -> BuiltinList a
tail :: forall a. BuiltinList a -> BuiltinList a
tail (BuiltinList (a
_:[a]
xs)) = forall a. [a] -> BuiltinList a
BuiltinList [a]
xs
tail (BuiltinList []) = forall a. HasCallStack => String -> a
Haskell.error String
"empty list"
{-# NOINLINE chooseList #-}
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
{-# NOINLINE mkNilData #-}
mkNilData :: BuiltinUnit -> BuiltinList BuiltinData
mkNilData :: BuiltinUnit -> BuiltinList BuiltinData
mkNilData BuiltinUnit
_ = forall a. [a] -> BuiltinList a
BuiltinList []
{-# NOINLINE mkNilPairData #-}
mkNilPairData :: BuiltinUnit -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
mkNilPairData :: BuiltinUnit -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
mkNilPairData BuiltinUnit
_ = forall a. [a] -> BuiltinList a
BuiltinList []
{-# NOINLINE mkCons #-}
mkCons :: a -> BuiltinList a -> BuiltinList a
mkCons :: forall a. a -> BuiltinList a -> BuiltinList a
mkCons a
a (BuiltinList [a]
as) = forall a. [a] -> BuiltinList a
BuiltinList (a
aforall a. a -> [a] -> [a]
:[a]
as)
data BuiltinData = BuiltinData PLC.Data deriving stock Typeable BuiltinData
BuiltinData -> DataType
BuiltinData -> Constr
(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)
gmapMo :: 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
gmapMp :: forall (m :: * -> *).
MonadPlus 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
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinData -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinData -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinData -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinData -> [u]
gmapQr :: 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
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinData -> r
gmapT :: (forall b. Data b => b -> b) -> BuiltinData -> BuiltinData
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinData -> BuiltinData
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinData)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinData)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinData)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinData)
dataTypeOf :: BuiltinData -> DataType
$cdataTypeOf :: BuiltinData -> DataType
toConstr :: BuiltinData -> Constr
$ctoConstr :: BuiltinData -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinData
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinData
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinData -> c BuiltinData
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinData -> c BuiltinData
Data
instance Haskell.Show BuiltinData where
show :: BuiltinData -> String
show (BuiltinData Data
d) = forall a. Show a => a -> String
show Data
d
instance Haskell.Eq BuiltinData where
== :: BuiltinData -> BuiltinData -> Bool
(==) (BuiltinData Data
d) (BuiltinData Data
d') = 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') = forall a. Ord a => a -> a -> Ordering
compare Data
d Data
d'
instance NFData BuiltinData where
rnf :: BuiltinData -> ()
rnf (BuiltinData Data
d) = forall a. NFData a => a -> ()
rnf Data
d
instance Pretty BuiltinData where
pretty :: forall ann. BuiltinData -> Doc ann
pretty (BuiltinData Data
d) = forall a ann. Pretty a => a -> Doc ann
pretty Data
d
{-# NOINLINE builtinDataToData #-}
builtinDataToData :: BuiltinData -> PLC.Data
builtinDataToData :: BuiltinData -> Data
builtinDataToData (BuiltinData Data
d) = Data
d
{-# NOINLINE dataToBuiltinData #-}
dataToBuiltinData :: PLC.Data -> BuiltinData
dataToBuiltinData :: Data -> BuiltinData
dataToBuiltinData = Data -> BuiltinData
BuiltinData
{-# NOINLINE chooseData #-}
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
{-# NOINLINE mkConstr #-}
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 (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BuiltinData -> Data
builtinDataToData [BuiltinData]
args))
{-# NOINLINE mkMap #-}
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 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')
{-# NOINLINE mkList #-}
mkList :: BuiltinList BuiltinData -> BuiltinData
mkList :: BuiltinList BuiltinData -> BuiltinData
mkList (BuiltinList [BuiltinData]
l) = Data -> BuiltinData
BuiltinData ([Data] -> Data
PLC.List (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BuiltinData -> Data
builtinDataToData [BuiltinData]
l))
{-# NOINLINE mkI #-}
mkI :: BuiltinInteger -> BuiltinData
mkI :: BuiltinInteger -> BuiltinData
mkI BuiltinInteger
i = Data -> BuiltinData
BuiltinData (BuiltinInteger -> Data
PLC.I BuiltinInteger
i)
{-# NOINLINE mkB #-}
mkB :: BuiltinByteString -> BuiltinData
mkB :: BuiltinByteString -> BuiltinData
mkB (BuiltinByteString ByteString
b) = Data -> BuiltinData
BuiltinData (ByteString -> Data
PLC.B ByteString
b)
{-# NOINLINE unsafeDataAsConstr #-}
unsafeDataAsConstr :: BuiltinData -> BuiltinPair BuiltinInteger (BuiltinList BuiltinData)
unsafeDataAsConstr :: BuiltinData -> BuiltinPair BuiltinInteger (BuiltinList BuiltinData)
unsafeDataAsConstr (BuiltinData (PLC.Constr BuiltinInteger
i [Data]
args)) = forall a b. (a, b) -> BuiltinPair a b
BuiltinPair (BuiltinInteger
i, forall a. [a] -> BuiltinList a
BuiltinList 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
_ = forall a. HasCallStack => String -> a
Haskell.error String
"not a Constr"
{-# NOINLINE unsafeDataAsMap #-}
unsafeDataAsMap :: BuiltinData -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
unsafeDataAsMap :: BuiltinData -> BuiltinList (BuiltinPair BuiltinData BuiltinData)
unsafeDataAsMap (BuiltinData (PLC.Map [(Data, Data)]
m)) = forall a. [a] -> BuiltinList a
BuiltinList (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') = forall a b. (a, b) -> BuiltinPair a b
BuiltinPair (Data -> BuiltinData
dataToBuiltinData Data
d, Data -> BuiltinData
dataToBuiltinData Data
d')
unsafeDataAsMap BuiltinData
_ = forall a. HasCallStack => String -> a
Haskell.error String
"not a Map"
{-# NOINLINE unsafeDataAsList #-}
unsafeDataAsList :: BuiltinData -> BuiltinList BuiltinData
unsafeDataAsList :: BuiltinData -> BuiltinList BuiltinData
unsafeDataAsList (BuiltinData (PLC.List [Data]
l)) = forall a. [a] -> BuiltinList a
BuiltinList (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Data -> BuiltinData
dataToBuiltinData [Data]
l)
unsafeDataAsList BuiltinData
_ = forall a. HasCallStack => String -> a
Haskell.error String
"not a List"
{-# NOINLINE unsafeDataAsI #-}
unsafeDataAsI :: BuiltinData -> BuiltinInteger
unsafeDataAsI :: BuiltinData -> BuiltinInteger
unsafeDataAsI (BuiltinData (PLC.I BuiltinInteger
i)) = BuiltinInteger
i
unsafeDataAsI BuiltinData
_ = forall a. HasCallStack => String -> a
Haskell.error String
"not an I"
{-# NOINLINE unsafeDataAsB #-}
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB :: BuiltinData -> BuiltinByteString
unsafeDataAsB (BuiltinData (PLC.B ByteString
b)) = ByteString -> BuiltinByteString
BuiltinByteString ByteString
b
unsafeDataAsB BuiltinData
_ = forall a. HasCallStack => String -> a
Haskell.error String
"not a B"
{-# NOINLINE equalsData #-}
equalsData :: BuiltinData -> BuiltinData -> BuiltinBool
equalsData :: BuiltinData -> BuiltinData -> BuiltinBool
equalsData (BuiltinData Data
b1) (BuiltinData Data
b2) = Bool -> BuiltinBool
BuiltinBool forall a b. (a -> b) -> a -> b
$ Data
b1 forall a. Eq a => a -> a -> Bool
Haskell.== Data
b2
{-# NOINLINE serialiseData #-}
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData :: BuiltinData -> BuiltinByteString
serialiseData (BuiltinData Data
b) = ByteString -> BuiltinByteString
BuiltinByteString forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
BS.toStrict forall a b. (a -> b) -> a -> b
$ forall a. Serialise a => a -> ByteString
serialise Data
b