@@ -23,7 +23,8 @@ import PlutusCore.Data (Data (..))
23
23
import PlutusCore.Default.Universe
24
24
import PlutusCore.Evaluation.Machine.BuiltinCostModel
25
25
import PlutusCore.Evaluation.Machine.ExBudgetStream (ExBudgetStream )
26
- import PlutusCore.Evaluation.Machine.ExMemoryUsage (ExMemoryUsage , IntegerCostedLiterally (.. ),
26
+ import PlutusCore.Evaluation.Machine.ExMemoryUsage (ArrayCostedByLength , ExMemoryUsage ,
27
+ IntegerCostedLiterally (.. ),
27
28
ListCostedByLength (.. ),
28
29
NumBytesCostedAsNumWords (.. ), memoryUsage ,
29
30
singletonRose )
@@ -2107,25 +2108,30 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where
2107
2108
(runCostingFunTwoArguments . paramDropList)
2108
2109
2109
2110
toBuiltinMeaning _semvar LengthOfArray =
2110
- let lengthOfArrayDenotation :: SomeConstant uni (Vector a ) -> BuiltinResult Int
2111
+ let lengthOfArrayDenotation :: SomeConstant uni (ArrayCostedByLength a ) -> BuiltinResult Int
2111
2112
lengthOfArrayDenotation (SomeConstant (Some (ValueOf uni vec))) =
2112
2113
case uni of
2113
2114
DefaultUniArray _uniA -> pure $ Vector. length vec
2114
2115
_ -> throwing _StructuralUnliftingError " Expected an array but got something else"
2115
2116
{-# INLINE lengthOfArrayDenotation #-}
2116
- in makeBuiltinMeaning lengthOfArrayDenotation (runCostingFunOneArgument . unimplementedCostingFun )
2117
+ in makeBuiltinMeaning lengthOfArrayDenotation (runCostingFunOneArgument . paramLengthOfArray )
2117
2118
2118
2119
toBuiltinMeaning _semvar ListToArray =
2119
- let listToArrayDenotation :: SomeConstant uni [a ] -> BuiltinResult (Opaque val (Vector a ))
2120
+ let listToArrayDenotation
2121
+ :: SomeConstant uni (ListCostedByLength a )
2122
+ -> BuiltinResult (Opaque val (Vector a ))
2120
2123
listToArrayDenotation (SomeConstant (Some (ValueOf uniListA xs))) =
2121
2124
case uniListA of
2122
2125
DefaultUniList uniA -> pure $ fromValueOf (DefaultUniArray uniA) $ Vector. fromList xs
2123
2126
_ -> throwing _StructuralUnliftingError " Expected an array but got something else"
2124
2127
{-# INLINE listToArrayDenotation #-}
2125
- in makeBuiltinMeaning listToArrayDenotation (runCostingFunOneArgument . unimplementedCostingFun )
2128
+ in makeBuiltinMeaning listToArrayDenotation (runCostingFunOneArgument . paramListToArray )
2126
2129
2127
2130
toBuiltinMeaning _semvar IndexArray =
2128
- let indexArrayDenotation :: SomeConstant uni (Vector a ) -> Int -> BuiltinResult (Opaque val a )
2131
+ let indexArrayDenotation
2132
+ :: SomeConstant uni (ArrayCostedByLength a )
2133
+ -> Int
2134
+ -> BuiltinResult (Opaque val a )
2129
2135
indexArrayDenotation (SomeConstant (Some (ValueOf uni vec))) n =
2130
2136
case uni of
2131
2137
DefaultUniArray arg -> do
@@ -2138,7 +2144,7 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where
2138
2144
-- message, so we don't need to repeat them here.
2139
2145
throwing _StructuralUnliftingError " Expected an array but got something else"
2140
2146
{-# INLINE indexArrayDenotation #-}
2141
- in makeBuiltinMeaning indexArrayDenotation (runCostingFunTwoArguments . unimplementedCostingFun )
2147
+ in makeBuiltinMeaning indexArrayDenotation (runCostingFunTwoArguments . paramIndexArray )
2142
2148
2143
2149
-- See Note [Inlining meanings of builtins].
2144
2150
{-# INLINE toBuiltinMeaning #-}
0 commit comments