{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module PlutusCore.Default.Builtins where
import PlutusPrelude
import PlutusCore.Builtin
import PlutusCore.Data
import PlutusCore.Default.Universe
import PlutusCore.Evaluation.Machine.BuiltinCostModel
import PlutusCore.Evaluation.Machine.ExMemory
import PlutusCore.Evaluation.Result
import PlutusCore.Pretty
import Codec.Serialise (serialise)
import Crypto (verifyEcdsaSecp256k1Signature, verifyEd25519Signature, verifySchnorrSecp256k1Signature)
import Data.ByteString qualified as BS
import Data.ByteString.Hash qualified as Hash
import Data.ByteString.Lazy qualified as BS (toStrict)
import Data.Char
import Data.Ix
import Data.Text (Text)
import Data.Text.Encoding (decodeUtf8', encodeUtf8)
import Flat hiding (from, to)
import Flat.Decoder
import Flat.Encoder as Flat
data DefaultFun
= AddInteger
| SubtractInteger
| MultiplyInteger
| DivideInteger
| QuotientInteger
| RemainderInteger
| ModInteger
| EqualsInteger
| LessThanInteger
| LessThanEqualsInteger
| AppendByteString
| ConsByteString
| SliceByteString
| LengthOfByteString
| IndexByteString
| EqualsByteString
| LessThanByteString
| LessThanEqualsByteString
| Sha2_256
| Sha3_256
| Blake2b_256
| VerifyEd25519Signature
| VerifyEcdsaSecp256k1Signature
| VerifySchnorrSecp256k1Signature
| AppendString
| EqualsString
| EncodeUtf8
| DecodeUtf8
| IfThenElse
| ChooseUnit
| Trace
| FstPair
| SndPair
| ChooseList
| MkCons
| HeadList
| TailList
| NullList
| ChooseData
| ConstrData
| MapData
| ListData
| IData
| BData
| UnConstrData
| UnMapData
| UnListData
| UnIData
| UnBData
| EqualsData
| SerialiseData
| MkPairData
| MkNilData
| MkNilPairData
deriving stock (Int -> DefaultFun -> ShowS
[DefaultFun] -> ShowS
DefaultFun -> String
(Int -> DefaultFun -> ShowS)
-> (DefaultFun -> String)
-> ([DefaultFun] -> ShowS)
-> Show DefaultFun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultFun] -> ShowS
$cshowList :: [DefaultFun] -> ShowS
show :: DefaultFun -> String
$cshow :: DefaultFun -> String
showsPrec :: Int -> DefaultFun -> ShowS
$cshowsPrec :: Int -> DefaultFun -> ShowS
Show, DefaultFun -> DefaultFun -> Bool
(DefaultFun -> DefaultFun -> Bool)
-> (DefaultFun -> DefaultFun -> Bool) -> Eq DefaultFun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultFun -> DefaultFun -> Bool
$c/= :: DefaultFun -> DefaultFun -> Bool
== :: DefaultFun -> DefaultFun -> Bool
$c== :: DefaultFun -> DefaultFun -> Bool
Eq, Eq DefaultFun
Eq DefaultFun
-> (DefaultFun -> DefaultFun -> Ordering)
-> (DefaultFun -> DefaultFun -> Bool)
-> (DefaultFun -> DefaultFun -> Bool)
-> (DefaultFun -> DefaultFun -> Bool)
-> (DefaultFun -> DefaultFun -> Bool)
-> (DefaultFun -> DefaultFun -> DefaultFun)
-> (DefaultFun -> DefaultFun -> DefaultFun)
-> Ord DefaultFun
DefaultFun -> DefaultFun -> Bool
DefaultFun -> DefaultFun -> Ordering
DefaultFun -> DefaultFun -> DefaultFun
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DefaultFun -> DefaultFun -> DefaultFun
$cmin :: DefaultFun -> DefaultFun -> DefaultFun
max :: DefaultFun -> DefaultFun -> DefaultFun
$cmax :: DefaultFun -> DefaultFun -> DefaultFun
>= :: DefaultFun -> DefaultFun -> Bool
$c>= :: DefaultFun -> DefaultFun -> Bool
> :: DefaultFun -> DefaultFun -> Bool
$c> :: DefaultFun -> DefaultFun -> Bool
<= :: DefaultFun -> DefaultFun -> Bool
$c<= :: DefaultFun -> DefaultFun -> Bool
< :: DefaultFun -> DefaultFun -> Bool
$c< :: DefaultFun -> DefaultFun -> Bool
compare :: DefaultFun -> DefaultFun -> Ordering
$ccompare :: DefaultFun -> DefaultFun -> Ordering
$cp1Ord :: Eq DefaultFun
Ord, Int -> DefaultFun
DefaultFun -> Int
DefaultFun -> [DefaultFun]
DefaultFun -> DefaultFun
DefaultFun -> DefaultFun -> [DefaultFun]
DefaultFun -> DefaultFun -> DefaultFun -> [DefaultFun]
(DefaultFun -> DefaultFun)
-> (DefaultFun -> DefaultFun)
-> (Int -> DefaultFun)
-> (DefaultFun -> Int)
-> (DefaultFun -> [DefaultFun])
-> (DefaultFun -> DefaultFun -> [DefaultFun])
-> (DefaultFun -> DefaultFun -> [DefaultFun])
-> (DefaultFun -> DefaultFun -> DefaultFun -> [DefaultFun])
-> Enum DefaultFun
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: DefaultFun -> DefaultFun -> DefaultFun -> [DefaultFun]
$cenumFromThenTo :: DefaultFun -> DefaultFun -> DefaultFun -> [DefaultFun]
enumFromTo :: DefaultFun -> DefaultFun -> [DefaultFun]
$cenumFromTo :: DefaultFun -> DefaultFun -> [DefaultFun]
enumFromThen :: DefaultFun -> DefaultFun -> [DefaultFun]
$cenumFromThen :: DefaultFun -> DefaultFun -> [DefaultFun]
enumFrom :: DefaultFun -> [DefaultFun]
$cenumFrom :: DefaultFun -> [DefaultFun]
fromEnum :: DefaultFun -> Int
$cfromEnum :: DefaultFun -> Int
toEnum :: Int -> DefaultFun
$ctoEnum :: Int -> DefaultFun
pred :: DefaultFun -> DefaultFun
$cpred :: DefaultFun -> DefaultFun
succ :: DefaultFun -> DefaultFun
$csucc :: DefaultFun -> DefaultFun
Enum, DefaultFun
DefaultFun -> DefaultFun -> Bounded DefaultFun
forall a. a -> a -> Bounded a
maxBound :: DefaultFun
$cmaxBound :: DefaultFun
minBound :: DefaultFun
$cminBound :: DefaultFun
Bounded, (forall x. DefaultFun -> Rep DefaultFun x)
-> (forall x. Rep DefaultFun x -> DefaultFun) -> Generic DefaultFun
forall x. Rep DefaultFun x -> DefaultFun
forall x. DefaultFun -> Rep DefaultFun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DefaultFun x -> DefaultFun
$cfrom :: forall x. DefaultFun -> Rep DefaultFun x
Generic, Ord DefaultFun
Ord DefaultFun
-> ((DefaultFun, DefaultFun) -> [DefaultFun])
-> ((DefaultFun, DefaultFun) -> DefaultFun -> Int)
-> ((DefaultFun, DefaultFun) -> DefaultFun -> Int)
-> ((DefaultFun, DefaultFun) -> DefaultFun -> Bool)
-> ((DefaultFun, DefaultFun) -> Int)
-> ((DefaultFun, DefaultFun) -> Int)
-> Ix DefaultFun
(DefaultFun, DefaultFun) -> Int
(DefaultFun, DefaultFun) -> [DefaultFun]
(DefaultFun, DefaultFun) -> DefaultFun -> Bool
(DefaultFun, DefaultFun) -> DefaultFun -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
unsafeRangeSize :: (DefaultFun, DefaultFun) -> Int
$cunsafeRangeSize :: (DefaultFun, DefaultFun) -> Int
rangeSize :: (DefaultFun, DefaultFun) -> Int
$crangeSize :: (DefaultFun, DefaultFun) -> Int
inRange :: (DefaultFun, DefaultFun) -> DefaultFun -> Bool
$cinRange :: (DefaultFun, DefaultFun) -> DefaultFun -> Bool
unsafeIndex :: (DefaultFun, DefaultFun) -> DefaultFun -> Int
$cunsafeIndex :: (DefaultFun, DefaultFun) -> DefaultFun -> Int
index :: (DefaultFun, DefaultFun) -> DefaultFun -> Int
$cindex :: (DefaultFun, DefaultFun) -> DefaultFun -> Int
range :: (DefaultFun, DefaultFun) -> [DefaultFun]
$crange :: (DefaultFun, DefaultFun) -> [DefaultFun]
$cp1Ix :: Ord DefaultFun
Ix)
deriving anyclass (DefaultFun -> ()
(DefaultFun -> ()) -> NFData DefaultFun
forall a. (a -> ()) -> NFData a
rnf :: DefaultFun -> ()
$crnf :: DefaultFun -> ()
NFData, Int -> DefaultFun -> Int
DefaultFun -> Int
(Int -> DefaultFun -> Int)
-> (DefaultFun -> Int) -> Hashable DefaultFun
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: DefaultFun -> Int
$chash :: DefaultFun -> Int
hashWithSalt :: Int -> DefaultFun -> Int
$chashWithSalt :: Int -> DefaultFun -> Int
Hashable, PrettyBy PrettyConfigPlc)
instance Pretty DefaultFun where
pretty :: DefaultFun -> Doc ann
pretty DefaultFun
fun = String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty (String -> Doc ann) -> String -> Doc ann
forall a b. (a -> b) -> a -> b
$ case DefaultFun -> String
forall a. Show a => a -> String
show DefaultFun
fun of
String
"" -> String
""
Char
c : String
s -> Char -> Char
toLower Char
c Char -> ShowS
forall a. a -> [a] -> [a]
: String
s
instance ExMemoryUsage DefaultFun where
memoryUsage :: DefaultFun -> ExMemory
memoryUsage DefaultFun
_ = ExMemory
1
nonZeroArg :: (Integer -> Integer -> Integer) -> Integer -> Integer -> EvaluationResult Integer
nonZeroArg :: (Integer -> Integer -> Integer)
-> Integer -> Integer -> EvaluationResult Integer
nonZeroArg Integer -> Integer -> Integer
_ Integer
_ Integer
0 = EvaluationResult Integer
forall a. EvaluationResult a
EvaluationFailure
nonZeroArg Integer -> Integer -> Integer
f Integer
x Integer
y = Integer -> EvaluationResult Integer
forall a. a -> EvaluationResult a
EvaluationSuccess (Integer -> EvaluationResult Integer)
-> Integer -> EvaluationResult Integer
forall a b. (a -> b) -> a -> b
$ Integer -> Integer -> Integer
f Integer
x Integer
y
instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where
type CostingPart uni DefaultFun = BuiltinCostModel
toBuiltinMeaning
:: forall val. HasConstantIn uni val
=> DefaultFun -> BuiltinMeaning val BuiltinCostModel
toBuiltinMeaning :: DefaultFun -> BuiltinMeaning val BuiltinCostModel
toBuiltinMeaning DefaultFun
AddInteger =
(Integer -> Integer -> Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Num Integer => Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
(+) @Integer)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramAddInteger)
toBuiltinMeaning DefaultFun
SubtractInteger =
(Integer -> Integer -> Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
((-) @Integer)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramSubtractInteger)
toBuiltinMeaning DefaultFun
MultiplyInteger =
(Integer -> Integer -> Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Num Integer => Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
(*) @Integer)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramMultiplyInteger)
toBuiltinMeaning DefaultFun
DivideInteger =
(Integer -> Integer -> EvaluationResult Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
((Integer -> Integer -> Integer)
-> Integer -> Integer -> EvaluationResult Integer
nonZeroArg Integer -> Integer -> Integer
forall a. Integral a => a -> a -> a
div)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramDivideInteger)
toBuiltinMeaning DefaultFun
QuotientInteger =
(Integer -> Integer -> EvaluationResult Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
((Integer -> Integer -> Integer)
-> Integer -> Integer -> EvaluationResult Integer
nonZeroArg Integer -> Integer -> Integer
forall a. Integral a => a -> a -> a
quot)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramQuotientInteger)
toBuiltinMeaning DefaultFun
RemainderInteger =
(Integer -> Integer -> EvaluationResult Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
((Integer -> Integer -> Integer)
-> Integer -> Integer -> EvaluationResult Integer
nonZeroArg Integer -> Integer -> Integer
forall a. Integral a => a -> a -> a
rem)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramRemainderInteger)
toBuiltinMeaning DefaultFun
ModInteger =
(Integer -> Integer -> EvaluationResult Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
((Integer -> Integer -> Integer)
-> Integer -> Integer -> EvaluationResult Integer
nonZeroArg Integer -> Integer -> Integer
forall a. Integral a => a -> a -> a
mod)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramModInteger)
toBuiltinMeaning DefaultFun
EqualsInteger =
(Integer -> Integer -> Bool)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Eq Integer => Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
(==) @Integer)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramEqualsInteger)
toBuiltinMeaning DefaultFun
LessThanInteger =
(Integer -> Integer -> Bool)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Ord Integer => Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
(<) @Integer)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramLessThanInteger)
toBuiltinMeaning DefaultFun
LessThanEqualsInteger =
(Integer -> Integer -> Bool)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Ord Integer => Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
(<=) @Integer)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramLessThanEqualsInteger)
toBuiltinMeaning DefaultFun
AppendByteString =
(ByteString -> ByteString -> ByteString)
-> (BuiltinCostModel
-> ToCostingType (Length '[ByteString, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString -> ByteString -> ByteString
BS.append
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramAppendByteString)
toBuiltinMeaning DefaultFun
ConsByteString =
(Integer -> ByteString -> ByteString)
-> (BuiltinCostModel
-> ToCostingType (Length '[Integer, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\Integer
n ByteString
xs -> Word8 -> ByteString -> ByteString
BS.cons (Integer -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral @Integer Integer
n) ByteString
xs)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramConsByteString)
toBuiltinMeaning DefaultFun
SliceByteString =
(Int -> Int -> ByteString -> ByteString)
-> (BuiltinCostModel
-> ToCostingType (Length '[Int, Int, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\Int
start Int
n ByteString
xs -> Int -> ByteString -> ByteString
BS.take Int
n (Int -> ByteString -> ByteString
BS.drop Int
start ByteString
xs))
(CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget
runCostingFunThreeArguments (CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelThreeArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelThreeArguments
forall (f :: * -> *).
BuiltinCostModelBase f -> f ModelThreeArguments
paramSliceByteString)
toBuiltinMeaning DefaultFun
LengthOfByteString =
(ByteString -> Int)
-> (BuiltinCostModel -> ToCostingType (Length '[ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString -> Int
BS.length
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramLengthOfByteString)
toBuiltinMeaning DefaultFun
IndexByteString =
(ByteString -> Int -> EvaluationResult Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[ByteString, Int]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\ByteString
xs Int
n -> if Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
0 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< ByteString -> Int
BS.length ByteString
xs then Integer -> EvaluationResult Integer
forall a. a -> EvaluationResult a
EvaluationSuccess (Integer -> EvaluationResult Integer)
-> Integer -> EvaluationResult Integer
forall a b. (a -> b) -> a -> b
$ Word8 -> Integer
forall a. Integral a => a -> Integer
toInteger (Word8 -> Integer) -> Word8 -> Integer
forall a b. (a -> b) -> a -> b
$ ByteString -> Int -> Word8
BS.index ByteString
xs Int
n else EvaluationResult Integer
forall a. EvaluationResult a
EvaluationFailure)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramIndexByteString)
toBuiltinMeaning DefaultFun
EqualsByteString =
(ByteString -> ByteString -> Bool)
-> (BuiltinCostModel
-> ToCostingType (Length '[ByteString, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Eq ByteString => ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
(==) @BS.ByteString)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramEqualsByteString)
toBuiltinMeaning DefaultFun
LessThanByteString =
(ByteString -> ByteString -> Bool)
-> (BuiltinCostModel
-> ToCostingType (Length '[ByteString, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Ord ByteString => ByteString -> ByteString -> Bool
forall a. Ord a => a -> a -> Bool
(<) @BS.ByteString)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramLessThanByteString)
toBuiltinMeaning DefaultFun
LessThanEqualsByteString =
(ByteString -> ByteString -> Bool)
-> (BuiltinCostModel
-> ToCostingType (Length '[ByteString, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Ord ByteString => ByteString -> ByteString -> Bool
forall a. Ord a => a -> a -> Bool
(<=) @BS.ByteString)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramLessThanEqualsByteString)
toBuiltinMeaning DefaultFun
Sha2_256 =
(ByteString -> ByteString)
-> (BuiltinCostModel -> ToCostingType (Length '[ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString -> ByteString
Hash.sha2_256
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramSha2_256)
toBuiltinMeaning DefaultFun
Sha3_256 =
(ByteString -> ByteString)
-> (BuiltinCostModel -> ToCostingType (Length '[ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString -> ByteString
Hash.sha3_256
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramSha3_256)
toBuiltinMeaning DefaultFun
Blake2b_256 =
(ByteString -> ByteString)
-> (BuiltinCostModel -> ToCostingType (Length '[ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString -> ByteString
Hash.blake2b_256
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramBlake2b_256)
toBuiltinMeaning DefaultFun
VerifyEd25519Signature =
(ByteString -> ByteString -> ByteString -> EvaluationResult Bool)
-> (BuiltinCostModel
-> ToCostingType (Length '[ByteString, ByteString, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Alternative EvaluationResult =>
ByteString -> ByteString -> ByteString -> EvaluationResult Bool
forall (f :: * -> *).
Alternative f =>
ByteString -> ByteString -> ByteString -> f Bool
verifyEd25519Signature @EvaluationResult)
(CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget
runCostingFunThreeArguments (CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelThreeArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelThreeArguments
forall (f :: * -> *).
BuiltinCostModelBase f -> f ModelThreeArguments
paramVerifyEd25519Signature)
toBuiltinMeaning DefaultFun
VerifyEcdsaSecp256k1Signature =
(ByteString
-> ByteString -> ByteString -> Emitter (EvaluationResult Bool))
-> (BuiltinCostModel
-> ToCostingType (Length '[ByteString, ByteString, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString
-> ByteString -> ByteString -> Emitter (EvaluationResult Bool)
verifyEcdsaSecp256k1Signature
(CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget
runCostingFunThreeArguments (CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelThreeArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelThreeArguments
forall (f :: * -> *).
BuiltinCostModelBase f -> f ModelThreeArguments
paramVerifyEcdsaSecp256k1Signature)
toBuiltinMeaning DefaultFun
VerifySchnorrSecp256k1Signature =
(ByteString
-> ByteString -> ByteString -> Emitter (EvaluationResult Bool))
-> (BuiltinCostModel
-> ToCostingType (Length '[ByteString, ByteString, ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString
-> ByteString -> ByteString -> Emitter (EvaluationResult Bool)
verifySchnorrSecp256k1Signature
(CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget
runCostingFunThreeArguments (CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelThreeArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelThreeArguments
forall (f :: * -> *).
BuiltinCostModelBase f -> f ModelThreeArguments
paramVerifySchnorrSecp256k1Signature)
toBuiltinMeaning DefaultFun
AppendString =
(Text -> Text -> Text)
-> (BuiltinCostModel -> ToCostingType (Length '[Text, Text]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Semigroup Text => Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
(<>) @Text)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramAppendString)
toBuiltinMeaning DefaultFun
EqualsString =
(Text -> Text -> Bool)
-> (BuiltinCostModel -> ToCostingType (Length '[Text, Text]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Eq Text => Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
(==) @Text)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramEqualsString)
toBuiltinMeaning DefaultFun
EncodeUtf8 =
(Text -> ByteString)
-> (BuiltinCostModel -> ToCostingType (Length '[Text]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
Text -> ByteString
encodeUtf8
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramEncodeUtf8)
toBuiltinMeaning DefaultFun
DecodeUtf8 =
(ByteString -> EvaluationResult Text)
-> (BuiltinCostModel -> ToCostingType (Length '[ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(forall a.
(Foldable (Either UnicodeException),
Alternative EvaluationResult) =>
Either UnicodeException a -> EvaluationResult a
forall (f :: * -> *) (g :: * -> *) a.
(Foldable f, Alternative g) =>
f a -> g a
reoption @_ @EvaluationResult (Either UnicodeException Text -> EvaluationResult Text)
-> (ByteString -> Either UnicodeException Text)
-> ByteString
-> EvaluationResult Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Either UnicodeException Text
decodeUtf8')
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramDecodeUtf8)
toBuiltinMeaning DefaultFun
IfThenElse =
(Bool
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0)))
-> (BuiltinCostModel
-> ToCostingType
(Length
(Bool
: GetArgs
(Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))))))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\Bool
b Opaque val (TyVarRep ('TyNameRep "a" 0))
x Opaque val (TyVarRep ('TyNameRep "a" 0))
y -> if Bool
b then Opaque val (TyVarRep ('TyNameRep "a" 0))
x else Opaque val (TyVarRep ('TyNameRep "a" 0))
y)
(CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget
runCostingFunThreeArguments (CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelThreeArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelThreeArguments
forall (f :: * -> *).
BuiltinCostModelBase f -> f ModelThreeArguments
paramIfThenElse)
toBuiltinMeaning DefaultFun
ChooseUnit =
(()
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0)))
-> (BuiltinCostModel
-> ToCostingType
(Length
(()
: GetArgs
(Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))))))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\() Opaque val (TyVarRep ('TyNameRep "a" 0))
a -> Opaque val (TyVarRep ('TyNameRep "a" 0))
a)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramChooseUnit)
toBuiltinMeaning DefaultFun
Trace =
(Text
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Emitter (Opaque val (TyVarRep ('TyNameRep "a" 0))))
-> (BuiltinCostModel
-> ToCostingType
(Length '[Text, Opaque val (TyVarRep ('TyNameRep "a" 0))]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\Text
text Opaque val (TyVarRep ('TyNameRep "a" 0))
a -> Opaque val (TyVarRep ('TyNameRep "a" 0))
a Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Emitter () -> Emitter (Opaque val (TyVarRep ('TyNameRep "a" 0)))
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Text -> Emitter ()
emit Text
text)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramTrace)
toBuiltinMeaning DefaultFun
FstPair =
(SomeConstant
uni (TyVarRep ('TyNameRep "a" 0), TyVarRep ('TyNameRep "b" 1))
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "a" 0))))
-> (BuiltinCostModel
-> ToCostingType
(Length
'[SomeConstant
DefaultUni
(TyVarRep ('TyNameRep "a" 0), TyVarRep ('TyNameRep "b" 1))]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
SomeConstant
uni (TyVarRep ('TyNameRep "a" 0), TyVarRep ('TyNameRep "b" 1))
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "a" 0)))
forall a b.
SomeConstant uni (a, b) -> EvaluationResult (Opaque val a)
fstPlc
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramFstPair)
where
fstPlc :: SomeConstant uni (a, b) -> EvaluationResult (Opaque val a)
fstPlc :: SomeConstant uni (a, b) -> EvaluationResult (Opaque val a)
fstPlc (SomeConstant (Some (ValueOf uni (Esc a)
uniPairAB a
xy))) = do
DefaultUniPair uniA _ <- uni (Esc a) -> EvaluationResult (uni (Esc a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure uni (Esc a)
uniPairAB
Opaque val a -> EvaluationResult (Opaque val a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Opaque val a -> EvaluationResult (Opaque val a))
-> (a2 -> Opaque val a) -> a2 -> EvaluationResult (Opaque val a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Some (ValueOf DefaultUni) -> Opaque val a
forall term.
HasConstant term =>
Some (ValueOf (UniOf term)) -> term
fromConstant (Some (ValueOf DefaultUni) -> Opaque val a)
-> (a2 -> Some (ValueOf DefaultUni)) -> a2 -> Opaque val a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DefaultUni (Esc a2) -> a2 -> Some (ValueOf DefaultUni)
forall a (uni :: * -> *). uni (Esc a) -> a -> Some (ValueOf uni)
someValueOf DefaultUni (Esc a2)
DefaultUni (Esc a2)
uniA (a2 -> EvaluationResult (Opaque val a))
-> a2 -> EvaluationResult (Opaque val a)
forall a b. (a -> b) -> a -> b
$ (a2, a1) -> a2
forall a b. (a, b) -> a
fst a
(a2, a1)
xy
{-# INLINE fstPlc #-}
toBuiltinMeaning DefaultFun
SndPair =
(SomeConstant
uni (TyVarRep ('TyNameRep "a" 0), TyVarRep ('TyNameRep "b" 1))
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "b" 1))))
-> (BuiltinCostModel
-> ToCostingType
(Length
'[SomeConstant
DefaultUni
(TyVarRep ('TyNameRep "a" 0), TyVarRep ('TyNameRep "b" 1))]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
SomeConstant
uni (TyVarRep ('TyNameRep "a" 0), TyVarRep ('TyNameRep "b" 1))
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "b" 1)))
forall a b.
SomeConstant uni (a, b) -> EvaluationResult (Opaque val b)
sndPlc
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramSndPair)
where
sndPlc :: SomeConstant uni (a, b) -> EvaluationResult (Opaque val b)
sndPlc :: SomeConstant uni (a, b) -> EvaluationResult (Opaque val b)
sndPlc (SomeConstant (Some (ValueOf uni (Esc a)
uniPairAB a
xy))) = do
DefaultUniPair _ uniB <- uni (Esc a) -> EvaluationResult (uni (Esc a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure uni (Esc a)
uniPairAB
Opaque val b -> EvaluationResult (Opaque val b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Opaque val b -> EvaluationResult (Opaque val b))
-> (a1 -> Opaque val b) -> a1 -> EvaluationResult (Opaque val b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Some (ValueOf DefaultUni) -> Opaque val b
forall term.
HasConstant term =>
Some (ValueOf (UniOf term)) -> term
fromConstant (Some (ValueOf DefaultUni) -> Opaque val b)
-> (a1 -> Some (ValueOf DefaultUni)) -> a1 -> Opaque val b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DefaultUni (Esc a1) -> a1 -> Some (ValueOf DefaultUni)
forall a (uni :: * -> *). uni (Esc a) -> a -> Some (ValueOf uni)
someValueOf DefaultUni (Esc a1)
DefaultUni (Esc a1)
uniB (a1 -> EvaluationResult (Opaque val b))
-> a1 -> EvaluationResult (Opaque val b)
forall a b. (a -> b) -> a -> b
$ (a2, a1) -> a1
forall a b. (a, b) -> b
snd a
(a2, a1)
xy
{-# INLINE sndPlc #-}
toBuiltinMeaning DefaultFun
ChooseList =
(SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> Opaque val (TyVarRep ('TyNameRep "b" 1))
-> Opaque val (TyVarRep ('TyNameRep "b" 1))
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "b" 1))))
-> (BuiltinCostModel
-> ToCostingType
(Length
'[SomeConstant DefaultUni [TyVarRep ('TyNameRep "a" 0)],
Opaque val (TyVarRep ('TyNameRep "b" 1)),
Opaque val (TyVarRep ('TyNameRep "b" 1))]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> Opaque val (TyVarRep ('TyNameRep "b" 1))
-> Opaque val (TyVarRep ('TyNameRep "b" 1))
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "b" 1)))
forall a b. SomeConstant uni [a] -> b -> b -> EvaluationResult b
choosePlc
(CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget
runCostingFunThreeArguments (CostingFun ModelThreeArguments
-> ExMemory -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelThreeArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelThreeArguments
forall (f :: * -> *).
BuiltinCostModelBase f -> f ModelThreeArguments
paramChooseList)
where
choosePlc :: SomeConstant uni [a] -> b -> b -> EvaluationResult b
choosePlc :: SomeConstant uni [a] -> b -> b -> EvaluationResult b
choosePlc (SomeConstant (Some (ValueOf uni (Esc a)
uniListA a
xs))) b
a b
b = do
DefaultUniList _ <- uni (Esc a) -> EvaluationResult (uni (Esc a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure uni (Esc a)
uniListA
b -> EvaluationResult b
forall (f :: * -> *) a. Applicative f => a -> f a
pure (b -> EvaluationResult b) -> b -> EvaluationResult b
forall a b. (a -> b) -> a -> b
$ case a
xs of
[] -> b
a
_ : _ -> b
b
{-# INLINE choosePlc #-}
toBuiltinMeaning DefaultFun
MkCons =
(SomeConstant uni (TyVarRep ('TyNameRep "a" 0))
-> SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult (Opaque val [TyVarRep ('TyNameRep "a" 0)]))
-> (BuiltinCostModel
-> ToCostingType
(Length
'[SomeConstant DefaultUni (TyVarRep ('TyNameRep "a" 0)),
SomeConstant DefaultUni [TyVarRep ('TyNameRep "a" 0)]]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
SomeConstant uni (TyVarRep ('TyNameRep "a" 0))
-> SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult (Opaque val [TyVarRep ('TyNameRep "a" 0)])
forall a.
SomeConstant uni a
-> SomeConstant uni [a] -> EvaluationResult (Opaque val [a])
consPlc
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramMkCons)
where
consPlc
:: SomeConstant uni a -> SomeConstant uni [a] -> EvaluationResult (Opaque val [a])
consPlc :: SomeConstant uni a
-> SomeConstant uni [a] -> EvaluationResult (Opaque val [a])
consPlc
(SomeConstant (Some (ValueOf uni (Esc a)
uniA a
x)))
(SomeConstant (Some (ValueOf uni (Esc a)
uniListA a
xs))) = do
DefaultUniList uniA' <- uni (Esc a) -> EvaluationResult (uni (Esc a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure uni (Esc a)
uniListA
Just Esc a :~: Esc a1
Refl <- Maybe (Esc a :~: Esc a1)
-> EvaluationResult (Maybe (Esc a :~: Esc a1))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe (Esc a :~: Esc a1)
-> EvaluationResult (Maybe (Esc a :~: Esc a1)))
-> Maybe (Esc a :~: Esc a1)
-> EvaluationResult (Maybe (Esc a :~: Esc a1))
forall a b. (a -> b) -> a -> b
$ uni (Esc a)
uniA uni (Esc a) -> uni (Esc a1) -> Maybe (Esc a :~: Esc a1)
forall k (f :: k -> *) (a :: k) (b :: k).
GEq f =>
f a -> f b -> Maybe (a :~: b)
`geq` uni (Esc a1)
DefaultUni (Esc a1)
uniA'
Opaque val [a] -> EvaluationResult (Opaque val [a])
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Opaque val [a] -> EvaluationResult (Opaque val [a]))
-> (a -> Opaque val [a]) -> a -> EvaluationResult (Opaque val [a])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Some (ValueOf uni) -> Opaque val [a]
forall term.
HasConstant term =>
Some (ValueOf (UniOf term)) -> term
fromConstant (Some (ValueOf uni) -> Opaque val [a])
-> (a -> Some (ValueOf uni)) -> a -> Opaque val [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. uni (Esc a) -> a -> Some (ValueOf uni)
forall a (uni :: * -> *). uni (Esc a) -> a -> Some (ValueOf uni)
someValueOf uni (Esc a)
uniListA (a -> EvaluationResult (Opaque val [a]))
-> a -> EvaluationResult (Opaque val [a])
forall a b. (a -> b) -> a -> b
$ a
x a -> [a] -> [a]
forall a. a -> [a] -> [a]
: a
[a]
xs
{-# INLINE consPlc #-}
toBuiltinMeaning DefaultFun
HeadList =
(SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "a" 0))))
-> (BuiltinCostModel
-> ToCostingType
(Length '[SomeConstant DefaultUni [TyVarRep ('TyNameRep "a" 0)]]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult (Opaque val (TyVarRep ('TyNameRep "a" 0)))
forall a. SomeConstant uni [a] -> EvaluationResult (Opaque val a)
headPlc
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramHeadList)
where
headPlc :: SomeConstant uni [a] -> EvaluationResult (Opaque val a)
headPlc :: SomeConstant uni [a] -> EvaluationResult (Opaque val a)
headPlc (SomeConstant (Some (ValueOf uni (Esc a)
uniListA a
xs))) = do
DefaultUniList uniA <- uni (Esc a) -> EvaluationResult (uni (Esc a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure uni (Esc a)
uniListA
x : _ <- a -> EvaluationResult a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
xs
Opaque val a -> EvaluationResult (Opaque val a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Opaque val a -> EvaluationResult (Opaque val a))
-> (Some (ValueOf DefaultUni) -> Opaque val a)
-> Some (ValueOf DefaultUni)
-> EvaluationResult (Opaque val a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Some (ValueOf DefaultUni) -> Opaque val a
forall term.
HasConstant term =>
Some (ValueOf (UniOf term)) -> term
fromConstant (Some (ValueOf DefaultUni) -> EvaluationResult (Opaque val a))
-> Some (ValueOf DefaultUni) -> EvaluationResult (Opaque val a)
forall a b. (a -> b) -> a -> b
$ DefaultUni (Esc a1) -> a1 -> Some (ValueOf DefaultUni)
forall a (uni :: * -> *). uni (Esc a) -> a -> Some (ValueOf uni)
someValueOf DefaultUni (Esc a1)
DefaultUni (Esc a1)
uniA a1
x
{-# INLINE headPlc #-}
toBuiltinMeaning DefaultFun
TailList =
(SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult (Opaque val [TyVarRep ('TyNameRep "a" 0)]))
-> (BuiltinCostModel
-> ToCostingType
(Length '[SomeConstant DefaultUni [TyVarRep ('TyNameRep "a" 0)]]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult (Opaque val [TyVarRep ('TyNameRep "a" 0)])
forall a. SomeConstant uni [a] -> EvaluationResult (Opaque val [a])
tailPlc
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramTailList)
where
tailPlc :: SomeConstant uni [a] -> EvaluationResult (Opaque val [a])
tailPlc :: SomeConstant uni [a] -> EvaluationResult (Opaque val [a])
tailPlc (SomeConstant (Some (ValueOf uni (Esc a)
uniListA a
xs))) = do
DefaultUniList _ <- uni (Esc a) -> EvaluationResult (uni (Esc a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure uni (Esc a)
uniListA
_ : xs' <- a -> EvaluationResult a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
xs
Opaque val [a] -> EvaluationResult (Opaque val [a])
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Opaque val [a] -> EvaluationResult (Opaque val [a]))
-> (Some (ValueOf uni) -> Opaque val [a])
-> Some (ValueOf uni)
-> EvaluationResult (Opaque val [a])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Some (ValueOf uni) -> Opaque val [a]
forall term.
HasConstant term =>
Some (ValueOf (UniOf term)) -> term
fromConstant (Some (ValueOf uni) -> EvaluationResult (Opaque val [a]))
-> Some (ValueOf uni) -> EvaluationResult (Opaque val [a])
forall a b. (a -> b) -> a -> b
$ uni (Esc a) -> a -> Some (ValueOf uni)
forall a (uni :: * -> *). uni (Esc a) -> a -> Some (ValueOf uni)
someValueOf uni (Esc a)
uniListA a
[a1]
xs'
{-# INLINE tailPlc #-}
toBuiltinMeaning DefaultFun
NullList =
(SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult Bool)
-> (BuiltinCostModel
-> ToCostingType
(Length '[SomeConstant DefaultUni [TyVarRep ('TyNameRep "a" 0)]]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
SomeConstant uni [TyVarRep ('TyNameRep "a" 0)]
-> EvaluationResult Bool
forall a. SomeConstant uni [a] -> EvaluationResult Bool
nullPlc
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramNullList)
where
nullPlc :: SomeConstant uni [a] -> EvaluationResult Bool
nullPlc :: SomeConstant uni [a] -> EvaluationResult Bool
nullPlc (SomeConstant (Some (ValueOf uni (Esc a)
uniListA a
xs))) = do
DefaultUniList _ <- uni (Esc a) -> EvaluationResult (uni (Esc a))
forall (f :: * -> *) a. Applicative f => a -> f a
pure uni (Esc a)
uniListA
Bool -> EvaluationResult Bool
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Bool -> EvaluationResult Bool) -> Bool -> EvaluationResult Bool
forall a b. (a -> b) -> a -> b
$ [a1] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null a
[a1]
xs
{-# INLINE nullPlc #-}
toBuiltinMeaning DefaultFun
ChooseData =
(Data
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0)))
-> (BuiltinCostModel
-> ToCostingType
(Length
(Data
: GetArgs
(Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))
-> Opaque val (TyVarRep ('TyNameRep "a" 0))))))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\Data
d
Opaque val (TyVarRep ('TyNameRep "a" 0))
xConstr
Opaque val (TyVarRep ('TyNameRep "a" 0))
xMap Opaque val (TyVarRep ('TyNameRep "a" 0))
xList Opaque val (TyVarRep ('TyNameRep "a" 0))
xI Opaque val (TyVarRep ('TyNameRep "a" 0))
xB ->
case Data
d of
Constr {} -> Opaque val (TyVarRep ('TyNameRep "a" 0))
xConstr
Map {} -> Opaque val (TyVarRep ('TyNameRep "a" 0))
xMap
List {} -> Opaque val (TyVarRep ('TyNameRep "a" 0))
xList
I {} -> Opaque val (TyVarRep ('TyNameRep "a" 0))
xI
B {} -> Opaque val (TyVarRep ('TyNameRep "a" 0))
xB)
(CostingFun ModelSixArguments
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
runCostingFunSixArguments (CostingFun ModelSixArguments
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelSixArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelSixArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelSixArguments
paramChooseData)
toBuiltinMeaning DefaultFun
ConstrData =
(Integer -> [Data] -> Data)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer, [Data]]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
Integer -> [Data] -> Data
Constr
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramConstrData)
toBuiltinMeaning DefaultFun
MapData =
([(Data, Data)] -> Data)
-> (BuiltinCostModel -> ToCostingType (Length '[[(Data, Data)]]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
[(Data, Data)] -> Data
Map
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramMapData)
toBuiltinMeaning DefaultFun
ListData =
([Data] -> Data)
-> (BuiltinCostModel -> ToCostingType (Length '[[Data]]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
[Data] -> Data
List
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramListData)
toBuiltinMeaning DefaultFun
IData =
(Integer -> Data)
-> (BuiltinCostModel -> ToCostingType (Length '[Integer]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
Integer -> Data
I
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramIData)
toBuiltinMeaning DefaultFun
BData =
(ByteString -> Data)
-> (BuiltinCostModel -> ToCostingType (Length '[ByteString]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
ByteString -> Data
B
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramBData)
toBuiltinMeaning DefaultFun
UnConstrData =
(Data -> EvaluationResult (Integer, [Data]))
-> (BuiltinCostModel -> ToCostingType (Length '[Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\case
Constr Integer
i [Data]
ds -> (Integer, [Data]) -> EvaluationResult (Integer, [Data])
forall a. a -> EvaluationResult a
EvaluationSuccess (Integer
i, [Data]
ds)
Data
_ -> EvaluationResult (Integer, [Data])
forall a. EvaluationResult a
EvaluationFailure)
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramUnConstrData)
toBuiltinMeaning DefaultFun
UnMapData =
(Data -> EvaluationResult [(Data, Data)])
-> (BuiltinCostModel -> ToCostingType (Length '[Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\case
Map [(Data, Data)]
es -> [(Data, Data)] -> EvaluationResult [(Data, Data)]
forall a. a -> EvaluationResult a
EvaluationSuccess [(Data, Data)]
es
Data
_ -> EvaluationResult [(Data, Data)]
forall a. EvaluationResult a
EvaluationFailure)
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramUnMapData)
toBuiltinMeaning DefaultFun
UnListData =
(Data -> EvaluationResult [Data])
-> (BuiltinCostModel -> ToCostingType (Length '[Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\case
List [Data]
ds -> [Data] -> EvaluationResult [Data]
forall a. a -> EvaluationResult a
EvaluationSuccess [Data]
ds
Data
_ -> EvaluationResult [Data]
forall a. EvaluationResult a
EvaluationFailure)
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramUnListData)
toBuiltinMeaning DefaultFun
UnIData =
(Data -> EvaluationResult Integer)
-> (BuiltinCostModel -> ToCostingType (Length '[Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\case
I Integer
i -> Integer -> EvaluationResult Integer
forall a. a -> EvaluationResult a
EvaluationSuccess Integer
i
Data
_ -> EvaluationResult Integer
forall a. EvaluationResult a
EvaluationFailure)
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramUnIData)
toBuiltinMeaning DefaultFun
UnBData =
(Data -> EvaluationResult ByteString)
-> (BuiltinCostModel -> ToCostingType (Length '[Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\case
B ByteString
b -> ByteString -> EvaluationResult ByteString
forall a. a -> EvaluationResult a
EvaluationSuccess ByteString
b
Data
_ -> EvaluationResult ByteString
forall a. EvaluationResult a
EvaluationFailure)
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramUnBData)
toBuiltinMeaning DefaultFun
EqualsData =
(Data -> Data -> Bool)
-> (BuiltinCostModel -> ToCostingType (Length '[Data, Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(Eq Data => Data -> Data -> Bool
forall a. Eq a => a -> a -> Bool
(==) @Data)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramEqualsData)
toBuiltinMeaning DefaultFun
SerialiseData =
(Data -> ByteString)
-> (BuiltinCostModel -> ToCostingType (Length '[Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(ByteString -> ByteString
BS.toStrict (ByteString -> ByteString)
-> (Data -> ByteString) -> Data -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Serialise Data => Data -> ByteString
forall a. Serialise a => a -> ByteString
serialise @Data)
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramSerialiseData)
toBuiltinMeaning DefaultFun
MkPairData =
(Data -> Data -> (Data, Data))
-> (BuiltinCostModel -> ToCostingType (Length '[Data, Data]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
((,) @Data @Data)
(CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget
runCostingFunTwoArguments (CostingFun ModelTwoArguments -> ExMemory -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelTwoArguments)
-> BuiltinCostModel
-> ExMemory
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelTwoArguments
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelTwoArguments
paramMkPairData)
toBuiltinMeaning DefaultFun
MkNilData =
(() -> [Data])
-> (BuiltinCostModel -> ToCostingType (Length '[()]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\() -> [] @Data)
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramMkNilData)
toBuiltinMeaning DefaultFun
MkNilPairData =
(() -> [(Data, Data)])
-> (BuiltinCostModel -> ToCostingType (Length '[()]))
-> BuiltinMeaning val BuiltinCostModel
forall a val cost (binds :: [Some TyNameRep]) (args :: [*]) res
(j :: Nat).
(binds ~ ToBinds a, args ~ GetArgs a, a ~ FoldArgs args res,
ElaborateFromTo 0 j val a, KnownPolytype binds val args res a) =>
a
-> (cost -> ToCostingType (Length args)) -> BuiltinMeaning val cost
makeBuiltinMeaning
(\() -> [] @(Data,Data))
(CostingFun ModelOneArgument -> ExMemory -> ExBudget
runCostingFunOneArgument (CostingFun ModelOneArgument -> ExMemory -> ExBudget)
-> (BuiltinCostModel -> CostingFun ModelOneArgument)
-> BuiltinCostModel
-> ExMemory
-> ExBudget
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinCostModel -> CostingFun ModelOneArgument
forall (f :: * -> *). BuiltinCostModelBase f -> f ModelOneArgument
paramMkNilPairData)
{-# INLINE toBuiltinMeaning #-}
builtinTagWidth :: NumBits
builtinTagWidth :: Int
builtinTagWidth = Int
7
encodeBuiltin :: Word8 -> Flat.Encoding
encodeBuiltin :: Word8 -> Encoding
encodeBuiltin = Int -> Word8 -> Encoding
eBits Int
builtinTagWidth
decodeBuiltin :: Get Word8
decodeBuiltin :: Get Word8
decodeBuiltin = Int -> Get Word8
dBEBits8 Int
builtinTagWidth
instance Flat DefaultFun where
encode :: DefaultFun -> Encoding
encode = Word8 -> Encoding
encodeBuiltin (Word8 -> Encoding)
-> (DefaultFun -> Word8) -> DefaultFun -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. \case
DefaultFun
AddInteger -> Word8
0
DefaultFun
SubtractInteger -> Word8
1
DefaultFun
MultiplyInteger -> Word8
2
DefaultFun
DivideInteger -> Word8
3
DefaultFun
QuotientInteger -> Word8
4
DefaultFun
RemainderInteger -> Word8
5
DefaultFun
ModInteger -> Word8
6
DefaultFun
EqualsInteger -> Word8
7
DefaultFun
LessThanInteger -> Word8
8
DefaultFun
LessThanEqualsInteger -> Word8
9
DefaultFun
AppendByteString -> Word8
10
DefaultFun
ConsByteString -> Word8
11
DefaultFun
SliceByteString -> Word8
12
DefaultFun
LengthOfByteString -> Word8
13
DefaultFun
IndexByteString -> Word8
14
DefaultFun
EqualsByteString -> Word8
15
DefaultFun
LessThanByteString -> Word8
16
DefaultFun
LessThanEqualsByteString -> Word8
17
DefaultFun
Sha2_256 -> Word8
18
DefaultFun
Sha3_256 -> Word8
19
DefaultFun
Blake2b_256 -> Word8
20
DefaultFun
VerifyEd25519Signature -> Word8
21
DefaultFun
VerifyEcdsaSecp256k1Signature -> Word8
52
DefaultFun
VerifySchnorrSecp256k1Signature -> Word8
53
DefaultFun
AppendString -> Word8
22
DefaultFun
EqualsString -> Word8
23
DefaultFun
EncodeUtf8 -> Word8
24
DefaultFun
DecodeUtf8 -> Word8
25
DefaultFun
IfThenElse -> Word8
26
DefaultFun
ChooseUnit -> Word8
27
DefaultFun
Trace -> Word8
28
DefaultFun
FstPair -> Word8
29
DefaultFun
SndPair -> Word8
30
DefaultFun
ChooseList -> Word8
31
DefaultFun
MkCons -> Word8
32
DefaultFun
HeadList -> Word8
33
DefaultFun
TailList -> Word8
34
DefaultFun
NullList -> Word8
35
DefaultFun
ChooseData -> Word8
36
DefaultFun
ConstrData -> Word8
37
DefaultFun
MapData -> Word8
38
DefaultFun
ListData -> Word8
39
DefaultFun
IData -> Word8
40
DefaultFun
BData -> Word8
41
DefaultFun
UnConstrData -> Word8
42
DefaultFun
UnMapData -> Word8
43
DefaultFun
UnListData -> Word8
44
DefaultFun
UnIData -> Word8
45
DefaultFun
UnBData -> Word8
46
DefaultFun
EqualsData -> Word8
47
DefaultFun
MkPairData -> Word8
48
DefaultFun
MkNilData -> Word8
49
DefaultFun
MkNilPairData -> Word8
50
DefaultFun
SerialiseData -> Word8
51
decode :: Get DefaultFun
decode = Word8 -> Get DefaultFun
forall a (f :: * -> *).
(Eq a, Num a, MonadFail f, Show a) =>
a -> f DefaultFun
go (Word8 -> Get DefaultFun) -> Get Word8 -> Get DefaultFun
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Get Word8
decodeBuiltin
where go :: a -> f DefaultFun
go a
0 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
AddInteger
go a
1 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
SubtractInteger
go a
2 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
MultiplyInteger
go a
3 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
DivideInteger
go a
4 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
QuotientInteger
go a
5 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
RemainderInteger
go a
6 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
ModInteger
go a
7 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
EqualsInteger
go a
8 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
LessThanInteger
go a
9 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
LessThanEqualsInteger
go a
10 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
AppendByteString
go a
11 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
ConsByteString
go a
12 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
SliceByteString
go a
13 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
LengthOfByteString
go a
14 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
IndexByteString
go a
15 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
EqualsByteString
go a
16 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
LessThanByteString
go a
17 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
LessThanEqualsByteString
go a
18 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
Sha2_256
go a
19 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
Sha3_256
go a
20 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
Blake2b_256
go a
21 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
VerifyEd25519Signature
go a
22 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
AppendString
go a
23 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
EqualsString
go a
24 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
EncodeUtf8
go a
25 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
DecodeUtf8
go a
26 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
IfThenElse
go a
27 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
ChooseUnit
go a
28 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
Trace
go a
29 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
FstPair
go a
30 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
SndPair
go a
31 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
ChooseList
go a
32 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
MkCons
go a
33 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
HeadList
go a
34 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
TailList
go a
35 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
NullList
go a
36 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
ChooseData
go a
37 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
ConstrData
go a
38 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
MapData
go a
39 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
ListData
go a
40 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
IData
go a
41 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
BData
go a
42 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
UnConstrData
go a
43 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
UnMapData
go a
44 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
UnListData
go a
45 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
UnIData
go a
46 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
UnBData
go a
47 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
EqualsData
go a
48 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
MkPairData
go a
49 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
MkNilData
go a
50 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
MkNilPairData
go a
51 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
SerialiseData
go a
52 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
VerifyEcdsaSecp256k1Signature
go a
53 = DefaultFun -> f DefaultFun
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefaultFun
VerifySchnorrSecp256k1Signature
go a
t = String -> f DefaultFun
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> f DefaultFun) -> String -> f DefaultFun
forall a b. (a -> b) -> a -> b
$ String
"Failed to decode builtin tag, got: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
t
size :: DefaultFun -> Int -> Int
size DefaultFun
_ Int
n = Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
builtinTagWidth