diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.cbor.size.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.cbor.size.golden index 37b767d4672..4725b8206dc 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.cbor.size.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.cbor.size.golden @@ -1 +1 @@ -2044 \ No newline at end of file +2033 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.large.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.large.budget.golden index 5da6a57915b..d82f6990454 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.large.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.large.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 436822709, exBudgetMemory = ExMemory 2150480} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 420427505, exBudgetMemory = ExMemory 2101768} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.pir.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.pir.golden index c2dcaf79fdb..529fdaa01a4 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.pir.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.pir.golden @@ -508,14 +508,7 @@ program a = pair data data in /\r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r}) + \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f]) {List (Tuple2 data data)} (Nil {Tuple2 data data}) (\(x : pair data data) (xs : list (pair data data)) -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.small.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.small.budget.golden index 57c090a060a..9250df579bd 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.small.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.small.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 62348110, exBudgetMemory = ExMemory 280102} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 61549309, exBudgetMemory = ExMemory 277674} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.uplc.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.uplc.golden index fc8c201c964..8b64c6d2da6 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.uplc.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.uplc.golden @@ -730,7 +730,11 @@ program [ ]) , (constr 1 [ cse - , cse ]) ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) ]) , (constr 0 [ ]) ]) ]) ])) (constr 3 @@ -742,11 +746,7 @@ program [ ]) , (constr 1 [ cse - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ]) ]) ])) (constr 1 @@ -779,16 +779,16 @@ program [ ]) , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ])) + , cse ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 [ cse - , cse ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 0 [ (constr 0 @@ -813,22 +813,22 @@ program , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + [ (cse + 4) , (constr 0 [ ]) ])) (constr 1 - [ (cse - 1) + [ cse , (constr 0 [ ]) ])) (constr 1 @@ -836,58 +836,50 @@ program , (constr 0 [ ]) ])) (cse - 10)) + 1)) (cse 10)) (constr 0 [ (constr 1 [ ]) , cse ])) - (cse 1)) - (cse 100)) - (cse 4)) - (constr 0 - [ (constr 1 []) - , (constr 1 - [ 1 - , (constr 0 - [ ]) ]) ])) - (cse 2)) - (unsafeRatio 9)) + (cse 2)) + (constr 0 + [ (constr 1 + []) + , (constr 1 + [ 1 + , (constr 0 + [ ]) ]) ])) + (cse 10)) + (cse 100)) + (cse 1)) + (unsafeRatio 1)) (unsafeRatio 3)) (unsafeRatio 0)) - (constr 1 [0, (constr 0 [])])) - (unsafeRatio 51)) - (unsafeRatio 4)) - (unsafeRatio 1)) + (unsafeRatio 4)) + (constr 1 [0, (constr 0 [])])) + (unsafeRatio 9)) + (unsafeRatio 51)) ((\s -> s s) (\s arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 0 [])) - (delay - ((\x -> - constr 1 - [ (constr 0 - [ (force - (force - fstPair) - x) - , (force - (force - sndPair) - x) ]) + case + xs + [ (constr 0 []) + , (\x xs -> + constr 1 + [ (constr 0 + [ (force + (force fstPair) + x) , (force - (s - s - (delay - (\x -> x))) - (force tailList - xs)) ]) - (force headList xs)))))) + (force sndPair) + x) ]) + , (force + (s s (delay (\x -> x))) + xs) ]) ])) (delay (\x -> x)))) ((\s -> s s) (\s ds cparams -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.cbor.size.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.cbor.size.golden index 4d2b2566466..cdfeb367919 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.cbor.size.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.cbor.size.golden @@ -1 +1 @@ -2042 \ No newline at end of file +2023 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.large.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.large.budget.golden index bb77063f73c..68f8452830f 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.large.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.large.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 599331564, exBudgetMemory = ExMemory 3024315} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 582792360, exBudgetMemory = ExMemory 2974703} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.pir.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.pir.golden index 6a6e6307dc0..3d28a35c1c2 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.pir.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.pir.golden @@ -438,14 +438,7 @@ program a = pair data data in /\r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r}) + \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f]) {List (Tuple2 data data)} (Nil {Tuple2 data data}) (\(x : pair data data) (xs : list (pair data data)) -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.small.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.small.budget.golden index e1e845fa60e..807af782f71 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.small.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.small.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 60810367, exBudgetMemory = ExMemory 271603} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 59867566, exBudgetMemory = ExMemory 268275} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.uplc.golden b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.uplc.golden index e222d76b3d8..e1a39b7d140 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.uplc.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.uplc.golden @@ -36,908 +36,895 @@ program (\cse -> (\cse -> (\cse -> - (\cse -> - (\cse -> - (\cse -> - (\cfg -> - (\fun - ds -> + (\cfg -> + (\fun + ds -> + case + ((\cse -> + (\cse -> case - ((\cse -> - (\cse -> - case - (equalsInteger - 0 - cse) - [ (case - (equalsInteger - 2 - cse) - [ error - , ((\l -> - constr 1 - [ ]) + (equalsInteger + 0 + cse) + [ (case + (equalsInteger + 2 + cse) + [ error + , ((\l -> + constr 1 + [ ]) + (force + (force + sndPair) + cse)) ]) + , (constr 0 + [ (force + caseData_go + (unMapData + (force + headList + (force + tailList (force (force sndPair) - cse)) ]) - , (constr 0 - [ (force - caseData_go - (unMapData - (force - headList - (force - tailList - (force - (force - sndPair) - cse))))) ]) ]) - (force - (force - fstPair) - cse)) - (unConstrData + cse))))) ]) ]) + (force + (force + fstPair) + cse)) + (unConstrData + (force + headList + (force + tailList + (force + tailList (force - headList (force - tailList - (force - tailList - (force + sndPair) + (unConstrData + ((\tup -> + case + (equalsInteger + 5 + (force + (force + fstPair) + tup)) + [ error + , (force + headList + (force + tailList + (force + (force + sndPair) + tup))) ]) + (unConstrData (force - sndPair) - (unConstrData - ((\tup -> - case - (equalsInteger - 5 - (force - (force - fstPair) - tup)) - [ error - , (force - headList - (force - tailList - (force - (force - sndPair) - tup))) ]) - (unConstrData + headList + (force + tailList + (force + tailList (force - headList (force - tailList - (force - tailList - (force - (force - sndPair) - (unConstrData - ds)))))))))))))) - [ (\cparams -> - case - (fun - cparams) - [ () - , error ]) - , () ]) - ((\go - eta -> - go - eta) - ((\s -> - s - s) - (\s - ds -> - case - ds - [ (constr 0 - [ ]) - , (\x - xs -> - case - (case - x - [ (\ds - actualValueData -> - validateParamValue - ((\k -> - (\s -> - s - s) - (\s - ds -> - case - ds - [ error - , (\ds - xs' -> - case - ds - [ (\k' - i -> - case - (equalsInteger - k - k') - [ (s - s - xs') - , i ]) ]) ])) - (unIData - ds) - cfg) - actualValueData) ]) - [ (s - s - xs) - , (constr 1 - [ ]) ]) ])))) - (constr 1 - [ (constr 0 - [ 0 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 30 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 1000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 1 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 2 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 24576 - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 122880 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 3 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 32768 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 4 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 5 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 1000000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 6 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250000000 - , cse ]) ]) - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 7 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 8 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 2000 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 9 - , (constr 3 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 10 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 1000) - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 200) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 11 - , (constr 3 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 10) - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 16 - , (constr 1 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 17 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 3000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 6500 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 18 - , (constr 0 - [ ]) ]) - , (constr 1 - [ (constr 0 - [ 19 - , (constr 2 - [ (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 25) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 20000) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5000) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 20 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 21 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 120000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 22 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 12288 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 23 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 200 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 24 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 25 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , cse ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 26 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ (unsafeRatio - 13 - 20) - , (constr 0 - [ ]) ]) ]) ]) - , cse ]) ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , cse ]) ]) - , cse ]) ]) - , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 27 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 3 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 28 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 18 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 293 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 29 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 30 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 31 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 100000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 32 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 13 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 37 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 33 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , cse ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (unsafeRatio - 1000 - 1) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) - (constr 3 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ])) - (constr 3 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) + sndPair) + (unConstrData + ds)))))))))))))) + [ (\cparams -> + case + (fun + cparams) + [ () + , error ]) + , () ]) + ((\go + eta -> + go + eta) + ((\s -> + s + s) + (\s + ds -> + case + ds + [ (constr 0 + [ ]) + , (\x + xs -> + case + (case + x + [ (\ds + actualValueData -> + validateParamValue + ((\k -> + (\s -> + s + s) + (\s + ds -> + case + ds + [ error + , (\ds + xs' -> + case + ds + [ (\k' + i -> + case + (equalsInteger + k + k') + [ (s + s + xs') + , i ]) ]) ])) + (unIData + ds) + cfg) + actualValueData) ]) + [ (s + s + xs) , (constr 1 - [ cse - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ])) - (constr 3 - [ (constr 1 - [ cse - , cse ]) ])) - (constr 1 - [ (constr 3 - [ (constr 1 + [ ]) ]) ])))) + (constr 1 + [ (constr 0 + [ 0 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 30 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 1000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 1 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 2 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 24576 + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 122880 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 3 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 32768 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 4 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 5 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 1000000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 6 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250000000 + , cse ]) ]) + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 7 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 8 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 2000 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 9 + , (constr 3 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 10 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 1000) + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 200) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 11 + , (constr 3 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 10) + , cse ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 16 + , (constr 1 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 17 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 3000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 6500 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 18 + , (constr 0 + [ ]) ]) + , (constr 1 + [ (constr 0 + [ 19 + , (constr 2 + [ (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 25) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 20000) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5000) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 20 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 21 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 120000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 22 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 12288 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 23 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 200 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 24 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 25 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , cse ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 26 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ (unsafeRatio + 13 + 20) + , (constr 0 + [ ]) ]) ]) ]) + , cse ]) ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , cse ]) ]) + , cse ]) ]) + , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 27 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 3 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 28 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 18 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 293 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 29 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 30 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 31 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 100000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 32 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 13 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 37 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 33 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , cse ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (unsafeRatio + 1000 + 1) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) + (constr 3 + [ (constr 1 + [ cse + , (constr 1 [ (constr 0 - [ (constr 1 + [ (constr 0 [ ]) , (constr 1 [ cse - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) - , (constr 0 - [ ]) ])) - (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ])) + (constr 3 + [ (constr 1 + [ cse , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ])) - (constr 0 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ cse + , cse ]) ]) + , (constr 0 + [ ]) ]) ]) ])) + (constr 3 [ (constr 1 - [ ]) - , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 10) - , cse ]) ])) + , cse ]) ])) + (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) + , (constr 0 + [ ]) ])) (constr 1 [ (constr 0 [ (constr 0 [ ]) - , cse ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) , (constr 0 [ ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 - [ 0 - , (constr 1 - [ 1000000 - , (constr 0 - [ ]) ]) ]) ])) - (constr 1 - [ (constr 0 - [ (constr 2 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) + [ (cse + 10) + , cse ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ (cse + 100) + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 0 [ (constr 0 [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + , cse ]) , (constr 0 [ ]) ])) - (constr 1 - [ cse - , (constr 0 - [ ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 1000000 + , (constr 0 + [ ]) ]) ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 2 + [ ]) + , cse ]) , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) - (cse - 100)) - (cse - 1)) - (cse 10)) - (constr 0 - [ (constr 1 - []) - , cse ])) - (cse 1)) - (cse 2)) + (constr 1 + [ cse + , (constr 0 + [ ]) ])) + (constr 1 + [ (cse + 1) + , (constr 0 + [ ]) ])) + (constr 1 + [ cse + , (constr 0 + [ ]) ])) + (cse 4)) + (constr 0 + [ (constr 1 + []) + , cse ])) + (cse 1)) (constr 0 [ (constr 1 []) , (constr 1 [ 1 , (constr 0 [ ]) ]) ])) - (cse 4)) - (cse 5)) - (unsafeRatio 9)) + (cse 2)) + (cse 10)) + (unsafeRatio 4)) (unsafeRatio 1)) - (unsafeRatio 0)) + (unsafeRatio 51)) (constr 1 [0, (constr 0 [])])) - (unsafeRatio 4)) + (unsafeRatio 0)) (unsafeRatio 3)) - (unsafeRatio 51)) + (unsafeRatio 9)) ((\s -> s s) (\s arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 0 [])) - (delay - ((\x -> - constr 1 - [ (constr 0 - [ (force - (force fstPair) - x) - , (force - (force sndPair) - x) ]) - , (force - (s - s - (delay (\x -> x))) - (force tailList - xs)) ]) - (force headList xs)))))) + case + xs + [ (constr 0 []) + , (\x xs -> + constr 1 + [ (constr 0 + [ (force (force fstPair) + x) + , (force (force sndPair) + x) ]) + , (force + (s s (delay (\x -> x))) + xs) ]) ])) (delay (\x -> x)))) (cse (\arg_0 arg_1 -> arg_1))) (cse (\arg_0 arg_1 -> arg_0))) diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden index ab07ac44fb7..696ee7741d6 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.cbor.size.golden @@ -1 +1 @@ -2043 \ No newline at end of file +2030 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden index e92f85090bb..6f81fb5d17e 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.large.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 438310709, exBudgetMemory = ExMemory 2159780} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 420475505, exBudgetMemory = ExMemory 2102068} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden index f27ac2bb978..7bf7bbd1ed2 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.pir.golden @@ -486,14 +486,7 @@ program a = pair data data in /\r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r}) + \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f]) {List (Tuple2 data data)} (Nil {Tuple2 data data}) (\(x : pair data data) (xs : list (pair data data)) -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden index 63354a63efa..f54fd96416d 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.small.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 62444110, exBudgetMemory = ExMemory 280702} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 61597309, exBudgetMemory = ExMemory 277974} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden index 1ea51fc169b..9b87c70ed67 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.uplc.golden @@ -717,19 +717,22 @@ program (constr 3 [ (constr 1 [ cse - , cse ]) ])) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ])) (constr 3 [ (constr 1 [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ])) + , cse ]) ])) (constr 3 [ (constr 1 [ cse @@ -739,10 +742,7 @@ program [ ]) , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ]) ]) ])) (constr 1 @@ -765,7 +765,8 @@ program , (constr 1 [ cse , (constr 1 - [ cse + [ (cse + 10) , (constr 0 [ ]) ]) ]) ]) , (constr 0 @@ -819,8 +820,7 @@ program , (constr 0 [ ]) ])) (constr 1 - [ (cse - 4) + [ cse , (constr 0 [ ]) ])) (constr 1 @@ -829,63 +829,52 @@ program [ ]) ])) (constr 1 [ (cse - 1) + 4) , (constr 0 [ ]) ])) (cse - 5)) - (cse - 10)) - (constr 0 - [ (constr 1 - [ ]) - , cse ])) - (constr 0 - [ (constr 1 - []) - , (constr 1 - [ 1 - , (constr 0 - [ ]) ]) ])) - (cse 100)) - (cse 2)) - (cse 10)) - (cse 1)) - (unsafeRatio 9)) - (unsafeRatio 1)) - (unsafeRatio 0)) - (unsafeRatio 4)) - (constr 1 [0, (constr 0 [])])) - (unsafeRatio 3)) - (unsafeRatio 51)) + 1)) + (constr 0 + [ (constr 1 + [ ]) + , cse ])) + (cse 10)) + (cse 5)) + (cse 1)) + (cse 100)) + (cse 2)) + (constr 0 + [ (constr 1 []) + , (constr 1 + [ 1 + , (constr 0 + []) ]) ])) + (unsafeRatio 1)) + (unsafeRatio 0)) + (unsafeRatio 51)) + (unsafeRatio 9)) + (unsafeRatio 4)) + (constr 1 [0, (constr 0 [])])) + (unsafeRatio 3)) ((\s -> s s) (\s arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 0 [])) - (delay - ((\x xs -> - constr 1 - [ (constr 0 - [ (force - (force - fstPair) - x) - , (force - (force - sndPair) - x) ]) + case + xs + [ (constr 0 []) + , (\x xs -> + constr 1 + [ (constr 0 + [ (force + (force fstPair) + x) , (force - (s - s - (delay - (\x -> x))) - xs) ]) - (force headList xs) - (force tailList xs)))))) + (force sndPair) + x) ]) + , (force + (s s (delay (\x -> x))) + xs) ]) ])) (delay (\x -> x)))) ((\s -> s s) (\s ds cparams -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden index 94589f6139c..810c4ddf172 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.cbor.size.golden @@ -1 +1 @@ -2041 \ No newline at end of file +2025 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden index e9140a955c2..ba4581d4110 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.large.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 600819564, exBudgetMemory = ExMemory 3033615} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 582936360, exBudgetMemory = ExMemory 2975603} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden index 4c3d0fa342b..686ddd98731 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.pir.golden @@ -416,14 +416,7 @@ program a = pair data data in /\r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r}) + \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f]) {List (Tuple2 data data)} (Nil {Tuple2 data data}) (\(x : pair data data) (xs : list (pair data data)) -> diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden index c6e1335a404..ec0f6578812 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.small.budget.golden @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 60906367, exBudgetMemory = ExMemory 272203} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 60011566, exBudgetMemory = ExMemory 269175} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden index 83133d50b48..0b5243ae489 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.uplc.golden @@ -38,739 +38,734 @@ program (\cse -> (\cse -> (\cse -> - (\cse -> - (\cfg -> - (\fun - ds -> - case - ((\ds -> - (\x -> - case - (equalsInteger - 0 - x) - [ (case - (equalsInteger - 2 - x) - [ error - , (constr 1 - [ ]) ]) - , (constr 0 - [ ((\d -> - force - caseData_go - (unMapData - d)) + (\cfg -> + (\fun + ds -> + case + ((\ds -> + (\x -> + case + (equalsInteger + 0 + x) + [ (case + (equalsInteger + 2 + x) + [ error + , (constr 1 + [ ]) ]) + , (constr 0 + [ ((\d -> + force + caseData_go + (unMapData + d)) + (force + headList (force - headList + tailList (force - tailList (force - (force - sndPair) - ds)))) ]) ]) + sndPair) + ds)))) ]) ]) + (force (force - (force - fstPair) - ds)) - (unConstrData + fstPair) + ds)) + (unConstrData + (force + headList (force - headList + tailList (force tailList (force - tailList (force - (force - sndPair) - (unConstrData - ((\si -> - case - (equalsInteger - 5 + sndPair) + (unConstrData + ((\si -> + case + (equalsInteger + 5 + (force (force - (force - fstPair) - si)) - [ error - , (force - headList + fstPair) + si)) + [ error + , (force + headList + (force + tailList (force - tailList (force - (force - sndPair) - si))) ]) - (unConstrData + sndPair) + si))) ]) + (unConstrData + (force + headList (force - headList + tailList (force tailList (force - tailList (force - (force - sndPair) - (unConstrData - ds)))))))))))))) - [ (\cparams -> - case - (fun - cparams) - [ () - , error ]) - , () ]) - ((\go - eta -> - go - eta) - ((\s -> - s - s) - (\s - ds -> - case - ds - [ (constr 0 - [ ]) - , (\x - xs -> - case - (case - x - [ (\ds - actualValueData -> - validateParamValue - ((\k -> - (\s -> - s - s) - (\s - ds -> - case - ds - [ error - , (\ds - xs' -> - case - ds - [ (\k' - i -> - case - (equalsInteger - k - k') - [ (s - s - xs') - , i ]) ]) ])) - (unIData - ds) - cfg) - actualValueData) ]) - [ (s - s - xs) - , (constr 1 - [ ]) ]) ])))) - (constr 1 - [ (constr 0 - [ 0 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 30 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 1000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 1 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 2 + sndPair) + (unConstrData + ds)))))))))))))) + [ (\cparams -> + case + (fun + cparams) + [ () + , error ]) + , () ]) + ((\go + eta -> + go + eta) + ((\s -> + s + s) + (\s + ds -> + case + ds + [ (constr 0 + [ ]) + , (\x + xs -> + case + (case + x + [ (\ds + actualValueData -> + validateParamValue + ((\k -> + (\s -> + s + s) + (\s + ds -> + case + ds + [ error + , (\ds + xs' -> + case + ds + [ (\k' + i -> + case + (equalsInteger + k + k') + [ (s + s + xs') + , i ]) ]) ])) + (unIData + ds) + cfg) + actualValueData) ]) + [ (s + s + xs) , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 24576 - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 122880 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 3 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 32768 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 4 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 5 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 1000000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 6 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250000000 - , cse ]) ]) - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 7 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 8 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 2000 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 9 - , (constr 3 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 10 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 1000) - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 200) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 11 - , (constr 3 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 10) - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 16 - , (constr 1 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 17 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 3000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 6500 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 18 - , (constr 0 - [ ]) ]) - , (constr 1 - [ (constr 0 - [ 19 - , (constr 2 - [ (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 25) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 20000) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5000) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 20 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 21 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 120000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 22 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 12288 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 23 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 200 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 24 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 25 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , cse ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 26 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ (unsafeRatio - 13 - 20) - , (constr 0 - [ ]) ]) ]) ]) - , cse ]) ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , cse ]) ]) - , cse ]) ]) - , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 27 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 3 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 28 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 18 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 293 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 29 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 30 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 31 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 100000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 32 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 13 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 37 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 33 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , cse ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (unsafeRatio - 1000 - 1) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) - (constr 3 - [ (constr 1 - [ cse - , cse ]) ])) + [ ]) ]) ])))) + (constr 1 + [ (constr 0 + [ 0 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 30 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 1000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 1 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 2 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 24576 + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 122880 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 3 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 32768 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 4 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 5 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 1000000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 6 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250000000 + , cse ]) ]) + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 7 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 8 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 2000 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 9 + , (constr 3 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 10 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 1000) + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 200) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 11 + , (constr 3 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 10) + , cse ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 16 + , (constr 1 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 17 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 3000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 6500 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 18 + , (constr 0 + [ ]) ]) + , (constr 1 + [ (constr 0 + [ 19 + , (constr 2 + [ (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 25) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 20000) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5000) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 20 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 21 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 120000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 22 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 12288 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 23 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 200 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 24 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 25 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , cse ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 26 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ (unsafeRatio + 13 + 20) + , (constr 0 + [ ]) ]) ]) ]) + , cse ]) ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , cse ]) ]) + , cse ]) ]) + , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 27 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 3 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 28 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 18 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 293 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 29 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 30 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 31 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 100000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 32 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 13 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 37 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 33 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , cse ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (unsafeRatio + 1000 + 1) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) (constr 3 [ (constr 1 [ cse @@ -780,10 +775,7 @@ program [ ]) , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ]) ]) ])) (constr 3 @@ -795,85 +787,88 @@ program [ ]) , (constr 1 [ cse - , cse ]) ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) ]) , (constr 0 [ ]) ]) ]) ])) - (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) - , (constr 0 - [ ]) ])) + (constr 3 + [ (constr 1 + [ cse + , cse ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse + (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) , (constr 1 [ cse - , (constr 0 - [ ]) ]) ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 - [ (cse - 10) + [ cse , cse ]) ])) - (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 1000000 - , (constr 0 - [ ]) ]) ]) ])) - (constr 1 - [ (constr 0 - [ (constr 2 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ])) + (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , cse ]) + , (constr 0 + [ ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 1000000 + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 0 - [ (constr 0 + [ (constr 2 [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + , cse ]) , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 @@ -881,60 +876,55 @@ program , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (cse + 1) , (constr 0 [ ]) ])) - (cse - 2)) + (constr 1 + [ cse + , (constr 0 + [ ]) ])) (cse 1)) - (cse 4)) + (cse 10)) (constr 0 [ (constr 1 []) , cse ])) - (cse 100)) + (cse 2)) (cse 10)) - (cse 1)) + (cse 100)) (constr 0 [ (constr 1 []) , (constr 1 [ 1 , (constr 0 []) ]) ])) - (cse 5)) - (unsafeRatio 0)) - (unsafeRatio 4)) - (unsafeRatio 51)) - (constr 1 [0, (constr 0 [])])) - (unsafeRatio 9)) - (unsafeRatio 3)) + (cse 4)) + (unsafeRatio 9)) + (unsafeRatio 3)) + (unsafeRatio 4)) + (unsafeRatio 0)) + (constr 1 [0, (constr 0 [])])) + (unsafeRatio 51)) (unsafeRatio 1)) ((\s -> s s) (\s arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 0 [])) - (delay - ((\x xs -> - constr 1 - [ (constr 0 - [ (force - (force fstPair) - x) - , (force - (force sndPair) - x) ]) - , (force - (s - s - (delay (\x -> x))) - xs) ]) - (force headList xs) - (force tailList xs)))))) + case + xs + [ (constr 0 []) + , (\x xs -> + constr 1 + [ (constr 0 + [ (force (force fstPair) + x) + , (force (force sndPair) + x) ]) + , (force + (s s (delay (\x -> x))) + xs) ]) ])) (delay (\x -> x)))) (cse (\arg_0 arg_1 -> arg_1))) (cse (\arg_0 arg_1 -> arg_0))) diff --git a/nix/shell.nix b/nix/shell.nix index 56567465b63..e04ce71c1b4 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -69,6 +69,7 @@ let ]; common-pkgs = [ + pkgs.ghcid agda-tools.agda agda-tools.agda-with-stdlib agda-tools.agda-mode diff --git a/plutus-benchmark/bitwise/test/9.6/Ed25519.uplc.golden b/plutus-benchmark/bitwise/test/9.6/Ed25519.uplc.golden index 7dbdba8101e..f31b10a7494 100644 --- a/plutus-benchmark/bitwise/test/9.6/Ed25519.uplc.golden +++ b/plutus-benchmark/bitwise/test/9.6/Ed25519.uplc.golden @@ -969,7 +969,7 @@ (case ds [ (\w - rest -> + cont -> w) ])) (case ds @@ -984,7 +984,7 @@ (case ds [ (\w - cont -> + rest -> w) ])) ]) (next ipv)) ]) diff --git a/plutus-benchmark/casing/bench/Bench.hs b/plutus-benchmark/casing/bench/Bench.hs new file mode 100644 index 00000000000..646d1786e4a --- /dev/null +++ b/plutus-benchmark/casing/bench/Bench.hs @@ -0,0 +1,39 @@ +{-# LANGUAGE BangPatterns #-} + +{- | This benchmark cases measures efficiency of builtin case operations. Each branches exclusively + contain casing operations only. +-} + +module Main (main) where + +import Criterion.Main + +import PlutusBenchmark.Common (benchTermCek, getConfig, mkMostRecentEvalCtx) +import PlutusLedgerApi.Common (EvaluationContext) + +import PlutusBenchmark.Casing qualified as Casing + +import Control.Exception +import Data.Functor + +benchmarks :: EvaluationContext -> [Benchmark] +benchmarks ctx = + [ bgroup "casing" + [mkBMs "bool" Casing.casingBool + , mkBMs "bool one branch" Casing.casingBoolOneBranch + , mkBMs "integer" Casing.casingInteger + , mkBMs "list" Casing.casingList + , mkBMs "list one branch" Casing.casingListOneBranch + ] + ] + where + mkBMs name f = + bgroup name $ [2000, 4000..12000] <&> \n -> + bench (show n) $ benchTermCek ctx (f n) + +main :: IO () +main = do + -- Run each benchmark for at least 15 seconds. Change this with -L or --timeout. + config <- getConfig 15.0 + evalCtx <- evaluate mkMostRecentEvalCtx + defaultMainWith config $ benchmarks evalCtx diff --git a/plutus-benchmark/casing/src/PlutusBenchmark/Casing.hs b/plutus-benchmark/casing/src/PlutusBenchmark/Casing.hs new file mode 100644 index 00000000000..0da14646b49 --- /dev/null +++ b/plutus-benchmark/casing/src/PlutusBenchmark/Casing.hs @@ -0,0 +1,100 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} + +module PlutusBenchmark.Casing where + +import Control.Monad.Except +import Data.Either +import PlutusBenchmark.Common (Term) +import PlutusCore (DefaultUni (..), SomeTypeIn (..), Type (..), freshName, runQuote, someValueOf) +import PlutusCore.MkPlc +import UntypedPlutusCore qualified as UPLC + +debruijnTermUnsafe :: UPLC.Term UPLC.Name uni fun ann + -> UPLC.Term UPLC.NamedDeBruijn uni fun ann +debruijnTermUnsafe = + fromRight (Prelude.error "debruijnTermUnsafe") . runExcept @UPLC.FreeVariableError . UPLC.deBruijnTerm + +nonMatchingBranch :: TermLike term tyname name UPLC.DefaultUni UPLC.DefaultFun => term () +nonMatchingBranch = constant () $ someValueOf DefaultUniInteger $ -1 + +-- Note that we don't need to generate casings for the none maching branches because +-- only matching branches get executed. +-- | Generate a term that does a lot of casing on boolean +casingBool :: Integer -> Term +casingBool 0 = constant () $ someValueOf DefaultUniInteger 42 +casingBool i + | i `mod` 2 == 0 = + kase () + (TyBuiltin () (SomeTypeIn DefaultUniInteger)) + (constant () $ someValueOf DefaultUniBool False) + [casingBool (i-1), nonMatchingBranch] + | otherwise = + kase () + (TyBuiltin () (SomeTypeIn DefaultUniInteger)) + (constant () $ someValueOf DefaultUniBool True) + [nonMatchingBranch, casingBool (i-1)] + +casingBoolOneBranch :: Integer -> Term +casingBoolOneBranch 0 = constant () $ someValueOf DefaultUniInteger 42 +casingBoolOneBranch i = + kase () + (TyBuiltin () (SomeTypeIn DefaultUniInteger)) + (constant () $ someValueOf DefaultUniBool False) + [casingBoolOneBranch (i-1)] + +casingInteger :: Integer -> Term +casingInteger 0 = constant () $ someValueOf DefaultUniInteger 42 +casingInteger i = + let + numBranches = 5 + -- 5 is arbitrary, this indicates the number of branches to have on each casing + currentI = i `mod` numBranches + in kase () + (TyBuiltin () (SomeTypeIn DefaultUniInteger)) + (constant () $ someValueOf DefaultUniInteger currentI) + (replicate (fromIntegral currentI) nonMatchingBranch + <> [casingInteger (i-1)] + <> replicate (fromIntegral $ numBranches - 1 - currentI) nonMatchingBranch + ) + +listConsHandler + :: TermLike term tyname UPLC.Name UPLC.DefaultUni UPLC.DefaultFun + => (term () -> term () -> term ()) -> term () +listConsHandler f = runQuote $ do + x <- freshName "x" + xs <- freshName "xs" + pure $ + lamAbs () x (TyBuiltin () (SomeTypeIn DefaultUniInteger)) $ + lamAbs () xs (TyBuiltin () (SomeTypeIn $ DefaultUniApply DefaultUniProtoList DefaultUniInteger)) $ + f (var () x) (var () xs) + + +casingList :: Integer -> Term +casingList i = debruijnTermUnsafe $ go i arg + where + arg = + constant () $ + someValueOf (DefaultUniApply DefaultUniProtoList DefaultUniInteger) $ replicate (fromIntegral i) 42 + + go 0 t = t + go n t = + kase () + (TyBuiltin () (SomeTypeIn $ DefaultUniApply DefaultUniProtoList DefaultUniInteger)) + t + [nonMatchingBranch, listConsHandler (\_x xs -> go (n-1) xs)] + + +casingListOneBranch :: Integer -> Term +casingListOneBranch i = debruijnTermUnsafe $ go i arg + where + arg = + constant () $ + someValueOf (DefaultUniApply DefaultUniProtoList DefaultUniInteger) $ replicate (fromIntegral i) 42 + + go 0 t = t + go n t = + kase () + (TyBuiltin () (SomeTypeIn $ DefaultUniApply DefaultUniProtoList DefaultUniInteger)) + t + [listConsHandler (\_x xs -> go (n-1) xs)] diff --git a/plutus-benchmark/ed25519-costs/test/9.6/ed25519-costs.golden b/plutus-benchmark/ed25519-costs/test/9.6/ed25519-costs.golden index 793b0d69a26..235a5768568 100644 --- a/plutus-benchmark/ed25519-costs/test/9.6/ed25519-costs.golden +++ b/plutus-benchmark/ed25519-costs/test/9.6/ed25519-costs.golden @@ -1,20 +1,20 @@ n Script size CPU usage Memory usage ---------------------------------------------------------------------- - 0 403 (2.5%) 4494392 (0.0%) 22221 (0.2%) - 10 2130 (13.0%) 633398222 (6.3%) 447021 (3.2%) - 20 3857 (23.5%) 1262302052 (12.6%) 871821 (6.2%) - 30 5584 (34.1%) 1891205882 (18.9%) 1296621 (9.3%) - 40 7311 (44.6%) 2520109712 (25.2%) 1721421 (12.3%) - 50 9037 (55.2%) 3149013542 (31.5%) 2146221 (15.3%) - 60 10764 (65.7%) 3777917372 (37.8%) 2571021 (18.4%) - 70 12491 (76.2%) 4406821202 (44.1%) 2995821 (21.4%) - 80 14217 (86.8%) 5035725032 (50.4%) 3420621 (24.4%) - 90 15944 (97.3%) 5664628862 (56.6%) 3845421 (27.5%) - 100 17671 (107.9%) 6293532692 (62.9%) 4270221 (30.5%) - 110 19398 (118.4%) 6922436522 (69.2%) 4695021 (33.5%) - 120 21124 (128.9%) 7551340352 (75.5%) 5119821 (36.6%) - 130 22851 (139.5%) 8180244182 (81.8%) 5544621 (39.6%) - 140 24578 (150.0%) 8809148012 (88.1%) 5969421 (42.6%) - 150 26305 (160.6%) 9438051842 (94.4%) 6394221 (45.7%) + 0 370 (2.3%) 3327591 (0.0%) 17493 (0.1%) + 10 2097 (12.8%) 596061071 (6.0%) 304493 (2.2%) + 20 3824 (23.3%) 1188794551 (11.9%) 591493 (4.2%) + 30 5551 (33.9%) 1781528031 (17.8%) 878493 (6.3%) + 40 7278 (44.4%) 2374261511 (23.7%) 1165493 (8.3%) + 50 9004 (55.0%) 2966994991 (29.7%) 1452493 (10.4%) + 60 10731 (65.5%) 3559728471 (35.6%) 1739493 (12.4%) + 70 12458 (76.0%) 4152461951 (41.5%) 2026493 (14.5%) + 80 14184 (86.6%) 4745195431 (47.5%) 2313493 (16.5%) + 90 15911 (97.1%) 5337928911 (53.4%) 2600493 (18.6%) + 100 17638 (107.7%) 5930662391 (59.3%) 2887493 (20.6%) + 110 19365 (118.2%) 6523395871 (65.2%) 3174493 (22.7%) + 120 21091 (128.7%) 7116129351 (71.2%) 3461493 (24.7%) + 130 22818 (139.3%) 7708862831 (77.1%) 3748493 (26.8%) + 140 24545 (149.8%) 8301596311 (83.0%) 4035493 (28.8%) + 150 26272 (160.4%) 8894329791 (88.9%) 4322493 (30.9%) Off-chain version succeeded on 100 inputs diff --git a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-10.eval.golden b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-10.eval.golden index 0094d9dce66..035bc5e2c10 100644 --- a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-10.eval.golden +++ b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-10.eval.golden @@ -1,6 +1,6 @@ -CPU: 162_153_514 -Memory: 678_042 -Term Size: 144 -Flat Size: 198 +CPU: 66_825_610 +Memory: 312_530 +Term Size: 108 +Flat Size: 170 (con integer 155) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-100.eval.golden b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-100.eval.golden index 4d1507c8016..2f17e643b56 100644 --- a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-100.eval.golden +++ b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-100.eval.golden @@ -1,6 +1,6 @@ -CPU: 13_307_125_294 -Memory: 55_324_332 -Term Size: 144 -Flat Size: 781 +CPU: 5_789_660_200 +Memory: 26_523_500 +Term Size: 108 +Flat Size: 753 (con integer 15050) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-5.eval.golden b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-5.eval.golden index a15b42fceb1..7f33cdc35d7 100644 --- a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-5.eval.golden +++ b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-5.eval.golden @@ -1,6 +1,6 @@ -CPU: 49_067_604 -Memory: 206_662 -Term Size: 144 -Flat Size: 176 +CPU: 19_422_330 +Memory: 92_790 +Term Size: 108 +Flat Size: 148 (con integer 40) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-50.eval.golden b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-50.eval.golden index d9b61693a7b..7bc55d1b8c2 100644 --- a/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-50.eval.golden +++ b/plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-50.eval.golden @@ -1,6 +1,6 @@ -CPU: 3_405_667_194 -Memory: 14_167_282 -Term Size: 144 -Flat Size: 397 +CPU: 1_471_225_650 +Memory: 6_755_850 +Term Size: 108 +Flat Size: 369 (con integer 3775) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Sum/9.6/left-fold-built-in.eval.golden b/plutus-benchmark/lists/test/Sum/9.6/left-fold-built-in.eval.golden index b8e527bdff5..b827f9d2f93 100644 --- a/plutus-benchmark/lists/test/Sum/9.6/left-fold-built-in.eval.golden +++ b/plutus-benchmark/lists/test/Sum/9.6/left-fold-built-in.eval.golden @@ -1,6 +1,6 @@ -CPU: 122_258_594 -Memory: 523_832 -Term Size: 78 -Flat Size: 220 +CPU: 63_416_900 +Memory: 333_400 +Term Size: 60 +Flat Size: 207 (con integer 5050) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Sum/9.6/left-fold-data.eval.golden b/plutus-benchmark/lists/test/Sum/9.6/left-fold-data.eval.golden index 482d70bac59..11e24147d45 100644 --- a/plutus-benchmark/lists/test/Sum/9.6/left-fold-data.eval.golden +++ b/plutus-benchmark/lists/test/Sum/9.6/left-fold-data.eval.golden @@ -1,6 +1,6 @@ -CPU: 272_169_783 -Memory: 1_096_129 -Term Size: 159 -Flat Size: 723 +CPU: 213_589_083 +Memory: 906_529 +Term Size: 141 +Flat Size: 710 (con integer 5050) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Sum/9.6/right-fold-built-in.eval.golden b/plutus-benchmark/lists/test/Sum/9.6/right-fold-built-in.eval.golden index 48bd25de195..32c890149a1 100644 --- a/plutus-benchmark/lists/test/Sum/9.6/right-fold-built-in.eval.golden +++ b/plutus-benchmark/lists/test/Sum/9.6/right-fold-built-in.eval.golden @@ -1,6 +1,6 @@ -CPU: 127_058_594 -Memory: 553_832 -Term Size: 81 -Flat Size: 223 +CPU: 68_216_900 +Memory: 363_400 +Term Size: 63 +Flat Size: 210 (con integer 5050) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Sum/9.6/right-fold-data.eval.golden b/plutus-benchmark/lists/test/Sum/9.6/right-fold-data.eval.golden index f09aeb6120a..2dbd70c8e55 100644 --- a/plutus-benchmark/lists/test/Sum/9.6/right-fold-data.eval.golden +++ b/plutus-benchmark/lists/test/Sum/9.6/right-fold-data.eval.golden @@ -1,6 +1,6 @@ -CPU: 276_969_783 -Memory: 1_126_129 -Term Size: 162 -Flat Size: 725 +CPU: 218_389_083 +Memory: 936_529 +Term Size: 144 +Flat Size: 712 (con integer 5050) \ No newline at end of file diff --git a/plutus-benchmark/plutus-benchmark.cabal b/plutus-benchmark/plutus-benchmark.cabal index 2998b5ee1c9..c20ab263125 100644 --- a/plutus-benchmark/plutus-benchmark.cabal +++ b/plutus-benchmark/plutus-benchmark.cabal @@ -254,6 +254,30 @@ test-suite plutus-benchmark-lists-tests , tasty , tasty-quickcheck +---------------- casing ---------------- + +library casing-internal + import: lang, ghc-version-support, os-support + hs-source-dirs: casing/src + exposed-modules: PlutusBenchmark.Casing + build-depends: + , base >=4.9 && <5 + , mtl + , plutus-benchmark-common + , plutus-core ^>=1.49 + +benchmark casing + import: lang, ghc-version-support, os-support + type: exitcode-stdio-1.0 + main-is: Bench.hs + hs-source-dirs: casing/bench + build-depends: + , base >=4.9 && <5 + , casing-internal + , criterion >=1.5.9.0 + , plutus-benchmark-common + , plutus-ledger-api ^>=1.49 + ---------------- validation ---------------- benchmark validation diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-20.eval.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-20.eval.golden index 09c2669da22..558987dca7c 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 239_576_808 -Memory: 906_600 -Term Size: 1_391 -Flat Size: 1_977 +CPU: 186_924_676 +Memory: 721_804 +Term Size: 1_349 +Flat Size: 1_948 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-4.eval.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-4.eval.golden index 4569973a259..8b90b7684a0 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 67_117_032 -Memory: 256_248 -Term Size: 1_391 -Flat Size: 1_591 +CPU: 54_007_444 +Memory: 208_284 +Term Size: 1_349 +Flat Size: 1_562 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.pir.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.pir.golden index 7eb166d9bf0..e21520bd9b3 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.pir.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.pir.golden @@ -70,6 +70,36 @@ (headList {data} (tailList {data} args)))) (/\dead -> traceError {Tuple2 a b} "PT1") {all dead. dead} + in + letrec + !go : list data -> List (Tuple2 bytestring data) + = \(xs : list data) -> + case + (List (Tuple2 bytestring data)) + xs + [ (Nil {Tuple2 bytestring data}) + , (\(x : data) (xs : list data) -> + Cons + {Tuple2 bytestring data} + (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` + {bytestring} + {data} + unBData + (\(d : data) -> d) + x) + (go xs)) ] + in + letrec + !go : list data -> List bytestring + = \(xs : list data) -> + case + (List bytestring) + xs + [ (Nil {bytestring}) + , (\(x : data) (xs : list data) -> + Cons {bytestring} (unBData x) (go xs)) ] + in + let !`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` : data -> Credential = \(d : data) -> let @@ -119,6 +149,28 @@ (/\dead -> traceError {StakingCredential} "PT1") {all dead. dead}) {all dead. dead} + in + letrec + !go : + list data -> List (Tuple2 StakingCredential integer) + = \(xs : list data) -> + case + (List (Tuple2 StakingCredential integer)) + xs + [ (Nil {Tuple2 StakingCredential integer}) + , (\(x : data) + (xs : list data) -> + Cons + {Tuple2 StakingCredential integer} + (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` + {StakingCredential} + {integer} + `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + unIData + x) + (go xs)) ] + in + let data DCert | DCert_match where DCertDelegDeRegKey : StakingCredential -> DCert DCertDelegDelegate : StakingCredential -> bytestring -> DCert @@ -206,89 +258,21 @@ {all dead. dead}) {all dead. dead}) {all dead. dead} - !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> traceError {Bool} "PT1") - {all dead. dead}) - {all dead. dead} - data (Extended :: * -> *) a | Extended_match where - Finite : a -> Extended a - NegInf : Extended a - PosInf : Extended a - !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : - all a. (\a -> data -> a) a -> data -> Extended a - = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Extended a} - (/\dead -> NegInf {a}) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Extended a} - (/\dead -> - Finite {a} (`$dUnsafeFromData` (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Extended a} - (/\dead -> PosInf {a}) - (/\dead -> traceError {Extended a} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} - !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. bytestring} - (/\dead -> unBData (headList {data} args)) - (/\dead -> traceError {bytestring} "PT1") - {all dead. dead} - data TxOutRef | TxOutRef_match where - TxOutRef : bytestring -> integer -> TxOutRef - !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. TxOutRef} - (/\dead -> - TxOutRef - (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` - (headList {data} args)) - (unIData (headList {data} (tailList {data} args)))) - (/\dead -> traceError {TxOutRef} "PT1") - {all dead. dead} + in + letrec + !go : list data -> List DCert + = \(xs : list data) -> + case + (List DCert) + xs + [ (Nil {DCert}) + , (\(x : data) (xs : list data) -> + Cons + {DCert} + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let !`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` : all a. (\a -> data -> a) a -> data -> Maybe a = /\a -> @@ -311,16 +295,6 @@ (/\dead -> traceError {Maybe a} "PT1") {all dead. dead}) {all dead. dead} - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} !`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` : all k v. (\a -> data -> a) k -> @@ -329,25 +303,27 @@ (\k v -> List (Tuple2 k v)) k v = /\k v -> \(`$dUnsafeFromData` : (\a -> data -> a) k) - (`$dUnsafeFromData` : (\a -> data -> a) v) - (d : data) -> + (`$dUnsafeFromData` : (\a -> data -> a) v) -> letrec !go : list (pair data data) -> List (Tuple2 k v) - = caseList' - {pair data data} - {List (Tuple2 k v)} - (Nil {Tuple2 k v}) - (\(tup : pair data data) (tups : list (pair data data)) -> - Cons - {Tuple2 k v} - (Tuple2 - {k} - {v} - (`$dUnsafeFromData` (fstPair {data} {data} tup)) - (`$dUnsafeFromData` (sndPair {data} {data} tup))) - (go tups)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 k v)) + xs + [ (Nil {Tuple2 k v}) + , (\(tup : pair data data) + (tups : list (pair data data)) -> + Cons + {Tuple2 k v} + (Tuple2 + {k} + {v} + (`$dUnsafeFromData` (fstPair {data} {data} tup)) + (`$dUnsafeFromData` + (sndPair {data} {data} tup))) + (go tups)) ] in - go (unMapData d) + \(d : data) -> go (unMapData d) ~`$fUnsafeFromDataValue` : data -> (\k v -> List (Tuple2 k v)) bytestring integer = `$fUnsafeFromDataMap_$cunsafeFromBuiltinData` @@ -402,6 +378,136 @@ (headList {data} (tailList {data} l)))) (/\dead -> traceError {TxOut} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxOut + = \(xs : list data) -> + case + (List TxOut) + xs + [ (Nil {TxOut}) + , (\(x : data) (xs : list data) -> + Cons + {TxOut} + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. bytestring} + (/\dead -> unBData (headList {data} args)) + (/\dead -> traceError {bytestring} "PT1") + {all dead. dead} + data TxOutRef | TxOutRef_match where + TxOutRef : bytestring -> integer -> TxOutRef + !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxOutRef} + (/\dead -> + TxOutRef + (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + (headList {data} args)) + (unIData (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxOutRef} "PT1") + {all dead. dead} + data TxInInfo | TxInInfo_match where + TxInInfo : TxOutRef -> TxOut -> TxInInfo + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (let + !tup : pair integer (list data) = unConstrData x + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxInInfo} + (/\dead -> + TxInInfo + (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` + (headList {data} args)) + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` + (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxInInfo} "PT1") + {all dead. dead}) + (go xs)) ] + in + let + !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> traceError {Bool} "PT1") + {all dead. dead}) + {all dead. dead} + data (Extended :: * -> *) a | Extended_match where + Finite : a -> Extended a + NegInf : Extended a + PosInf : Extended a + !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : + all a. (\a -> data -> a) a -> data -> Extended a + = /\a -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Extended a} + (/\dead -> NegInf {a}) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Extended a} + (/\dead -> + Finite {a} (`$dUnsafeFromData` (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Extended a} + (/\dead -> PosInf {a}) + (/\dead -> traceError {Extended a} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} data ScriptPurpose | ScriptPurpose_match where Certifying : DCert -> ScriptPurpose Minting : bytestring -> ScriptPurpose @@ -413,8 +519,6 @@ UpperBound : Extended a -> Bool -> UpperBound a data (Interval :: * -> *) a | Interval_match where Interval : LowerBound a -> UpperBound a -> Interval a - data TxInInfo | TxInInfo_match where - TxInInfo : TxOutRef -> TxOut -> TxInInfo data TxInfo | TxInfo_match where TxInfo : List TxInInfo -> @@ -471,62 +575,10 @@ (let !d : data = headList {data} args in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (let - !tup : pair integer (list data) - = unConstrData x - !index : integer - = fstPair {integer} {list data} tup - !args : list data - = sndPair {integer} {list data} tup - in - Bool_match - (case - Bool - (equalsInteger 0 index) - [False, True]) - {all dead. TxInInfo} - (/\dead -> - TxInInfo - (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` - (headList {data} args)) - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - (headList - {data} - (tailList {data} args)))) - (/\dead -> traceError {TxInInfo} "PT1") - {all dead. dead}) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxOut - = caseList' - {data} - {List TxOut} - (Nil {TxOut}) - (\(x : data) - (xs : list data) -> - Cons - {TxOut} - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {bytestring} @@ -543,44 +595,10 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List DCert - = caseList' - {data} - {List DCert} - (Nil {DCert}) - (\(x : data) - (xs : list data) -> - Cons - {DCert} - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List (Tuple2 StakingCredential integer) - = caseList' - {data} - {List (Tuple2 StakingCredential integer)} - (Nil {Tuple2 StakingCredential integer}) - (\(x : data) - (xs : list data) -> - Cons - {Tuple2 StakingCredential integer} - (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` - {StakingCredential} - {integer} - `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - unIData - x) - (go xs)) - in go (unListData d)) (let !tup : pair integer (list data) @@ -644,38 +662,10 @@ (let !d : data = headList {data} l in - letrec - !go : list data -> List bytestring - = caseList' - {data} - {List bytestring} - (Nil {bytestring}) - (\(x : data) (xs : list data) -> - Cons {bytestring} (unBData x) (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List (Tuple2 bytestring data) - = caseList' - {data} - {List (Tuple2 bytestring data)} - (Nil {Tuple2 bytestring data}) - (\(x : data) - (xs : list data) -> - Cons - {Tuple2 bytestring data} - (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` - {bytestring} - {data} - unBData - (\(d : data) -> d) - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` (headList {data} (tailList {data} l)))) diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.size.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.size.golden index 6f5d72eacc7..90dfef95162 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.size.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1.size.golden @@ -1 +1 @@ -1391 \ No newline at end of file +1349 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-20.eval.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-20.eval.golden index d8055ea2a22..ae58fb263a9 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 231_352_385 -Memory: 868_958 -Term Size: 1_331 -Flat Size: 1_900 +CPU: 179_644_253 +Memory: 690_062 +Term Size: 1_292 +Flat Size: 1_873 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-4.eval.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-4.eval.golden index 2f88b47bfbf..b6bb8dc02a7 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 64_863_937 -Memory: 245_838 -Term Size: 1_331 -Flat Size: 1_514 +CPU: 51_930_349 +Memory: 198_974 +Term Size: 1_292 +Flat Size: 1_487 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.pir.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.pir.golden index e135b6c0f56..51fe9dd2e99 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.pir.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.pir.golden @@ -32,6 +32,41 @@ (headList {data} (tailList {data} args)))) (/\dead -> traceError {Tuple2 a b} "PT1") {all dead. dead} + in + letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a + in + letrec + !go : list data -> List (Tuple2 bytestring data) + = \(xs : list data) -> + case + (List (Tuple2 bytestring data)) + xs + [ (Nil {Tuple2 bytestring data}) + , (\(x : data) (xs : list data) -> + Cons + {Tuple2 bytestring data} + (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` + {bytestring} + {data} + unBData + (\(d : data) -> d) + x) + (go xs)) ] + in + letrec + !go : list data -> List bytestring + = \(xs : list data) -> + case + (List bytestring) + xs + [ (Nil {bytestring}) + , (\(x : data) (xs : list data) -> + Cons {bytestring} (unBData x) (go xs)) ] + in + let data Credential | Credential_match where PubKeyCredential : bytestring -> Credential ScriptCredential : bytestring -> Credential @@ -87,6 +122,28 @@ (/\dead -> traceError {StakingCredential} "PT1") {all dead. dead}) {all dead. dead} + in + letrec + !go : + list data -> List (Tuple2 StakingCredential integer) + = \(xs : list data) -> + case + (List (Tuple2 StakingCredential integer)) + xs + [ (Nil {Tuple2 StakingCredential integer}) + , (\(x : data) + (xs : list data) -> + Cons + {Tuple2 StakingCredential integer} + (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` + {StakingCredential} + {integer} + `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + unIData + x) + (go xs)) ] + in + let data DCert | DCert_match where DCertDelegDeRegKey : StakingCredential -> DCert DCertDelegDelegate : StakingCredential -> bytestring -> DCert @@ -174,89 +231,21 @@ {all dead. dead}) {all dead. dead}) {all dead. dead} - !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> traceError {Bool} "PT1") - {all dead. dead}) - {all dead. dead} - data (Extended :: * -> *) a | Extended_match where - Finite : a -> Extended a - NegInf : Extended a - PosInf : Extended a - !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : - all a. (\a -> data -> a) a -> data -> Extended a - = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Extended a} - (/\dead -> NegInf {a}) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Extended a} - (/\dead -> - Finite {a} (`$dUnsafeFromData` (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Extended a} - (/\dead -> PosInf {a}) - (/\dead -> traceError {Extended a} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} - !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. bytestring} - (/\dead -> unBData (headList {data} args)) - (/\dead -> traceError {bytestring} "PT1") - {all dead. dead} - data TxOutRef | TxOutRef_match where - TxOutRef : bytestring -> integer -> TxOutRef - !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. TxOutRef} - (/\dead -> - TxOutRef - (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` - (headList {data} args)) - (unIData (headList {data} (tailList {data} args)))) - (/\dead -> traceError {TxOutRef} "PT1") - {all dead. dead} + in + letrec + !go : list data -> List DCert + = \(xs : list data) -> + case + (List DCert) + xs + [ (Nil {DCert}) + , (\(x : data) (xs : list data) -> + Cons + {DCert} + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a Nothing : Maybe a @@ -282,23 +271,6 @@ (/\dead -> traceError {Maybe a} "PT1") {all dead. dead}) {all dead. dead} - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let !`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` : all k v. (\a -> data -> a) k -> @@ -307,25 +279,27 @@ (\k v -> List (Tuple2 k v)) k v = /\k v -> \(`$dUnsafeFromData` : (\a -> data -> a) k) - (`$dUnsafeFromData` : (\a -> data -> a) v) - (d : data) -> + (`$dUnsafeFromData` : (\a -> data -> a) v) -> letrec !go : list (pair data data) -> List (Tuple2 k v) - = caseList' - {pair data data} - {List (Tuple2 k v)} - (Nil {Tuple2 k v}) - (\(tup : pair data data) (tups : list (pair data data)) -> - Cons - {Tuple2 k v} - (Tuple2 - {k} - {v} - (`$dUnsafeFromData` (fstPair {data} {data} tup)) - (`$dUnsafeFromData` (sndPair {data} {data} tup))) - (go tups)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 k v)) + xs + [ (Nil {Tuple2 k v}) + , (\(tup : pair data data) + (tups : list (pair data data)) -> + Cons + {Tuple2 k v} + (Tuple2 + {k} + {v} + (`$dUnsafeFromData` (fstPair {data} {data} tup)) + (`$dUnsafeFromData` + (sndPair {data} {data} tup))) + (go tups)) ] in - go (unMapData d) + \(d : data) -> go (unMapData d) ~`$fUnsafeFromDataValue` : data -> (\k v -> List (Tuple2 k v)) bytestring integer = `$fUnsafeFromDataMap_$cunsafeFromBuiltinData` @@ -390,6 +364,136 @@ (headList {data} (tailList {data} l)))) (/\dead -> traceError {TxOut} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxOut + = \(xs : list data) -> + case + (List TxOut) + xs + [ (Nil {TxOut}) + , (\(x : data) (xs : list data) -> + Cons + {TxOut} + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. bytestring} + (/\dead -> unBData (headList {data} args)) + (/\dead -> traceError {bytestring} "PT1") + {all dead. dead} + data TxOutRef | TxOutRef_match where + TxOutRef : bytestring -> integer -> TxOutRef + !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxOutRef} + (/\dead -> + TxOutRef + (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + (headList {data} args)) + (unIData (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxOutRef} "PT1") + {all dead. dead} + data TxInInfo | TxInInfo_match where + TxInInfo : TxOutRef -> TxOut -> TxInInfo + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (let + !tup : pair integer (list data) = unConstrData x + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxInInfo} + (/\dead -> + TxInInfo + (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` + (headList {data} args)) + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` + (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxInInfo} "PT1") + {all dead. dead}) + (go xs)) ] + in + let + !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> traceError {Bool} "PT1") + {all dead. dead}) + {all dead. dead} + data (Extended :: * -> *) a | Extended_match where + Finite : a -> Extended a + NegInf : Extended a + PosInf : Extended a + !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : + all a. (\a -> data -> a) a -> data -> Extended a + = /\a -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Extended a} + (/\dead -> NegInf {a}) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Extended a} + (/\dead -> + Finite {a} (`$dUnsafeFromData` (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Extended a} + (/\dead -> PosInf {a}) + (/\dead -> traceError {Extended a} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} data ScriptPurpose | ScriptPurpose_match where Certifying : DCert -> ScriptPurpose Minting : bytestring -> ScriptPurpose @@ -401,8 +505,6 @@ UpperBound : Extended a -> Bool -> UpperBound a data (Interval :: * -> *) a | Interval_match where Interval : LowerBound a -> UpperBound a -> Interval a - data TxInInfo | TxInInfo_match where - TxInInfo : TxOutRef -> TxOut -> TxInInfo data TxInfo | TxInfo_match where TxInfo : List TxInInfo -> @@ -461,62 +563,10 @@ (let !d : data = headList {data} args in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (let - !tup : pair integer (list data) - = unConstrData x - !index : integer - = fstPair {integer} {list data} tup - !args : list data - = sndPair {integer} {list data} tup - in - Bool_match - (case - Bool - (equalsInteger 0 index) - [False, True]) - {all dead. TxInInfo} - (/\dead -> - TxInInfo - (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` - (headList {data} args)) - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - (headList - {data} - (tailList {data} args)))) - (/\dead -> traceError {TxInInfo} "PT1") - {all dead. dead}) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxOut - = caseList' - {data} - {List TxOut} - (Nil {TxOut}) - (\(x : data) - (xs : list data) -> - Cons - {TxOut} - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {bytestring} @@ -533,44 +583,10 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List DCert - = caseList' - {data} - {List DCert} - (Nil {DCert}) - (\(x : data) - (xs : list data) -> - Cons - {DCert} - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List (Tuple2 StakingCredential integer) - = caseList' - {data} - {List (Tuple2 StakingCredential integer)} - (Nil {Tuple2 StakingCredential integer}) - (\(x : data) - (xs : list data) -> - Cons - {Tuple2 StakingCredential integer} - (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` - {StakingCredential} - {integer} - `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - unIData - x) - (go xs)) - in go (unListData d)) (let !tup : pair integer (list data) @@ -638,38 +654,10 @@ (let !d : data = headList {data} l in - letrec - !go : list data -> List bytestring - = caseList' - {data} - {List bytestring} - (Nil {bytestring}) - (\(x : data) (xs : list data) -> - Cons {bytestring} (unBData x) (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List (Tuple2 bytestring data) - = caseList' - {data} - {List (Tuple2 bytestring data)} - (Nil {Tuple2 bytestring data}) - (\(x : data) - (xs : list data) -> - Cons - {Tuple2 bytestring data} - (`$fUnsafeFromDataTuple2_$cunsafeFromBuiltinData` - {bytestring} - {data} - unBData - (\(d : data) -> d) - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` (headList {data} (tailList {data} l)))) diff --git a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.size.golden b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.size.golden index db7ad20dcdb..364aacb7268 100644 --- a/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.size.golden +++ b/plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2.size.golden @@ -1 +1 @@ -1331 \ No newline at end of file +1292 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-20.eval.golden b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-20.eval.golden index 99e148821d4..bf9af12c8d8 100644 --- a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 20_088_713 -Memory: 72_250 -Term Size: 89 -Flat Size: 654 +CPU: 8_111_579 +Memory: 33_498 +Term Size: 71 +Flat Size: 641 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-4.eval.golden b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-4.eval.golden index 32d12aa14e6..33ad034bd76 100644 --- a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 5_512_473 -Memory: 19_482 -Term Size: 89 -Flat Size: 268 +CPU: 2_908_251 +Memory: 11_066 +Term Size: 71 +Flat Size: 254 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.pir.golden b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.pir.golden index 3c245bbf1b1..315c74685a7 100644 --- a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.pir.golden +++ b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.pir.golden @@ -1,17 +1,10 @@ (letrec !go : list data -> integer = \(xs : list data) -> - chooseList - {data} - {all dead. integer} + case + integer xs - (/\dead -> 0) - (/\dead -> - let - !ds : data = headList {data} xs - in - addInteger 1 (go (tailList {data} xs))) - {integer} + [0, (\(ds : data) (eta : list data) -> addInteger 1 (go eta))] in let data Bool | Bool_match where diff --git a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.size.golden b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.size.golden index 7730ef7f3e0..2fb681e3f93 100644 --- a/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.size.golden +++ b/plutus-benchmark/script-contexts/test/V1/Data/9.6/checkScriptContext1.size.golden @@ -1 +1 @@ -89 \ No newline at end of file +71 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-20.eval.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-20.eval.golden index 1ef0be6fba9..078581d034d 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 263_820_778 -Memory: 991_876 -Term Size: 1_434 -Flat Size: 2_082 +CPU: 210_982_658 +Memory: 807_516 +Term Size: 1_416 +Flat Size: 2_070 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-4.eval.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-4.eval.golden index 9bf978ce5ab..eb4795a89ac 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 73_991_066 -Memory: 282_948 -Term Size: 1_434 -Flat Size: 1_648 +CPU: 60_695_490 +Memory: 235_420 +Term Size: 1_416 +Flat Size: 1_636 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.pir.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.pir.golden index b5807377331..154dc162539 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.pir.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.pir.golden @@ -43,9 +43,17 @@ 0 (\(ds : TxOut) (xs : List TxOut) -> addInteger 1 (go xs)) in + letrec + !go : list data -> List bytestring + = \(xs : list data) -> + case + (List bytestring) + xs + [ (Nil {bytestring}) + , (\(x : data) (xs : list data) -> + Cons {bytestring} (unBData x) (go xs)) ] + in let - !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data - = \(d : data) -> d data Bool | Bool_match where True : Bool False : Bool @@ -54,57 +62,6 @@ !traceError : all a. string -> a = /\a -> \(str : string) -> let !x : Unit = trace {Unit} str Unit in error {a} - !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> traceError {Bool} "PT1") - {all dead. dead}) - {all dead. dead} - data (Extended :: * -> *) a | Extended_match where - Finite : a -> Extended a - NegInf : Extended a - PosInf : Extended a - !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : - all a. (\a -> data -> a) a -> data -> Extended a - = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Extended a} - (/\dead -> NegInf {a}) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Extended a} - (/\dead -> - Finite {a} (`$dUnsafeFromData` (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Extended a} - (/\dead -> PosInf {a}) - (/\dead -> traceError {Extended a} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} !`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` : data -> Credential = \(d : data) -> let @@ -241,84 +198,21 @@ {all dead. dead}) {all dead. dead}) {all dead. dead} - !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. bytestring} - (/\dead -> unBData (headList {data} args)) - (/\dead -> traceError {bytestring} "PT1") - {all dead. dead} - data TxOutRef | TxOutRef_match where - TxOutRef : bytestring -> integer -> TxOutRef - !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. TxOutRef} - (/\dead -> - TxOutRef - (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` - (headList {data} args)) - (unIData (headList {data} (tailList {data} args)))) - (/\dead -> traceError {TxOutRef} "PT1") - {all dead. dead} - data ScriptPurpose | ScriptPurpose_match where - Certifying : DCert -> ScriptPurpose - Minting : bytestring -> ScriptPurpose - Rewarding : StakingCredential -> ScriptPurpose - Spending : TxOutRef -> ScriptPurpose - !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : - data -> ScriptPurpose - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> Minting (unBData (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Spending - (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Rewarding - (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 3 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Certifying - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> traceError {ScriptPurpose} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead} + in + letrec + !go : list data -> List DCert + = \(xs : list data) -> + case + (List DCert) + xs + [ (Nil {DCert}) + , (\(x : data) (xs : list data) -> + Cons + {DCert} + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let !`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` : all a. (\a -> data -> a) a -> data -> Maybe a = /\a -> @@ -341,16 +235,6 @@ (/\dead -> traceError {Maybe a} "PT1") {all dead. dead}) {all dead. dead} - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} !`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` : all k v. (\a -> data -> a) k -> @@ -359,25 +243,27 @@ (\k v -> List (Tuple2 k v)) k v = /\k v -> \(`$dUnsafeFromData` : (\a -> data -> a) k) - (`$dUnsafeFromData` : (\a -> data -> a) v) - (d : data) -> + (`$dUnsafeFromData` : (\a -> data -> a) v) -> letrec !go : list (pair data data) -> List (Tuple2 k v) - = caseList' - {pair data data} - {List (Tuple2 k v)} - (Nil {Tuple2 k v}) - (\(tup : pair data data) (tups : list (pair data data)) -> - Cons - {Tuple2 k v} - (Tuple2 - {k} - {v} - (`$dUnsafeFromData` (fstPair {data} {data} tup)) - (`$dUnsafeFromData` (sndPair {data} {data} tup))) - (go tups)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 k v)) + xs + [ (Nil {Tuple2 k v}) + , (\(tup : pair data data) + (tups : list (pair data data)) -> + Cons + {Tuple2 k v} + (Tuple2 + {k} + {v} + (`$dUnsafeFromData` (fstPair {data} {data} tup)) + (`$dUnsafeFromData` + (sndPair {data} {data} tup))) + (go tups)) ] in - go (unMapData d) + \(d : data) -> go (unMapData d) ~`$fUnsafeFromDataValue` : data -> (\k v -> List (Tuple2 k v)) bytestring integer = `$fUnsafeFromDataMap_$cunsafeFromBuiltinData` @@ -458,6 +344,53 @@ (headList {data} (tailList {data} l)))) (/\dead -> traceError {TxOut} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxOut + = \(xs : list data) -> + case + (List TxOut) + xs + [ (Nil {TxOut}) + , (\(x : data) (xs : list data) -> + Cons + {TxOut} + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. bytestring} + (/\dead -> unBData (headList {data} args)) + (/\dead -> traceError {bytestring} "PT1") + {all dead. dead} + data TxOutRef | TxOutRef_match where + TxOutRef : bytestring -> integer -> TxOutRef + !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxOutRef} + (/\dead -> + TxOutRef + (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + (headList {data} args)) + (unIData (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxOutRef} "PT1") + {all dead. dead} data TxInInfo | TxInInfo_match where TxInInfo : TxOutRef -> TxOut -> TxInInfo !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> TxInInfo @@ -478,6 +411,133 @@ (headList {data} (tailList {data} args)))) (/\dead -> traceError {TxInInfo} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data + = \(d : data) -> d + !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> traceError {Bool} "PT1") + {all dead. dead}) + {all dead. dead} + data (Extended :: * -> *) a | Extended_match where + Finite : a -> Extended a + NegInf : Extended a + PosInf : Extended a + !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : + all a. (\a -> data -> a) a -> data -> Extended a + = /\a -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Extended a} + (/\dead -> NegInf {a}) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Extended a} + (/\dead -> + Finite {a} (`$dUnsafeFromData` (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Extended a} + (/\dead -> PosInf {a}) + (/\dead -> traceError {Extended a} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} + data ScriptPurpose | ScriptPurpose_match where + Certifying : DCert -> ScriptPurpose + Minting : bytestring -> ScriptPurpose + Rewarding : StakingCredential -> ScriptPurpose + Spending : TxOutRef -> ScriptPurpose + !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : + data -> ScriptPurpose + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> Minting (unBData (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Spending + (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Rewarding + (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 3 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Certifying + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> traceError {ScriptPurpose} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead} data (LowerBound :: * -> *) a | LowerBound_match where LowerBound : Extended a -> Bool -> LowerBound a data (UpperBound :: * -> *) a | UpperBound_match where @@ -544,59 +604,14 @@ (let !d : data = headList {data} args in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxOut - = caseList' - {data} - {List TxOut} - (Nil {TxOut}) - (\(x : data) - (xs : list data) -> - Cons - {TxOut} - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {bytestring} @@ -613,21 +628,6 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List DCert - = caseList' - {data} - {List DCert} - (Nil {DCert}) - (\(x : data) - (xs : list data) -> - Cons - {DCert} - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {StakingCredential} @@ -697,15 +697,6 @@ (let !d : data = headList {data} l in - letrec - !go : list data -> List bytestring - = caseList' - {data} - {List bytestring} - (Nil {bytestring}) - (\(x : data) (xs : list data) -> - Cons {bytestring} (unBData x) (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {ScriptPurpose} diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.size.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.size.golden index 891f73536c0..6894a427415 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.size.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1.size.golden @@ -1 +1 @@ -1434 \ No newline at end of file +1416 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-20.eval.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-20.eval.golden index 34d29ff4770..b77fe637f02 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 255_564_355 -Memory: 954_034 -Term Size: 1_372 -Flat Size: 2_003 +CPU: 203_670_235 +Memory: 775_574 +Term Size: 1_357 +Flat Size: 1_995 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-4.eval.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-4.eval.golden index ad0f32e1102..dc1930b974b 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 71_705_971 -Memory: 272_338 -Term Size: 1_372 -Flat Size: 1_569 +CPU: 58_586_395 +Memory: 225_910 +Term Size: 1_357 +Flat Size: 1_561 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.pir.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.pir.golden index e42cd7f5b64..f8cc973a3a0 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.pir.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.pir.golden @@ -1,68 +1,30 @@ -(let - !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data - = \(d : data) -> d +(letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a + in + letrec + !go : list data -> List bytestring + = \(xs : list data) -> + case + (List bytestring) + xs + [ (Nil {bytestring}) + , (\(x : data) (xs : list data) -> + Cons {bytestring} (unBData x) (go xs)) ] + in + let data Bool | Bool_match where True : Bool False : Bool + data Credential | Credential_match where + PubKeyCredential : bytestring -> Credential + ScriptCredential : bytestring -> Credential data Unit | Unit_match where Unit : Unit !traceError : all a. string -> a = /\a -> \(str : string) -> let !x : Unit = trace {Unit} str Unit in error {a} - !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> traceError {Bool} "PT1") - {all dead. dead}) - {all dead. dead} - data (Extended :: * -> *) a | Extended_match where - Finite : a -> Extended a - NegInf : Extended a - PosInf : Extended a - !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : - all a. (\a -> data -> a) a -> data -> Extended a - = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Extended a} - (/\dead -> NegInf {a}) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Extended a} - (/\dead -> - Finite {a} (`$dUnsafeFromData` (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Extended a} - (/\dead -> PosInf {a}) - (/\dead -> traceError {Extended a} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} - data Credential | Credential_match where - PubKeyCredential : bytestring -> Credential - ScriptCredential : bytestring -> Credential !`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` : data -> Credential = \(d : data) -> let @@ -202,84 +164,21 @@ {all dead. dead}) {all dead. dead}) {all dead. dead} - !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. bytestring} - (/\dead -> unBData (headList {data} args)) - (/\dead -> traceError {bytestring} "PT1") - {all dead. dead} - data TxOutRef | TxOutRef_match where - TxOutRef : bytestring -> integer -> TxOutRef - !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. TxOutRef} - (/\dead -> - TxOutRef - (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` - (headList {data} args)) - (unIData (headList {data} (tailList {data} args)))) - (/\dead -> traceError {TxOutRef} "PT1") - {all dead. dead} - data ScriptPurpose | ScriptPurpose_match where - Certifying : DCert -> ScriptPurpose - Minting : bytestring -> ScriptPurpose - Rewarding : StakingCredential -> ScriptPurpose - Spending : TxOutRef -> ScriptPurpose - !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : - data -> ScriptPurpose - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> Minting (unBData (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Spending - (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Rewarding - (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 3 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Certifying - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> traceError {ScriptPurpose} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead} + in + letrec + !go : list data -> List DCert + = \(xs : list data) -> + case + (List DCert) + xs + [ (Nil {DCert}) + , (\(x : data) (xs : list data) -> + Cons + {DCert} + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a Nothing : Maybe a @@ -305,25 +204,8 @@ (/\dead -> traceError {Maybe a} "PT1") {all dead. dead}) {all dead. dead} - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} data (Tuple2 :: * -> * -> *) a b | Tuple2_match where Tuple2 : a -> b -> Tuple2 a b - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let !`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` : all k v. (\a -> data -> a) k -> @@ -332,25 +214,27 @@ (\k v -> List (Tuple2 k v)) k v = /\k v -> \(`$dUnsafeFromData` : (\a -> data -> a) k) - (`$dUnsafeFromData` : (\a -> data -> a) v) - (d : data) -> + (`$dUnsafeFromData` : (\a -> data -> a) v) -> letrec !go : list (pair data data) -> List (Tuple2 k v) - = caseList' - {pair data data} - {List (Tuple2 k v)} - (Nil {Tuple2 k v}) - (\(tup : pair data data) (tups : list (pair data data)) -> - Cons - {Tuple2 k v} - (Tuple2 - {k} - {v} - (`$dUnsafeFromData` (fstPair {data} {data} tup)) - (`$dUnsafeFromData` (sndPair {data} {data} tup))) - (go tups)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 k v)) + xs + [ (Nil {Tuple2 k v}) + , (\(tup : pair data data) + (tups : list (pair data data)) -> + Cons + {Tuple2 k v} + (Tuple2 + {k} + {v} + (`$dUnsafeFromData` (fstPair {data} {data} tup)) + (`$dUnsafeFromData` + (sndPair {data} {data} tup))) + (go tups)) ] in - go (unMapData d) + \(d : data) -> go (unMapData d) ~`$fUnsafeFromDataValue` : data -> (\k v -> List (Tuple2 k v)) bytestring integer = `$fUnsafeFromDataMap_$cunsafeFromBuiltinData` @@ -446,6 +330,53 @@ (headList {data} (tailList {data} l)))) (/\dead -> traceError {TxOut} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxOut + = \(xs : list data) -> + case + (List TxOut) + xs + [ (Nil {TxOut}) + , (\(x : data) (xs : list data) -> + Cons + {TxOut} + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. bytestring} + (/\dead -> unBData (headList {data} args)) + (/\dead -> traceError {bytestring} "PT1") + {all dead. dead} + data TxOutRef | TxOutRef_match where + TxOutRef : bytestring -> integer -> TxOutRef + !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxOutRef} + (/\dead -> + TxOutRef + (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + (headList {data} args)) + (unIData (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxOutRef} "PT1") + {all dead. dead} data TxInInfo | TxInInfo_match where TxInInfo : TxOutRef -> TxOut -> TxInInfo !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> TxInInfo @@ -466,6 +397,133 @@ (headList {data} (tailList {data} args)))) (/\dead -> traceError {TxInInfo} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data + = \(d : data) -> d + !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> traceError {Bool} "PT1") + {all dead. dead}) + {all dead. dead} + data (Extended :: * -> *) a | Extended_match where + Finite : a -> Extended a + NegInf : Extended a + PosInf : Extended a + !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : + all a. (\a -> data -> a) a -> data -> Extended a + = /\a -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Extended a} + (/\dead -> NegInf {a}) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Extended a} + (/\dead -> + Finite {a} (`$dUnsafeFromData` (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Extended a} + (/\dead -> PosInf {a}) + (/\dead -> traceError {Extended a} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} + data ScriptPurpose | ScriptPurpose_match where + Certifying : DCert -> ScriptPurpose + Minting : bytestring -> ScriptPurpose + Rewarding : StakingCredential -> ScriptPurpose + Spending : TxOutRef -> ScriptPurpose + !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : + data -> ScriptPurpose + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> Minting (unBData (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Spending + (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Rewarding + (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 3 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Certifying + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> traceError {ScriptPurpose} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead} data (LowerBound :: * -> *) a | LowerBound_match where LowerBound : Extended a -> Bool -> LowerBound a data (UpperBound :: * -> *) a | UpperBound_match where @@ -534,59 +592,14 @@ (let !d : data = headList {data} args in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxOut - = caseList' - {data} - {List TxOut} - (Nil {TxOut}) - (\(x : data) - (xs : list data) -> - Cons - {TxOut} - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {bytestring} @@ -603,21 +616,6 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List DCert - = caseList' - {data} - {List DCert} - (Nil {DCert}) - (\(x : data) - (xs : list data) -> - Cons - {DCert} - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {StakingCredential} @@ -691,15 +689,6 @@ (let !d : data = headList {data} l in - letrec - !go : list data -> List bytestring - = caseList' - {data} - {List bytestring} - (Nil {bytestring}) - (\(x : data) (xs : list data) -> - Cons {bytestring} (unBData x) (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {ScriptPurpose} diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.size.golden b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.size.golden index ec7f702f21d..3c0c17f1cb1 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.size.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2.size.golden @@ -1 +1 @@ -1372 \ No newline at end of file +1357 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.eval.golden b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.eval.golden index d37bc9b6119..4529d07aefb 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.eval.golden @@ -1,6 +1,6 @@ CPU: 5_514_022 Memory: 9_478 -Term Size: 146 -Flat Size: 1_196 +Term Size: 131 +Flat Size: 1_185 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.pir.golden b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.pir.golden index cf67ce98a2f..95c033c5112 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.pir.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.pir.golden @@ -55,19 +55,17 @@ in letrec !go : list a -> Bool = \(xs : list a) -> - chooseList - {a} - {all dead. Bool} + case + Bool xs - (/\dead -> False) - (/\dead -> - Bool_match - (p (headList {a} xs)) - {all dead. Bool} - (/\dead -> True) - (/\dead -> go (tailList {a} xs)) - {all dead. dead}) - {Bool} + [ False + , (\(x : a) (xs : list a) -> + Bool_match + (p x) + {all dead. Bool} + (/\dead -> True) + (/\dead -> go xs) + {all dead. dead}) ] in go) (\(x : pair data data) -> diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.uplc.golden b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.uplc.golden index a3df3785780..6621493fd80 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.uplc.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrick.uplc.golden @@ -12,19 +12,15 @@ [ (case ((\s -> s s) (\s xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - (case - (equalsData - obsScriptCred - (force (force fstPair) - (force headList xs))) - [ ((\x -> s s x) - (force tailList xs)) - , (constr 0 []) ])))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (equalsData + obsScriptCred + (force (force fstPair) x)) + [(s s xs), (constr 0 [])]) ]) rest) [ (constr 0 []) , ((\x -> error) diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.eval.golden b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.eval.golden index 1129cf3179a..ff03a6add4c 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.eval.golden @@ -1,6 +1,6 @@ CPU: 5_706_022 Memory: 10_678 -Term Size: 165 -Flat Size: 1_208 +Term Size: 147 +Flat Size: 1_194 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.pir.golden b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.pir.golden index dda85fd0708..c9a15df159a 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.pir.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.pir.golden @@ -28,13 +28,7 @@ in r = Unit -> r in \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r}) + case r xs [z, f]) nilCase (\(x : a) (xs : list a) (ds : Unit) -> consCase x xs) l diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.uplc.golden b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.uplc.golden index 5b9692486d3..91fe5b8104b 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.uplc.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/dataFwdStakeTrickManual.uplc.golden @@ -51,19 +51,12 @@ (\arg -> delay (\l -> - force - (force (force chooseList) - l - (delay - (\ds -> - (\x -> error) - (force trace - "not found" - (constr 0 [])))) - (delay - ((\x xs ds -> lookForCred x xs) - (force headList l) - (force tailList l)))) + case + l + [ (\ds -> + (\x -> error) + (force trace "not found" (constr 0 []))) + , (\x xs ds -> lookForCred x xs) ] (constr 0 []))) (\p tl -> case diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.eval.golden b/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.eval.golden index d78d2c98ccf..3de93a2bddf 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.eval.golden @@ -1,6 +1,6 @@ -CPU: 329_387_977 -Memory: 1_221_548 -Term Size: 1_563 -Flat Size: 2_655 +CPU: 263_175_910 +Memory: 990_672 +Term Size: 1_548 +Flat Size: 2_647 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.pir.golden b/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.pir.golden index b60f09d175c..019758d72b2 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.pir.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.pir.golden @@ -1,3 +1,18 @@ +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +letrec + !go : list data -> List bytestring + = \(xs : list data) -> + case + (List bytestring) + xs + [ (Nil {bytestring}) + , (\(x : data) (xs : list data) -> + Cons {bytestring} (unBData x) (go xs)) ] +in let data Bool | Bool_match where True : Bool @@ -5,114 +20,11 @@ let data Credential | Credential_match where PubKeyCredential : bytestring -> Credential ScriptCredential : bytestring -> Credential - data StakingCredential | StakingCredential_match where - StakingHash : Credential -> StakingCredential - StakingPtr : integer -> integer -> integer -> StakingCredential - !`$fEqStakingCredential_$c==` : StakingCredential -> StakingCredential -> Bool - = \(ds : StakingCredential) (ds : StakingCredential) -> - StakingCredential_match - ds - {Bool} - (\(l : Credential) -> - StakingCredential_match - ds - {Bool} - (\(r : Credential) -> - Credential_match - l - {Bool} - (\(l : bytestring) -> - Credential_match - r - {Bool} - (\(r : bytestring) -> - case Bool (equalsByteString l r) [False, True]) - (\(ipv : bytestring) -> False)) - (\(a : bytestring) -> - Credential_match - r - {Bool} - (\(ipv : bytestring) -> False) - (\(a' : bytestring) -> - case Bool (equalsByteString a a') [False, True]))) - (\(ipv : integer) (ipv : integer) (ipv : integer) -> False)) - (\(a : integer) (b : integer) (c : integer) -> - StakingCredential_match - ds - {Bool} - (\(ipv : Credential) -> False) - (\(a' : integer) (b' : integer) (c' : integer) -> - Bool_match - (case Bool (equalsInteger a a') [False, True]) - {all dead. Bool} - (/\dead -> - Bool_match - (case Bool (equalsInteger b b') [False, True]) - {all dead. Bool} - (/\dead -> - case Bool (equalsInteger c c') [False, True]) - (/\dead -> False) - {all dead. dead}) - (/\dead -> False) - {all dead. dead})) - !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data - = \(d : data) -> d data Unit | Unit_match where Unit : Unit !traceError : all a. string -> a = /\a -> \(str : string) -> let !x : Unit = trace {Unit} str Unit in error {a} - !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> traceError {Bool} "PT1") - {all dead. dead}) - {all dead. dead} - data (Extended :: * -> *) a | Extended_match where - Finite : a -> Extended a - NegInf : Extended a - PosInf : Extended a - !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : - all a. (\a -> data -> a) a -> data -> Extended a - = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Extended a} - (/\dead -> NegInf {a}) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Extended a} - (/\dead -> - Finite {a} (`$dUnsafeFromData` (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Extended a} - (/\dead -> PosInf {a}) - (/\dead -> traceError {Extended a} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} !`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` : data -> Credential = \(d : data) -> let @@ -132,6 +44,9 @@ let (/\dead -> traceError {Credential} "PT1") {all dead. dead}) {all dead. dead} + data StakingCredential | StakingCredential_match where + StakingHash : Credential -> StakingCredential + StakingPtr : integer -> integer -> integer -> StakingCredential !`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` : data -> StakingCredential = \(d : data) -> @@ -244,84 +159,21 @@ let {all dead. dead}) {all dead. dead}) {all dead. dead} - !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. bytestring} - (/\dead -> unBData (headList {data} args)) - (/\dead -> traceError {bytestring} "PT1") - {all dead. dead} - data TxOutRef | TxOutRef_match where - TxOutRef : bytestring -> integer -> TxOutRef - !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. TxOutRef} - (/\dead -> - TxOutRef - (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` - (headList {data} args)) - (unIData (headList {data} (tailList {data} args)))) - (/\dead -> traceError {TxOutRef} "PT1") - {all dead. dead} - data ScriptPurpose | ScriptPurpose_match where - Certifying : DCert -> ScriptPurpose - Minting : bytestring -> ScriptPurpose - Rewarding : StakingCredential -> ScriptPurpose - Spending : TxOutRef -> ScriptPurpose - !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : - data -> ScriptPurpose - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> Minting (unBData (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Spending - (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Rewarding - (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 3 index) [False, True]) - {all dead. ScriptPurpose} - (/\dead -> - Certifying - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> traceError {ScriptPurpose} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead} +in +letrec + !go : list data -> List DCert + = \(xs : list data) -> + case + (List DCert) + xs + [ (Nil {DCert}) + , (\(x : data) (xs : list data) -> + Cons + {DCert} + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` x) + (go xs)) ] +in +let data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a Nothing : Maybe a @@ -347,25 +199,8 @@ let (/\dead -> traceError {Maybe a} "PT1") {all dead. dead}) {all dead. dead} - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} data (Tuple2 :: * -> * -> *) a b | Tuple2_match where Tuple2 : a -> b -> Tuple2 a b -in -letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a -in -let !`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` : all k v. (\a -> data -> a) k -> @@ -374,25 +209,25 @@ let (\k v -> List (Tuple2 k v)) k v = /\k v -> \(`$dUnsafeFromData` : (\a -> data -> a) k) - (`$dUnsafeFromData` : (\a -> data -> a) v) - (d : data) -> + (`$dUnsafeFromData` : (\a -> data -> a) v) -> letrec !go : list (pair data data) -> List (Tuple2 k v) - = caseList' - {pair data data} - {List (Tuple2 k v)} - (Nil {Tuple2 k v}) - (\(tup : pair data data) (tups : list (pair data data)) -> - Cons - {Tuple2 k v} - (Tuple2 - {k} - {v} - (`$dUnsafeFromData` (fstPair {data} {data} tup)) - (`$dUnsafeFromData` (sndPair {data} {data} tup))) - (go tups)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 k v)) + xs + [ (Nil {Tuple2 k v}) + , (\(tup : pair data data) (tups : list (pair data data)) -> + Cons + {Tuple2 k v} + (Tuple2 + {k} + {v} + (`$dUnsafeFromData` (fstPair {data} {data} tup)) + (`$dUnsafeFromData` (sndPair {data} {data} tup))) + (go tups)) ] in - go (unMapData d) + \(d : data) -> go (unMapData d) ~`$fUnsafeFromDataValue` : data -> (\k v -> List (Tuple2 k v)) bytestring integer = `$fUnsafeFromDataMap_$cunsafeFromBuiltinData` @@ -488,6 +323,53 @@ let (headList {data} (tailList {data} l)))) (/\dead -> traceError {TxOut} "PT1") {all dead. dead} +in +letrec + !go : list data -> List TxOut + = \(xs : list data) -> + case + (List TxOut) + xs + [ (Nil {TxOut}) + , (\(x : data) (xs : list data) -> + Cons + {TxOut} + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` x) + (go xs)) ] +in +let + !`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` : data -> bytestring + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. bytestring} + (/\dead -> unBData (headList {data} args)) + (/\dead -> traceError {bytestring} "PT1") + {all dead. dead} + data TxOutRef | TxOutRef_match where + TxOutRef : bytestring -> integer -> TxOutRef + !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxOutRef} + (/\dead -> + TxOutRef + (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + (headList {data} args)) + (unIData (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxOutRef} "PT1") + {all dead. dead} data TxInInfo | TxInInfo_match where TxInInfo : TxOutRef -> TxOut -> TxInInfo !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> TxInInfo @@ -508,6 +390,180 @@ let (headList {data} (tailList {data} args)))) (/\dead -> traceError {TxInInfo} "PT1") {all dead. dead} +in +letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] +in +letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] +in +let + !`$fEqStakingCredential_$c==` : StakingCredential -> StakingCredential -> Bool + = \(ds : StakingCredential) (ds : StakingCredential) -> + StakingCredential_match + ds + {Bool} + (\(l : Credential) -> + StakingCredential_match + ds + {Bool} + (\(r : Credential) -> + Credential_match + l + {Bool} + (\(l : bytestring) -> + Credential_match + r + {Bool} + (\(r : bytestring) -> + case Bool (equalsByteString l r) [False, True]) + (\(ipv : bytestring) -> False)) + (\(a : bytestring) -> + Credential_match + r + {Bool} + (\(ipv : bytestring) -> False) + (\(a' : bytestring) -> + case Bool (equalsByteString a a') [False, True]))) + (\(ipv : integer) (ipv : integer) (ipv : integer) -> False)) + (\(a : integer) (b : integer) (c : integer) -> + StakingCredential_match + ds + {Bool} + (\(ipv : Credential) -> False) + (\(a' : integer) (b' : integer) (c' : integer) -> + Bool_match + (case Bool (equalsInteger a a') [False, True]) + {all dead. Bool} + (/\dead -> + Bool_match + (case Bool (equalsInteger b b') [False, True]) + {all dead. Bool} + (/\dead -> + case Bool (equalsInteger c c') [False, True]) + (/\dead -> False) + {all dead. dead}) + (/\dead -> False) + {all dead. dead})) + !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data + = \(d : data) -> d + !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> traceError {Bool} "PT1") + {all dead. dead}) + {all dead. dead} + data (Extended :: * -> *) a | Extended_match where + Finite : a -> Extended a + NegInf : Extended a + PosInf : Extended a + !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : + all a. (\a -> data -> a) a -> data -> Extended a + = /\a -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Extended a} + (/\dead -> NegInf {a}) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Extended a} + (/\dead -> + Finite {a} (`$dUnsafeFromData` (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Extended a} + (/\dead -> PosInf {a}) + (/\dead -> traceError {Extended a} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} + data ScriptPurpose | ScriptPurpose_match where + Certifying : DCert -> ScriptPurpose + Minting : bytestring -> ScriptPurpose + Rewarding : StakingCredential -> ScriptPurpose + Spending : TxOutRef -> ScriptPurpose + !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : + data -> ScriptPurpose + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> Minting (unBData (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Spending + (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Rewarding + (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 3 index) [False, True]) + {all dead. ScriptPurpose} + (/\dead -> + Certifying + (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> traceError {ScriptPurpose} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead} data (LowerBound :: * -> *) a | LowerBound_match where LowerBound : Extended a -> Bool -> LowerBound a data (UpperBound :: * -> *) a | UpperBound_match where @@ -575,57 +631,14 @@ in (let !d : data = headList {data} args in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : list data -> List TxOut - = caseList' - {data} - {List TxOut} - (Nil {TxOut}) - (\(x : data) (xs : list data) -> - Cons - {TxOut} - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {bytestring} @@ -642,19 +655,6 @@ in (let !d : data = headList {data} l in - letrec - !go : list data -> List DCert - = caseList' - {data} - {List DCert} - (Nil {DCert}) - (\(x : data) (xs : list data) -> - Cons - {DCert} - (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {StakingCredential} @@ -720,15 +720,6 @@ in (let !d : data = headList {data} l in - letrec - !go : list data -> List bytestring - = caseList' - {data} - {List bytestring} - (Nil {bytestring}) - (\(x : data) (xs : list data) -> - Cons {bytestring} (unBData x) (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {ScriptPurpose} diff --git a/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.uplc.golden b/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.uplc.golden index bb07685dfa9..b985af4c2f8 100644 --- a/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.uplc.golden +++ b/plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.uplc.golden @@ -1,40 +1,42 @@ (program 1.1.0 - ((\caseList' -> + ((\go -> (\traceError -> - (\`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` -> - (\`$fEqStakingCredential_$c==` - obsScriptCred - ctx -> - case - ((\tup -> - (\index -> - (\args -> - case - (equalsInteger 0 index) - [ (traceError "PT1") - , (constr 0 - [ ((\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (traceError - "PT1") - , ((\l -> - (\l -> - (\l -> + (\`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` -> + (\`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` -> + (\`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` -> + (\go -> + (\`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` -> + (\`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` -> + (\go -> + (\`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` -> + (\`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` -> + (\`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` -> + (\go -> + (\go + obsScriptCred + ctx -> + case + ((\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (traceError "PT1") + , ((\`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` -> + constr 0 + [ ((\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (traceError + "PT1") + , ((\l -> (\l -> (\l -> (\l -> @@ -42,11 +44,11 @@ (\l -> (\l -> (\l -> - (\`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` -> - (\cse -> - (\cse -> - (\`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` -> - (\`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` -> + (\l -> + (\l -> + (\`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` -> + (\cse -> + (\cse -> (\arg_0 arg_1 arg_2 @@ -72,410 +74,233 @@ , arg_9 , arg_10 , arg_11 ]) - ((\d -> - (\s -> - s - s) - (\s -> - caseList' - (constr 0 - [ ]) - (\x - xs -> - constr 1 - [ (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - , (s - s - xs) ])) - (unListData - d)) + (go + (unListData + (force + headList + args))) + (go + (unListData + (force + headList + l))) + (go + (unListData + (force + headList + l))) + (cse (force headList - args)) - ((\d -> - (\s -> - s - s) - (\s -> - caseList' - (constr 0 - [ ]) - (\x - xs -> - constr 1 - [ (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - , (s - s - xs) ])) - (unListData - d)) + l)) + (cse (force headList - l))) - (\d -> - (\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (traceError - "PT1") - , (constr 0 - [ (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` - (force - headList - args)) - , (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - (force - headList - (force - tailList - args))) ]) ]) - (force - (force - sndPair) - tup)) - (force - (force - fstPair) - tup)) - (unConstrData - d)) - ((\d -> - (\s -> - s - s) - (\s -> - caseList' - (constr 0 - [ ]) - (\x - xs -> - constr 1 - [ (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - , (s - s - xs) ])) + l)) + (go (unListData - d)) - (force - headList - l))) - (\eta -> - (\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (traceError - "PT1") - , ((\l -> - (\l -> - constr 0 - [ ((\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (traceError - "PT1") - , (constr 0 - [ (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` - (force - headList - args)) - , (`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` - `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (force - headList + (force + headList + l))) + (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` + `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + unIData + (force + headList + l)) + ((\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (traceError + "PT1") + , ((\`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` -> + (\`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` -> + constr 0 + [ ((\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (traceError + "PT1") + , (constr 0 + [ (`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` + unIData + (force + headList + args)) + , (`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` + (force + headList + (force + tailList + args))) ]) ]) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + (force + headList + args))) + , ((\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (traceError + "PT1") + , (constr 0 + [ (`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` + unIData + (force + headList + args)) + , (`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` + (force + headList + (force + tailList + args))) ]) ]) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + (force + headList + (force + tailList + args)))) ]) + (\d -> + (\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (case + (equalsInteger + 1 + index) + [ (traceError + "PT1") + , (constr 0 + [ ]) ]) + , (constr 1 + [ ]) ]) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + d))) + (\`$dUnsafeFromData` + d -> + (\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (case + (equalsInteger + 1 + index) + [ (case + (equalsInteger + 2 + index) + [ (traceError + "PT1") + , (constr 2 + [ ]) ]) + , (constr 0 + [ (`$dUnsafeFromData` (force - tailList - args))) ]) ]) - (force - (force - sndPair) - tup)) - (force - (force - fstPair) - tup)) - (unConstrData - (force - headList - args))) - , (cse - (force - headList - l)) - , ((\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (case - (equalsInteger - 1 - index) - [ (case - (equalsInteger - 2 - index) - [ (traceError - "PT1") - , (constr 1 - [ (force - headList - args) ]) ]) - , (constr 2 - [ (unBData - (force - headList - args)) ]) ]) - , (constr 0 - [ ]) ]) - (force - (force - sndPair) - tup)) - (force - (force - fstPair) - tup)) - (unConstrData - (force - headList - l))) - , (`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` - unBData - (force - headList - (force - tailList - l))) ]) - (force - tailList - l)) - (force - tailList - args)) ]) - (force - (force - sndPair) - tup)) - (force - (force - fstPair) - tup)) - (unConstrData - eta)) - (cse - (force - headList - l)) - (cse - (force - headList - l)) - ((\d -> - (\s -> - s - s) - (\s -> - caseList' - (constr 0 - [ ]) - (\x - xs -> - constr 1 - [ (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - x) - , (s - s - xs) ])) - (unListData - d)) - (force - headList - l)) - (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` - `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - unIData - (force - headList - l)) - ((\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (traceError - "PT1") - , (constr 0 - [ ((\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (traceError - "PT1") - , (constr 0 - [ (`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` - unIData - (force - headList - args)) - , (`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` - (force - headList - (force - tailList - args))) ]) ]) - (force + headList + args)) ]) ]) + , (constr 1 + [ ]) ]) + (force + (force + sndPair) + tup)) (force - sndPair) - tup)) - (force - (force - fstPair) - tup)) - (unConstrData - (force - headList - args))) - , ((\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (traceError - "PT1") - , (constr 0 - [ (`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` - unIData - (force - headList - args)) - , (`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` - (force - headList - (force - tailList - args))) ]) ]) - (force - (force - sndPair) - tup)) - (force - (force - fstPair) - tup)) - (unConstrData - (force - headList - (force - tailList - args)))) ]) ]) - (force + (force + fstPair) + tup)) + (unConstrData + d))) ]) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + (force + headList + l))) + (go + (unListData (force - sndPair) - tup)) - (force + headList + l))) + (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` + `$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` + `$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` (force - fstPair) - tup)) - (unConstrData - (force - headList - l))) - ((\d -> - (\s -> - s - s) - (\s -> - caseList' - (constr 0 - [ ]) - (\x - xs -> - constr 1 - [ (unBData - x) - , (s - s - xs) ])) - (unListData - d)) - (force - headList - l)) + headList + l)) + (cse + `$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` + (force + headList + l))) + (cse + (cse + unIData))) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` - `$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - `$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` - (force - headList - l)) - (cse - `$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` + unBData)) + (\d -> + d) + (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + (force + headList (force - headList - l))) - (cse - (cse - unIData))) - (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` - unBData)) - (\`$dUnsafeFromData` - `$dUnsafeFromData` - d -> - (\s -> - s - s) - (\s -> - caseList' - (constr 0 - [ ]) - (\tup - tups -> - constr 1 - [ (constr 0 - [ (`$dUnsafeFromData` - (force - (force - fstPair) - tup)) - , (`$dUnsafeFromData` - (force - (force - sndPair) - tup)) ]) - , (s - s - tups) ])) - (unMapData - d)) - (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + tailList + l)))) (force - headList - (force - tailList - l)))) + tailList + l)) + (force + tailList + l)) (force tailList l)) @@ -499,438 +324,601 @@ l)) (force tailList - l)) - (force - tailList - l)) - (force - tailList - args)) ]) + args)) ]) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + (force + headList + args))) + , (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` (force + headList (force - sndPair) - tup)) - (force + tailList + args))) ]) + (\d -> + (\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (case + (equalsInteger + 1 + index) + [ (case + (equalsInteger + 2 + index) + [ (case + (equalsInteger + 3 + index) + [ (traceError + "PT1") + , (constr 0 + [ (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` + (force + headList + args)) ]) ]) + , (constr 2 + [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (force + headList + args)) ]) ]) + , (constr 3 + [ (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` + (force + headList + args)) ]) ]) + , (constr 1 + [ (unBData + (force + headList + args)) ]) ]) + (force + (force + sndPair) + tup)) (force - fstPair) - tup)) - (unConstrData - (force - headList - args))) - , (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - (force - headList - (force - tailList - args))) ]) ]) - (force (force sndPair) + (force + fstPair) + tup)) + (unConstrData + d))) ]) + (force (force sndPair) + tup)) + (force (force fstPair) tup)) - (force (force fstPair) tup)) - (unConstrData ctx)) - [ (\ds - ds -> - case - ds - [ (\ds - ds - ds - ds - ds - ds - ds - ds - ds - ds - ds - ds -> - force - ((\`$j` -> - case - ds - [ (delay - ((\x -> + (unConstrData ctx)) + [ (\ds + ds -> + case + ds + [ (\ds + ds + ds + ds + ds + ds + ds + ds + ds + ds + ds + ds -> + force + ((\`$j` -> + case + ds + [ (delay + ((\x -> + case + error + [ (\a + ds -> + `$j` + a + ds) ]) + (force + trace + "PT8" + (constr 0 + [ ])))) + , (\x + ds -> + delay + (case + x + [ (\a + ds -> + `$j` + a + ds) ])) ]) + (\a + ds -> + force + ((\`$j` -> case - error - [ (\a - ds -> - `$j` - a - ds) ]) - (force - trace - "PT8" - (constr 0 - [ ])))) - , (\x - ds -> - delay - (case - x - [ (\a - ds -> - `$j` - a - ds) ])) ]) - (\a - ds -> - force - ((\`$j` -> - case - ds - [ (delay - (`$j` - (traceError - "PT9"))) - , (\ds - as -> - delay - (`$j` - as)) ]) - (\rest -> - force - ((\`$j` -> - case - rest - [ (delay - ((\x -> - case - error - [ (\a - ds -> - `$j` - a - ds) ]) - (force - trace - "PT8" - (constr 0 - [ ])))) - , (\x - ds -> - delay - (case - x - [ (\a - ds -> - `$j` - a - ds) ])) ]) - (\a - ds -> - (\obsScriptCred' -> - (\go -> - case - (`$fEqStakingCredential_$c==` - obsScriptCred' - a) - [ (constr 0 - [ ]) - , (case - (`$fEqStakingCredential_$c==` - obsScriptCred' - a) - [ (constr 0 - [ ]) - , (go - ds) ]) ]) - ((\s -> - s - s) - (\s + ds + [ (delay + (`$j` + (traceError + "PT9"))) + , (\ds + as -> + delay + (`$j` + as)) ]) + (\rest -> + force + ((\`$j` -> + case + rest + [ (delay + ((\x -> + case + error + [ (\a + ds -> + `$j` + a + ds) ]) + (force + trace + "PT8" + (constr 0 + [ ])))) + , (\x + ds -> + delay + (case + x + [ (\a + ds -> + `$j` + a + ds) ])) ]) + (\a + ds -> + (\obsScriptCred' -> + (\`$fEqStakingCredential_$c==` -> + (\go -> + case + (`$fEqStakingCredential_$c==` + obsScriptCred' + a) + [ (constr 0 + [ ]) + , (case + (`$fEqStakingCredential_$c==` + obsScriptCred' + a) + [ (constr 0 + [ ]) + , (go + ds) ]) ]) + ((\s -> + s + s) + (\s + ds -> + case + ds + [ ((\x -> + error) + (force + trace + "not found" + (constr 0 + [ ]))) + , (\ds + xs' -> + case + ds + [ (\c' + i -> + case + (`$fEqStakingCredential_$c==` + c' + obsScriptCred') + [ (constr 0 + [ ]) + , (s + s + xs') ]) ]) ]))) + (\ds ds -> case ds - [ ((\x -> - error) - (force - trace - "not found" - (constr 0 - [ ]))) - , (\ds - xs' -> + [ (\l -> + case + ds + [ (\r -> + case + l + [ (\l -> + case + r + [ (\r -> + case + (equalsByteString + l + r) + [ (constr 1 + [ ]) + , (constr 0 + [ ]) ]) + , (\ipv -> + constr 1 + [ ]) ]) + , (\a -> + case + r + [ (\ipv -> + constr 1 + [ ]) + , (\a' -> + case + (equalsByteString + a + a') + [ (constr 1 + [ ]) + , (constr 0 + [ ]) ]) ]) ]) + , (\ipv + ipv + ipv -> + constr 1 + [ ]) ]) + , (\a + b + c -> case ds - [ (\c' - i -> + [ (\ipv -> + constr 1 + [ ]) + , (\a' + b' + c' -> case - (`$fEqStakingCredential_$c==` - c' - obsScriptCred') - [ (constr 0 + (equalsInteger + a + a') + [ (constr 1 [ ]) - , (s - s - xs') ]) ]) ]))) - (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - obsScriptCred)))))))) ]) ]) - (\ds - ds -> - case - ds - [ (\l -> - case - ds - [ (\r -> - case - l - [ (\l -> - case - r - [ (\r -> - case - (equalsByteString - l - r) - [ (constr 1 - [ ]) - , (constr 0 - [ ]) ]) - , (\ipv -> - constr 1 - [ ]) ]) - , (\a -> - case - r - [ (\ipv -> - constr 1 - []) - , (\a' -> - case - (equalsByteString - a - a') - [ (constr 1 - [ ]) - , (constr 0 - [ ]) ]) ]) ]) - , (\ipv ipv ipv -> - constr 1 []) ]) - , (\a - b - c -> - case - ds - [ (\ipv -> constr 1 []) - , (\a' - b' - c' -> - case - (equalsInteger - a - a') - [ (constr 1 []) - , (case - (equalsInteger - b - b') - [ (constr 1 - []) - , (case - (equalsInteger - c - c') - [ (constr 1 - []) - , (constr 0 - [ ]) ]) ]) ]) ]) ])) - (\d -> d)) + , (case + (equalsInteger + b + b') + [ (constr 1 + [ ]) + , (case + (equalsInteger + c + c') + [ (constr 1 + [ ]) + , (constr 0 + [ ]) ]) ]) ]) ]) ])) + (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + obsScriptCred)))))))) ]) ]) + ((\s -> + s s) + (\s + xs -> + case + xs + [ (constr 0 []) + , (\x + xs -> + constr 1 + [ (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` + x) + , (s s xs) ]) ]))) + ((\s -> + s s) + (\s + xs -> + case + xs + [ (constr 0 []) + , (\x + xs -> + constr 1 + [ (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` + x) + , (s s xs) ]) ]))) + (\d -> + (\tup -> + (\index -> + (\args -> + case + (equalsInteger 0 index) + [ (traceError "PT1") + , (constr 0 + [ (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` + (force headList + args)) + , (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` + (force + headList + (force + tailList + args))) ]) ]) + (force (force sndPair) tup)) + (force (force fstPair) tup)) + (unConstrData d))) (\d -> (\tup -> (\index -> (\args -> case (equalsInteger 0 index) - [ (case - (equalsInteger 1 index) - [ (traceError "PT1") - , (constr 0 []) ]) - , (constr 1 []) ]) + [ (traceError "PT1") + , (constr 0 + [ (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` + (force headList + args)) + , (unIData + (force headList + (force tailList + args))) ]) ]) (force (force sndPair) tup)) (force (force fstPair) tup)) (unConstrData d))) - (\`$dUnsafeFromData` d -> + (\d -> (\tup -> (\index -> (\args -> case (equalsInteger 0 index) - [ (case - (equalsInteger 1 index) - [ (case - (equalsInteger 2 index) - [ (traceError "PT1") - , (constr 2 []) ]) - , (constr 0 - [ (`$dUnsafeFromData` - (force headList - args)) ]) ]) - , (constr 1 []) ]) + [ (traceError "PT1") + , (unBData + (force headList args)) ]) (force (force sndPair) tup)) (force (force fstPair) tup)) (unConstrData d))) - (\d -> - (\tup -> - (\index -> - (\args -> - case - (equalsInteger 0 index) - [ (case - (equalsInteger 1 index) - [ (case - (equalsInteger 2 index) - [ (case - (equalsInteger - 3 - index) - [ (traceError "PT1") - , (constr 0 - [ (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` - (force - headList - args)) ]) ]) - , (constr 2 - [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (force headList - args)) ]) ]) - , (constr 3 - [ (`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` - (force headList - args)) ]) ]) - , (constr 1 - [ (unBData - (force headList - args)) ]) ]) - (force (force sndPair) tup)) - (force (force fstPair) tup)) - (unConstrData d))) - (\d -> + ((\s -> + s s) + (\s + xs -> + case + xs + [ (constr 0 []) + , (\x + xs -> + constr 1 + [ (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` + x) + , (s s xs) ]) ]))) + (\eta -> (\tup -> (\index -> (\args -> case (equalsInteger 0 index) - [ (case - (equalsInteger 1 index) - [ (case - (equalsInteger 2 index) - [ (case - (equalsInteger 3 index) - [ (case - (equalsInteger - 4 - index) - [ (case + [ (traceError "PT1") + , ((\l -> + (\l -> + (\`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` -> + (\cse -> + constr 0 + [ ((\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (traceError + "PT1") + , (constr 0 + [ (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` + (force + headList + args)) + , (`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` + `$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (force + headList + (force + tailList + args))) ]) ]) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + (force + headList + args))) + , (cse + (cse unIData) + (force headList + l)) + , ((\tup -> + (\index -> + (\args -> + case + (equalsInteger + 0 + index) + [ (case + (equalsInteger + 1 + index) + [ (case + (equalsInteger + 2 + index) + [ (traceError + "PT1") + , (constr 1 + [ (force + headList + args) ]) ]) + , (constr 2 + [ (unBData + (force + headList + args)) ]) ]) + , (constr 0 + [ ]) ]) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + (force + headList + l))) + , (`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` + unBData + (force headList + (force + tailList + l))) ]) + (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` + unBData)) + (\`$dUnsafeFromData` + d -> + (\tup -> + (\index -> + (\args -> + case (equalsInteger - 5 + 1 index) [ (case (equalsInteger - 6 + 0 index) [ (traceError "PT1") - , (constr 4 - [ ]) ]) - , (constr 3 + , (constr 0 + [ (`$dUnsafeFromData` + (force + headList + args)) ]) ]) + , (constr 1 []) ]) - , (constr 6 - [ (unBData - (force - headList - args)) - , (unIData - (force - headList - (force - tailList - args))) ]) ]) - , (constr 5 - [ (unBData + (force (force - headList - args)) - , (unBData - (force - headList - (force - tailList - args))) ]) ]) - , (constr 1 - [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (force headList - args)) - , (unBData - (force headList - (force tailList - args))) ]) ]) - , (constr 0 - [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (force headList - args)) ]) ]) - , (constr 2 - [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` - (force headList args)) ]) ]) + sndPair) + tup)) + (force + (force fstPair) + tup)) + (unConstrData d))) + (force tailList l)) + (force tailList args)) ]) (force (force sndPair) tup)) (force (force fstPair) tup)) - (unConstrData d))) - (\d -> - (\tup -> - (\index -> - (\args -> - case - (equalsInteger 0 index) - [ (case - (equalsInteger 1 index) - [ (traceError "PT1") - , ((\l -> - constr 1 - [ (unIData - (force headList args)) - , (unIData - (force headList l)) - , (unIData - (force headList - (force tailList - l))) ]) - (force tailList args)) ]) - , (constr 0 - [ (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` - (force headList args)) ]) ]) - (force (force sndPair) tup)) - (force (force fstPair) tup)) - (unConstrData d))) - (\d -> - (\tup -> - (\index -> - (\args -> - case - (equalsInteger 0 index) - [ (case - (equalsInteger 1 index) - [ (traceError "PT1") - , (constr 1 - [ (unBData - (force headList args)) ]) ]) - , (constr 0 - [(unBData (force headList args))]) ]) - (force (force sndPair) tup)) - (force (force fstPair) tup)) - (unConstrData d))) + (unConstrData eta))) + (\`$dUnsafeFromData` `$dUnsafeFromData` -> + (\go d -> go (unMapData d)) + ((\s -> s s) + (\s xs -> + case + xs + [ (constr 0 []) + , (\tup tups -> + constr 1 + [ (constr 0 + [ (`$dUnsafeFromData` + (force (force fstPair) + tup)) + , (`$dUnsafeFromData` + (force (force sndPair) + tup)) ]) + , (s s tups) ]) ])))) + ((\s -> + s s) + (\s + xs -> + case + xs + [ (constr 0 []) + , (\x + xs -> + constr 1 + [ (`$fUnsafeFromDataDCert_$cunsafeFromBuiltinData` + x) + , (s s xs) ]) ]))) (\d -> (\tup -> (\index -> (\args -> case (equalsInteger 0 index) - [ (traceError "PT1") - , (constr 0 - [ (`$fUnsafeFromDataTxId_$cunsafeFromBuiltinData` - (force headList args)) - , (unIData - (force headList - (force tailList args))) ]) ]) + [ (case + (equalsInteger 1 index) + [ (case + (equalsInteger 2 index) + [ (case + (equalsInteger 3 index) + [ (case + (equalsInteger 4 index) + [ (case + (equalsInteger 5 index) + [ (case + (equalsInteger + 6 + index) + [ (traceError + "PT1") + , (constr 4 []) ]) + , (constr 3 []) ]) + , (constr 6 + [ (unBData + (force headList + args)) + , (unIData + (force + headList + (force + tailList + args))) ]) ]) + , (constr 5 + [ (unBData + (force headList args)) + , (unBData + (force headList + (force tailList + args))) ]) ]) + , (constr 1 + [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (force headList args)) + , (unBData + (force headList + (force tailList + args))) ]) ]) + , (constr 0 + [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (force headList args)) ]) ]) + , (constr 2 + [ (`$fUnsafeFromDataStakingCredential_$cunsafeFromBuiltinData` + (force headList args)) ]) ]) (force (force sndPair) tup)) (force (force fstPair) tup)) (unConstrData d))) @@ -940,31 +928,40 @@ (\args -> case (equalsInteger 0 index) - [ (traceError "PT1") - , (unBData (force headList args)) ]) + [ (case + (equalsInteger 1 index) + [ (traceError "PT1") + , ((\l -> + constr 1 + [ (unIData (force headList args)) + , (unIData (force headList l)) + , (unIData + (force headList + (force tailList l))) ]) + (force tailList args)) ]) + , (constr 0 + [ (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` + (force headList args)) ]) ]) (force (force sndPair) tup)) (force (force fstPair) tup)) (unConstrData d))) - (\`$dUnsafeFromData` d -> + (\d -> (\tup -> (\index -> (\args -> case - (equalsInteger 1 index) + (equalsInteger 0 index) [ (case - (equalsInteger 0 index) + (equalsInteger 1 index) [ (traceError "PT1") - , (constr 0 - [ (`$dUnsafeFromData` - (force headList args)) ]) ]) - , (constr 1 []) ]) + , (constr 1 [(unBData (force headList args))]) ]) + , (constr 0 [(unBData (force headList args))]) ]) (force (force sndPair) tup)) (force (force fstPair) tup)) (unConstrData d))) (\str -> (\x -> error) (force trace str (constr 0 [])))) - (\z f xs -> - force - (force (force chooseList) + ((\s -> s s) + (\s xs -> + case xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))))) \ No newline at end of file + [(constr 0 []), (\x xs -> constr 1 [(unBData x), (s s xs)])])))) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-20.eval.golden b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-20.eval.golden index 2d7b9754ba8..2d103b8c923 100644 --- a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 20_218_376 -Memory: 72_582 -Term Size: 92 -Flat Size: 718 +CPU: 8_241_242 +Memory: 33_830 +Term Size: 74 +Flat Size: 705 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-4.eval.golden b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-4.eval.golden index 41bbcad43e1..8106d21a5af 100644 --- a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 5_642_136 -Memory: 19_814 -Term Size: 92 -Flat Size: 284 +CPU: 3_037_914 +Memory: 11_398 +Term Size: 74 +Flat Size: 271 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.pir.golden b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.pir.golden index e712dccca43..f2cd8a4aea7 100644 --- a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.pir.golden +++ b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.pir.golden @@ -1,17 +1,10 @@ (letrec !go : list data -> integer = \(xs : list data) -> - chooseList - {data} - {all dead. integer} + case + integer xs - (/\dead -> 0) - (/\dead -> - let - !ds : data = headList {data} xs - in - addInteger 1 (go (tailList {data} xs))) - {integer} + [0, (\(ds : data) (eta : list data) -> addInteger 1 (go eta))] in let data Bool | Bool_match where diff --git a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.size.golden b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.size.golden index 69226f7293a..0aeb5485442 100644 --- a/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.size.golden +++ b/plutus-benchmark/script-contexts/test/V2/Data/9.6/checkScriptContext1.size.golden @@ -1 +1 @@ -92 \ No newline at end of file +74 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-20.eval.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-20.eval.golden index 2c2b4d4a1f5..c510189af67 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 266_959_835 -Memory: 1_003_489 -Term Size: 2_574 -Flat Size: 3_265 +CPU: 213_316_721 +Memory: 814_897 +Term Size: 2_511 +Flat Size: 3_214 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-4.eval.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-4.eval.golden index 15dadd1fa63..2ccdb1da345 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 77_898_123 -Memory: 299_361 -Term Size: 2_574 -Flat Size: 2_831 +CPU: 63_797_553 +Memory: 247_601 +Term Size: 2_511 +Flat Size: 2_780 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.pir.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.pir.golden index 7d0ac0355dd..7d8f84715b8 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.pir.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.pir.golden @@ -44,8 +44,8 @@ (\(ds : TxOut) (xs : List TxOut) -> addInteger 1 (go xs)) in let - !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data - = \(d : data) -> d + data GovernanceActionId | GovernanceActionId_match where + GovernanceActionId : bytestring -> integer -> GovernanceActionId data Bool | Bool_match where True : Bool False : Bool @@ -54,59 +54,6 @@ !traceError : all a. string -> a = /\a -> \(str : string) -> let !x : Unit = trace {Unit} str Unit in error {a} - !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> traceError {Bool} "PT1") - {all dead. dead}) - {all dead. dead} - data (Extended :: * -> *) a | Extended_match where - Finite : a -> Extended a - NegInf : Extended a - PosInf : Extended a - !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : - all a. (\a -> data -> a) a -> data -> Extended a - = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Extended a} - (/\dead -> NegInf {a}) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Extended a} - (/\dead -> - Finite {a} (`$dUnsafeFromData` (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Extended a} - (/\dead -> PosInf {a}) - (/\dead -> traceError {Extended a} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} - data GovernanceActionId | GovernanceActionId_match where - GovernanceActionId : bytestring -> integer -> GovernanceActionId !`$fUnsafeFromDataGovernanceAction_$cunsafeFromBuiltinData` : data -> GovernanceActionId = \(d : data) -> @@ -124,30 +71,21 @@ (unIData (headList {data} (tailList {data} args)))) (/\dead -> traceError {GovernanceActionId} "PT1") {all dead. dead} - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} !`$fUnsafeFromDataList_$cunsafeFromBuiltinData` : all a. (\a -> data -> a) a -> data -> List a = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) -> letrec !go : list data -> List a - = caseList' - {data} - {List a} - (Nil {a}) - (\(x : data) (xs : list data) -> - Cons {a} (`$dUnsafeFromData` x) (go xs)) + = \(xs : list data) -> + case + (List a) + xs + [ (Nil {a}) + , (\(x : data) (xs : list data) -> + Cons {a} (`$dUnsafeFromData` x) (go xs)) ] in - go (unListData d) + \(d : data) -> go (unListData d) !`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` : data -> Credential = \(d : data) -> let @@ -197,25 +135,27 @@ (\k v -> List (Tuple2 k v)) k v = /\k v -> \(`$dUnsafeFromData` : (\a -> data -> a) k) - (`$dUnsafeFromData` : (\a -> data -> a) v) - (d : data) -> + (`$dUnsafeFromData` : (\a -> data -> a) v) -> letrec !go : list (pair data data) -> List (Tuple2 k v) - = caseList' - {pair data data} - {List (Tuple2 k v)} - (Nil {Tuple2 k v}) - (\(tup : pair data data) (tups : list (pair data data)) -> - Cons - {Tuple2 k v} - (Tuple2 - {k} - {v} - (`$dUnsafeFromData` (fstPair {data} {data} tup)) - (`$dUnsafeFromData` (sndPair {data} {data} tup))) - (go tups)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 k v)) + xs + [ (Nil {Tuple2 k v}) + , (\(tup : pair data data) + (tups : list (pair data data)) -> + Cons + {Tuple2 k v} + (Tuple2 + {k} + {v} + (`$dUnsafeFromData` (fstPair {data} {data} tup)) + (`$dUnsafeFromData` + (sndPair {data} {data} tup))) + (go tups)) ] in - go (unMapData d) + \(d : data) -> go (unMapData d) data ProtocolVersion | ProtocolVersion_match where ProtocolVersion : integer -> integer -> ProtocolVersion data Rational | Rational_match where @@ -525,6 +465,22 @@ {all dead. dead})) (/\dead -> traceError {ProposalProcedure} "PT1") {all dead. dead} + in + letrec + !go : list data -> List ProposalProcedure + = \(xs : list data) -> + case + (List ProposalProcedure) + xs + [ (Nil {ProposalProcedure}) + , (\(x : data) (xs : list data) -> + Cons + {ProposalProcedure} + (`$fUnsafeFromDataProposalProcedure_$cunsafeFromBuiltinData` + x) + (go xs)) ] + in + let data DRep | DRep_match where DRep : Credential -> DRep DRepAlwaysAbstain : DRep @@ -788,60 +744,21 @@ {all dead. dead}) {all dead. dead}) {all dead. dead} - data Voter | Voter_match where - CommitteeVoter : Credential -> Voter - DRepVoter : Credential -> Voter - StakePoolVoter : bytestring -> Voter - !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> Voter - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Voter} - (/\dead -> - CommitteeVoter - (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Voter} - (/\dead -> - DRepVoter - (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Voter} - (/\dead -> - StakePoolVoter (unBData (headList {data} args))) - (/\dead -> traceError {Voter} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} - data TxOutRef | TxOutRef_match where - TxOutRef : bytestring -> integer -> TxOutRef - !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. TxOutRef} - (/\dead -> - TxOutRef - (unBData (headList {data} args)) - (unIData (headList {data} (tailList {data} args)))) - (/\dead -> traceError {TxOutRef} "PT1") - {all dead. dead} + in + letrec + !go : list data -> List TxCert + = \(xs : list data) -> + case + (List TxCert) + xs + [ (Nil {TxCert}) + , (\(x : data) (xs : list data) -> + Cons + {TxCert} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let !`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` : data -> TxOut = \(eta : data) -> @@ -958,6 +875,39 @@ (headList {data} (tailList {data} l)))) (/\dead -> traceError {TxOut} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxOut + = \(xs : list data) -> + case + (List TxOut) + xs + [ (Nil {TxOut}) + , (\(x : data) (xs : list data) -> + Cons + {TxOut} + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + data TxOutRef | TxOutRef_match where + TxOutRef : bytestring -> integer -> TxOutRef + !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxOutRef} + (/\dead -> + TxOutRef + (unBData (headList {data} args)) + (unIData (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxOutRef} "PT1") + {all dead. dead} data TxInInfo | TxInInfo_match where TxInInfo : TxOutRef -> TxOut -> TxInInfo !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> TxInInfo @@ -978,6 +928,123 @@ (headList {data} (tailList {data} args)))) (/\dead -> traceError {TxInInfo} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data + = \(d : data) -> d + !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> traceError {Bool} "PT1") + {all dead. dead}) + {all dead. dead} + data (Extended :: * -> *) a | Extended_match where + Finite : a -> Extended a + NegInf : Extended a + PosInf : Extended a + !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : + all a. (\a -> data -> a) a -> data -> Extended a + = /\a -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Extended a} + (/\dead -> NegInf {a}) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Extended a} + (/\dead -> + Finite {a} (`$dUnsafeFromData` (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Extended a} + (/\dead -> PosInf {a}) + (/\dead -> traceError {Extended a} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} + data Voter | Voter_match where + CommitteeVoter : Credential -> Voter + DRepVoter : Credential -> Voter + StakePoolVoter : bytestring -> Voter + !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> Voter + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Voter} + (/\dead -> + CommitteeVoter + (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Voter} + (/\dead -> + DRepVoter + (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Voter} + (/\dead -> + StakePoolVoter (unBData (headList {data} args))) + (/\dead -> traceError {Voter} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} data ScriptInfo | ScriptInfo_match where CertifyingScript : integer -> TxCert -> ScriptInfo MintingScript : bytestring -> ScriptInfo @@ -1073,59 +1140,14 @@ (let !d : data = headList {data} args in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxOut - = caseList' - {data} - {List TxOut} - (Nil {TxOut}) - (\(x : data) - (xs : list data) -> - Cons - {TxOut} - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (unIData (headList {data} l)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` @@ -1141,21 +1163,6 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxCert - = caseList' - {data} - {List TxCert} - (Nil {TxCert}) - (\(x : data) - (xs : list data) -> - Cons - {TxCert} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {Credential} @@ -1369,21 +1376,6 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List ProposalProcedure - = caseList' - {data} - {List ProposalProcedure} - (Nil {ProposalProcedure}) - (\(x : data) - (xs : list data) -> - Cons - {ProposalProcedure} - (`$fUnsafeFromDataProposalProcedure_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` {integer} diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.size.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.size.golden index b2b5ccbf751..89b988799e6 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.size.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1.size.golden @@ -1 +1 @@ -2574 \ No newline at end of file +2511 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-20.eval.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-20.eval.golden index 43848c1b50d..d36acd063c3 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 259_567_412 -Memory: 971_047 -Term Size: 2_510 -Flat Size: 3_185 +CPU: 205_924_298 +Memory: 782_455 +Term Size: 2_447 +Flat Size: 3_137 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-4.eval.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-4.eval.golden index 68c80c447cf..ba9377e7f9e 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 75_709_028 -Memory: 289_351 -Term Size: 2_510 -Flat Size: 2_751 +CPU: 61_608_458 +Memory: 237_591 +Term Size: 2_447 +Flat Size: 2_703 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.pir.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.pir.golden index 332fc18c5d3..22979e31eed 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.pir.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.pir.golden @@ -1,6 +1,6 @@ (let - !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data - = \(d : data) -> d + data GovernanceActionId | GovernanceActionId_match where + GovernanceActionId : bytestring -> integer -> GovernanceActionId data Bool | Bool_match where True : Bool False : Bool @@ -9,59 +9,6 @@ !traceError : all a. string -> a = /\a -> \(str : string) -> let !x : Unit = trace {Unit} str Unit in error {a} - !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> traceError {Bool} "PT1") - {all dead. dead}) - {all dead. dead} - data (Extended :: * -> *) a | Extended_match where - Finite : a -> Extended a - NegInf : Extended a - PosInf : Extended a - !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : - all a. (\a -> data -> a) a -> data -> Extended a - = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Extended a} - (/\dead -> NegInf {a}) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Extended a} - (/\dead -> - Finite {a} (`$dUnsafeFromData` (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Extended a} - (/\dead -> PosInf {a}) - (/\dead -> traceError {Extended a} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} - data GovernanceActionId | GovernanceActionId_match where - GovernanceActionId : bytestring -> integer -> GovernanceActionId !`$fUnsafeFromDataGovernanceAction_$cunsafeFromBuiltinData` : data -> GovernanceActionId = \(d : data) -> @@ -79,16 +26,6 @@ (unIData (headList {data} (tailList {data} args)))) (/\dead -> traceError {GovernanceActionId} "PT1") {all dead. dead} - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} in letrec data (List :: * -> *) a | List_match where @@ -99,17 +36,18 @@ !`$fUnsafeFromDataList_$cunsafeFromBuiltinData` : all a. (\a -> data -> a) a -> data -> List a = /\a -> - \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) -> letrec !go : list data -> List a - = caseList' - {data} - {List a} - (Nil {a}) - (\(x : data) (xs : list data) -> - Cons {a} (`$dUnsafeFromData` x) (go xs)) + = \(xs : list data) -> + case + (List a) + xs + [ (Nil {a}) + , (\(x : data) (xs : list data) -> + Cons {a} (`$dUnsafeFromData` x) (go xs)) ] in - go (unListData d) + \(d : data) -> go (unListData d) data Credential | Credential_match where PubKeyCredential : bytestring -> Credential ScriptCredential : bytestring -> Credential @@ -167,25 +105,27 @@ (\k v -> List (Tuple2 k v)) k v = /\k v -> \(`$dUnsafeFromData` : (\a -> data -> a) k) - (`$dUnsafeFromData` : (\a -> data -> a) v) - (d : data) -> + (`$dUnsafeFromData` : (\a -> data -> a) v) -> letrec !go : list (pair data data) -> List (Tuple2 k v) - = caseList' - {pair data data} - {List (Tuple2 k v)} - (Nil {Tuple2 k v}) - (\(tup : pair data data) (tups : list (pair data data)) -> - Cons - {Tuple2 k v} - (Tuple2 - {k} - {v} - (`$dUnsafeFromData` (fstPair {data} {data} tup)) - (`$dUnsafeFromData` (sndPair {data} {data} tup))) - (go tups)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 k v)) + xs + [ (Nil {Tuple2 k v}) + , (\(tup : pair data data) + (tups : list (pair data data)) -> + Cons + {Tuple2 k v} + (Tuple2 + {k} + {v} + (`$dUnsafeFromData` (fstPair {data} {data} tup)) + (`$dUnsafeFromData` + (sndPair {data} {data} tup))) + (go tups)) ] in - go (unMapData d) + \(d : data) -> go (unMapData d) data ProtocolVersion | ProtocolVersion_match where ProtocolVersion : integer -> integer -> ProtocolVersion data Rational | Rational_match where @@ -495,6 +435,22 @@ {all dead. dead})) (/\dead -> traceError {ProposalProcedure} "PT1") {all dead. dead} + in + letrec + !go : list data -> List ProposalProcedure + = \(xs : list data) -> + case + (List ProposalProcedure) + xs + [ (Nil {ProposalProcedure}) + , (\(x : data) (xs : list data) -> + Cons + {ProposalProcedure} + (`$fUnsafeFromDataProposalProcedure_$cunsafeFromBuiltinData` + x) + (go xs)) ] + in + let data DRep | DRep_match where DRep : Credential -> DRep DRepAlwaysAbstain : DRep @@ -758,60 +714,21 @@ {all dead. dead}) {all dead. dead}) {all dead. dead} - data Voter | Voter_match where - CommitteeVoter : Credential -> Voter - DRepVoter : Credential -> Voter - StakePoolVoter : bytestring -> Voter - !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> Voter - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. Voter} - (/\dead -> - CommitteeVoter - (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 1 index) [False, True]) - {all dead. Voter} - (/\dead -> - DRepVoter - (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` - (headList {data} args))) - (/\dead -> - Bool_match - (case Bool (equalsInteger 2 index) [False, True]) - {all dead. Voter} - (/\dead -> - StakePoolVoter (unBData (headList {data} args))) - (/\dead -> traceError {Voter} "PT1") - {all dead. dead}) - {all dead. dead}) - {all dead. dead} - data TxOutRef | TxOutRef_match where - TxOutRef : bytestring -> integer -> TxOutRef - !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef - = \(d : data) -> - let - !tup : pair integer (list data) = unConstrData d - !index : integer = fstPair {integer} {list data} tup - !args : list data = sndPair {integer} {list data} tup - in - Bool_match - (case Bool (equalsInteger 0 index) [False, True]) - {all dead. TxOutRef} - (/\dead -> - TxOutRef - (unBData (headList {data} args)) - (unIData (headList {data} (tailList {data} args)))) - (/\dead -> traceError {TxOutRef} "PT1") - {all dead. dead} + in + letrec + !go : list data -> List TxCert + = \(xs : list data) -> + case + (List TxCert) + xs + [ (Nil {TxCert}) + , (\(x : data) (xs : list data) -> + Cons + {TxCert} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let data StakingCredential | StakingCredential_match where StakingHash : Credential -> StakingCredential StakingPtr : integer -> integer -> integer -> StakingCredential @@ -946,6 +863,39 @@ (headList {data} (tailList {data} l)))) (/\dead -> traceError {TxOut} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxOut + = \(xs : list data) -> + case + (List TxOut) + xs + [ (Nil {TxOut}) + , (\(x : data) (xs : list data) -> + Cons + {TxOut} + (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + data TxOutRef | TxOutRef_match where + TxOutRef : bytestring -> integer -> TxOutRef + !`$fUnsafeFromDataTxOutRef_$cunsafeFromBuiltinData` : data -> TxOutRef + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. TxOutRef} + (/\dead -> + TxOutRef + (unBData (headList {data} args)) + (unIData (headList {data} (tailList {data} args)))) + (/\dead -> traceError {TxOutRef} "PT1") + {all dead. dead} data TxInInfo | TxInInfo_match where TxInInfo : TxOutRef -> TxOut -> TxInInfo !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> TxInInfo @@ -966,6 +916,123 @@ (headList {data} (tailList {data} args)))) (/\dead -> traceError {TxInInfo} "PT1") {all dead. dead} + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + letrec + !go : list data -> List TxInInfo + = \(xs : list data) -> + case + (List TxInInfo) + xs + [ (Nil {TxInInfo}) + , (\(x : data) (xs : list data) -> + Cons + {TxInInfo} + (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` x) + (go xs)) ] + in + let + !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data + = \(d : data) -> d + !`$fUnsafeFromDataBool_$cunsafeFromBuiltinData` : data -> Bool + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> traceError {Bool} "PT1") + {all dead. dead}) + {all dead. dead} + data (Extended :: * -> *) a | Extended_match where + Finite : a -> Extended a + NegInf : Extended a + PosInf : Extended a + !`$fUnsafeFromDataExtended_$cunsafeFromBuiltinData` : + all a. (\a -> data -> a) a -> data -> Extended a + = /\a -> + \(`$dUnsafeFromData` : (\a -> data -> a) a) (d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Extended a} + (/\dead -> NegInf {a}) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Extended a} + (/\dead -> + Finite {a} (`$dUnsafeFromData` (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Extended a} + (/\dead -> PosInf {a}) + (/\dead -> traceError {Extended a} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} + data Voter | Voter_match where + CommitteeVoter : Credential -> Voter + DRepVoter : Credential -> Voter + StakePoolVoter : bytestring -> Voter + !`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` : data -> Voter + = \(d : data) -> + let + !tup : pair integer (list data) = unConstrData d + !index : integer = fstPair {integer} {list data} tup + !args : list data = sndPair {integer} {list data} tup + in + Bool_match + (case Bool (equalsInteger 0 index) [False, True]) + {all dead. Voter} + (/\dead -> + CommitteeVoter + (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 1 index) [False, True]) + {all dead. Voter} + (/\dead -> + DRepVoter + (`$fUnsafeFromDataCredential_$cunsafeFromBuiltinData` + (headList {data} args))) + (/\dead -> + Bool_match + (case Bool (equalsInteger 2 index) [False, True]) + {all dead. Voter} + (/\dead -> + StakePoolVoter (unBData (headList {data} args))) + (/\dead -> traceError {Voter} "PT1") + {all dead. dead}) + {all dead. dead}) + {all dead. dead} data ScriptInfo | ScriptInfo_match where CertifyingScript : integer -> TxCert -> ScriptInfo MintingScript : bytestring -> ScriptInfo @@ -1063,59 +1130,14 @@ (let !d : data = headList {data} args in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxInInfo - = caseList' - {data} - {List TxInInfo} - (Nil {TxInInfo}) - (\(x : data) - (xs : list data) -> - Cons - {TxInInfo} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxOut - = caseList' - {data} - {List TxOut} - (Nil {TxOut}) - (\(x : data) - (xs : list data) -> - Cons - {TxOut} - (`$fUnsafeFromDataTxOut_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (unIData (headList {data} l)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` @@ -1131,21 +1153,6 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List TxCert - = caseList' - {data} - {List TxCert} - (Nil {TxCert}) - (\(x : data) - (xs : list data) -> - Cons - {TxCert} - (`$fUnsafeFromDataScriptContext_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMap_$cunsafeFromBuiltinData` {Credential} @@ -1376,21 +1383,6 @@ (let !d : data = headList {data} l in - letrec - !go : - list data -> List ProposalProcedure - = caseList' - {data} - {List ProposalProcedure} - (Nil {ProposalProcedure}) - (\(x : data) - (xs : list data) -> - Cons - {ProposalProcedure} - (`$fUnsafeFromDataProposalProcedure_$cunsafeFromBuiltinData` - x) - (go xs)) - in go (unListData d)) (`$fUnsafeFromDataMaybe_$cunsafeFromBuiltinData` {integer} diff --git a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.size.golden b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.size.golden index dd8285ac2c3..4baaea8c600 100644 --- a/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.size.golden +++ b/plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2.size.golden @@ -1 +1 @@ -2510 \ No newline at end of file +2447 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-20.eval.golden b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-20.eval.golden index 9f903f7bb1a..964afa7bb65 100644 --- a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-20.eval.golden +++ b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-20.eval.golden @@ -1,6 +1,6 @@ -CPU: 20_218_376 -Memory: 72_582 -Term Size: 92 -Flat Size: 724 +CPU: 8_241_242 +Memory: 33_830 +Term Size: 74 +Flat Size: 711 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-4.eval.golden b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-4.eval.golden index dcd1f9250cd..e57bf28b955 100644 --- a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 5_642_136 -Memory: 19_814 -Term Size: 92 -Flat Size: 290 +CPU: 3_037_914 +Memory: 11_398 +Term Size: 74 +Flat Size: 277 (constr 0) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.pir.golden b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.pir.golden index ed79ee0d629..ca420e981af 100644 --- a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.pir.golden +++ b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.pir.golden @@ -1,17 +1,10 @@ (letrec !go : list data -> integer = \(xs : list data) -> - chooseList - {data} - {all dead. integer} + case + integer xs - (/\dead -> 0) - (/\dead -> - let - !ds : data = headList {data} xs - in - addInteger 1 (go (tailList {data} xs))) - {integer} + [0, (\(ds : data) (eta : list data) -> addInteger 1 (go eta))] in let data Bool | Bool_match where diff --git a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.size.golden b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.size.golden index 69226f7293a..0aeb5485442 100644 --- a/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.size.golden +++ b/plutus-benchmark/script-contexts/test/V3/Data/9.6/checkScriptContext1.size.golden @@ -1 +1 @@ -92 \ No newline at end of file +74 \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed-4.eval.golden b/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed-4.eval.golden index 21514329b47..471678ec283 100644 --- a/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed-4.eval.golden +++ b/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed-4.eval.golden @@ -1,6 +1,6 @@ -CPU: 35_069_192 -Memory: 124_698 -Term Size: 1_937 -Flat Size: 1_985 +CPU: 23_381_930 +Memory: 81_162 +Term Size: 1_910 +Flat Size: 1_965 (con unit ()) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.pir.golden b/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.pir.golden index 2d11e620f65..52c1c18e36a 100644 --- a/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.pir.golden +++ b/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.pir.golden @@ -452,16 +452,6 @@ let {all dead. dead} !`$fUnsafeFromDataBuiltinData_$cunsafeFromBuiltinData` : data -> data = \(d : data) -> d - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} !filter : all a. (\a -> data -> a) a -> @@ -476,54 +466,52 @@ let letrec !go : (\a -> list data) a -> (\a -> list data) a = \(ds : (\a -> list data) a) -> - caseList' - {data} - {(\a -> list data) a} - [] - (\(x : data) (eta : list data) -> - let - !h : a = `$dUnsafeFromData` x - in - Bool_match - (pred h) - {all dead. (\a -> list data) a} - (/\dead -> - let - !nt : list data = go eta - in - mkCons {data} (`$dToData` h) nt) - (/\dead -> go eta) - {all dead. dead}) + case + ((\a -> list data) a) ds + [ [] + , (\(x : data) (eta : list data) -> + let + !h : a = `$dUnsafeFromData` x + in + Bool_match + (pred h) + {all dead. (\a -> list data) a} + (/\dead -> + let + !nt : list data = go eta + in + mkCons {data} (`$dToData` h) nt) + (/\dead -> go eta) + {all dead. dead}) ] in \(eta : (\a -> list data) a) -> go eta !member : all k a. (\a -> a -> data) k -> k -> (\k a -> list (pair data data)) k a -> Bool = /\k a -> - \(`$dToData` : (\a -> a -> data) k) - (ds : k) - (ds : (\k a -> list (pair data data)) k a) -> + \(`$dToData` : (\a -> a -> data) k) (ds : k) -> letrec !go : list (pair data data) -> Bool - = caseList' - {pair data data} - {Bool} - False - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData - (`$dToData` ds) - (fstPair {data} {data} hd)) - [False, True]) - {all dead. list (pair data data) -> Bool} - (/\dead -> \(ds : list (pair data data)) -> True) - (/\dead -> go) - {all dead. dead}) + = \(xs : list (pair data data)) -> + case + Bool + xs + [ False + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData + (`$dToData` ds) + (fstPair {data} {data} hd)) + [False, True]) + {all dead. list (pair data data) -> Bool} + (/\dead -> \(ds : list (pair data data)) -> True) + (/\dead -> go) + {all dead. dead}) ] in - go ds + \(ds : (\k a -> list (pair data data)) k a) -> go ds !mapMaybe : all k a b. (\a -> data -> a) a -> @@ -537,27 +525,28 @@ let (f : a -> Maybe b) -> letrec !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) -> - Maybe_match - {b} - (f (`$dUnsafeFromData` (sndPair {data} {data} hd))) - {all dead. - list (pair data data) -> list (pair data data)} - (\(v' : b) -> - /\dead -> - \(eta : list (pair data data)) -> - mkCons - {pair data data} - (mkPairData - (fstPair {data} {data} hd) - (`$dToData` v')) - (go eta)) - (/\dead -> go) - {all dead. dead}) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) -> + Maybe_match + {b} + (f (`$dUnsafeFromData` (sndPair {data} {data} hd))) + {all dead. + list (pair data data) -> list (pair data data)} + (\(v' : b) -> + /\dead -> + \(eta : list (pair data data)) -> + mkCons + {pair data data} + (mkPairData + (fstPair {data} {data} hd) + (`$dToData` v')) + (go eta)) + (/\dead -> go) + {all dead. dead}) ] in go !null : all a. (\a -> list data) a -> Bool diff --git a/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.size.golden b/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.size.golden index 93715bcebd4..f72825c8d11 100644 --- a/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.size.golden +++ b/plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed.size.golden @@ -1 +1 @@ -1935 \ No newline at end of file +1908 \ No newline at end of file diff --git a/plutus-core/changelog.d/20250708_163237_seungheon.ooh_6602_list.md b/plutus-core/changelog.d/20250708_163237_seungheon.ooh_6602_list.md new file mode 100644 index 00000000000..b2b6ccf5c31 --- /dev/null +++ b/plutus-core/changelog.d/20250708_163237_seungheon.ooh_6602_list.md @@ -0,0 +1,3 @@ +### Added + +- Added support for `Case`ing on builtin lists. When `Case`ing a builtin list, exactly one or two branches are allowed: with a single branch, Case assumes the list is non-empty and applies the head element and the tail to that branch; with two branches, the first branch is selected if the list is empty (and takes no arguments), and the second branch is chosen if the list is non-empty, receiving the head element and the tail as its arguments. Note, the single branch **WILL FAIL** the script evaluation if empty list is given. diff --git a/plutus-core/plutus-core/src/PlutusCore/Builtin/Case.hs b/plutus-core/plutus-core/src/PlutusCore/Builtin/Case.hs index 938b02f0625..99fc4fd9b12 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Builtin/Case.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Builtin/Case.hs @@ -5,8 +5,9 @@ module PlutusCore.Builtin.Case where +import PlutusCore.Builtin.KnownType (HeadSpine) import PlutusCore.Core.Type (Type, UniOf) -import PlutusCore.Name.Unique +import PlutusCore.Name.Unique (TyName) import Control.DeepSeq (NFData (..), rwhnf) import Data.Default.Class (Default (..)) @@ -19,9 +20,11 @@ import Universe class AnnotateCaseBuiltin uni where -- | Given a tag for a built-in type and a list of branches, annotate each of the branches with -- its expected argument types or fail if casing on values of the built-in type isn't supported. + -- Note: you don't need to include the resulting type of the whole case matching in the + -- returning list here. annotateCaseBuiltin :: UniOf term ~ uni - => SomeTypeIn uni + => Type TyName uni ann -> [term] -> Either Text [(term, [Type TyName uni ann])] @@ -29,7 +32,11 @@ class CaseBuiltin uni where -- | Given a constant with its type tag and a vector of branches, choose the appropriate branch -- or fail if the constant doesn't correspond to any of the branches (or casing on constants of -- this type isn't supported at all). - caseBuiltin :: UniOf term ~ uni => Some (ValueOf uni) -> Vector term -> Either Text term + caseBuiltin + :: UniOf term ~ uni + => Some (ValueOf uni) + -> Vector term + -> Either Text (HeadSpine term (Some (ValueOf uni))) -- See Note [DO NOT newtype-wrap functions]. -- | A @data@ version of 'CaseBuiltin'. we parameterize the evaluator by a 'CaserBuiltin' so that @@ -37,7 +44,7 @@ class CaseBuiltin uni where -- latter is required for earlier protocol versions when we didn't support casing on builtins). data CaserBuiltin uni = CaserBuiltin { unCaserBuiltin - :: !(forall term. UniOf term ~ uni => Some (ValueOf uni) -> Vector term -> Either Text term) + :: !(forall term. UniOf term ~ uni => Some (ValueOf uni) -> Vector term -> Either Text (HeadSpine term (Some (ValueOf uni)))) } instance NFData (CaserBuiltin uni) where diff --git a/plutus-core/plutus-core/src/PlutusCore/Builtin/KnownType.hs b/plutus-core/plutus-core/src/PlutusCore/Builtin/KnownType.hs index 48de0f659a0..5127b640c56 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Builtin/KnownType.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Builtin/KnownType.hs @@ -23,6 +23,8 @@ module PlutusCore.Builtin.KnownType , ReadKnownM , Spine (..) , HeadSpine (..) + , headSpine + , MonoHeadSpine , MakeKnownIn (..) , readKnownConstant , MakeKnown @@ -43,6 +45,7 @@ import PlutusCore.Evaluation.Result import PlutusCore.Pretty import Control.Monad.Except +import Data.Bifunctor import Data.Either.Extras import Data.Functor.Identity import Data.String @@ -287,14 +290,33 @@ data Spine a deriving stock (Show, Eq, Foldable, Functor) -- | The head-spine form of an iterated application. Provides O(1) access to the head of the --- application. Isomorphic to @NonEmpty@, except is strict and the no-spine case is made a separate +-- application. @NonEmpty a ~ HeadSpine a a@, except is strict and the no-spine case is made a separate -- constructor for performance reasons (it only takes a single pattern match to access the head when -- there's no spine this way, while otherwise we'd also need to match on the spine to ensure that -- it's empty -- and the no-spine case is by far the most common one, hence we want to optimize it). -data HeadSpine a +-- +-- Used in built-in functions returning function applications such as 'CaseList'. +data HeadSpine a b = HeadOnly a - | HeadSpine a (Spine a) - deriving stock (Show, Eq, Functor, Foldable) + | HeadSpine a (Spine b) + deriving stock (Show, Eq, Functor) + +-- | @HeadSpine@ but the type of head and spine is same +type MonoHeadSpine a = HeadSpine a a + +instance Bifunctor HeadSpine where + bimap headF _ (HeadOnly a) = HeadOnly $ headF a + bimap headF spineF (HeadSpine a b) = HeadSpine (headF a) (spineF <$> b) + +-- | Construct @HeadSpine@ from head and list. +headSpine :: a -> [b] -> HeadSpine a b +headSpine h [] = HeadOnly h +headSpine h (x:xs) = + -- It's critical to use 'foldr' here, so that deforestation kicks in. + -- See Note [Definition of foldl'] in "GHC.List" and related Notes around for an explanation + -- of the trick. + HeadSpine h $ foldr (\x2 r x1 -> SpineCons x1 $ r x2) SpineLast xs x +{-# INLINE headSpine #-} -- | -- @@ -313,19 +335,19 @@ deriving via PrettyCommon (Spine a) -- z -- >>> pretty (HeadSpine 'f' (SpineCons 'x' $ SpineLast 'y')) -- f `applyN` [x, y] -instance Pretty a => Pretty (HeadSpine a) where +instance (Pretty a, Pretty b) => Pretty (HeadSpine a b) where pretty (HeadOnly x) = pretty x pretty (HeadSpine f xs) = pretty f <+> "`applyN`" <+> pretty xs -instance PrettyBy config a => DefaultPrettyBy config (HeadSpine a) -deriving via PrettyCommon (HeadSpine a) - instance PrettyDefaultBy config (HeadSpine a) => PrettyBy config (HeadSpine a) +instance (PrettyBy config a, PrettyBy config b) => DefaultPrettyBy config (HeadSpine a b) +deriving via PrettyCommon (HeadSpine a b) + instance PrettyDefaultBy config (HeadSpine a b) => PrettyBy config (HeadSpine a b) -- See Note [Performance of ReadKnownIn and MakeKnownIn instances]. class uni ~ UniOf val => MakeKnownIn uni val a where -- | Convert a Haskell value to the corresponding PLC value. -- The inverse of 'readKnown'. - makeKnown :: a -> BuiltinResult (HeadSpine val) - default makeKnown :: KnownBuiltinType val a => a -> BuiltinResult (HeadSpine val) + makeKnown :: a -> BuiltinResult (HeadSpine val val) + default makeKnown :: KnownBuiltinType val a => a -> BuiltinResult (HeadSpine val val) -- Everything on evaluation path has to be strict in production, so in theory we don't need to -- force anything here. In practice however all kinds of weird things happen in tests and @val@ -- can be non-strict enough to cause trouble here, so we're forcing the argument. Looking at the @@ -352,7 +374,7 @@ class uni ~ UniOf val => ReadKnownIn uni val a where type ReadKnown val = ReadKnownIn (UniOf val) val -- | Same as 'makeKnown', but allows for neither emitting nor storing the cause of a failure. -makeKnownOrFail :: MakeKnownIn uni val a => a -> EvaluationResult (HeadSpine val) +makeKnownOrFail :: MakeKnownIn uni val a => a -> EvaluationResult (HeadSpine val val) makeKnownOrFail x = case makeKnown x of BuiltinSuccess val -> EvaluationSuccess val BuiltinSuccessWithLogs _ val -> EvaluationSuccess val @@ -413,6 +435,6 @@ instance uni ~ UniOf val => ReadKnownIn uni val (Opaque val rep) where readKnown = coerceArg pure {-# INLINE readKnown #-} -instance uni ~ UniOf val => MakeKnownIn uni val (Opaque (HeadSpine val) rep) where +instance uni ~ UniOf val => MakeKnownIn uni val (Opaque (HeadSpine val val) rep) where makeKnown = coerceArg pure {-# INLINE makeKnown #-} diff --git a/plutus-core/plutus-core/src/PlutusCore/Builtin/Runtime.hs b/plutus-core/plutus-core/src/PlutusCore/Builtin/Runtime.hs index 38848e48d53..cef91e81544 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Builtin/Runtime.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Builtin/Runtime.hs @@ -30,7 +30,7 @@ import NoThunks.Class -- Evaluators that ignore the entire concept of costing (e.g. the CK machine) may of course force -- the result of the builtin application unconditionally. data BuiltinRuntime val - = BuiltinCostedResult ExBudgetStream ~(BuiltinResult (HeadSpine val)) + = BuiltinCostedResult ExBudgetStream ~(BuiltinResult (HeadSpine val val)) | BuiltinExpectArgument (val -> BuiltinRuntime val) | BuiltinExpectForce (BuiltinRuntime val) diff --git a/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs b/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs index b0f6e7d87c8..3ac09109406 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs @@ -974,7 +974,7 @@ evaluate it and let the evaluator perform all the necessary reductions. So if you want to return an application from a built-in function, you need to use 'HeadSpine' at the type level and 'headSpine' at the term level, where the latter has the following signature: - headSpine :: Opaque val asToB -> [val] -> Opaque (HeadSpine val) b + headSpineOpaque :: Opaque val asToB -> [val] -> Opaque (MonoHeadSpine val) b 'headSpine' takes the head of the application, i.e. a function from @a0@, @a1@ ... @an@ to @b@, and applies it to a list of values of respective types, returning a `b`. Whether types match or not is @@ -993,12 +993,12 @@ Here's how we can define it as a built-in function using 'headSpine': :: Opaque val b -> Opaque val (a -> [a] -> b) -> SomeConstant uni [a] - -> BuiltinResult (Opaque (HeadSpine val) b) + -> BuiltinResult (Opaque (MonoHeadSpine val) b) caseListDenotation z f (SomeConstant (Some (ValueOf uniListA xs0))) = do case uniListA of DefaultUniList uniA -> pure $ case xs0 of - [] -> headSpine z [] -- [1] - x : xs -> headSpine f [fromValueOf uniA x, fromValueOf uniListA xs] -- [2] + [] -> headSpineOpaque z [] -- [1] + x : xs -> headSpineOpaque f [fromValueOf uniA x, fromValueOf uniListA xs] -- [2] _ -> throwError $ structuralUnliftingError "Expected a list but got something else" {-# INLINE caseListDenotation #-} @@ -1104,15 +1104,15 @@ functions. -} -- | Take a function and a list of arguments and apply the former to the latter. -headSpine :: Opaque val asToB -> [val] -> Opaque (HeadSpine val) b -headSpine (Opaque f) = Opaque . \case +headSpineOpaque :: Opaque val asToB -> [val] -> Opaque (MonoHeadSpine val) b +headSpineOpaque (Opaque f) = Opaque . \case [] -> HeadOnly f x0 : xs -> -- It's critical to use 'foldr' here, so that deforestation kicks in. -- See Note [Definition of foldl'] in "GHC.List" and related Notes around for an explanation -- of the trick. HeadSpine f $ foldr (\x2 r x1 -> SpineCons x1 $ r x2) SpineLast xs x0 -{-# INLINE headSpine #-} +{-# INLINE headSpineOpaque #-} instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where type CostingPart uni DefaultFun = BuiltinCostModel diff --git a/plutus-core/plutus-core/src/PlutusCore/Default/Universe.hs b/plutus-core/plutus-core/src/PlutusCore/Default/Universe.hs index 401f10f93ab..fa8e8a82e31 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Default/Universe.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Default/Universe.hs @@ -45,6 +45,7 @@ module PlutusCore.Default.Universe import PlutusCore.Builtin import PlutusPrelude +import PlutusCore.Core.Type (Type (..)) import PlutusCore.Crypto.BLS12_381.G1 qualified as BLS12_381.G1 import PlutusCore.Crypto.BLS12_381.G2 qualified as BLS12_381.G2 import PlutusCore.Crypto.BLS12_381.Pairing qualified as BLS12_381.Pairing @@ -530,23 +531,43 @@ outOfBoundsErr x branches = fold ] instance AnnotateCaseBuiltin DefaultUni where - annotateCaseBuiltin (SomeTypeIn uni) branches = case uni of - DefaultUniBool -> Right $ map (, []) branches - DefaultUniInteger -> Right $ map (, []) branches - _ -> Left $ display uni <> " isn't supported in 'case'" + annotateCaseBuiltin ty branches = case ty of + TyBuiltin _ (SomeTypeIn DefaultUniBool) -> + case branches of + [f] -> Right $ [(f, [])] + [f, t] -> Right $ [(f, []), (t, [])] + _ -> Left $ "Casing on bool requires exactly one branch or two branches" + TyBuiltin _ (SomeTypeIn DefaultUniInteger) -> + Right $ map (, []) branches + listTy@(TyApp _ (TyBuiltin _ (SomeTypeIn DefaultUniProtoList)) argTy) -> + case branches of + [cons] -> Right [(cons, [argTy, listTy])] + [nil, cons] -> Right [(nil, []), (cons, [argTy, listTy])] + _ -> Left $ "Casing on list requires exactly one branch or two branches" + _ -> Left $ display (() <$ ty) <> " isn't supported in 'case'" instance CaseBuiltin DefaultUni where - caseBuiltin (Some (ValueOf uni x)) branches = case uni of + caseBuiltin someVal@(Some (ValueOf uni x)) branches = case uni of DefaultUniBool -> case x of -- We allow there to be only one branch as long as the scrutinee is 'False'. -- This is strictly to save size by not having the 'True' branch if it was gonna be -- 'Error' anyway. - False | len == 1 || len == 2 -> Right $ branches Vector.! 0 - True | len == 2 -> Right $ branches Vector.! 1 - _ -> Left $ outOfBoundsErr x branches + False | len == 1 || len == 2 -> Right $ HeadOnly $ branches Vector.! 0 + True | len == 2 -> Right $ HeadOnly $ branches Vector.! 1 + _ -> Left $ outOfBoundsErr someVal branches DefaultUniInteger - | 0 <= x && x < toInteger len -> Right $ branches Vector.! fromInteger x - | otherwise -> Left $ outOfBoundsErr x branches + | 0 <= x && x < toInteger len -> Right $ HeadOnly $ branches Vector.! fromInteger x + | otherwise -> Left $ outOfBoundsErr someVal branches + DefaultUniList ty + | len == 1 -> + case x of + [] -> Left "Expected non-empty list, got empty list for casing list" + (y : ys) -> Right $ headSpine (branches Vector.! 0) [someValueOf ty y, someValueOf uni ys] + | len == 2 -> + case x of + [] -> Right $ HeadOnly $ branches Vector.! 0 + (y : ys) -> Right $ headSpine (branches Vector.! 1) [someValueOf ty y, someValueOf uni ys] + | otherwise -> Left $ outOfBoundsErr someVal branches _ -> Left $ display uni <> " isn't supported in 'case'" where !len = Vector.length branches diff --git a/plutus-core/plutus-core/src/PlutusCore/Error.hs b/plutus-core/plutus-core/src/PlutusCore/Error.hs index b93fdc8a02c..864f451ba21 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Error.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Error.hs @@ -274,6 +274,7 @@ instance (Pretty term, PrettyUni uni, Pretty fun, Pretty ann) => prettyBy _ (UnsupportedCaseBuiltin ann err) = hsep [ "Unsupported 'case' of a value of a built-in type at" , pretty ann <> ":" + , hardline , pretty err ] diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Ck.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Ck.hs index 4a379564501..502407736c6 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Ck.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Ck.hs @@ -247,26 +247,30 @@ FrameCase cs : stack <| e = case e of case unCaserBuiltin caser val $ Vector.fromList cs of Left err -> throwErrorWithCause (OperationalError $ CkCaseBuiltinError err) $ ckValueToTerm e - Right res -> stack |> res + Right (HeadOnly fX) -> stack |> fX + Right (HeadSpine f xs) -> transferConstantSpine xs stack |> f _ -> throwErrorWithCause (StructuralError NonConstrScrutinizedMachineError) $ ckValueToTerm e -- | Transfers a 'Spine' onto the stack. The first argument will be at the top of the stack. -- -- >>> import PlutusCore.Default -- >>> import PlutusCore.Builtin --- >>> transferSpine (SpineCons (fromValue (1 :: Integer)) (SpineLast (fromValue (2 :: Integer)))) [FrameUnwrap :: Frame DefaultUni DefaultFun] +-- >>> transferValueSpine (SpineCons (fromValue (1 :: Integer)) (SpineLast (fromValue (2 :: Integer)))) [FrameUnwrap :: Frame DefaultUni DefaultFun] -- [FrameAwaitFunValue (VCon (Some (ValueOf DefaultUniInteger 1))),FrameAwaitFunValue (VCon (Some (ValueOf DefaultUniInteger 2))),FrameUnwrap] -transferSpine :: Spine (CkValue uni fun) -> Context uni fun -> Context uni fun -transferSpine args ctx = foldr ((:) . FrameAwaitFunValue) ctx args +transferValueSpine :: Spine (CkValue uni fun) -> Context uni fun -> Context uni fun +transferValueSpine args ctx = foldr ((:) . FrameAwaitFunValue) ctx args + +transferConstantSpine :: Spine (Some (ValueOf uni)) -> Context uni fun -> Context uni fun +transferConstantSpine args ctx = foldr ((:) . FrameAwaitFunValue . VCon) ctx args -- | Evaluate a 'HeadSpine' by pushing the arguments (if any) onto the stack and proceeding with -- the returning phase of the CK machine, i.e. @<|@. returnCkHeadSpine :: Context uni fun - -> HeadSpine (CkValue uni fun) + -> HeadSpine (CkValue uni fun) (CkValue uni fun) -> CkM uni fun s (Term TyName Name uni fun ()) returnCkHeadSpine stack (HeadOnly x) = stack <| x -returnCkHeadSpine stack (HeadSpine f xs) = transferSpine xs stack <| f +returnCkHeadSpine stack (HeadSpine f xs) = transferValueSpine xs stack <| f -- | Take a possibly partial builtin application and -- diff --git a/plutus-core/plutus-core/src/PlutusCore/MkPlc.hs b/plutus-core/plutus-core/src/PlutusCore/MkPlc.hs index c44f8a6872f..0b6aa62779b 100644 --- a/plutus-core/plutus-core/src/PlutusCore/MkPlc.hs +++ b/plutus-core/plutus-core/src/PlutusCore/MkPlc.hs @@ -55,6 +55,7 @@ module PlutusCore.MkPlc , mkIterKindArrow , mkFreshTermLet , headSpineToTerm + , headSpineToTermNoAnn ) where import PlutusPrelude @@ -339,5 +340,11 @@ mkFreshTermLet aT a = do pure (var mempty genName, termLet mempty (Def (VarDecl mempty genName aT) a)) -- | 'apply' the head of the application to the arguments iteratively. -headSpineToTerm :: TermLike term tyname name uni fun => HeadSpine (term ()) -> term () -headSpineToTerm = foldl1 (apply ()) +headSpineToTerm :: TermLike term tyname name uni fun => ann -> MonoHeadSpine (term ann) -> term ann +headSpineToTerm _ (HeadOnly t) = t +headSpineToTerm ann (HeadSpine t ts) = foldl (apply ann) t ts + +-- | @headSpineToTerm@ but without annotation. +headSpineToTermNoAnn :: TermLike term tyname name uni fun => MonoHeadSpine (term ()) -> term () +headSpineToTermNoAnn (HeadOnly t) = t +headSpineToTermNoAnn (HeadSpine t ts) = foldl (apply ()) t ts diff --git a/plutus-core/plutus-core/src/PlutusCore/TypeCheck/Internal.hs b/plutus-core/plutus-core/src/PlutusCore/TypeCheck/Internal.hs index 1ae4622584d..08d36f237ba 100644 --- a/plutus-core/plutus-core/src/PlutusCore/TypeCheck/Internal.hs +++ b/plutus-core/plutus-core/src/PlutusCore/TypeCheck/Internal.hs @@ -565,7 +565,7 @@ inferTypeM (Case ann resTy scrut branches) = do vScrutTy <- inferTypeM scrut -- We don't know exactly what to expect, we only know that it should - -- be a SOP with the right number of sum alternatives + -- be a SOP with the right number of sum alternatives when type of scrutinee is SOP let prods = map (\j -> "prod_" <> Text.pack (show j)) [0 .. length branches - 1] expectedSop = ExpectedShape (Text.intercalate " " $ "sop" : prods) prods case unNormalized vScrutTy of @@ -576,14 +576,12 @@ inferTypeM (Case ann resTy scrut branches) = do -- scrutinee does not have a SOP type with the right number of alternatives -- for the number of branches Nothing -> throwError (TypeMismatch ann (void scrut) expectedSop vScrutTy) - TyBuiltin _ someUni -> case annotateCaseBuiltin someUni branches of + vTy -> case annotateCaseBuiltin vTy branches of Right branchesAndArgTypes -> for_ branchesAndArgTypes $ \(c, argTypes) -> do vArgTypes <- traverse (fmap unNormalized . normalizeTypeM) argTypes -- made of sub-parts of a normalized type, so normalized checkTypeM ann c (Normalized $ mkIterTyFun () vArgTypes (unNormalized vResTy)) Left err -> throwError $ UnsupportedCaseBuiltin ann err - -- scrutinee does not have a SOP type at all - _ -> throwError (TypeMismatch ann (void scrut) expectedSop vScrutTy) -- If we got through all that, then every case type is correct, including that -- they all result in vResTy, so we can safely conclude that that is the type of the diff --git a/plutus-core/plutus-core/test/Evaluation/Spec.hs b/plutus-core/plutus-core/test/Evaluation/Spec.hs index a6c396e9101..873839a4ded 100644 --- a/plutus-core/plutus-core/test/Evaluation/Spec.hs +++ b/plutus-core/plutus-core/test/Evaluation/Spec.hs @@ -123,7 +123,7 @@ prop_builtinEvaluation :: -- outcome, and decides whether to pass or fail the property. (fun -> [Term uni fun] -> - Either SomeException (BuiltinResult (HeadSpine (Term uni fun))) -> + Either SomeException (BuiltinResult (MonoHeadSpine (Term uni fun))) -> PropertyT IO ()) -> Property prop_builtinEvaluation runtimes bn mkGen f = property $ do @@ -132,7 +132,7 @@ prop_builtinEvaluation runtimes bn mkGen f = property $ do eval :: [Term uni fun] -> BuiltinRuntime (Term uni fun) -> - BuiltinResult (HeadSpine (Term uni fun)) + BuiltinResult (MonoHeadSpine (Term uni fun)) eval [] (BuiltinCostedResult _ getFxs) = getFxs eval (arg : args) (BuiltinExpectArgument toRuntime) = diff --git a/plutus-core/plutus-ir/src/PlutusIR/Transform/CaseReduce.hs b/plutus-core/plutus-ir/src/PlutusIR/Transform/CaseReduce.hs index 53ea27b770e..900ee2248de 100644 --- a/plutus-core/plutus-ir/src/PlutusIR/Transform/CaseReduce.hs +++ b/plutus-core/plutus-ir/src/PlutusIR/Transform/CaseReduce.hs @@ -11,6 +11,7 @@ import PlutusCore.MkPlc import PlutusIR.Core import Control.Lens (transformOf, (^?)) +import Data.Bifunctor (second) import Data.List.Extras import GHC.IsList (fromList) import PlutusCore qualified as PLC @@ -38,5 +39,6 @@ processTerm = \case -- structural error into an operational one, which would be unfortunate, so instead we decided -- not to fully optimize such scripts, since they aren't valid anyway. Case ann _ (Constr _ _ i args) cs | Just c <- cs ^? wix i -> mkIterApp c ((ann,) <$> args) - Case _ _ (Constant _ con) cs | Right res <- caseBuiltin con (fromList cs) -> res + Case ann _ (Constant _ con) cs | Right fXs <- caseBuiltin con (fromList cs) -> + headSpineToTerm ann (second (Constant ann) fXs) t -> t diff --git a/plutus-core/plutus-ir/src/PlutusIR/Transform/EvaluateBuiltins.hs b/plutus-core/plutus-ir/src/PlutusIR/Transform/EvaluateBuiltins.hs index 2b98ae9a369..cab6f2d8a55 100644 --- a/plutus-core/plutus-ir/src/PlutusIR/Transform/EvaluateBuiltins.hs +++ b/plutus-core/plutus-ir/src/PlutusIR/Transform/EvaluateBuiltins.hs @@ -11,7 +11,7 @@ module PlutusIR.Transform.EvaluateBuiltins ) where import PlutusCore.Builtin -import PlutusCore.MkPlc (headSpineToTerm) +import PlutusCore.MkPlc (headSpineToTermNoAnn) import PlutusIR.Contexts import PlutusIR.Core @@ -56,12 +56,12 @@ evaluateBuiltins preserveLogging binfo costModel = transformOf termSubterms proc -> Maybe (Term tyname name uni fun ()) eval (BuiltinCostedResult _ getFXs) AppContextEnd = case getFXs of - BuiltinSuccess fXs -> Just $ headSpineToTerm fXs + BuiltinSuccess fXs -> Just $ headSpineToTermNoAnn fXs -- Evaluates successfully, but does logging. If we're being conservative -- then we should leave these in, so we don't remove people's logging! -- Otherwise `trace "hello" x` is a prime candidate for evaluation! BuiltinSuccessWithLogs _ fXs -> - if preserveLogging then Nothing else Just $ headSpineToTerm fXs + if preserveLogging then Nothing else Just $ headSpineToTermNoAnn fXs -- Evaluation failure. This can mean that the evaluation legitimately -- failed (e.g. `divideInteger 1 0`), or that it failed because the -- argument terms are not currently in the right form (because they're diff --git a/plutus-core/plutus-ir/src/PlutusIR/TypeCheck/Internal.hs b/plutus-core/plutus-ir/src/PlutusIR/TypeCheck/Internal.hs index 691c4285dfa..7be5f85e71d 100644 --- a/plutus-core/plutus-ir/src/PlutusIR/TypeCheck/Internal.hs +++ b/plutus-core/plutus-ir/src/PlutusIR/TypeCheck/Internal.hs @@ -288,14 +288,12 @@ inferTypeM (Case ann resTy scrut branches) = do -- scrutinee does not have a SOP type with the right number of alternatives -- for the number of branches Nothing -> throwError $ PLCTypeError (TypeMismatch ann (void scrut) expectedSop vScrutTy) - TyBuiltin _ someUni -> case annotateCaseBuiltin someUni branches of - Right branchesAndArgTypes -> for_ branchesAndArgTypes $ \(c, argTypes) -> do - vArgTypes <- traverse (fmap unNormalized . normalizeTypeM) argTypes - -- made of sub-parts of a normalized type, so normalized - checkTypeM ann c (Normalized $ mkIterTyFun () vArgTypes (unNormalized vResTy)) - Left err -> throwError $ PLCTypeError (UnsupportedCaseBuiltin ann err) - -- scrutinee does not have a SOP type at all - _ -> throwError $ PLCTypeError (TypeMismatch ann (void scrut) expectedSop vScrutTy) + vTy -> case annotateCaseBuiltin vTy branches of + Right branchesAndArgTypes -> for_ branchesAndArgTypes $ \(c, argTypes) -> do + vArgTypes <- traverse (fmap unNormalized . normalizeTypeM) argTypes + -- made of sub-parts of a normalized type, so normalized + checkTypeM ann c (Normalized $ mkIterTyFun () vArgTypes (unNormalized vResTy)) + Left err -> throwError $ PLCTypeError (UnsupportedCaseBuiltin ann err) -- If we got through all that, then every case type is correct, including that -- they all result in vResTy, so we can safely conclude that that is the type of the diff --git a/plutus-core/testlib/PlutusCore/Generators/Hedgehog/TypeEvalCheck.hs b/plutus-core/testlib/PlutusCore/Generators/Hedgehog/TypeEvalCheck.hs index 97267e285e9..132121482cd 100644 --- a/plutus-core/testlib/PlutusCore/Generators/Hedgehog/TypeEvalCheck.hs +++ b/plutus-core/testlib/PlutusCore/Generators/Hedgehog/TypeEvalCheck.hs @@ -51,7 +51,7 @@ data TypeEvalCheckError uni fun !(Normalized (Type TyName uni ())) | TypeEvalCheckErrorException !String | TypeEvalCheckErrorIllEvaled - !(EvaluationResult (HeadSpine (Term TyName Name uni fun ()))) + !(EvaluationResult (MonoHeadSpine (Term TyName Name uni fun ()))) !(EvaluationResult (Term TyName Name uni fun ())) -- ^ The former is an expected result of evaluation, the latter -- is an actual one. @@ -65,7 +65,7 @@ data TypeEvalCheckResult uni fun = TypeEvalCheckResult instance ( PrettyBy config (Type TyName uni ()) , PrettyBy config (Term TyName Name uni fun ()) - , PrettyBy config (HeadSpine (Term TyName Name uni fun ())) + , PrettyBy config (MonoHeadSpine (Term TyName Name uni fun ())) , PrettyBy config (Error uni fun ()) ) => PrettyBy config (TypeEvalCheckError uni fun) where prettyBy config (TypeEvalCheckErrorIllFormed err) = diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/Cek/Internal.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/Cek/Internal.hs index 47b3ba3b90b..ab4a0531007 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/Cek/Internal.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/Cek/Internal.hs @@ -653,12 +653,20 @@ transferArgStack (ConsStack arg rest) c = transferArgStack rest (FrameAwaitFunVa -- See Note [ArgStack vs Spine]. -- | Transfers a 'Spine' onto the stack. The first argument will be at the top of the stack. -transferSpine +transferValueSpine :: Spine (CekValue uni fun ann) -> Context uni fun ann -> Context uni fun ann -transferSpine args ctx = foldr FrameAwaitFunValue ctx args -{-# INLINE transferSpine #-} +transferValueSpine args ctx = foldr FrameAwaitFunValue ctx args +{-# INLINE transferValueSpine #-} + +-- | Transfers a 'Spine' of constant values onto the stack. The first argument will be at the top of the stack. +transferConstantSpine + :: Spine (Some (ValueOf uni)) + -> Context uni fun ann + -> Context uni fun ann +transferConstantSpine args ctx = foldr (FrameAwaitFunValue . VCon) ctx args +{-# INLINE transferConstantSpine #-} runCekM :: forall a cost uni fun ann @@ -800,23 +808,25 @@ enterComputeCek = computeCek -- "apparently good" value. (VConstr i _) | fromIntegral @_ @Integer i > fromIntegral @Int @Integer maxBound -> throwErrorDischarged (StructuralError (MissingCaseBranchMachineError i)) e - -- Otherwise, we can safely convert the index to an Int and use it + -- Otherwise, we can safely convert the index to an Int and use it. (VConstr i args) -> case (V.!?) cs (fromIntegral i) of Just t -> computeCek (transferArgStack args ctx) env t Nothing -> throwErrorDischarged (StructuralError $ MissingCaseBranchMachineError i) e + -- Proceed with caser when expression given is not Constr. VCon val -> case unCaserBuiltin ?cekCaserBuiltin val cs of - Left err -> throwErrorDischarged (OperationalError $ CekCaseBuiltinError err) e - Right res -> computeCek ctx env res + Left err -> throwErrorDischarged (OperationalError $ CekCaseBuiltinError err) e + Right (HeadOnly fX) -> computeCek ctx env fX + Right (HeadSpine f xs) -> computeCek (transferConstantSpine xs ctx) env f _ -> throwErrorDischarged (StructuralError NonConstrScrutinizedMachineError) e -- | Evaluate a 'HeadSpine' by pushing the arguments (if any) onto the stack and proceeding with -- the returning phase of the CEK machine. returnCekHeadSpine :: Context uni fun ann - -> HeadSpine (CekValue uni fun ann) + -> MonoHeadSpine (CekValue uni fun ann) -> CekM uni fun s (Term NamedDeBruijn uni fun ()) returnCekHeadSpine ctx (HeadOnly x) = returnCek ctx x - returnCekHeadSpine ctx (HeadSpine f xs) = returnCek (transferSpine xs ctx) f + returnCekHeadSpine ctx (HeadSpine f xs) = returnCek (transferValueSpine xs ctx) f -- | @force@ a term and proceed. -- If v is a delay then compute the body of v; diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/SteppableCek/Internal.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/SteppableCek/Internal.hs index d61a028a917..f506861a1d5 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/SteppableCek/Internal.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/SteppableCek/Internal.hs @@ -114,8 +114,12 @@ transferArgStack ann = go go (ConsStack arg rest) c = go rest (FrameAwaitFunValue ann arg c) -- | Transfers a 'Spine' onto the stack. The first argument will be at the top of the stack. -transferSpine :: ann -> Spine (CekValue uni fun ann) -> Context uni fun ann -> Context uni fun ann -transferSpine ann args ctx = foldr (FrameAwaitFunValue ann) ctx args +transferValueSpine :: ann -> Spine (CekValue uni fun ann) -> Context uni fun ann -> Context uni fun ann +transferValueSpine ann args ctx = foldr (FrameAwaitFunValue ann) ctx args + +-- | Transfers a 'Spine' of contant values onto the stack. The first argument will be at the top of the stack. +transferConstantSpine :: ann -> Spine (Some (ValueOf uni)) -> Context uni fun ann -> Context uni fun ann +transferConstantSpine ann args ctx = foldr (FrameAwaitFunValue ann . VCon) ctx args computeCek :: forall uni fun ann s @@ -213,7 +217,8 @@ returnCek (FrameCases ann env cs ctx) e = case e of Nothing -> throwErrorDischarged (StructuralError $ MissingCaseBranchMachineError i) e VCon val -> case unCaserBuiltin ?cekCaserBuiltin val cs of Left err -> throwErrorDischarged (OperationalError $ CekCaseBuiltinError err) e - Right res -> pure $ Computing ctx env res + Right (HeadOnly fX) -> pure $ Computing ctx env fX + Right (HeadSpine f xs) -> pure $ Computing (transferConstantSpine ann xs ctx) env f _ -> throwErrorDischarged (StructuralError NonConstrScrutinizedMachineError) e -- | @force@ a term and proceed. @@ -448,10 +453,10 @@ lookupVarName varName@(NamedDeBruijn _ varIx) varEnv = returnCekHeadSpine :: ann -> Context uni fun ann - -> HeadSpine (CekValue uni fun ann) + -> MonoHeadSpine (CekValue uni fun ann) -> CekM uni fun s (CekState uni fun ann) returnCekHeadSpine _ ctx (HeadOnly x) = pure $ Returning ctx x -returnCekHeadSpine ann ctx (HeadSpine f xs) = pure $ Returning (transferSpine ann xs ctx) f +returnCekHeadSpine ann ctx (HeadSpine f xs) = pure $ Returning (transferValueSpine ann xs ctx) f -- | Take a possibly partial builtin application and -- diff --git a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs index bb083599643..4d9d04643c2 100644 --- a/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs +++ b/plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseReduce.hs @@ -5,15 +5,15 @@ module UntypedPlutusCore.Transform.CaseReduce , processTerm ) where +import Control.Lens (transformOf) +import Data.Bifunctor (second) +import Data.Vector qualified as V import PlutusCore.Builtin (CaseBuiltin (..)) import PlutusCore.MkPlc import UntypedPlutusCore.Core import UntypedPlutusCore.Transform.Simplifier (SimplifierStage (CaseReduce), SimplifierT, recordSimplification) -import Control.Lens (transformOf) -import Data.Vector qualified as V - caseReduce :: (Monad m, CaseBuiltin uni) => Term name uni fun a @@ -30,5 +30,7 @@ processTerm = \case -- not to fully optimize such scripts, since they aren't valid anyway. Case ann (Constr _ i args) cs | Just c <- (V.!?) cs (fromIntegral i) -> mkIterApp c ((ann,) <$> args) - Case _ (Constant _ con) cs | Right res <- caseBuiltin con cs -> res + Case ann (Constant _ con) cs | Right fXs <- caseBuiltin con cs -> + headSpineToTerm ann (second (Constant ann) fXs) + t -> t diff --git a/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.plc.golden b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.plc.golden new file mode 100644 index 00000000000..5fea38fcd3b --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.plc.golden @@ -0,0 +1 @@ +(Right (con integer 1)) \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.type.golden b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.type.golden new file mode 100644 index 00000000000..557f8ffd629 --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.type.golden @@ -0,0 +1 @@ +(Right (con integer)) \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.uplc.golden b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.uplc.golden new file mode 100644 index 00000000000..5fea38fcd3b --- /dev/null +++ b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseList.uplc.golden @@ -0,0 +1 @@ +(Right (con integer 1)) \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseNonTag.type.golden b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseNonTag.type.golden index ae4f9e4987e..6e7d59b8358 100644 --- a/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseNonTag.type.golden +++ b/plutus-core/untyped-plutus-core/test/Evaluation/Golden/caseNonTag.type.golden @@ -1,7 +1,2 @@ -(Left Type mismatch at () -Expected a term of type - '(sop)' -But found one of type - '(fun (con integer) (fun (con integer) (con integer)))' -Namely, - '(builtin addInteger)') \ No newline at end of file +(Left Unsupported 'case' of a value of a built-in type at (): + (fun (con integer) (fun (con integer) (con integer))) isn't supported in 'case') \ No newline at end of file diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs index 7b3a02b7e98..cd1eb8cb74b 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs @@ -1251,8 +1251,9 @@ test_Case = (mkConstant () scrut) (map (mkConstant ()) is) in case typecheckEvaluateCekNoEmit def defaultBuiltinCostModelForTesting term of - Left _ -> False - Right EvaluationFailure -> length is /= 2 && (scrut || length is /= 1) + Left _ -> length is /= 1 && length is /= 2 + -- Bool casing only fails if there's one branch and its trying to case True. + Right EvaluationFailure -> scrut && length is /= 2 Right (EvaluationSuccess res) -> res == mkConstant () (is !! fromEnum scrut) , QC.testProperty "Integer success" . QC.withMaxSuccess 99 $ \(QC.NonEmpty is :: QC.NonEmptyList Integer) -> @@ -1277,6 +1278,47 @@ test_Case = Left _ -> False Right EvaluationFailure -> 0 > scrut || scrut >= fromIntegral (length is) Right (EvaluationSuccess res) -> res == mkConstant () (is !! fromIntegral scrut) + , QC.testProperty "List success" . QC.withMaxSuccess 99 $ + \(scrut :: [Integer]) -> + let + term :: Term TyName Name DefaultUni DefaultFun () + term = runQuote $ do + x <- freshName "x" + xs <- freshName "xs" + let + listElem = mkTyBuiltin @_ @Integer () + list = mkTyBuiltin @_ @[Integer] () + pure $ + kase () + listElem + (mkConstant () scrut) + [ mkConstant @Integer () 42 + , lamAbs () x listElem $ lamAbs () xs list $ var () x + ] + expected [] = 42 + expected (x:_xs) = x + in Right (EvaluationSuccess . mkConstant () $ expected scrut) QC.=== + typecheckEvaluateCekNoEmit def defaultBuiltinCostModelForTesting term + , QC.testProperty "List any" . QC.withMaxSuccess 99 $ + \(scrut :: [Integer]) -> + let + term :: Term TyName Name DefaultUni DefaultFun () + term = runQuote $ do + x <- freshName "x" + xs <- freshName "xs" + let + listElem = mkTyBuiltin @_ @Integer () + list = mkTyBuiltin @_ @[Integer] () + pure $ + kase () + listElem + (mkConstant () scrut) + [ lamAbs () x listElem $ lamAbs () xs list $ var () x + ] + in case (typecheckEvaluateCekNoEmit def defaultBuiltinCostModelForTesting term, scrut) of + (Right EvaluationFailure, []) -> True + (Right (EvaluationSuccess res), (x:_xs)) -> res == mkConstant () x + _ -> False ] test_definition :: TestTree diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/MakeRead.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/MakeRead.hs index 45ee9a3c79a..37707ed3977 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/MakeRead.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/MakeRead.hs @@ -39,7 +39,7 @@ makeRead makeRead x = do fXsTerm <- makeKnownOrFail @_ @(TPLC.Term TyName Name DefaultUni DefaultFun ()) x case splitStructuralOperational <$> typecheckReadKnownCek def - TPLC.defaultBuiltinCostModelForTesting (headSpineToTerm fXsTerm) of + TPLC.defaultBuiltinCostModelForTesting (headSpineToTermNoAnn fXsTerm) of Left err -> error $ "Type error" ++ displayPlcCondensedErrorClassic err Right (Left err) -> error $ "Evaluation error: " ++ show err Right (Right res) -> res diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Golden.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Golden.hs index 8a753b1893f..e77de2a6582 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Golden.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Golden.hs @@ -392,6 +392,15 @@ caseNoBranch = Case () integer tag1 [] caseInteger :: Term TyName Name DefaultUni DefaultFun () caseInteger = Case () integer (mkConstant @Integer () 1) [] +caseList :: Term TyName Name DefaultUni DefaultFun () +caseList = runQuote $ do + a <- freshName "a" + b <- freshName "b" + pure $ + Case () integer (mkConstant @[Integer] () [1]) + [ LamAbs () a integer $ LamAbs () b (mkTyBuiltin @_ @[Integer] ()) $ Var () a + ] + caseNonTag :: Term TyName Name DefaultUni DefaultFun () caseNonTag = Case () integer (builtin () AddInteger) [] @@ -486,6 +495,7 @@ namesAndTests = , ("caseProd1", caseProd1) , ("caseNoBranch", caseNoBranch) , ("caseInteger", caseInteger) + , ("caseList", caseList) , ("caseNonTag", caseNonTag) ] diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Machines.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Machines.hs index 1898d740735..6e676ac252e 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Machines.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Machines.hs @@ -34,6 +34,7 @@ import PlutusCore.StdLib.Data.Nat qualified as Plc import PlutusCore.StdLib.Meta import PlutusCore.StdLib.Meta.Data.Function (etaExpand) +import Data.Bifunctor (bimap) import Data.Proxy (Proxy (..)) import GHC.Exts (fromString) import GHC.Ix @@ -59,7 +60,7 @@ testMachine machine eval = let resExp = makeKnownOrFail @_ @(Plc.Term TyName Name DefaultUni DefaultFun ()) val case splitStructuralOperational . eval $ eraseTerm term of Left err -> fail $ show err - Right resAct -> fmap HeadOnly resAct === fmap (fmap eraseTerm) resExp + Right resAct -> fmap HeadOnly resAct === fmap (bimap eraseTerm eraseTerm) resExp test_machines :: TestTree test_machines = diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.eval.golden index 87b5bd734f5..9d78bd27aaa 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.eval.golden @@ -1,6 +1,6 @@ -CPU: 21_822_868 -Memory: 60_074 -Term Size: 108 -Flat Size: 308 +CPU: 13_284_190 +Memory: 28_690 +Term Size: 84 +Flat Size: 290 (con integer 3636) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.pir.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.pir.golden index 432a9f19aa5..f439d0a26ae 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.pir.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/currencySymbolValueOf.pir.golden @@ -1,3 +1,13 @@ +letrec + !go : list (pair data data) -> integer + = \(xs : list (pair data data)) -> + case + integer + xs + [ 0 + , (\(hd : pair data data) (eta : list (pair data data)) -> + addInteger (unIData (sndPair {data} {data} hd)) (go eta)) ] +in let data Bool | Bool_match where True : Bool @@ -5,16 +15,6 @@ let data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a Nothing : Maybe a - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} in \(value : (\k a -> list (pair data data)) @@ -26,38 +26,27 @@ in (let !k : data = bData cur in - (letrec - !go : list (pair data data) -> Maybe data - = caseList' - {pair data data} - {Maybe data} - (Nothing {data}) - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. list (pair data data) -> Maybe data} - (/\dead -> - \(ds : list (pair data data)) -> - Just {data} (sndPair {data} {data} hd)) - (/\dead -> go) - {all dead. dead}) - in - go) - value) + letrec + !go : list (pair data data) -> Maybe data + = \(xs : list (pair data data)) -> + case + (Maybe data) + xs + [ (Nothing {data}) + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. list (pair data data) -> Maybe data} + (/\dead -> + \(ds : list (pair data data)) -> + Just {data} (sndPair {data} {data} hd)) + (/\dead -> go) + {all dead. dead}) ] + in + go value) {integer} - (\(a : data) -> - (letrec - !go : list (pair data data) -> integer - = caseList' - {pair data data} - {integer} - 0 - (\(hd : pair data data) (eta : list (pair data data)) -> - addInteger (unIData (sndPair {data} {data} hd)) (go eta)) - in - go) - (unMapData a)) + (\(a : data) -> go (unMapData a)) 0 \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq1.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq1.eval.golden index 210aede87a5..ed21f6a6db6 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq1.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq1.eval.golden @@ -1,6 +1,6 @@ -CPU: 572_651_535 -Memory: 1_678_825 -Term Size: 716 -Flat Size: 990 +CPU: 404_558_040 +Memory: 1_063_065 +Term Size: 692 +Flat Size: 974 (constr 0) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq2.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq2.eval.golden index 00f7e9af9bd..be066db146a 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq2.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq2.eval.golden @@ -1,6 +1,6 @@ -CPU: 605_386_994 -Memory: 1_788_335 -Term Size: 716 -Flat Size: 1_041 +CPU: 426_853_400 +Memory: 1_134_603 +Term Size: 692 +Flat Size: 1_025 (constr 1) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq3.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq3.eval.golden index 779f6531201..b5ec59e6209 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq3.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq3.eval.golden @@ -1,6 +1,6 @@ -CPU: 631_932_902 -Memory: 1_872_808 -Term Size: 716 -Flat Size: 1_041 +CPU: 444_780_449 +Memory: 1_187_024 +Term Size: 692 +Flat Size: 1_025 (constr 0) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq4.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq4.eval.golden index 4087f70fbd6..ac90ee8ed93 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq4.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq4.eval.golden @@ -1,6 +1,6 @@ -CPU: 553_472_600 -Memory: 1_595_247 -Term Size: 716 -Flat Size: 997 +CPU: 390_396_929 +Memory: 997_859 +Term Size: 692 +Flat Size: 981 (constr 1) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq5.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq5.eval.golden index 4b53eb88cae..fddcc9f5ed3 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq5.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/geq5.eval.golden @@ -1,6 +1,6 @@ -CPU: 593_735_630 -Memory: 1_739_025 -Term Size: 716 -Flat Size: 997 +CPU: 418_791_884 +Memory: 1_097_937 +Term Size: 692 +Flat Size: 981 (constr 0) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt.pir.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt.pir.golden index 10436aa49d6..791135b3eb8 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt.pir.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt.pir.golden @@ -1,3 +1,26 @@ +let + data Bool | Bool_match where + True : Bool + False : Bool +in +letrec + !go : list (pair data data) -> Bool + = \(xs : list (pair data data)) -> + case + Bool + xs + [ True + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsInteger 0 (unIData (sndPair {data} {data} hd))) + [False, True]) + {all dead. list (pair data data) -> Bool} + (/\dead -> go) + (/\dead -> \(ds : list (pair data data)) -> False) + {all dead. dead}) ] +in let !`$fToDataInteger_$ctoBuiltinData` : integer -> data = \(i : integer) -> iData i @@ -33,9 +56,6 @@ let `$fToDataInteger_$ctoBuiltinData` data Unit | Unit_match where Unit : Unit - data Bool | Bool_match where - True : Bool - False : Bool !`$fUnsafeFromDataThese_$cunsafeFromBuiltinData` : all a b. (\a -> data -> a) a -> (\a -> data -> a) b -> data -> These a b = /\a b -> @@ -76,19 +96,62 @@ let {all dead. dead}) {all dead. dead}) {all dead. dead} + !ifThenElse : all a. bool -> a -> a -> a + = /\a -> \(b : bool) (x : a) (y : a) -> case a b [y, x] +in +letrec + !go : list (pair data data) -> Bool + = \(xs : list (pair data data)) -> + case + Bool + xs + [ True + , (\(hd : pair data data) -> + Bool_match + (let + !k' : These integer integer + = `$fUnsafeFromDataThese_$cunsafeFromBuiltinData` + {integer} + {integer} + unIData + unIData + (sndPair {data} {data} hd) + in + These_match + {integer} + {integer} + k' + {Bool} + (\(b : integer) -> + ifThenElse {Bool} (lessThanInteger 0 b) False True) + (\(a : integer) (b : integer) -> + ifThenElse {Bool} (lessThanInteger a b) False True) + (\(a : integer) -> + ifThenElse {Bool} (lessThanInteger a 0) False True)) + {all dead. list (pair data data) -> Bool} + (/\dead -> go) + (/\dead -> \(ds : list (pair data data)) -> False) + {all dead. dead}) ] +in +letrec + !go : list (pair data data) -> Bool + = \(xs : list (pair data data)) -> + case + Bool + xs + [ True + , (\(hd : pair data data) -> + Bool_match + (go (unMapData (sndPair {data} {data} hd))) + {all dead. list (pair data data) -> Bool} + (/\dead -> go) + (/\dead -> \(ds : list (pair data data)) -> False) + {all dead. dead}) ] +in +let !`$fToDataMap_$ctoBuiltinData` : all k a. (\k a -> list (pair data data)) k a -> data = /\k a -> \(ds : (\k a -> list (pair data data)) k a) -> mapData ds - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} !map : all k a b. (\a -> data -> a) a -> @@ -102,20 +165,21 @@ let (f : a -> b) -> letrec !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) (eta : list (pair data data)) -> - mkCons - {pair data data} - (mkPairData - (fstPair {data} {data} hd) - (`$dToData` - (f - (`$dUnsafeFromData` - (sndPair {data} {data} hd))))) - (go eta)) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) (eta : list (pair data data)) -> + mkCons + {pair data data} + (mkPairData + (fstPair {data} {data} hd) + (`$dToData` + (f + (`$dUnsafeFromData` + (sndPair {data} {data} hd))))) + (go eta)) ] in go in @@ -123,68 +187,70 @@ letrec !safeAppend : list (pair data data) -> list (pair data data) -> list (pair data data) = \(xs : list (pair data data)) (xs : list (pair data data)) -> - caseList' - {pair data data} - {list (pair data data)} - xs - (\(hd : pair data data) (tl : list (pair data data)) -> - let - !v : data = sndPair {data} {data} hd - !k : data = fstPair {data} {data} hd - !eta : list (pair data data) = safeAppend tl xs - !nilCase : list (pair data data) - = mkCons {pair data data} (mkPairData k v) [] - in - letrec - !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - nilCase - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. - list (pair data data) -> list (pair data data)} - (/\dead -> mkCons {pair data data} (mkPairData k v)) - (/\dead -> - \(eta : list (pair data data)) -> - mkCons {pair data data} hd (go eta)) - {all dead. dead}) - in - go eta) + case + (list (pair data data)) xs + [ xs + , (\(hd : pair data data) (tl : list (pair data data)) -> + let + !v : data = sndPair {data} {data} hd + !k : data = fstPair {data} {data} hd + !eta : list (pair data data) = safeAppend tl xs + !nilCase : list (pair data data) + = mkCons {pair data data} (mkPairData k v) [] + in + letrec + !go : list (pair data data) -> list (pair data data) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ nilCase + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. + list (pair data data) -> + list (pair data data)} + (/\dead -> + mkCons {pair data data} (mkPairData k v)) + (/\dead -> + \(eta : list (pair data data)) -> + mkCons {pair data data} hd (go eta)) + {all dead. dead}) ] + in + go eta) ] in let data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a Nothing : Maybe a !lookup' : data -> list (pair data data) -> Maybe data - = \(k : data) (m : list (pair data data)) -> - (letrec - !go : list (pair data data) -> Maybe data - = caseList' - {pair data data} - {Maybe data} - (Nothing {data}) - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. list (pair data data) -> Maybe data} - (/\dead -> - \(ds : list (pair data data)) -> - Just {data} (sndPair {data} {data} hd)) - (/\dead -> go) - {all dead. dead}) - in - go) - m + = \(k : data) -> + letrec + !go : list (pair data data) -> Maybe data + = \(xs : list (pair data data)) -> + case + (Maybe data) + xs + [ (Nothing {data}) + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. list (pair data data) -> Maybe data} + (/\dead -> + \(ds : list (pair data data)) -> + Just {data} (sndPair {data} {data} hd)) + (/\dead -> go) + {all dead. dead}) ] + in + \(m : list (pair data data)) -> go m !union : all k a b. (\a -> data -> a) a -> @@ -199,113 +265,114 @@ let (`$dUnsafeFromData` : (\a -> data -> a) b) (`$dToData` : (\a -> a -> data) a) (`$dToData` : (\a -> a -> data) b) - (ds : (\k a -> list (pair data data)) k a) - (ds : (\k a -> list (pair data data)) k b) -> + (ds : (\k a -> list (pair data data)) k a) -> letrec !goRight : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) (tl : list (pair data data)) -> - let - !v : data = sndPair {data} {data} hd - !k : data = fstPair {data} {data} hd - in - Maybe_match - {data} - (lookup' k ds) - {all dead. list (pair data data)} - (\(r : data) -> - /\dead -> - mkCons - {pair data data} - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - {a} - {b} - `$dToData` - `$dToData` - (These - {a} - {b} - (`$dUnsafeFromData` v) - (`$dUnsafeFromData` r)))) - (goRight tl)) - (/\dead -> - mkCons - {pair data data} - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - {a} - {b} - `$dToData` - `$dToData` - (That {a} {b} (`$dUnsafeFromData` v)))) - (goRight tl)) - {all dead. dead}) - in - letrec - !goLeft : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) (tl : list (pair data data)) -> - let - !v : data = sndPair {data} {data} hd - !k : data = fstPair {data} {data} hd - in - Maybe_match - {data} - (lookup' k ds) - {all dead. list (pair data data)} - (\(r : data) -> - /\dead -> - mkCons - {pair data data} - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - {a} - {b} - `$dToData` - `$dToData` - (These - {a} - {b} - (`$dUnsafeFromData` v) - (`$dUnsafeFromData` r)))) - (goLeft tl)) - (/\dead -> - mkCons - {pair data data} - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - {a} - {b} - `$dToData` - `$dToData` - (This {a} {b} (`$dUnsafeFromData` v)))) - (goLeft tl)) - {all dead. dead}) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) (tl : list (pair data data)) -> + let + !v : data = sndPair {data} {data} hd + !k : data = fstPair {data} {data} hd + in + Maybe_match + {data} + (lookup' k ds) + {all dead. list (pair data data)} + (\(r : data) -> + /\dead -> + mkCons + {pair data data} + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + {a} + {b} + `$dToData` + `$dToData` + (These + {a} + {b} + (`$dUnsafeFromData` v) + (`$dUnsafeFromData` r)))) + (goRight tl)) + (/\dead -> + mkCons + {pair data data} + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + {a} + {b} + `$dToData` + `$dToData` + (That {a} {b} (`$dUnsafeFromData` v)))) + (goRight tl)) + {all dead. dead}) ] in - safeAppend (goLeft ds) (goRight ds) + \(ds : (\k a -> list (pair data data)) k b) -> + letrec + !goLeft : list (pair data data) -> list (pair data data) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) (tl : list (pair data data)) -> + let + !v : data = sndPair {data} {data} hd + !k : data = fstPair {data} {data} hd + in + Maybe_match + {data} + (lookup' k ds) + {all dead. list (pair data data)} + (\(r : data) -> + /\dead -> + mkCons + {pair data data} + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + {a} + {b} + `$dToData` + `$dToData` + (These + {a} + {b} + (`$dUnsafeFromData` v) + (`$dUnsafeFromData` r)))) + (goLeft tl)) + (/\dead -> + mkCons + {pair data data} + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + {a} + {b} + `$dToData` + `$dToData` + (This {a} {b} (`$dUnsafeFromData` v)))) + (goLeft tl)) + {all dead. dead}) ] + in + safeAppend (goLeft ds) (goRight ds) in letrec !rev : all a. list a -> list a -> list a = /\a -> \(l : list a) (acc : list a) -> - caseList' - {a} - {Unit -> list a} - (\(ds : Unit) -> acc) - (\(x : a) (xs : list a) (ds : Unit) -> - rev {a} xs (mkCons {a} x acc)) + case + (Unit -> list a) l + [ (\(ds : Unit) -> acc) + , (\(x : a) (xs : list a) (ds : Unit) -> + rev {a} xs (mkCons {a} x acc)) ] Unit in let @@ -315,167 +382,168 @@ let list (pair data data) -> list (pair data data) -> Bool - = \(is : data -> Bool) (eqV : data -> data -> Bool) -> + = \(is : data -> Bool) -> letrec - !goBoth : list (pair data data) -> list (pair data data) -> Bool - = \(l : list (pair data data)) (l : list (pair data data)) -> - caseList' - {pair data data} - {Unit -> Bool} - (\(ds : Unit) -> - caseList' - {pair data data} - {Unit -> Bool} - (\(ds : Unit) -> True) - (\(x : pair data data) - (xs : list (pair data data)) - (ds : Unit) -> - letrec - !go : list (pair data data) -> Bool - = caseList' - {pair data data} - {Bool} - True - (\(hd : pair data data) -> - Bool_match - (is (sndPair {data} {data} hd)) - {all dead. list (pair data data) -> Bool} - (/\dead -> go) - (/\dead -> - \(ds : list (pair data data)) -> - False) - {all dead. dead}) - in - go l) - l - Unit) - (\(x : pair data data) -> - let - ~v : data = sndPair {data} {data} x - in - \(xs : list (pair data data)) (ds : Unit) -> - caseList' - {pair data data} - {Unit -> Bool} - (\(ds : Unit) -> - letrec - !go : list (pair data data) -> Bool - = caseList' - {pair data data} - {Bool} - True - (\(hd : pair data data) -> + !go : list (pair data data) -> Bool + = \(xs : list (pair data data)) -> + case + Bool + xs + [ True + , (\(hd : pair data data) -> + Bool_match + (is (sndPair {data} {data} hd)) + {all dead. list (pair data data) -> Bool} + (/\dead -> go) + (/\dead -> \(ds : list (pair data data)) -> False) + {all dead. dead}) ] + in + letrec + !go : list (pair data data) -> Bool + = \(xs : list (pair data data)) -> + case + Bool + xs + [ True + , (\(hd : pair data data) -> + Bool_match + (is (sndPair {data} {data} hd)) + {all dead. list (pair data data) -> Bool} + (/\dead -> go) + (/\dead -> \(ds : list (pair data data)) -> False) + {all dead. dead}) ] + in + \(eqV : data -> data -> Bool) -> + letrec + !goBoth : list (pair data data) -> list (pair data data) -> Bool + = \(l : list (pair data data)) (l : list (pair data data)) -> + case + (Unit -> Bool) + l + [ (\(ds : Unit) -> + case + (Unit -> Bool) + l + [ (\(ds : Unit) -> True) + , (\(x : pair data data) + (xs : list (pair data data)) + (ds : Unit) -> + go l) ] + Unit) + , (\(x : pair data data) -> + let + ~v : data = sndPair {data} {data} x + in + \(xs : list (pair data data)) (ds : Unit) -> + case + (Unit -> Bool) + l + [ (\(ds : Unit) -> go l) + , (\(x : pair data data) + (xs : list (pair data data)) + (ds : Unit) -> + let + !d : data = fstPair {data} {data} x + in + letrec + !goRight : + list (pair data data) -> + list (pair data data) -> + Bool + = \(acc : list (pair data data)) + (l : list (pair data data)) -> + case + (Unit -> Bool) + l + [ (\(ds : Unit) -> False) + , (\(x : pair data data) + (xs : list (pair data data)) + (ds : Unit) -> + let + !v : data + = sndPair {data} {data} x + in + Bool_match + (is v) + {all dead. Bool} + (/\dead -> goRight acc xs) + (/\dead -> + Bool_match + (case + Bool + (equalsData + (fstPair + {data} + {data} + x) + d) + [False, True]) + {all dead. Bool} + (/\dead -> + Bool_match + (eqV v v) + {all dead. Bool} + (/\dead -> + goBoth + xs + (rev + {pair + data + data} + acc + xs)) + (/\dead -> False) + {all dead. dead}) + (/\dead -> + goRight + (mkCons + {pair data data} + x + acc) + xs) + {all dead. dead}) + {all dead. dead}) ] + Unit + in + Bool_match + (case + Bool + (equalsData d (fstPair {data} {data} x)) + [False, True]) + {all dead. Bool} + (/\dead -> + Bool_match + (eqV v (sndPair {data} {data} x)) + {all dead. Bool} + (/\dead -> goBoth xs xs) + (/\dead -> False) + {all dead. dead}) + (/\dead -> Bool_match - (is (sndPair {data} {data} hd)) - {all dead. - list (pair data data) -> Bool} - (/\dead -> go) + (is v) + {all dead. Bool} + (/\dead -> goBoth xs l) (/\dead -> - \(ds : list (pair data data)) -> - False) + goRight + (Bool_match + (is (sndPair {data} {data} x)) + {all dead. + list (pair data data)} + (/\dead -> []) + (/\dead -> + mkCons + {pair data data} + x + []) + {all dead. dead}) + xs) {all dead. dead}) - in - go l) - (\(x : pair data data) - (xs : list (pair data data)) - (ds : Unit) -> - let - !d : data = fstPair {data} {data} x - in - letrec - !goRight : - list (pair data data) -> - list (pair data data) -> - Bool - = \(acc : list (pair data data)) - (l : list (pair data data)) -> - caseList' - {pair data data} - {Unit -> Bool} - (\(ds : Unit) -> False) - (\(x : pair data data) - (xs : list (pair data data)) - (ds : Unit) -> - let - !v : data = sndPair {data} {data} x - in - Bool_match - (is v) - {all dead. Bool} - (/\dead -> goRight acc xs) - (/\dead -> - Bool_match - (case - Bool - (equalsData - (fstPair {data} {data} x) - d) - [False, True]) - {all dead. Bool} - (/\dead -> - Bool_match - (eqV v v) - {all dead. Bool} - (/\dead -> - goBoth - xs - (rev - {pair data data} - acc - xs)) - (/\dead -> False) - {all dead. dead}) - (/\dead -> - goRight - (mkCons - {pair data data} - x - acc) - xs) - {all dead. dead}) - {all dead. dead}) - l - Unit - in - Bool_match - (case - Bool - (equalsData d (fstPair {data} {data} x)) - [False, True]) - {all dead. Bool} - (/\dead -> - Bool_match - (eqV v (sndPair {data} {data} x)) - {all dead. Bool} - (/\dead -> goBoth xs xs) - (/\dead -> False) - {all dead. dead}) - (/\dead -> - Bool_match - (is v) - {all dead. Bool} - (/\dead -> goBoth xs l) - (/\dead -> - goRight - (Bool_match - (is (sndPair {data} {data} x)) - {all dead. list (pair data data)} - (/\dead -> []) - (/\dead -> - mkCons {pair data data} x []) - {all dead. dead}) - xs) - {all dead. dead}) - {all dead. dead}) - l - Unit) - l - Unit - in - \(eta : list (pair data data)) (eta : list (pair data data)) -> - goBoth eta eta - !ifThenElse : all a. bool -> a -> a -> a - = /\a -> \(b : bool) (x : a) (y : a) -> case a b [y, x] + {all dead. dead}) ] + Unit) ] + Unit + in + \(eta : list (pair data data)) (eta : list (pair data data)) -> + goBoth eta eta in \(l : (\k a -> list (pair data data)) @@ -486,143 +554,75 @@ in bytestring ((\k a -> list (pair data data)) bytestring integer)) -> Bool_match - (letrec - !go : list (pair data data) -> Bool - = caseList' - {pair data data} - {Bool} - True - (\(hd : pair data data) -> - Bool_match - (let - !k' : These integer integer - = `$fUnsafeFromDataThese_$cunsafeFromBuiltinData` - {integer} - {integer} - unIData - unIData - (sndPair {data} {data} hd) - in - These_match - {integer} - {integer} - k' - {Bool} - (\(b : integer) -> - ifThenElse {Bool} (lessThanInteger 0 b) False True) - (\(a : integer) (b : integer) -> - ifThenElse {Bool} (lessThanInteger a b) False True) - (\(a : integer) -> - ifThenElse {Bool} (lessThanInteger a 0) False True)) - {all dead. list (pair data data) -> Bool} - (/\dead -> go) - (/\dead -> \(ds : list (pair data data)) -> False) - {all dead. dead}) - in - letrec - !go : list (pair data data) -> Bool - = caseList' - {pair data data} - {Bool} - True - (\(hd : pair data data) -> - Bool_match - (go (unMapData (sndPair {data} {data} hd))) - {all dead. list (pair data data) -> Bool} - (/\dead -> go) - (/\dead -> \(ds : list (pair data data)) -> False) - {all dead. dead}) - in - go - (map - {bytestring} - {These - ((\k a -> list (pair data data)) bytestring integer) - ((\k a -> list (pair data data)) bytestring integer)} - {(\k a -> list (pair data data)) bytestring (These integer integer)} - (`$fUnsafeFromDataThese_$cunsafeFromBuiltinData` - {(\k a -> list (pair data data)) bytestring integer} - {(\k a -> list (pair data data)) bytestring integer} - (\(eta : data) -> unMapData eta) - (\(eta : data) -> unMapData eta)) - (`$fToDataMap_$ctoBuiltinData` {bytestring} {These integer integer}) - (\(k : - These - ((\k a -> list (pair data data)) bytestring integer) - ((\k a -> list (pair data data)) bytestring integer)) -> - These_match - {(\k a -> list (pair data data)) bytestring integer} - {(\k a -> list (pair data data)) bytestring integer} - k - {(\k a -> list (pair data data)) - bytestring - (These integer integer)} - (\(b : (\k a -> list (pair data data)) bytestring integer) -> - map - {bytestring} - {integer} - {These integer integer} - unIData - `$dToData` - (\(ds : integer) -> That {integer} {integer} ds) - b) - (\(a : (\k a -> list (pair data data)) bytestring integer) - (b : (\k a -> list (pair data data)) bytestring integer) -> - union - {bytestring} - {integer} - {integer} - unIData - unIData - `$fToDataInteger_$ctoBuiltinData` - `$fToDataInteger_$ctoBuiltinData` - a - b) - (\(a : (\k a -> list (pair data data)) bytestring integer) -> - map - {bytestring} - {integer} - {These integer integer} - unIData - `$dToData` - (\(ds : integer) -> This {integer} {integer} ds) - a)) - (union - {bytestring} - {(\k a -> list (pair data data)) bytestring integer} - {(\k a -> list (pair data data)) bytestring integer} - (\(eta : data) -> unMapData eta) - (\(eta : data) -> unMapData eta) - (`$fToDataMap_$ctoBuiltinData` {bytestring} {integer}) - (`$fToDataMap_$ctoBuiltinData` {bytestring} {integer}) - l - r))) + (go + (map + {bytestring} + {These + ((\k a -> list (pair data data)) bytestring integer) + ((\k a -> list (pair data data)) bytestring integer)} + {(\k a -> list (pair data data)) bytestring (These integer integer)} + (`$fUnsafeFromDataThese_$cunsafeFromBuiltinData` + {(\k a -> list (pair data data)) bytestring integer} + {(\k a -> list (pair data data)) bytestring integer} + (\(eta : data) -> unMapData eta) + (\(eta : data) -> unMapData eta)) + (`$fToDataMap_$ctoBuiltinData` {bytestring} {These integer integer}) + (\(k : + These + ((\k a -> list (pair data data)) bytestring integer) + ((\k a -> list (pair data data)) bytestring integer)) -> + These_match + {(\k a -> list (pair data data)) bytestring integer} + {(\k a -> list (pair data data)) bytestring integer} + k + {(\k a -> list (pair data data)) + bytestring + (These integer integer)} + (\(b : (\k a -> list (pair data data)) bytestring integer) -> + map + {bytestring} + {integer} + {These integer integer} + unIData + `$dToData` + (\(ds : integer) -> That {integer} {integer} ds) + b) + (\(a : (\k a -> list (pair data data)) bytestring integer) + (b : (\k a -> list (pair data data)) bytestring integer) -> + union + {bytestring} + {integer} + {integer} + unIData + unIData + `$fToDataInteger_$ctoBuiltinData` + `$fToDataInteger_$ctoBuiltinData` + a + b) + (\(a : (\k a -> list (pair data data)) bytestring integer) -> + map + {bytestring} + {integer} + {These integer integer} + unIData + `$dToData` + (\(ds : integer) -> This {integer} {integer} ds) + a)) + (union + {bytestring} + {(\k a -> list (pair data data)) bytestring integer} + {(\k a -> list (pair data data)) bytestring integer} + (\(eta : data) -> unMapData eta) + (\(eta : data) -> unMapData eta) + (`$fToDataMap_$ctoBuiltinData` {bytestring} {integer}) + (`$fToDataMap_$ctoBuiltinData` {bytestring} {integer}) + l + r))) {all dead. Bool} (/\dead -> Bool_match (unordEqWith - (\(v : data) -> - (letrec - !go : list (pair data data) -> Bool - = caseList' - {pair data data} - {Bool} - True - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsInteger - 0 - (unIData (sndPair {data} {data} hd))) - [False, True]) - {all dead. list (pair data data) -> Bool} - (/\dead -> go) - (/\dead -> \(ds : list (pair data data)) -> False) - {all dead. dead}) - in - go) - (unMapData v)) + (\(v : data) -> go (unMapData v)) (\(v : data) (v : data) -> unordEqWith (\(v : data) -> diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt1.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt1.eval.golden index 5c850aeb389..6e827f2a285 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt1.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt1.eval.golden @@ -1,6 +1,6 @@ -CPU: 667_779_628 -Memory: 1_986_424 -Term Size: 1_121 -Flat Size: 1_366 +CPU: 467_505_925 +Memory: 1_249_740 +Term Size: 1_091 +Flat Size: 1_348 (constr 1) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt2.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt2.eval.golden index 1494c51c5c5..61e5107e0a5 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt2.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt2.eval.golden @@ -1,6 +1,6 @@ -CPU: 605_610_994 -Memory: 1_789_735 -Term Size: 1_121 -Flat Size: 1_417 +CPU: 427_221_400 +Memory: 1_136_903 +Term Size: 1_091 +Flat Size: 1_399 (constr 1) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt3.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt3.eval.golden index 10b8f043be5..9e8f97f8290 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt3.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt3.eval.golden @@ -1,6 +1,6 @@ -CPU: 729_947_106 -Memory: 2_191_692 -Term Size: 1_121 -Flat Size: 1_417 +CPU: 508_734_018 +Memory: 1_377_728 +Term Size: 1_091 +Flat Size: 1_399 (constr 0) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt4.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt4.eval.golden index d6ec3a1f31b..60abbdf5b90 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt4.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt4.eval.golden @@ -1,6 +1,6 @@ -CPU: 553_696_600 -Memory: 1_596_647 -Term Size: 1_121 -Flat Size: 1_373 +CPU: 390_764_929 +Memory: 1_000_159 +Term Size: 1_091 +Flat Size: 1_355 (constr 1) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt5.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt5.eval.golden index 9d775693c9b..c373fcb5e82 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt5.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/gt5.eval.golden @@ -1,6 +1,6 @@ -CPU: 639_047_326 -Memory: 1_888_813 -Term Size: 1_121 -Flat Size: 1_373 +CPU: 448_730_470 +Memory: 1_190_945 +Term Size: 1_091 +Flat Size: 1_355 (constr 0) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueBurned.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueBurned.eval.golden index d3a6350b8e3..13e1bcfe823 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueBurned.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueBurned.eval.golden @@ -1,7 +1,7 @@ -CPU: 40_568_702 -Memory: 158_338 -Term Size: 131 -Flat Size: 288 +CPU: 26_700_791 +Memory: 113_530 +Term Size: 113 +Flat Size: 275 (con (list (pair data data)) diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueMinted.eval.golden b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueMinted.eval.golden index 04150e5efed..c8eef98cc5b 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueMinted.eval.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Budget/9.6/mintValueMinted.eval.golden @@ -1,7 +1,7 @@ -CPU: 35_652_280 -Memory: 139_608 -Term Size: 121 -Flat Size: 277 +CPU: 21_784_369 +Memory: 94_800 +Term Size: 103 +Flat Size: 264 (con (list (pair data data)) diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Long.stat.golden b/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Long.stat.golden index cceb2850da6..1b963df34be 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Long.stat.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Long.stat.golden @@ -1,15 +1,15 @@ -({cpu: 8145180510 | mem: 11696687}) -({cpu: 8070954 | mem: 31274}) -({cpu: 5797710389 | mem: 8166131}) -({cpu: 8070954 | mem: 31274}) -({cpu: 5797710389 | mem: 8166131}) -({cpu: 8070954 | mem: 31274}) -({cpu: 3450240268 | mem: 4635575}) -({cpu: 8070954 | mem: 31274}) -({cpu: 5797710389 | mem: 8166131}) -({cpu: 8070954 | mem: 31274}) -({cpu: 3450240268 | mem: 4635575}) -({cpu: 8070954 | mem: 31274}) -({cpu: 3450240268 | mem: 4635575}) -({cpu: 8070954 | mem: 31274}) -({cpu: 1102770147 | mem: 1105019}) \ No newline at end of file +({cpu: 6889698150 | mem: 6936007}) +({cpu: 5370732 | mem: 22258}) +({cpu: 4921341317 | mem: 4843115}) +({cpu: 5370732 | mem: 22258}) +({cpu: 4921341317 | mem: 4843115}) +({cpu: 5370732 | mem: 22258}) +({cpu: 2952984484 | mem: 2750223}) +({cpu: 5370732 | mem: 22258}) +({cpu: 4921341317 | mem: 4843115}) +({cpu: 5370732 | mem: 22258}) +({cpu: 2952984484 | mem: 2750223}) +({cpu: 5370732 | mem: 22258}) +({cpu: 2952984484 | mem: 2750223}) +({cpu: 5370732 | mem: 22258}) +({cpu: 984627651 | mem: 657331}) \ No newline at end of file diff --git a/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Short.stat.golden b/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Short.stat.golden index 73cdcdb87fc..506ed84a12c 100644 --- a/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Short.stat.golden +++ b/plutus-ledger-api/test-plugin/Spec/Data/Value/9.6/Short.stat.golden @@ -1,21 +1,21 @@ -({cpu: 1834088 | mem: 9964}) -({cpu: 4441311 | mem: 20952}) -({cpu: 7451253 | mem: 29813}) -({cpu: 9669936 | mem: 38870}) -({cpu: 11807005 | mem: 43099}) -({cpu: 14693116 | mem: 54384}) -({cpu: 21970875 | mem: 76234}) -({cpu: 23689905 | mem: 87754}) -({cpu: 27588040 | mem: 96083}) -({cpu: 17055215 | mem: 58813}) -({cpu: 42298615 | mem: 142504}) -({cpu: 12617659 | mem: 44560}) -({cpu: 61364942 | mem: 202211}) -({cpu: 71671524 | mem: 241561}) -({cpu: 87269410 | mem: 275204}) -({cpu: 97575992 | mem: 314554}) -({cpu: 117720583 | mem: 361483}) -({cpu: 120606694 | mem: 372768}) -({cpu: 152718461 | mem: 461048}) -({cpu: 56601121 | mem: 194372}) -({cpu: 1102770147 | mem: 1105019}) \ No newline at end of file +({cpu: 1408100 | mem: 8900}) +({cpu: 2102715 | mem: 12264}) +({cpu: 5043663 | mem: 21493}) +({cpu: 5802732 | mem: 24958}) +({cpu: 7939801 | mem: 29187}) +({cpu: 8945485 | mem: 33216}) +({cpu: 14662455 | mem: 49474}) +({cpu: 13787070 | mem: 50874}) +({cpu: 18298018 | mem: 62067}) +({cpu: 10982771 | mem: 36581}) +({cpu: 28107763 | mem: 90048}) +({cpu: 8457823 | mem: 29952}) +({cpu: 40813646 | mem: 125723}) +({cpu: 44524959 | mem: 138941}) +({cpu: 58898056 | mem: 169092}) +({cpu: 62609369 | mem: 182310}) +({cpu: 80069557 | mem: 220155}) +({cpu: 81075241 | mem: 224184}) +({cpu: 104328149 | mem: 278912}) +({cpu: 34925374 | mem: 112156}) +({cpu: 984627651 | mem: 657331}) \ No newline at end of file diff --git a/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs b/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs index 8703c53be51..c4a93efee6d 100644 --- a/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs +++ b/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs @@ -346,56 +346,80 @@ defineBuiltinTerms = do defineBuiltinTerm annMayInline 'Builtins.bls12_381_G2_compressed_zero $ PIR.mkConstant annMayInline BLS12_381.G2.compressed_zero - defineBuiltinTerm annMayInline 'Builtins.caseList' $ - -- > /\a r -> - -- > \(z : r) (f : a -> list a -> r) (xs : list a) -> - -- > chooseList - -- > {a} - -- > {all dead. r} - -- > xs - -- > (/\dead -> z) - -- > (/\dead -> f (headList {a} xs) (tailList {a} xs)) - -- > {r} - fmap (const annMayInline) . runQuote $ do - a <- freshTyName "a" - r <- freshTyName "r" - dead <- freshTyName "dead" - xs <- freshName "xs" - z <- freshName "z" - f <- freshName "f" - let listA = PLC.TyApp () (PLC.mkTyBuiltin @_ @[] ()) $ PLC.TyVar () a - funAtXs headOrTail = - PIR.apply - () - (PIR.tyInst () (PIR.builtin () headOrTail) $ PLC.TyVar () a) - (PIR.var () xs) - return - . PIR.tyAbs () a (PLC.Type ()) - . PIR.tyAbs () r (PLC.Type ()) - . PIR.lamAbs () z (PLC.TyVar () r) - . PIR.lamAbs - () - f - (PLC.TyFun () (PLC.TyVar () a) . PLC.TyFun () listA $ PLC.TyVar () r) - . PIR.lamAbs () xs listA - . PIR.tyInst - () - ( PIR.mkIterAppNoAnn - ( PIR.mkIterInstNoAnn - (PIR.builtin () PLC.ChooseList) - [ PLC.TyVar () a - , PLC.TyForall () dead (PLC.Type ()) $ PLC.TyVar () r - ] - ) - [ PIR.var () xs - , PIR.tyAbs () dead (PLC.Type ()) $ PIR.var () z - , PIR.tyAbs () dead (PLC.Type ()) $ - PIR.mkIterAppNoAnn - (PIR.var () f) - [funAtXs PLC.HeadList, funAtXs PLC.TailList] - ] - ) - $ PLC.TyVar () r + defineBuiltinTerm annMayInline 'Builtins.caseList' $ case datatypeStyle of + style | style == PIR.ScottEncoding || style == PIR.SumsOfProducts -> + -- > /\a r -> + -- > \(z : r) (f : a -> list a -> r) (xs : list a) -> + -- > chooseList + -- > {a} + -- > {all dead. r} + -- > xs + -- > (/\dead -> z) + -- > (/\dead -> f (headList {a} xs) (tailList {a} xs)) + -- > {r} + fmap (const annMayInline) . runQuote $ do + a <- freshTyName "a" + r <- freshTyName "r" + dead <- freshTyName "dead" + xs <- freshName "xs" + z <- freshName "z" + f <- freshName "f" + let listA = PLC.TyApp () (PLC.mkTyBuiltin @_ @[] ()) $ PLC.TyVar () a + funAtXs headOrTail = + PIR.apply + () + (PIR.tyInst () (PIR.builtin () headOrTail) $ PLC.TyVar () a) + (PIR.var () xs) + return + . PIR.tyAbs () a (PLC.Type ()) + . PIR.tyAbs () r (PLC.Type ()) + . PIR.lamAbs () z (PLC.TyVar () r) + . PIR.lamAbs + () + f + (PLC.TyFun () (PLC.TyVar () a) . PLC.TyFun () listA $ PLC.TyVar () r) + . PIR.lamAbs () xs listA + . PIR.tyInst + () + ( PIR.mkIterAppNoAnn + ( PIR.mkIterInstNoAnn + (PIR.builtin () PLC.ChooseList) + [ PLC.TyVar () a + , PLC.TyForall () dead (PLC.Type ()) $ PLC.TyVar () r + ] + ) + [ PIR.var () xs + , PIR.tyAbs () dead (PLC.Type ()) $ PIR.var () z + , PIR.tyAbs () dead (PLC.Type ()) $ + PIR.mkIterAppNoAnn + (PIR.var () f) + [funAtXs PLC.HeadList, funAtXs PLC.TailList] + ] + ) + $ PLC.TyVar () r + _BuiltinCasing -> + -- > /\a r -> + -- > \(z : r) (f : a -> list a -> r) (xs : list a) -> + -- > (case r xs z f) + fmap (const annMayInline) . runQuote $ do + a <- freshTyName "a" + r <- freshTyName "r" + xs <- freshName "xs" + z <- freshName "z" + f <- freshName "f" + let listA = PLC.TyApp () (PLC.mkTyBuiltin @_ @[] ()) $ PLC.TyVar () a + return + $ PIR.tyAbs () a (PLC.Type ()) + $ PIR.tyAbs () r (PLC.Type ()) + $ PIR.lamAbs () z (PLC.TyVar () r) + $ PIR.lamAbs () f (PLC.TyFun () (PLC.TyVar () a) . PLC.TyFun () listA $ PLC.TyVar () r) + $ PIR.lamAbs () xs listA + $ PIR.kase + () + (PLC.TyVar () r) + (PIR.var () xs) + [PIR.var () z, PIR.var () f] + defineBuiltinTerm annMayInline 'Builtins.caseData' $ -- > /\r -> diff --git a/plutus-tx-plugin/test/Budget/9.6/map1.eval.golden b/plutus-tx-plugin/test/Budget/9.6/map1.eval.golden index 419f1088884..372f1fd582c 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map1.eval.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map1.eval.golden @@ -1,7 +1,7 @@ -CPU: 237_135_571 -Memory: 573_654 -Term Size: 356 -Flat Size: 356 +CPU: 169_395_592 +Memory: 324_042 +Term Size: 329 +Flat Size: 336 (constr 0 diff --git a/plutus-tx-plugin/test/Budget/9.6/map1.pir.golden b/plutus-tx-plugin/test/Budget/9.6/map1.pir.golden index 970ca1c2d48..2b6bf62825c 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map1.pir.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map1.pir.golden @@ -25,16 +25,6 @@ let data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a Nothing : Maybe a - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} !lookup : all k a. (\a -> a -> data) k -> @@ -52,27 +42,27 @@ let (let !k : data = `$dToData` ds in - (letrec - !go : list (pair data data) -> Maybe data - = caseList' - {pair data data} - {Maybe data} - (Nothing {data}) - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. list (pair data data) -> Maybe data} - (/\dead -> - \(ds : list (pair data data)) -> - Just {data} (sndPair {data} {data} hd)) - (/\dead -> go) - {all dead. dead}) - in - go) - ds) + letrec + !go : list (pair data data) -> Maybe data + = \(xs : list (pair data data)) -> + case + (Maybe data) + xs + [ (Nothing {data}) + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. list (pair data data) -> Maybe data} + (/\dead -> + \(ds : list (pair data data)) -> + Just {data} (sndPair {data} {data} hd)) + (/\dead -> go) + {all dead. dead}) ] + in + go ds) {all dead. Maybe a} (\(a : data) -> /\dead -> Just {a} (`$dUnsafeFromData` a)) (/\dead -> Nothing {a}) @@ -111,23 +101,26 @@ in in letrec !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - nilCase - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. - list (pair data data) -> list (pair data data)} - (/\dead -> mkCons {pair data data} (mkPairData k a)) - (/\dead -> - \(eta : list (pair data data)) -> - mkCons {pair data data} hd (go eta)) - {all dead. dead}) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ nilCase + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. + list (pair data data) -> + list (pair data data)} + (/\dead -> + mkCons {pair data data} (mkPairData k a)) + (/\dead -> + \(eta : list (pair data data)) -> + mkCons {pair data data} hd (go eta)) + {all dead. dead}) ] in go ds) (mkCons {pair data data} (mkPairData (iData n) (I 0)) []) @@ -138,23 +131,24 @@ in in letrec !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. - list (pair data data) -> list (pair data data)} - (/\dead -> \(x : list (pair data data)) -> x) - (/\dead -> - \(eta : list (pair data data)) -> - mkCons {pair data data} hd (go eta)) - {all dead. dead}) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. + list (pair data data) -> list (pair data data)} + (/\dead -> \(x : list (pair data data)) -> x) + (/\dead -> + \(eta : list (pair data data)) -> + mkCons {pair data data} hd (go eta)) + {all dead. dead}) ] in go) nt diff --git a/plutus-tx-plugin/test/Budget/9.6/map1.uplc.golden b/plutus-tx-plugin/test/Budget/9.6/map1.uplc.golden index 45272ae2723..dedc0967ae9 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map1.uplc.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map1.uplc.golden @@ -1,89 +1,84 @@ (program 1.1.0 ((\`$fEnumBool_$cenumFromTo` n -> - (\caseList' -> + (\nt -> (\nt -> - (\nt -> - (\lookup -> - constr 0 - [ (lookup (\i -> iData i) unIData n nt) - , (lookup (\i -> iData i) unIData (addInteger 5 n) nt) - , (lookup (\i -> iData i) unIData (addInteger 10 n) nt) - , (lookup (\i -> iData i) unIData (addInteger 20 n) nt) - , (lookup (\i -> iData i) unIData (addInteger 5 n) nt) ]) - (\`$dToData` `$dUnsafeFromData` ds ds -> - case - ((\k -> - (\s -> s s) - (\s -> - caseList' - (constr 1 []) - (\hd -> - case - (equalsData k (force (force fstPair) hd)) - [ (\x -> s s x) - , (\ds -> - constr 0 - [(force (force sndPair) hd)]) ])) - ds) - (`$dToData` ds)) - [ (\a -> constr 0 [(`$dUnsafeFromData` a)]) - , (constr 1 []) ])) - ((\k -> - (\s -> s s) - (\s -> - caseList' - [] - (\hd -> + (\lookup -> + constr 0 + [ (lookup (\i -> iData i) unIData n nt) + , (lookup (\i -> iData i) unIData (addInteger 5 n) nt) + , (lookup (\i -> iData i) unIData (addInteger 10 n) nt) + , (lookup (\i -> iData i) unIData (addInteger 20 n) nt) + , (lookup (\i -> iData i) unIData (addInteger 5 n) nt) ]) + (\`$dToData` `$dUnsafeFromData` ds ds -> + case + ((\k -> + (\s -> s s) + (\s xs -> case - (equalsData k (force (force fstPair) hd)) - [ (\eta -> force mkCons hd (s s eta)) - , (\x -> x) ]))) - (iData (addInteger 5 n)) - nt)) - ((\z -> - (\go eta -> go eta) - ((\s -> s s) - (\s ds -> - case - ds - [ z - , (\y ys -> - (\ds -> - (\k -> - (\a -> - (\nilCase -> - (\s -> s s) - (\s -> - caseList' - nilCase - (\hd -> - case - (equalsData - k - (force (force fstPair) - hd)) - [ (\eta -> - force mkCons - hd - (s s eta)) - , (force mkCons - (mkPairData - k - a)) ])) - ds) - (force mkCons (mkPairData k a) [])) - (iData y)) - (iData (addInteger n y))) - (s s ys)) ]))) - (force mkCons (mkPairData (iData n) (I 0)) []) - (`$fEnumBool_$cenumFromTo` 1 10))) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay (f (force headList xs) (force tailList xs)))))) + xs + [ (constr 1 []) + , (\hd -> + case + (equalsData k (force (force fstPair) hd)) + [ (\x -> s s x) + , (\ds -> + constr 0 + [(force (force sndPair) hd)]) ]) ]) + ds) + (`$dToData` ds)) + [(\a -> constr 0 [(`$dUnsafeFromData` a)]), (constr 1 [])])) + ((\k -> + (\s -> s s) + (\s xs -> + case + xs + [ [] + , (\hd -> + case + (equalsData k (force (force fstPair) hd)) + [ (\eta -> force mkCons hd (s s eta)) + , (\x -> x) ]) ])) + (iData (addInteger 5 n)) + nt)) + ((\z -> + (\go eta -> go eta) + ((\s -> s s) + (\s ds -> + case + ds + [ z + , (\y ys -> + (\ds -> + (\k -> + (\a -> + (\nilCase -> + (\s -> s s) + (\s xs -> + case + xs + [ nilCase + , (\hd -> + case + (equalsData + k + (force (force fstPair) + hd)) + [ (\eta -> + force mkCons + hd + (s s eta)) + , (force mkCons + (mkPairData + k + a)) ]) ]) + ds) + (force mkCons (mkPairData k a) [])) + (iData y)) + (iData (addInteger n y))) + (s s ys)) ]))) + (force mkCons (mkPairData (iData n) (I 0)) []) + (`$fEnumBool_$cenumFromTo` 1 10))) ((\s -> s s) (\s x lim -> case diff --git a/plutus-tx-plugin/test/Budget/9.6/map2.eval.golden b/plutus-tx-plugin/test/Budget/9.6/map2.eval.golden index d1c6a1a3443..c22a47c168c 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map2.eval.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map2.eval.golden @@ -1,7 +1,7 @@ -CPU: 116_006_947 -Memory: 345_150 -Term Size: 449 -Flat Size: 469 +CPU: 76_658_230 +Memory: 199_974 +Term Size: 425 +Flat Size: 453 (constr 1 diff --git a/plutus-tx-plugin/test/Budget/9.6/map2.pir.golden b/plutus-tx-plugin/test/Budget/9.6/map2.pir.golden index 99d2c96dce2..89b37ce65b8 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map2.pir.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map2.pir.golden @@ -1,23 +1,36 @@ let - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b +in +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +letrec + !go : list (pair data data) -> List (Tuple2 integer integer) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 integer integer)) + xs + [ (Nil {Tuple2 integer integer}) + , (\(hd : pair data data) (tl : list (pair data data)) -> + Cons + {Tuple2 integer integer} + (Tuple2 + {integer} + {integer} + (unIData (fstPair {data} {data} hd)) + (unIData (sndPair {data} {data} hd))) + (go tl)) ] in letrec !go : list (pair data data) -> list (pair data data) -> list (pair data data) - = \(acc : list (pair data data)) -> - caseList' - {pair data data} - {list (pair data data)} - acc - (\(hd : pair data data) -> go (mkCons {pair data data} hd acc)) + = \(acc : list (pair data data)) (xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [acc, (\(hd : pair data data) -> go (mkCons {pair data data} hd acc))] in let data (Maybe :: * -> *) a | Maybe_match where @@ -26,13 +39,6 @@ let data Bool | Bool_match where True : Bool False : Bool - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b -in -letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a in letrec !goList : List (Tuple2 data data) -> list (pair data data) @@ -115,6 +121,57 @@ in (c (Tuple2 {integer} {integer} (addInteger 7 n) 77) n))))) + in + letrec + !go : list (pair data data) -> list (pair data data) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) (tl : list (pair data data)) -> + let + !v' : data = sndPair {data} {data} hd + !k' : data = fstPair {data} {data} hd + in + letrec + !go : list (pair data data) -> Maybe data + = \(xs : list (pair data data)) -> + case + (Maybe data) + xs + [ (Nothing {data}) + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k' (fstPair {data} {data} hd)) + [False, True]) + {all dead. + list (pair data data) -> Maybe data} + (/\dead -> + \(ds : list (pair data data)) -> + Just {data} (sndPair {data} {data} hd)) + (/\dead -> go) + {all dead. dead}) ] + in + Maybe_match + {data} + (go nt) + {all dead. list (pair data data)} + (\(r : data) -> + /\dead -> + mkCons + {pair data data} + (mkPairData + k' + (iData (addInteger (unIData v') (unIData r)))) + (go tl)) + (/\dead -> + mkCons {pair data data} (mkPairData k' v') (go tl)) + {all dead. dead}) ] + in + let !nt : list (pair data data) = unsafeFromSOPList {integer} @@ -139,14 +196,15 @@ in (c (Tuple2 {integer} {integer} (addInteger 5 n) 5) n)))))) - !nt : list (pair data data) - = letrec - !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) (tl : list (pair data data)) -> + in + letrec + !go : list (pair data data) -> list (pair data data) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) (tl : list (pair data data)) -> let !tl' : list (pair data data) = go tl in @@ -156,98 +214,35 @@ in in letrec !go : list (pair data data) -> Bool - = caseList' - {pair data data} - {Bool} - False - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. list (pair data data) -> Bool} - (/\dead -> - \(ds : list (pair data data)) -> True) - (/\dead -> go) - {all dead. dead}) + = \(xs : list (pair data data)) -> + case + Bool + xs + [ False + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. list (pair data data) -> Bool} + (/\dead -> + \(ds : list (pair data data)) -> True) + (/\dead -> go) + {all dead. dead}) ] in go nt) {all dead. list (pair data data)} (/\dead -> tl') (/\dead -> mkCons {pair data data} hd tl') - {all dead. dead}) - in - let + {all dead. dead}) ] + in + let + !nt : list (pair data data) + = let !rs' : list (pair data data) = go nt - in - letrec - !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) (tl : list (pair data data)) -> - let - !v' : data = sndPair {data} {data} hd - !k' : data = fstPair {data} {data} hd - in - Maybe_match - {data} - ((letrec - !go : list (pair data data) -> Maybe data - = caseList' - {pair data data} - {Maybe data} - (Nothing {data}) - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k' (fstPair {data} {data} hd)) - [False, True]) - {all dead. - list (pair data data) -> Maybe data} - (/\dead -> - \(ds : list (pair data data)) -> - Just {data} (sndPair {data} {data} hd)) - (/\dead -> go) - {all dead. dead}) - in - go) - nt) - {all dead. list (pair data data)} - (\(r : data) -> - /\dead -> - mkCons - {pair data data} - (mkPairData - k' - (iData (addInteger (unIData v') (unIData r)))) - (go tl)) - (/\dead -> - mkCons {pair data data} (mkPairData k' v') (go tl)) - {all dead. dead}) - in - let !ls' : list (pair data data) = go nt in go rs' ls' in - letrec - !go : list (pair data data) -> List (Tuple2 integer integer) - = caseList' - {pair data data} - {List (Tuple2 integer integer)} - (Nil {Tuple2 integer integer}) - (\(hd : pair data data) (tl : list (pair data data)) -> - Cons - {Tuple2 integer integer} - (Tuple2 - {integer} - {integer} - (unIData (fstPair {data} {data} hd)) - (unIData (sndPair {data} {data} hd))) - (go tl)) - in go nt \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/9.6/map2.uplc.golden b/plutus-tx-plugin/test/Budget/9.6/map2.uplc.golden index cebf1be6338..305112b5237 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map2.uplc.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map2.uplc.golden @@ -1,116 +1,117 @@ (program 1.1.0 - ((\caseList' -> + ((\go -> (\go -> (\goList n -> (\unsafeFromSOPList -> (\nt -> - (\nt -> + (\go -> (\nt -> - (\s -> s s) - (\s -> - caseList' - (constr 0 []) - (\hd tl -> - constr 1 - [ (constr 0 - [ (unIData (force (force fstPair) hd)) - , (unIData - (force (force sndPair) hd)) ]) - , (s s tl) ])) - nt) - ((\rs' -> - (\ls' -> - go rs' ls') + go + ((\rs' -> + (\ls' -> go rs' ls') (go nt)) ((\s -> s s) - (\s -> - caseList' - [] - (\hd - tl -> - (\v' -> - (\k' -> - case - ((\s -> - s s) + (\s + xs -> + case + xs + [ [] + , (\hd + tl -> + (\tl' -> + case + ((\k -> (\s -> - caseList' - (constr 1 []) - (\hd -> - case - (equalsData - k' - (force - (force - fstPair) - hd)) - [ (\x -> s s x) - , (\ds -> - constr 0 - [ (force - (force - sndPair) - hd) ]) ])) - nt) - [ (\r -> - force mkCons - (mkPairData - k' - (iData - (addInteger - (unIData v') - (unIData r)))) - (s s tl)) - , (force mkCons - (mkPairData k' v') - (s s tl)) ]) - (force (force fstPair) hd)) - (force (force sndPair) hd))) - nt)) - ((\s -> s s) - (\s -> - caseList' - [] - (\hd tl -> - (\tl' -> - case - ((\k -> - (\s -> s s) - (\s -> - caseList' - (constr 1 []) - (\hd -> + s s) + (\s + xs -> case - (equalsData - k - (force - (force fstPair) - hd)) - [ (\x -> s s x) - , (\ds -> - constr 0 []) ])) - nt) - (force (force fstPair) hd)) - [tl', (force mkCons hd tl')]) - (s s tl))) - nt))) - (unsafeFromSOPList - (\i -> iData i) - (\i -> iData i) - (constr 1 - [ (constr 0 [(addInteger 1 n), 1]) - , (constr 1 - [ (constr 0 [(addInteger 2 n), 2]) - , (constr 1 - [ (constr 0 [(addInteger 3 n), 3]) - , (constr 1 - [ (constr 0 [(addInteger 4 n), 4]) - , (constr 1 - [ (constr 0 - [(addInteger 5 n), 5]) - , (constr 0 []) ]) ]) ]) ]) ]))) + xs + [ (constr 1 []) + , (\hd -> + case + (equalsData + k + (force + (force + fstPair) + hd)) + [ (\x -> + s s x) + , (\ds -> + constr 0 + [ ]) ]) ]) + nt) + (force (force fstPair) hd)) + [tl', (force mkCons hd tl')]) + (s s tl)) ]) + nt))) + (unsafeFromSOPList + (\i -> iData i) + (\i -> iData i) + (constr 1 + [ (constr 0 [(addInteger 1 n), 1]) + , (constr 1 + [ (constr 0 [(addInteger 2 n), 2]) + , (constr 1 + [ (constr 0 [(addInteger 3 n), 3]) + , (constr 1 + [ (constr 0 [(addInteger 4 n), 4]) + , (constr 1 + [ (constr 0 + [(addInteger 5 n), 5]) + , (constr 0 + []) ]) ]) ]) ]) ]))) + ((\s -> + s s) + (\s + xs -> + case + xs + [ [] + , (\hd + tl -> + (\v' -> + (\k' -> + case + ((\s -> + s s) + (\s + xs -> + case + xs + [ (constr 1 []) + , (\hd -> + case + (equalsData + k' + (force + (force fstPair) + hd)) + [ (\x -> s s x) + , (\ds -> + constr 0 + [ (force + (force + sndPair) + hd) ]) ]) ]) + nt) + [ (\r -> + force mkCons + (mkPairData + k' + (iData + (addInteger + (unIData v') + (unIData r)))) + (s s tl)) + , (force mkCons + (mkPairData k' v') + (s s tl)) ]) + (force (force fstPair) hd)) + (force (force sndPair) hd)) ]))) (unsafeFromSOPList (\i -> iData i) (\i -> iData i) @@ -149,11 +150,16 @@ (case d [(\d d -> mkPairData d d)]) (s s ds)) ]))) ((\s -> s s) - (\s acc -> - caseList' acc (\hd -> (\x -> s s x) (force mkCons hd acc))))) - (\z f xs -> - force - (force (force chooseList) + (\s acc xs -> + case xs [acc, (\hd -> (\x -> s s x) (force mkCons hd acc))]))) + ((\s -> s s) + (\s xs -> + case xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))))) \ No newline at end of file + [ (constr 0 []) + , (\hd tl -> + constr 1 + [ (constr 0 + [ (unIData (force (force fstPair) hd)) + , (unIData (force (force sndPair) hd)) ]) + , (s s tl) ]) ])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/9.6/map3.eval.golden b/plutus-tx-plugin/test/Budget/9.6/map3.eval.golden index 3c0df7b1ea4..c5d69b5dd06 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map3.eval.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map3.eval.golden @@ -1,7 +1,7 @@ -CPU: 183_147_840 -Memory: 545_717 -Term Size: 728 -Flat Size: 747 +CPU: 130_599_615 +Memory: 352_217 +Term Size: 704 +Flat Size: 730 (constr 1 diff --git a/plutus-tx-plugin/test/Budget/9.6/map3.pir.golden b/plutus-tx-plugin/test/Budget/9.6/map3.pir.golden index 0747cc75c79..b9e4c5db05b 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map3.pir.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map3.pir.golden @@ -2,55 +2,47 @@ let data Bool | Bool_match where True : Bool False : Bool - !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} in letrec !safeAppend : list (pair data data) -> list (pair data data) -> list (pair data data) = \(xs : list (pair data data)) (xs : list (pair data data)) -> - caseList' - {pair data data} - {list (pair data data)} - xs - (\(hd : pair data data) (tl : list (pair data data)) -> - let - !v : data = sndPair {data} {data} hd - !k : data = fstPair {data} {data} hd - !eta : list (pair data data) = safeAppend tl xs - !nilCase : list (pair data data) - = mkCons {pair data data} (mkPairData k v) [] - in - letrec - !go : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - nilCase - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. - list (pair data data) -> list (pair data data)} - (/\dead -> mkCons {pair data data} (mkPairData k v)) - (/\dead -> - \(eta : list (pair data data)) -> - mkCons {pair data data} hd (go eta)) - {all dead. dead}) - in - go eta) + case + (list (pair data data)) xs + [ xs + , (\(hd : pair data data) (tl : list (pair data data)) -> + let + !v : data = sndPair {data} {data} hd + !k : data = fstPair {data} {data} hd + !eta : list (pair data data) = safeAppend tl xs + !nilCase : list (pair data data) + = mkCons {pair data data} (mkPairData k v) [] + in + letrec + !go : list (pair data data) -> list (pair data data) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ nilCase + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. + list (pair data data) -> + list (pair data data)} + (/\dead -> + mkCons {pair data data} (mkPairData k v)) + (/\dead -> + \(eta : list (pair data data)) -> + mkCons {pair data data} hd (go eta)) + {all dead. dead}) ] + in + go eta) ] in let !`$dToData` : (\a -> a -> data) integer = \(i : integer) -> iData i @@ -85,28 +77,28 @@ let Just : a -> Maybe a Nothing : Maybe a !lookup' : data -> list (pair data data) -> Maybe data - = \(k : data) (m : list (pair data data)) -> - (letrec - !go : list (pair data data) -> Maybe data - = caseList' - {pair data data} - {Maybe data} - (Nothing {data}) - (\(hd : pair data data) -> - Bool_match - (case - Bool - (equalsData k (fstPair {data} {data} hd)) - [False, True]) - {all dead. list (pair data data) -> Maybe data} - (/\dead -> - \(ds : list (pair data data)) -> - Just {data} (sndPair {data} {data} hd)) - (/\dead -> go) - {all dead. dead}) - in - go) - m + = \(k : data) -> + letrec + !go : list (pair data data) -> Maybe data + = \(xs : list (pair data data)) -> + case + (Maybe data) + xs + [ (Nothing {data}) + , (\(hd : pair data data) -> + Bool_match + (case + Bool + (equalsData k (fstPair {data} {data} hd)) + [False, True]) + {all dead. list (pair data data) -> Maybe data} + (/\dead -> + \(ds : list (pair data data)) -> + Just {data} (sndPair {data} {data} hd)) + (/\dead -> go) + {all dead. dead}) ] + in + \(m : list (pair data data)) -> go m data (Tuple2 :: * -> * -> *) a b | Tuple2_match where Tuple2 : a -> b -> Tuple2 a b in @@ -196,38 +188,15 @@ in (c (Tuple2 {integer} {integer} (addInteger 7 n) 70) n))))) - !nt : list (pair data data) - = unsafeFromSOPList - {integer} - {integer} - (\(i : integer) -> iData i) - (\(i : integer) -> iData i) - ((let - a = Tuple2 integer integer - in - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a})) - (/\a -> - \(c : Tuple2 integer integer -> a -> a) (n : a) -> - c - (Tuple2 {integer} {integer} (addInteger 1 n) 1) - (c - (Tuple2 {integer} {integer} (addInteger 2 n) 2) - (c - (Tuple2 {integer} {integer} (addInteger 3 n) 3) - (c - (Tuple2 {integer} {integer} (addInteger 4 n) 4) - (c - (Tuple2 {integer} {integer} (addInteger 5 n) 5) - n)))))) - !nt : list (pair data data) - = letrec - !goRight : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) (tl : list (pair data data)) -> + in + letrec + !goLeft : list (pair data data) -> list (pair data data) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) (tl : list (pair data data)) -> let !v : data = sndPair {data} {data} hd !k : data = fstPair {data} {data} hd @@ -252,7 +221,7 @@ in {integer} (unIData v) (unIData r)))) - (goRight tl)) + (goLeft tl)) (/\dead -> mkCons {pair data data} @@ -263,17 +232,44 @@ in {integer} `$dToData` `$dToData` - (That {integer} {integer} (unIData v)))) - (goRight tl)) - {all dead. dead}) - in - letrec - !goLeft : list (pair data data) -> list (pair data data) - = caseList' - {pair data data} - {list (pair data data)} - [] - (\(hd : pair data data) (tl : list (pair data data)) -> + (This {integer} {integer} (unIData v)))) + (goLeft tl)) + {all dead. dead}) ] + in + let + !nt : list (pair data data) + = unsafeFromSOPList + {integer} + {integer} + (\(i : integer) -> iData i) + (\(i : integer) -> iData i) + ((let + a = Tuple2 integer integer + in + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a})) + (/\a -> + \(c : Tuple2 integer integer -> a -> a) (n : a) -> + c + (Tuple2 {integer} {integer} (addInteger 1 n) 1) + (c + (Tuple2 {integer} {integer} (addInteger 2 n) 2) + (c + (Tuple2 {integer} {integer} (addInteger 3 n) 3) + (c + (Tuple2 {integer} {integer} (addInteger 4 n) 4) + (c + (Tuple2 {integer} {integer} (addInteger 5 n) 5) + n)))))) + in + letrec + !goRight : list (pair data data) -> list (pair data data) + = \(xs : list (pair data data)) -> + case + (list (pair data data)) + xs + [ [] + , (\(hd : pair data data) (tl : list (pair data data)) -> let !v : data = sndPair {data} {data} hd !k : data = fstPair {data} {data} hd @@ -298,7 +294,7 @@ in {integer} (unIData v) (unIData r)))) - (goLeft tl)) + (goRight tl)) (/\dead -> mkCons {pair data data} @@ -309,11 +305,12 @@ in {integer} `$dToData` `$dToData` - (This {integer} {integer} (unIData v)))) - (goLeft tl)) - {all dead. dead}) - in - safeAppend (goLeft nt) (goRight nt) + (That {integer} {integer} (unIData v)))) + (goRight tl)) + {all dead. dead}) ] + in + let + !nt : list (pair data data) = safeAppend (goLeft nt) (goRight nt) in (let a = Tuple2 integer (These integer integer) @@ -358,25 +355,25 @@ in a = These integer integer in \(`$dUnsafeFromData` : (\a -> data -> a) integer) - (`$dUnsafeFromData` : (\a -> data -> a) a) - (d : (\k a -> list (pair data data)) integer a) -> + (`$dUnsafeFromData` : (\a -> data -> a) a) -> letrec !go : list (pair data data) -> List (Tuple2 integer a) - = caseList' - {pair data data} - {List (Tuple2 integer a)} - (Nil {Tuple2 integer a}) - (\(hd : pair data data) (tl : list (pair data data)) -> - Cons - {Tuple2 integer a} - (Tuple2 - {integer} - {a} - (`$dUnsafeFromData` (fstPair {data} {data} hd)) - (`$dUnsafeFromData` (sndPair {data} {data} hd))) - (go tl)) + = \(xs : list (pair data data)) -> + case + (List (Tuple2 integer a)) + xs + [ (Nil {Tuple2 integer a}) + , (\(hd : pair data data) (tl : list (pair data data)) -> + Cons + {Tuple2 integer a} + (Tuple2 + {integer} + {a} + (`$dUnsafeFromData` (fstPair {data} {data} hd)) + (`$dUnsafeFromData` (sndPair {data} {data} hd))) + (go tl)) ] in - go d) + \(d : (\k a -> list (pair data data)) integer a) -> go d) unIData (\(d : data) -> let diff --git a/plutus-tx-plugin/test/Budget/9.6/map3.uplc.golden b/plutus-tx-plugin/test/Budget/9.6/map3.uplc.golden index e4a1e165264..3e9dafebdc9 100644 --- a/plutus-tx-plugin/test/Budget/9.6/map3.uplc.golden +++ b/plutus-tx-plugin/test/Budget/9.6/map3.uplc.golden @@ -1,199 +1,163 @@ (program 1.1.0 - ((\caseList' -> - (\safeAppend -> - (\lookup' -> - (\`$fToDataThese_$ctoBuiltinData` -> + ((\safeAppend -> + (\lookup' -> + (\`$fToDataThese_$ctoBuiltinData` -> + (\`$dToData` -> (\`$dToData` -> - (\`$dToData` -> - (\goList - n -> - (\unsafeFromSOPList -> - (\nt -> + (\goList + n -> + (\unsafeFromSOPList -> + (\nt -> + (\goLeft -> (\nt -> - (\nt -> - (\s -> - s s) - (\s - ds -> - case - ds - [ (constr 0 []) - , (\x - xs -> - constr 1 - [ (case - x - [ (\c - a -> - constr 0 - [ c - , (case - a - [ (\b -> b) - , (\a - b -> - addInteger - a - b) - , (\a -> - a) ]) ]) ]) - , (s s xs) ]) ]) - ((\s -> + (\goRight -> + (\nt -> + (\s -> s s) - (\s -> - caseList' - (constr 0 []) - (\hd - tl -> - constr 1 - [ (constr 0 - [ (unIData - (force - (force fstPair) - hd)) - , ((\tup -> - (\index -> - (\args -> - case - (equalsInteger - 0 - index) - [ (case + (\s + ds -> + case + ds + [ (constr 0 []) + , (\x + xs -> + constr 1 + [ (case + x + [ (\c + a -> + constr 0 + [ c + , (case + a + [ (\b -> + b) + , (\a + b -> + addInteger + a + b) + , (\a -> + a) ]) ]) ]) + , (s s xs) ]) ]) + ((\s -> + s s) + (\s + xs -> + case + xs + [ (constr 0 []) + , (\hd + tl -> + constr 1 + [ (constr 0 + [ (unIData + (force + (force + fstPair) + hd)) + , ((\tup -> + (\index -> + (\args -> + case (equalsInteger - 1 + 0 index) [ (case (equalsInteger - 2 + 1 index) - [ ((\x -> - error) - (force - trace - "PT1" - (constr 0 - [ ]))) - , (constr 1 - [ (unIData + [ (case + (equalsInteger + 2 + index) + [ ((\x -> + error) (force - headList - args)) - , (unIData + trace + "PT1" + (constr 0 + [ ]))) + , (constr 1 + [ (unIData + (force + headList + args)) + , (unIData + (force + headList + (force + tailList + args))) ]) ]) + , (constr 0 + [ (unIData (force headList - (force - tailList - args))) ]) ]) - , (constr 0 + args)) ]) ]) + , (constr 2 [ (unIData (force headList args)) ]) ]) - , (constr 2 - [ (unIData - (force - headList - args)) ]) ]) - (force - (force - sndPair) - tup)) - (force - (force - fstPair) - tup)) - (unConstrData - (force - (force - sndPair) - hd))) ]) - , (s s tl) ])) - nt)) - ((\goRight -> - safeAppend - ((\s -> - s s) - (\s -> - caseList' - [] - (\hd - tl -> - (\v -> - (\k -> - case - (lookup' k nt) - [ (\r -> - force - mkCons - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - `$dToData` - `$dToData` - (constr 1 - [ (unIData - v) - , (unIData - r) ]))) - (s s tl)) - , (force - mkCons - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - `$dToData` - `$dToData` - (constr 2 - [ (unIData - v) ]))) - (s s tl)) ]) - (force (force fstPair) - hd)) - (force (force sndPair) - hd))) - nt) - (goRight nt)) - ((\s -> - s s) - (\s -> - caseList' - [] - (\hd - tl -> - (\v -> - (\k -> - case - (lookup' k nt) - [ (\r -> - force - mkCons - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - `$dToData` - `$dToData` - (constr 1 - [ (unIData - v) - , (unIData - r) ]))) - (s s tl)) - , (force - mkCons - (mkPairData - k - (`$fToDataThese_$ctoBuiltinData` - `$dToData` - `$dToData` - (constr 0 - [ (unIData - v) ]))) - (s s tl)) ]) - (force (force fstPair) - hd)) - (force (force sndPair) - hd)))))) + (force + (force + sndPair) + tup)) + (force + (force + fstPair) + tup)) + (unConstrData + (force + (force + sndPair) + hd))) ]) + , (s s tl) ]) ]) + nt)) + (safeAppend (goLeft nt) (goRight nt))) + ((\s -> + s s) + (\s + xs -> + case + xs + [ [] + , (\hd + tl -> + (\v -> + (\k -> + case + (lookup' k nt) + [ (\r -> + force + mkCons + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + `$dToData` + `$dToData` + (constr 1 + [ (unIData + v) + , (unIData + r) ]))) + (s s tl)) + , (force + mkCons + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + `$dToData` + `$dToData` + (constr 0 + [ (unIData + v) ]))) + (s s tl)) ]) + (force (force fstPair) + hd)) + (force (force sndPair) + hd)) ]))) (unsafeFromSOPList (\i -> iData i) (\i -> iData i) @@ -216,102 +180,136 @@ , 5 ]) , (constr 0 [ ]) ]) ]) ]) ]) ]))) - (unsafeFromSOPList - (\i -> iData i) - (\i -> iData i) - (constr 1 - [ (constr 0 [(addInteger 3 n), 30]) - , (constr 1 - [ (constr 0 [(addInteger 4 n), 40]) - , (constr 1 - [ (constr 0 - [(addInteger 6 n), 60]) - , (constr 1 - [ (constr 0 - [(addInteger 7 n), 70]) - , (constr 0 []) ]) ]) ]) ]))) - (\`$dToData` `$dToData` -> - (\go eta -> goList (go eta)) - ((\s -> s s) - (\s ds -> - case - ds - [ (constr 0 []) - , (\x xs -> - constr 1 - [ (case - x - [ (\k a -> - constr 0 - [ (`$dToData` k) - , (`$dToData` - a) ]) ]) - , (s s xs) ]) ])))) - ((\s -> s s) - (\s ds -> - case - ds - [ [] - , (\d ds -> - force mkCons - (case d [(\d d -> mkPairData d d)]) - (s s ds)) ]))) - (\i -> iData i)) + ((\s -> + s s) + (\s + xs -> + case + xs + [ [] + , (\hd + tl -> + (\v -> + (\k -> + case + (lookup' k nt) + [ (\r -> + force + mkCons + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + `$dToData` + `$dToData` + (constr 1 + [ (unIData v) + , (unIData + r) ]))) + (s s tl)) + , (force + mkCons + (mkPairData + k + (`$fToDataThese_$ctoBuiltinData` + `$dToData` + `$dToData` + (constr 2 + [ (unIData + v) ]))) + (s s tl)) ]) + (force (force fstPair) hd)) + (force (force sndPair) hd)) ]))) + (unsafeFromSOPList + (\i -> iData i) + (\i -> iData i) + (constr 1 + [ (constr 0 [(addInteger 3 n), 30]) + , (constr 1 + [ (constr 0 [(addInteger 4 n), 40]) + , (constr 1 + [ (constr 0 [(addInteger 6 n), 60]) + , (constr 1 + [ (constr 0 + [(addInteger 7 n), 70]) + , (constr 0 []) ]) ]) ]) ]))) + (\`$dToData` `$dToData` -> + (\go eta -> goList (go eta)) + ((\s -> s s) + (\s ds -> + case + ds + [ (constr 0 []) + , (\x xs -> + constr 1 + [ (case + x + [ (\k a -> + constr 0 + [ (`$dToData` k) + , (`$dToData` a) ]) ]) + , (s s xs) ]) ])))) + ((\s -> s s) + (\s ds -> + case + ds + [ [] + , (\d ds -> + force mkCons + (case d [(\d d -> mkPairData d d)]) + (s s ds)) ]))) (\i -> iData i)) - (\`$dToData` `$dToData` ds -> - case - ds - [ (\arg -> constrData 1 (force mkCons (`$dToData` arg) [])) - , (\arg arg -> - constrData - 2 - (force mkCons - (`$dToData` arg) - (force mkCons (`$dToData` arg) []))) - , (\arg -> - constrData 0 (force mkCons (`$dToData` arg) [])) ])) - (\k m -> - (\s -> s s) - (\s -> - caseList' - (constr 1 []) - (\hd -> - case - (equalsData k (force (force fstPair) hd)) - [ (\x -> s s x) - , (\ds -> constr 0 [(force (force sndPair) hd)]) ])) - m)) - ((\s -> s s) - (\s xs xs -> - caseList' - xs - (\hd tl -> - (\v -> - (\k -> - (\eta -> - (\nilCase -> - (\s -> s s) - (\s -> - caseList' - nilCase - (\hd -> - case - (equalsData - k - (force (force fstPair) hd)) - [ (\eta -> - force mkCons hd (s s eta)) - , (force mkCons - (mkPairData k v)) ])) - eta) - (force mkCons (mkPairData k v) [])) - (s s tl xs)) - (force (force fstPair) hd)) - (force (force sndPair) hd)) - xs))) - (\z f xs -> - force - (force (force chooseList) + (\i -> iData i)) + (\`$dToData` `$dToData` ds -> + case + ds + [ (\arg -> constrData 1 (force mkCons (`$dToData` arg) [])) + , (\arg arg -> + constrData + 2 + (force mkCons + (`$dToData` arg) + (force mkCons (`$dToData` arg) []))) + , (\arg -> constrData 0 (force mkCons (`$dToData` arg) [])) ])) + (\k -> + (\go m -> go m) + ((\s -> s s) + (\s xs -> + case + xs + [ (constr 1 []) + , (\hd -> + case + (equalsData k (force (force fstPair) hd)) + [ (\x -> s s x) + , (\ds -> + constr 0 + [(force (force sndPair) hd)]) ]) ])))) + ((\s -> s s) + (\s xs xs -> + case xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))))) \ No newline at end of file + [ xs + , (\hd tl -> + (\v -> + (\k -> + (\eta -> + (\nilCase -> + (\s -> s s) + (\s xs -> + case + xs + [ nilCase + , (\hd -> + case + (equalsData + k + (force (force fstPair) hd)) + [ (\eta -> + force mkCons hd (s s eta)) + , (force mkCons + (mkPairData k v)) ]) ]) + eta) + (force mkCons (mkPairData k v) [])) + (s s tl xs)) + (force (force fstPair) hd)) + (force (force sndPair) hd)) ])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).eval.golden index 154d80c4dfe..13c6de99993 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).eval.golden @@ -1,6 +1,6 @@ -CPU: 10_746_784 -Memory: 44_612 -Term Size: 83 -Flat Size: 87 +CPU: 5_107_720 +Memory: 27_820 +Term Size: 68 +Flat Size: 76 (con (list integer) [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).pir.golden index 2bf0de201cc..62bc71f59e9 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).pir.golden @@ -1,14 +1,6 @@ let !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~foldr : all a b. (a -> b -> b) -> b -> list a -> b = /\a b -> \(f : a -> b -> b) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).uplc.golden index b92b22a7ff2..41ce8e7073f 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).uplc.golden @@ -8,15 +8,10 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay xs) - (delay - ((\xs -> - force mkCons - (force headList xs) - (force (go (delay (\x -> x))) xs)) - (force tailList xs)))))) + case + xs + [ xs + , (\x xs -> + force mkCons x (force (go (delay (\x -> x))) xs)) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.eval.golden index 4c7a7e7a40c..81479baf55e 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.eval.golden @@ -1,6 +1,6 @@ -CPU: 12_707_161 -Memory: 56_199 -Term Size: 111 -Flat Size: 120 +CPU: 6_530_290 +Memory: 37_811 +Term Size: 96 +Flat Size: 109 (constr 0 (constr 1) (constr 0)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.pir.golden index f521b0298c9..324852d95f2 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.pir.golden @@ -4,15 +4,7 @@ let data (Tuple2 :: * -> * -> *) a b | Tuple2_match where Tuple2 : a -> b -> Tuple2 a b !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Bool | Bool_match where True : Bool False : Bool diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.uplc.golden index 827d224c284..7816b010b91 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/all.uplc.golden @@ -19,15 +19,12 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 0 [])) - (delay - ((\xs -> - case - (p (force headList xs)) - [ (force (go (delay (\x -> x))) xs) - , (constr 1 []) ]) - (force tailList xs)))))) + case + xs + [ (constr 0 []) + , (\x xs -> + case + (p x) + [ (force (go (delay (\x -> x))) xs) + , (constr 1 []) ]) ])) (delay (\x -> x)))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.eval.golden index 6d91e9b84ea..f6c89f16bba 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.eval.golden @@ -1,6 +1,6 @@ -CPU: 1_827_714 -Memory: 7_992 -Term Size: 81 -Flat Size: 76 +CPU: 752_100 +Memory: 4_800 +Term Size: 66 +Flat Size: 66 (constr 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.pir.golden index 01d1fdf03c3..04f5cad8610 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.pir.golden @@ -3,15 +3,7 @@ let True : Bool False : Bool !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~all : all a. (a -> Bool) -> list a -> Bool = /\a -> \(p : a -> Bool) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.uplc.golden index d41edc2c63d..73fe4277e80 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.uplc.golden @@ -8,16 +8,13 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 0 [])) - (delay - ((\xs -> - case - (force headList xs) - [ (constr 1 []) - , (force (go (delay (\x -> x))) xs) ]) - (force tailList xs)))))) + case + xs + [ (constr 0 []) + , (\x xs -> + case + x + [ (constr 1 []) + , (force (go (delay (\x -> x))) xs) ]) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.eval.golden index 7b455dec254..d2d6ae0f80d 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.eval.golden @@ -1,6 +1,6 @@ -CPU: 20_228_840 -Memory: 88_878 -Term Size: 111 -Flat Size: 120 +CPU: 10_287_320 +Memory: 59_318 +Term Size: 96 +Flat Size: 109 (constr 0 (constr 0) (constr 1)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.pir.golden index 24bba36ac36..3e9d6f02b6a 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.pir.golden @@ -4,15 +4,7 @@ let data (Tuple2 :: * -> * -> *) a b | Tuple2_match where Tuple2 : a -> b -> Tuple2 a b !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Bool | Bool_match where True : Bool False : Bool diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.uplc.golden index edaab40bb71..0eae0a19899 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/any.uplc.golden @@ -19,15 +19,12 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\xs -> - case - (p (force headList xs)) - [ (constr 0 []) - , (force (go (delay (\x -> x))) xs) ]) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (p x) + [ (constr 0 []) + , (force (go (delay (\x -> x))) xs) ]) ])) (delay (\x -> x)))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.eval.golden index 154d80c4dfe..13c6de99993 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.eval.golden @@ -1,6 +1,6 @@ -CPU: 10_746_784 -Memory: 44_612 -Term Size: 83 -Flat Size: 87 +CPU: 5_107_720 +Memory: 27_820 +Term Size: 68 +Flat Size: 76 (con (list integer) [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.pir.golden index 9ed3d5871b0..7832c23319a 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.pir.golden @@ -1,14 +1,6 @@ let !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~foldr : all a b. (a -> b -> b) -> b -> list a -> b = /\a b -> \(f : a -> b -> b) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.uplc.golden index b92b22a7ff2..41ce8e7073f 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.uplc.golden @@ -8,15 +8,10 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay xs) - (delay - ((\xs -> - force mkCons - (force headList xs) - (force (go (delay (\x -> x))) xs)) - (force tailList xs)))))) + case + xs + [ xs + , (\x xs -> + force mkCons x (force (go (delay (\x -> x))) xs)) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.eval.golden index 25470674020..dc7625271e7 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.eval.golden @@ -1,6 +1,6 @@ -CPU: 8_715_372 -Memory: 39_900 -Term Size: 157 -Flat Size: 145 +CPU: 4_417_548 +Memory: 26_028 +Term Size: 139 +Flat Size: 132 (con (list integer) [1,2,3,4]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.pir.golden index 0ec97c0815b..27ae2f70580 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.pir.golden @@ -1,15 +1,7 @@ let ~`$fMkNilInteger` : (\arep -> list arep) integer = [] !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~foldr : all a b. (a -> b -> b) -> b -> list a -> b = /\a b -> \(f : a -> b -> b) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.uplc.golden index d9bd353f343..46d02ac6a34 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.uplc.golden @@ -34,12 +34,6 @@ (delay (\x -> x)))) (force (go (delay (\x -> x))) xs) x)) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay - (f (force headList xs) (force tailList xs))))))) + (\z f xs -> case xs [z, f]))) (delay (\x -> x))) xss)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.eval.golden index 91bbf76fd37..3622a3d4fd3 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.eval.golden @@ -1,6 +1,6 @@ -CPU: 59_046_994 -Memory: 269_782 -Term Size: 230 -Flat Size: 217 +CPU: 38_601_850 +Memory: 203_750 +Term Size: 212 +Flat Size: 204 (con (list integer) [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.pir.golden index be1aa8af04a..066d495d391 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.pir.golden @@ -1,15 +1,7 @@ let ~`$fMkNilInteger` : (\arep -> list arep) integer = [] !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~foldr : all a b. (a -> b -> b) -> b -> list a -> b = /\a b -> \(f : a -> b -> b) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.uplc.golden index d9f26f7e375..6e5d86598f5 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.uplc.golden @@ -57,12 +57,6 @@ (delay (\x -> x))) 2)) (force (go (delay (\x -> x))) xs))) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay - (f (force headList xs) (force tailList xs))))))) + (\z f xs -> case xs [z, f]))) (delay (\x -> x))) xss)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.eval.golden index c137ecc5fae..90404551cc8 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.eval.golden @@ -1,6 +1,6 @@ -CPU: 7_282_197 -Memory: 31_996 -Term Size: 108 -Flat Size: 113 +CPU: 4_353_162 +Memory: 22_516 +Term Size: 90 +Flat Size: 100 (con (list integer) [6,7,8,9,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.pir.golden index 071f3841990..ebdfebcaeeb 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.pir.golden @@ -4,15 +4,7 @@ let True : Bool False : Bool !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !ifThenElse : all a. bool -> a -> a -> a = /\a -> \(b : bool) (x : a) (y : a) -> case a b [y, x] !lessThanEqualsInteger : integer -> integer -> bool = lessThanEqualsInteger diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.uplc.golden index c01c64a4440..c2156447e9f 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/drop.uplc.golden @@ -10,17 +10,13 @@ (\`$dMkNil` n l -> case (lessThanEqualsInteger n 0) - [ (force - (force (force chooseList) - l - (delay `$dMkNil`) - (delay - ((\ds xs -> - force (force (drop (delay (\x -> x)))) - `$dMkNil` - (subtractInteger n 1) - xs) - (force headList l) - (force tailList l))))) + [ (case + l + [ `$dMkNil` + , (\ds xs -> + force (force (drop (delay (\x -> x)))) + `$dMkNil` + (subtractInteger n 1) + xs) ]) , l ]))) (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.eval.golden index b60b03818aa..937fc0103dc 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.eval.golden @@ -1,6 +1,6 @@ -CPU: 4_995_585 -Memory: 21_085 -Term Size: 85 -Flat Size: 91 +CPU: 2_306_550 +Memory: 13_105 +Term Size: 70 +Flat Size: 80 (con (list integer) [5,6,7,8,9,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.pir.golden index a9aecba2aa6..1fce75c4aee 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.pir.golden @@ -1,15 +1,7 @@ let ~v : integer = 5 !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Bool | Bool_match where True : Bool False : Bool diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.uplc.golden index 174cf4dec38..a83a7cd9116 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/dropWhile.uplc.golden @@ -8,15 +8,12 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay xs) - (delay - ((\xs' -> - case - (lessThanInteger (force headList xs) 5) - [xs, (force (go (delay (\x -> x))) xs')]) - (force tailList xs)))))) + case + xs + [ xs + , (\x xs' -> + case + (lessThanInteger x 5) + [xs, (force (go (delay (\x -> x))) xs')]) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.eval.golden index 7b53142cfdd..aed75eb0617 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.eval.golden @@ -1,6 +1,6 @@ -CPU: 18_915_614 -Memory: 79_878 -Term Size: 97 -Flat Size: 104 +CPU: 8_974_094 +Memory: 50_318 +Term Size: 82 +Flat Size: 94 (constr 0 (constr 0) (constr 1)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.pir.golden index b7b6d2ed0bb..fba5de73ae0 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.pir.golden @@ -20,15 +20,7 @@ let data (Tuple2 :: * -> * -> *) a b | Tuple2_match where Tuple2 : a -> b -> Tuple2 a b !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~elem : all a. (\a -> a -> a -> Bool) a -> a -> list a -> Bool = /\a -> \(`$dEq` : (\a -> a -> a -> Bool) a) (a : a) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.uplc.golden index 60d342f5f20..0218b93f26c 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elem.uplc.golden @@ -10,15 +10,12 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\xs -> - case - (equalsInteger a (force headList xs)) - [ (force (go (delay (\x -> x))) xs) - , (constr 0 []) ]) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (equalsInteger a x) + [ (force (go (delay (\x -> x))) xs) + , (constr 0 []) ]) ])) (delay (\x -> x)))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.eval.golden index d9d7efd05b3..f8f5fdd9efa 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.eval.golden @@ -1,6 +1,6 @@ -CPU: 10_621_534 -Memory: 45_302 -Term Size: 85 -Flat Size: 91 +CPU: 4_982_470 +Memory: 28_510 +Term Size: 70 +Flat Size: 81 (constr 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.pir.golden index 52cbc9d2aa0..089752f0e26 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.pir.golden @@ -1,14 +1,6 @@ let !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Bool | Bool_match where True : Bool False : Bool diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.uplc.golden index 6289139f013..810d813c777 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/elemBy.uplc.golden @@ -8,16 +8,13 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\xs -> - case - (lessThanEqualsInteger (force headList xs) 0) - [ (force (go (delay (\x -> x))) xs) - , (constr 0 []) ]) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (lessThanEqualsInteger x 0) + [ (force (go (delay (\x -> x))) xs) + , (constr 0 []) ]) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.eval.golden index 149399bf0b1..2cb73ff475e 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.eval.golden @@ -1,6 +1,6 @@ -CPU: 14_387_604 -Memory: 57_972 -Term Size: 100 -Flat Size: 106 +CPU: 8_268_540 +Memory: 38_180 +Term Size: 82 +Flat Size: 93 (con (list integer) [2,4,6,8,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.pir.golden index 5ca955ce877..6ca754bcfbb 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.pir.golden @@ -16,15 +16,7 @@ let in ifThenElse {Bool} b True False !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !mkCons : all a. a -> list a -> list a = mkCons ~filter : all a. (\arep -> list arep) a -> (a -> Bool) -> list a -> list a = /\a -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.uplc.golden index ed70716f8cc..89d99d5ae20 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/filter.uplc.golden @@ -8,18 +8,14 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay []) - (delay - ((\x xs -> - (\xs -> - case - (equalsInteger (modInteger x 2) 0) - [xs, (force mkCons x xs)]) - (force (go (delay (\x -> x))) xs)) - (force headList xs) - (force tailList xs)))))) + case + xs + [ [] + , (\x xs -> + (\xs -> + case + (equalsInteger (modInteger x 2) 0) + [xs, (force mkCons x xs)]) + (force (go (delay (\x -> x))) xs)) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.eval.golden index 1fa88f673a1..3d418742cf1 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.eval.golden @@ -1,6 +1,6 @@ -CPU: 21_108_840 -Memory: 94_378 -Term Size: 115 -Flat Size: 124 +CPU: 10_303_320 +Memory: 59_418 +Term Size: 97 +Flat Size: 110 (constr 0 (constr 0 (con integer 8)) (constr 1)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.pir.golden index e2eff29b469..bd655a67808 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.pir.golden @@ -7,15 +7,7 @@ let Just : a -> Maybe a Nothing : Maybe a !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Bool | Bool_match where True : Bool False : Bool diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.uplc.golden index 51a588ad571..655bf6c7649 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/find.uplc.golden @@ -19,16 +19,12 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\x xs -> - case - (p x) - [ (constr 0 [x]) - , (force (go (delay (\x -> x))) xs) ]) - (force headList xs) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (p x) + [ (constr 0 [x]) + , (force (go (delay (\x -> x))) xs) ]) ])) (delay (\x -> x)))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.eval.golden index 821ad624409..88d0203a7e4 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.eval.golden @@ -1,6 +1,6 @@ -CPU: 4_712_284 -Memory: 19_294 -Term Size: 95 -Flat Size: 103 +CPU: 2_561_056 +Memory: 12_910 +Term Size: 80 +Flat Size: 92 (constr 0 (con integer 3)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.pir.golden index b02c603f6b3..de0e88e28ec 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.pir.golden @@ -26,15 +26,7 @@ let Nothing : Maybe a !addInteger : integer -> integer -> integer = addInteger !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~findIndex : all a. (a -> Bool) -> list a -> Maybe integer = /\a -> \(f : a -> Bool) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.uplc.golden index 17ef9504f79..07b96a9cc4a 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexJust.uplc.golden @@ -8,19 +8,14 @@ (\go arg -> delay (\i xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\xs -> - case - (equalsInteger (force headList xs) 4) - [ (force (go (delay (\x -> x))) - (addInteger i 1) - xs) - , (constr 0 [i]) ]) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (equalsInteger x 4) + [ (force (go (delay (\x -> x))) (addInteger i 1) xs) + , (constr 0 [i]) ]) ])) (delay (\x -> x))) 0 xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.eval.golden index a8457c78f24..a619e51c82f 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.eval.golden @@ -1,6 +1,6 @@ -CPU: 12_886_574 -Memory: 52_622 -Term Size: 95 -Flat Size: 104 +CPU: 7_247_510 +Memory: 35_830 +Term Size: 80 +Flat Size: 93 (constr 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.pir.golden index 161fe796891..63ce1c9c48d 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.pir.golden @@ -26,15 +26,7 @@ let Nothing : Maybe a !addInteger : integer -> integer -> integer = addInteger !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~findIndex : all a. (a -> Bool) -> list a -> Maybe integer = /\a -> \(f : a -> Bool) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.uplc.golden index 8cb46cfbfc7..2a9a7349a4c 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndexNothing.uplc.golden @@ -8,19 +8,14 @@ (\go arg -> delay (\i xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\xs -> - case - (equalsInteger (force headList xs) 99) - [ (force (go (delay (\x -> x))) - (addInteger i 1) - xs) - , (constr 0 [i]) ]) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (equalsInteger x 99) + [ (force (go (delay (\x -> x))) (addInteger i 1) xs) + , (constr 0 [i]) ]) ])) (delay (\x -> x))) 0 xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.eval.golden index 5acd06d30f9..8e434983d75 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.eval.golden @@ -1,6 +1,6 @@ -CPU: 16_567_684 -Memory: 65_292 -Term Size: 109 -Flat Size: 116 +CPU: 10_448_620 +Memory: 45_500 +Term Size: 91 +Flat Size: 103 (con (list integer) [0,2,4,6,8]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.pir.golden index 06285de3cb9..928b8db5c7c 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.pir.golden @@ -1,15 +1,7 @@ let !addInteger : integer -> integer -> integer = addInteger !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !mkCons : all a. a -> list a -> list a = mkCons data Bool | Bool_match where True : Bool diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.uplc.golden index 9db6cebff01..477ba8fb9dc 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/findIndices.uplc.golden @@ -8,21 +8,17 @@ (\go arg -> delay (\i xs -> - force - (force (force chooseList) - xs - (delay []) - (delay - ((\x xs -> - (\indices -> - case - (equalsInteger (modInteger x 2) 0) - [(force mkCons i indices), indices]) - (force (go (delay (\x -> x))) - (addInteger i 1) - xs)) - (force headList xs) - (force tailList xs)))))) + case + xs + [ [] + , (\x xs -> + (\indices -> + case + (equalsInteger (modInteger x 2) 0) + [(force mkCons i indices), indices]) + (force (go (delay (\x -> x))) + (addInteger i 1) + xs)) ])) (delay (\x -> x))) 0 xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.eval.golden index d19bc410639..f8b274191a6 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.eval.golden @@ -1,6 +1,6 @@ -CPU: 11_780_694 -Memory: 49_612 -Term Size: 90 -Flat Size: 94 +CPU: 5_661_630 +Memory: 29_820 +Term Size: 72 +Flat Size: 81 (con integer 3628800) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.pir.golden index 9bb2b95c24c..bbe8217a4ca 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.pir.golden @@ -11,15 +11,7 @@ let ~`*` : all a. (\a -> a -> a -> a) a -> a -> a -> a = /\a -> \(v : (\a -> a -> a -> a) a) -> v !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~foldl : all a b. (b -> a -> b) -> b -> list a -> b = /\a b -> \(f : b -> a -> b) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.uplc.golden index 9eb114cf73e..b0722b757b3 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldl.uplc.golden @@ -8,17 +8,13 @@ (\go arg -> delay (\acc xs -> - force - (force (force chooseList) - xs - (delay acc) - (delay - ((\x xs -> - force (go (delay (\x -> x))) - (multiplyInteger acc x) - xs) - (force headList xs) - (force tailList xs)))))) + case + xs + [ acc + , (\x xs -> + force (go (delay (\x -> x))) + (multiplyInteger acc x) + xs) ])) (delay (\x -> x))) 1 xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.eval.golden index ff94c302d7f..87c6c82fffe 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.eval.golden @@ -1,6 +1,6 @@ -CPU: 10_875_244 -Memory: 43_312 -Term Size: 82 -Flat Size: 87 +CPU: 5_236_180 +Memory: 26_520 +Term Size: 67 +Flat Size: 76 (con integer 55) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.pir.golden index 06f2e9a3583..f1d5da1a126 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.pir.golden @@ -10,15 +10,7 @@ let ~`+` : all a. (\a -> a -> a -> a) a -> a -> a -> a = /\a -> \(v : (\a -> a -> a -> a) a) -> v !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~foldr : all a b. (a -> b -> b) -> b -> list a -> b = /\a b -> \(f : a -> b -> b) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.uplc.golden index 940a1646b23..c57cab4af48 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/foldr.uplc.golden @@ -8,15 +8,10 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay 0) - (delay - ((\xs -> - addInteger - (force headList xs) - (force (go (delay (\x -> x))) xs)) - (force tailList xs)))))) + case + xs + [ 0 + , (\x xs -> + addInteger x (force (go (delay (\x -> x))) xs)) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.pir.golden index 5d499b837f1..93095f2d465 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.pir.golden @@ -4,15 +4,7 @@ let = /\arep -> \(v : (\arep -> list arep) arep) -> v ~empty : all a. (\arep -> list arep) a -> list a = mkNil !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Unit | Unit_match where Unit : Unit ~caseList : all a r. (Unit -> r) -> (a -> list a -> r) -> list a -> r diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.uplc.golden index 793b96b43d4..8c923e35ad8 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headEmpty.uplc.golden @@ -1,9 +1 @@ -(program - 1.1.0 - (\ds -> - force - (force (force chooseList) - [] - (delay (\ds -> (\x -> error) (force trace "PT23" (constr 0 [])))) - (delay ((\x xs ds -> x) (force headList []) (force tailList [])))) - (constr 0 []))) \ No newline at end of file +(program 1.1.0 (\ds -> (\x -> error) (force trace "PT23" (constr 0 [])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.eval.golden index a7278bff038..30f039ee243 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.eval.golden @@ -1,6 +1,6 @@ -CPU: 761_907 -Memory: 3_096 -Term Size: 39 -Flat Size: 56 +CPU: 176_100 +Memory: 1_200 +Term Size: 21 +Flat Size: 42 (con integer 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.pir.golden index bd57f7148f7..bdc391f0c4c 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.pir.golden @@ -1,14 +1,6 @@ let !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Unit | Unit_match where Unit : Unit ~caseList : all a r. (Unit -> r) -> (a -> list a -> r) -> list a -> r diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.uplc.golden index 8a8d6b52439..c20d1f5459b 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/headOk.uplc.golden @@ -1,9 +1,8 @@ (program 1.1.0 (\xs -> - force - (force (force chooseList) - xs - (delay (\ds -> (\x -> error) (force trace "PT23" (constr 0 [])))) - (delay ((\x xs ds -> x) (force headList xs) (force tailList xs)))) + case + xs + [ (\ds -> (\x -> error) (force trace "PT23" (constr 0 []))) + , (\x xs ds -> x) ] (constr 0 []))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.eval.golden index f95a465f2d0..a1d6ba0da9e 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.eval.golden @@ -1,6 +1,6 @@ -CPU: 1_285_693 -Memory: 5_301 -Term Size: 68 -Flat Size: 90 +CPU: 651_886 +Memory: 3_105 +Term Size: 47 +Flat Size: 74 (con integer 6) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.pir.golden index 3ecda27747a..564b663a74a 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.pir.golden @@ -5,15 +5,7 @@ let ~builtinListIndexTooLargeError : string = "PT22" ~builtinListNegativeIndexError : string = "PT21" !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !drop : all a. integer -> list a -> list a = dropList !ifThenElse : all a. bool -> a -> a -> a = /\a -> \(b : bool) (x : a) (y : a) -> case a b [y, x] diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.uplc.golden index 7e049b62635..8a82b8396c7 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/index.uplc.golden @@ -6,17 +6,10 @@ case (lessThanInteger 5 0) [ (delay - ((\l -> - force - (force (force chooseList) - l - (delay (\_ann -> traceError "PT22")) - (delay - ((\x xs ds _ann -> x) - (force headList l) - (force tailList l)))) - (constr 0 []) - (constr 0 [])) - (force dropList 5 xs))) + (case + (force dropList 5 xs) + [(\_ann -> traceError "PT22"), (\x xs ds _ann -> x)] + (constr 0 []) + (constr 0 []))) , (delay (traceError "PT21")) ]) (\str -> (\x -> error) (force trace str (constr 0 [])))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.pir.golden index 073a77d943f..ea251ccfcbb 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.pir.golden @@ -5,15 +5,7 @@ let ~builtinListIndexTooLargeError : string = "PT22" ~builtinListNegativeIndexError : string = "PT21" !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !drop : all a. integer -> list a -> list a = dropList !ifThenElse : all a. bool -> a -> a -> a = /\a -> \(b : bool) (x : a) (y : a) -> case a b [y, x] diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.uplc.golden index 4a1f552146b..0fc37baa7cc 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexNegative.uplc.golden @@ -7,18 +7,11 @@ case (lessThanInteger i 0) [ (delay - ((\l -> - force - (force (force chooseList) - l - (delay (\_ann -> traceError "PT22")) - (delay - ((\x xs ds _ann -> x) - (force headList l) - (force tailList l)))) - (constr 0 []) - (constr 0 [])) - (force dropList i xs))) + (case + (force dropList i xs) + [(\_ann -> traceError "PT22"), (\x xs ds _ann -> x)] + (constr 0 []) + (constr 0 []))) , (delay (traceError "PT21")) ]) (\str -> (\x -> error) (force trace str (constr 0 []))))) (subtractInteger 0 1))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.pir.golden index 224917c5f22..4f0014a426b 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.pir.golden @@ -5,15 +5,7 @@ let ~builtinListIndexTooLargeError : string = "PT22" ~builtinListNegativeIndexError : string = "PT21" !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !drop : all a. integer -> list a -> list a = dropList !ifThenElse : all a. bool -> a -> a -> a = /\a -> \(b : bool) (x : a) (y : a) -> case a b [y, x] diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.uplc.golden index 71644652148..0138db17d33 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/indexTooLarge.uplc.golden @@ -6,17 +6,10 @@ case (lessThanInteger 10 0) [ (delay - ((\l -> - force - (force (force chooseList) - l - (delay (\_ann -> traceError "PT22")) - (delay - ((\x xs ds _ann -> x) - (force headList l) - (force tailList l)))) - (constr 0 []) - (constr 0 [])) - (force dropList 10 xs))) + (case + (force dropList 10 xs) + [(\_ann -> traceError "PT22"), (\x xs ds _ann -> x)] + (constr 0 []) + (constr 0 []))) , (delay (traceError "PT21")) ]) (\str -> (\x -> error) (force trace str (constr 0 [])))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.pir.golden index bfd724a9d8f..bbf00fcca61 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.pir.golden @@ -4,15 +4,7 @@ let = /\arep -> \(v : (\arep -> list arep) arep) -> v ~empty : all a. (\arep -> list arep) a -> list a = mkNil !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Unit | Unit_match where Unit : Unit ~caseList : all a r. (Unit -> r) -> (a -> list a -> r) -> list a -> r diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.uplc.golden index 8132ce9d202..6739121d588 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastEmpty.uplc.golden @@ -1,29 +1,23 @@ (program 1.1.0 - ((\caseList' -> - (\last ds -> force (force last) []) - ((\f -> - (\s -> f (\x -> f (\x -> f (\x -> f (\x -> s s x) x) x) x)) - (\s -> f (\x -> s s x))) - (\last arg -> - delay - (delay - (\l -> - caseList' - (\ds -> - (\x -> error) (force trace "PT25" (constr 0 []))) - (\x xs ds -> - caseList' - x - (\ds ds -> - force (force (last (delay (\x -> x)))) xs) - xs) - l - (constr 0 [])))) - (delay (\x -> x)))) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))))) \ No newline at end of file + ((\last ds -> force (force last) []) + ((\f -> + (\s -> f (\x -> f (\x -> f (\x -> f (\x -> s s x) x) x) x)) + (\s -> f (\x -> s s x))) + (\last arg -> + delay + (delay + (\l -> + case + l + [ (\ds -> + (\x -> error) (force trace "PT25" (constr 0 []))) + , (\x xs ds -> + case + xs + [ x + , (\ds ds -> + force (force (last (delay (\x -> x)))) + xs) ]) ] + (constr 0 [])))) + (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.eval.golden index 965d0261e7f..d423e34c5b8 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.eval.golden @@ -1,6 +1,6 @@ -CPU: 19_055_427 -Memory: 84_856 -Term Size: 119 -Flat Size: 122 +CPU: 4_736_100 +Memory: 29_700 +Term Size: 86 +Flat Size: 96 (con integer 10) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.pir.golden index 23be0f4d65d..c87011fdbfc 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.pir.golden @@ -1,14 +1,6 @@ let !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Unit | Unit_match where Unit : Unit ~caseList : all a r. (Unit -> r) -> (a -> list a -> r) -> list a -> r diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.uplc.golden index ea05f13d767..e21f536f157 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/lastOk.uplc.golden @@ -1,29 +1,23 @@ (program 1.1.0 - ((\caseList' -> - (\last xs -> force (force last) xs) - ((\f -> - (\s -> f (\x -> f (\x -> f (\x -> f (\x -> s s x) x) x) x)) - (\s -> f (\x -> s s x))) - (\last arg -> - delay - (delay - (\l -> - caseList' - (\ds -> - (\x -> error) (force trace "PT25" (constr 0 []))) - (\x xs ds -> - caseList' - x - (\ds ds -> - force (force (last (delay (\x -> x)))) xs) - xs) - l - (constr 0 [])))) - (delay (\x -> x)))) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))))) \ No newline at end of file + ((\last xs -> force (force last) xs) + ((\f -> + (\s -> f (\x -> f (\x -> f (\x -> f (\x -> s s x) x) x) x)) + (\s -> f (\x -> s s x))) + (\last arg -> + delay + (delay + (\l -> + case + l + [ (\ds -> + (\x -> error) (force trace "PT25" (constr 0 []))) + , (\x xs ds -> + case + xs + [ x + , (\ds ds -> + force (force (last (delay (\x -> x)))) + xs) ]) ] + (constr 0 [])))) + (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.eval.golden index 119de3ab223..a5cf1e4f7b0 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.eval.golden @@ -1,6 +1,6 @@ -CPU: 11_355_244 -Memory: 46_312 -Term Size: 85 -Flat Size: 90 +CPU: 5_236_180 +Memory: 26_520 +Term Size: 67 +Flat Size: 77 (con integer 10) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.pir.golden index e47a5bc4e06..d3600855bf5 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.pir.golden @@ -1,15 +1,7 @@ let !addInteger : integer -> integer -> integer = addInteger !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~length : all a. list a -> integer = /\a -> letrec diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.uplc.golden index 188963e1150..fb07bbb42c7 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/length.uplc.golden @@ -8,14 +8,10 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay 0) - (delay - ((\x xs -> - addInteger 1 (force (go (delay (\x -> x))) xs)) - (force headList xs) - (force tailList xs)))))) + case + xs + [ 0 + , (\x xs -> + addInteger 1 (force (go (delay (\x -> x))) xs)) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.eval.golden index 05540f9a034..c6a0c6a5479 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.eval.golden @@ -1,6 +1,6 @@ -CPU: 681_907 -Memory: 2_596 -Term Size: 25 -Flat Size: 39 +CPU: 144_100 +Memory: 1_000 +Term Size: 10 +Flat Size: 29 (constr 0 (con integer 1)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.pir.golden index 24023910697..7cc99d8506b 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.pir.golden @@ -3,15 +3,7 @@ let Just : a -> Maybe a Nothing : Maybe a !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~listToMaybe : all a. list a -> Maybe a = /\a -> caseList' diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.uplc.golden index 6e71d21bd03..6c87b6d77f8 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeJust.uplc.golden @@ -1,9 +1 @@ -(program - 1.1.0 - (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\ds -> constr 0 [(force headList xs)]) (force tailList xs)))))) \ No newline at end of file +(program 1.1.0 (\xs -> case xs [(constr 1 []), (\x ds -> constr 0 [x])])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.eval.golden index 3de6649b08b..c31bea48f64 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.eval.golden @@ -1,6 +1,6 @@ -CPU: 357_094 -Memory: 1_532 -Term Size: 25 -Flat Size: 43 +CPU: 64_100 +Memory: 500 +Term Size: 4 +Flat Size: 21 (constr 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.pir.golden index 8afe104e508..bc8db182e80 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.pir.golden @@ -7,15 +7,7 @@ let Just : a -> Maybe a Nothing : Maybe a !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~listToMaybe : all a. list a -> Maybe a = /\a -> caseList' diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.uplc.golden index 65216008d85..017a52b9b45 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/listToMaybeNothing.uplc.golden @@ -1,9 +1 @@ -(program - 1.1.0 - (\ds -> - force - (force (force chooseList) - [] - (delay (constr 1 [])) - (delay - ((\ds -> constr 0 [(force headList [])]) (force tailList [])))))) \ No newline at end of file +(program 1.1.0 (\ds -> constr 1 [])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.eval.golden index 8bb11b5bb7b..7657dd71136 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.eval.golden @@ -1,6 +1,6 @@ -CPU: 12_350_864 -Memory: 48_332 -Term Size: 84 -Flat Size: 90 +CPU: 6_711_800 +Memory: 31_540 +Term Size: 69 +Flat Size: 79 (con (list integer) [2,3,4,5,6,7,8,9,10,11]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.pir.golden index b653ee1a90b..dabc6e958c4 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.pir.golden @@ -14,15 +14,7 @@ let = `+` {integer} `$fAdditiveSemigroupInteger` ~`$fMkNilInteger` : (\arep -> list arep) integer = [] !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !mkCons : all a. a -> list a -> list a = mkCons ~map : all a b. (\arep -> list arep) b -> (a -> b) -> list a -> list b = /\a b -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.uplc.golden index 324e6833e47..1c048c80164 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/map.uplc.golden @@ -7,14 +7,11 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay []) - (delay - ((\xs -> - force mkCons - (addInteger (force headList xs) 1) - (force (go (delay (\x -> x))) xs)) - (force tailList xs)))))) + case + xs + [ [] + , (\x xs -> + force mkCons + (addInteger x 1) + (force (go (delay (\x -> x))) xs)) ])) (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.eval.golden index a3ec23bded5..d90abee6c34 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.eval.golden @@ -1,6 +1,6 @@ -CPU: 14_387_604 -Memory: 57_972 -Term Size: 109 -Flat Size: 115 +CPU: 7_788_540 +Memory: 35_180 +Term Size: 86 +Flat Size: 96 (con (list integer) [1,3,5,7,9]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.pir.golden index d1c5f95014f..6fe6e7f96c5 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.pir.golden @@ -4,15 +4,7 @@ let Just : a -> Maybe a Nothing : Maybe a !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !mkCons : all a. a -> list a -> list a = mkCons ~mapMaybe : all a b. (\arep -> list arep) b -> (a -> Maybe b) -> list a -> list b diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.uplc.golden index 83769662cb0..90d42ab447a 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/mapMaybe.uplc.golden @@ -8,23 +8,13 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay []) - (delay - ((\xs -> - case - ((\x -> - case - (equalsInteger (modInteger x 2) 0) - [(constr 0 [x]), (constr 1 [])]) - (force headList xs)) - [ (\y -> - force mkCons - y - (force (go (delay (\x -> x))) xs)) - , (force (go (delay (\x -> x))) xs) ]) - (force tailList xs)))))) + case + xs + [ [] + , (\x xs -> + case + (equalsInteger (modInteger x 2) 0) + [ (force mkCons x (force (go (delay (\x -> x))) xs)) + , (force (go (delay (\x -> x))) xs) ]) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.eval.golden index ddb5b637478..add976e7416 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.eval.golden @@ -1,6 +1,6 @@ -CPU: 10_738_494 -Memory: 45_502 -Term Size: 88 -Flat Size: 95 +CPU: 5_099_430 +Memory: 28_710 +Term Size: 73 +Flat Size: 85 (constr 0) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.pir.golden index 3a6ecb2f5b3..5a9d5729433 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.pir.golden @@ -18,15 +18,7 @@ let ifThenElse {Bool} b True False ~`$fEqInteger` : (\a -> a -> a -> Bool) integer = equalsInteger !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~elem : all a. (\a -> a -> a -> Bool) a -> a -> list a -> Bool = /\a -> \(`$dEq` : (\a -> a -> a -> Bool) a) (a : a) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.uplc.golden index 10e658c81f0..8eeb5ad1cad 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/notElem.uplc.golden @@ -9,17 +9,14 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\xs -> - case - (equalsInteger 42 (force headList xs)) - [ (force (go (delay (\x -> x))) xs) - , (constr 0 []) ]) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + (equalsInteger 42 x) + [ (force (go (delay (\x -> x))) xs) + , (constr 0 []) ]) ])) (delay (\x -> x))) xs) [(constr 1 []), (constr 0 [])])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.eval.golden index d09ac4407b1..063bc8a3a4a 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.eval.golden @@ -1,6 +1,6 @@ -CPU: 159_875_098 -Memory: 715_024 -Term Size: 253 -Flat Size: 236 +CPU: 77_564_260 +Memory: 439_660 +Term Size: 232 +Flat Size: 221 (con (list integer) [1,2,3,4,5,6,7,8,9,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.pir.golden index 4f710970a4e..078d969a633 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.pir.golden @@ -19,15 +19,7 @@ let ~`$fEqInteger` : (\a -> a -> a -> Bool) integer = equalsInteger ~`$fMkNilInteger` : (\arep -> list arep) integer = [] !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~foldr : all a b. (a -> b -> b) -> b -> list a -> b = /\a b -> \(f : a -> b -> b) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.uplc.golden index 6c45460e86c..009aa1c3b8d 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nub.uplc.golden @@ -10,43 +10,44 @@ (\go arg -> delay (\l xs -> - caseList' - [] - (\y ys -> - case - (force - ((\f -> - (\s -> - f - (\x -> - f - (\x -> - f - (\x -> f (\x -> s s x) x) - x) - x)) - (\s -> f (\x -> s s x))) - (\go arg -> - delay - (caseList' - (constr 1 []) - (\x xs -> - case - (equalsInteger x y) - [ (force - (go (delay (\x -> x))) - xs) - , (constr 0 []) ]))) - (delay (\x -> x))) - xs) - [ (force (go (delay (\x -> x))) ys xs) - , ((\cse -> - cse - (force (go (delay (\x -> x))) - ys - (cse xs))) - (force mkCons y)) ]) - l)) + case + l + [ [] + , (\y ys -> + case + (force + ((\f -> + (\s -> + f + (\x -> + f + (\x -> + f + (\x -> + f (\x -> s s x) x) + x) + x)) + (\s -> f (\x -> s s x))) + (\go arg -> + delay + (caseList' + (constr 1 []) + (\x xs -> + case + (equalsInteger x y) + [ (force + (go (delay (\x -> x))) + xs) + , (constr 0 []) ]))) + (delay (\x -> x))) + xs) + [ (force (go (delay (\x -> x))) ys xs) + , ((\cse -> + cse + (force (go (delay (\x -> x))) + ys + (cse xs))) + (force mkCons y)) ]) ])) (delay (\x -> x))) eta []) @@ -62,9 +63,4 @@ force mkCons x (force (go (delay (\x -> x))) xs)))) (delay (\x -> x))) xs)) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))))) \ No newline at end of file + (\z f xs -> case xs [z, f]))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.eval.golden index 016c30ecd79..d45d346046d 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.eval.golden @@ -1,6 +1,6 @@ -CPU: 24_047_678 -Memory: 111_961 -Term Size: 186 -Flat Size: 180 +CPU: 9_323_357 +Memory: 55_073 +Term Size: 156 +Flat Size: 157 (con (list integer) [1]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.pir.golden index 4a3aac7e580..d072ee4d955 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.pir.golden @@ -18,15 +18,7 @@ let in ifThenElse {Bool} b True False !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~elemBy : all a. (a -> a -> Bool) -> a -> list a -> Bool = /\a -> \(eq : a -> a -> Bool) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.uplc.golden index 01795562522..06d8f6e39bb 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/nubBy.uplc.golden @@ -8,46 +8,41 @@ (\go arg -> delay (\l xs -> - (\cse -> - cse - [] - (\y ys -> - case - (force - ((\f -> - (\s -> - f - (\x -> - f - (\x -> - f (\x -> f (\x -> s s x) x) x) - x)) - (\s -> f (\x -> s s x))) - (\go arg -> - delay - (cse - (constr 1 []) - (\x xs -> - case - (lessThanEqualsInteger x y) - [ (force (go (delay (\x -> x))) - xs) - , (constr 0 []) ]))) - (delay (\x -> x))) - xs) - [ (force (go (delay (\x -> x))) ys xs) - , ((\cse -> - cse - (force (go (delay (\x -> x))) ys (cse xs))) - (force mkCons y)) ]) - l) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay - (f (force headList xs) (force tailList xs))))))) + case + l + [ [] + , (\y ys -> + case + (force + ((\f -> + (\s -> + f + (\x -> + f + (\x -> + f (\x -> f (\x -> s s x) x) x) + x)) + (\s -> f (\x -> s s x))) + (\go arg -> + delay + (\xs -> + case + xs + [ (constr 1 []) + , (\x xs -> + case + (lessThanEqualsInteger x y) + [ (force + (go (delay (\x -> x))) + xs) + , (constr 0 []) ]) ])) + (delay (\x -> x))) + xs) + [ (force (go (delay (\x -> x))) ys xs) + , ((\cse -> + cse + (force (go (delay (\x -> x))) ys (cse xs))) + (force mkCons y)) ]) ])) (delay (\x -> x))) xs [])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.eval.golden index 5fdba8ae4b9..5f63ff78aab 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.eval.golden @@ -1,6 +1,6 @@ -CPU: 969_907 -Memory: 4_396 -Term Size: 81 -Flat Size: 76 +CPU: 432_100 +Memory: 2_800 +Term Size: 66 +Flat Size: 66 (constr 0) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.pir.golden index a89d95cdb7d..ba3fd7dff0e 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.pir.golden @@ -3,15 +3,7 @@ let True : Bool False : Bool !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~any : all a. (a -> Bool) -> list a -> Bool = /\a -> \(p : a -> Bool) -> diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.uplc.golden index 769ff71689a..78593a4f623 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/or.uplc.golden @@ -8,16 +8,13 @@ (\go arg -> delay (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\xs -> - case - (force headList xs) - [ (force (go (delay (\x -> x))) xs) - , (constr 0 []) ]) - (force tailList xs)))))) + case + xs + [ (constr 1 []) + , (\x xs -> + case + x + [ (force (go (delay (\x -> x))) xs) + , (constr 0 []) ]) ])) (delay (\x -> x))) xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.eval.golden index f29aabfc248..33637e14daf 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.eval.golden @@ -1,6 +1,6 @@ -CPU: 12_154_784 -Memory: 53_412 -Term Size: 97 -Flat Size: 98 +CPU: 6_035_720 +Memory: 33_620 +Term Size: 79 +Flat Size: 85 (con (list integer) [10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.pir.golden index a7d205abfb4..44cf324bac2 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.pir.golden @@ -1,14 +1,6 @@ let !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !mkCons : all a. a -> list a -> list a = mkCons in letrec diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.uplc.golden index c65dfe8fa3e..4ff1cbf2ed5 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/revAppend.uplc.golden @@ -8,15 +8,11 @@ delay (delay (\l r -> - force - (force (force chooseList) - l - (delay r) - (delay - ((\x xs -> - force (force (revAppend (delay (\x -> x)))) - xs - (force mkCons x r)) - (force headList l) - (force tailList l))))))) + case + l + [ r + , (\x xs -> + force (force (revAppend (delay (\x -> x)))) + xs + (force mkCons x r)) ]))) (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.eval.golden index 28d9d8831d9..37d0d922a62 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.eval.golden @@ -1,6 +1,6 @@ -CPU: 12_154_784 -Memory: 53_412 -Term Size: 97 -Flat Size: 99 +CPU: 6_035_720 +Memory: 33_620 +Term Size: 79 +Flat Size: 86 (con (list integer) [10,9,8,7,6,5,4,3,2,1]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.pir.golden index e643310ef9a..656c2b3d467 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.pir.golden @@ -1,15 +1,7 @@ let ~`$fMkNilInteger` : (\arep -> list arep) integer = [] !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !mkCons : all a. a -> list a -> list a = mkCons in letrec diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.uplc.golden index b5453975712..6f37b689d87 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/reverse.uplc.golden @@ -8,15 +8,11 @@ delay (delay (\l r -> - force - (force (force chooseList) - l - (delay r) - (delay - ((\x xs -> - force (force (revAppend (delay (\x -> x)))) - xs - (force mkCons x r)) - (force headList l) - (force tailList l))))))) + case + l + [ r + , (\x xs -> + force (force (revAppend (delay (\x -> x)))) + xs + (force mkCons x r)) ]))) (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.pir.golden index 3f7eff50e4f..009964683e5 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.pir.golden @@ -4,15 +4,7 @@ let = /\arep -> \(v : (\arep -> list arep) arep) -> v ~empty : all a. (\arep -> list arep) a -> list a = mkNil !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Unit | Unit_match where Unit : Unit ~caseList : all a r. (Unit -> r) -> (a -> list a -> r) -> list a -> r diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.uplc.golden index bf34b9f1680..a6d9dffb651 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailEmpty.uplc.golden @@ -1,9 +1 @@ -(program - 1.1.0 - (\ds -> - force - (force (force chooseList) - [] - (delay (\ds -> (\x -> error) (force trace "PT25" (constr 0 [])))) - (delay ((\x xs ds -> xs) (force headList []) (force tailList [])))) - (constr 0 []))) \ No newline at end of file +(program 1.1.0 (\ds -> (\x -> error) (force trace "PT25" (constr 0 [])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.eval.golden index 1666b49b348..f40116cdee0 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.eval.golden @@ -1,6 +1,6 @@ -CPU: 761_907 -Memory: 3_096 -Term Size: 39 -Flat Size: 56 +CPU: 176_100 +Memory: 1_200 +Term Size: 21 +Flat Size: 42 (con (list integer) [2,3,4,5,6,7,8,9,10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.pir.golden index 4a71da62851..c9b6784343b 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.pir.golden @@ -1,14 +1,6 @@ let !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] data Unit | Unit_match where Unit : Unit ~caseList : all a r. (Unit -> r) -> (a -> list a -> r) -> list a -> r diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.uplc.golden index 266a36fc6ba..0c43f57e7db 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/tailOk.uplc.golden @@ -1,9 +1,8 @@ (program 1.1.0 (\xs -> - force - (force (force chooseList) - xs - (delay (\ds -> (\x -> error) (force trace "PT25" (constr 0 [])))) - (delay ((\x xs ds -> xs) (force headList xs) (force tailList xs)))) + case + xs + [ (\ds -> (\x -> error) (force trace "PT25" (constr 0 []))) + , (\x xs ds -> xs) ] (constr 0 []))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.eval.golden index 7d41227893f..cc82e2859fa 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.eval.golden @@ -1,6 +1,6 @@ -CPU: 7_804_007 -Memory: 33_156 -Term Size: 110 -Flat Size: 115 +CPU: 5_114_972 +Memory: 25_176 +Term Size: 95 +Flat Size: 104 (con (list integer) [1,2,3,4,5]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.pir.golden index fd0dd7e5c38..e24122aa27b 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.pir.golden @@ -4,15 +4,7 @@ let True : Bool False : Bool !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !ifThenElse : all a. bool -> a -> a -> a = /\a -> \(b : bool) (x : a) (y : a) -> case a b [y, x] !lessThanEqualsInteger : integer -> integer -> bool = lessThanEqualsInteger diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.uplc.golden index 86a894d4f65..9e1654740d3 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/take.uplc.golden @@ -10,18 +10,15 @@ (\`$dMkNil` n l -> case (lessThanEqualsInteger n 0) - [ (force - (force (force chooseList) - l - (delay `$dMkNil`) - (delay - ((\xs -> - force mkCons - (force headList l) - (force (force (take (delay (\x -> x)))) - `$dMkNil` - (subtractInteger n 1) - xs)) - (force tailList l))))) + [ (case + l + [ `$dMkNil` + , (\x xs -> + force mkCons + x + (force (force (take (delay (\x -> x)))) + `$dMkNil` + (subtractInteger n 1) + xs)) ]) , `$dMkNil` ]))) (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.eval.golden index 2d7d26fa274..b28c2da7620 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.eval.golden @@ -1,6 +1,6 @@ -CPU: 665_907 -Memory: 2_496 -Term Size: 24 -Flat Size: 40 +CPU: 176_100 +Memory: 1_200 +Term Size: 12 +Flat Size: 32 (constr 0 (constr 0 (con integer 1) (con (list integer) [2,3,4,5,6,7,8,9,10]))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.pir.golden index 0540dab3000..d50a978fef2 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.pir.golden @@ -5,15 +5,7 @@ let Just : a -> Maybe a Nothing : Maybe a !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~uncons : all a. list a -> Maybe (Tuple2 a (list a)) = /\a -> caseList' diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.uplc.golden index a4563742bf5..a0cf6cf7608 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsJust.uplc.golden @@ -1,10 +1,3 @@ (program 1.1.0 - (\xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - (constr 0 - [(constr 0 [(force headList xs), (force tailList xs)])]))))) \ No newline at end of file + (\xs -> case xs [(constr 1 []), (\h t -> constr 0 [(constr 0 [h, t])])])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.eval.golden index c6699117f31..c31bea48f64 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.eval.golden @@ -1,6 +1,6 @@ -CPU: 357_094 -Memory: 1_532 -Term Size: 24 -Flat Size: 44 +CPU: 64_100 +Memory: 500 +Term Size: 4 +Flat Size: 21 (constr 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.pir.golden index e94540d5de8..bc007c6db4f 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.pir.golden @@ -9,15 +9,7 @@ let Just : a -> Maybe a Nothing : Maybe a !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~uncons : all a. list a -> Maybe (Tuple2 a (list a)) = /\a -> caseList' diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.uplc.golden index 1facba8acf0..017a52b9b45 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/unconsNothing.uplc.golden @@ -1,10 +1 @@ -(program - 1.1.0 - (\ds -> - force - (force (force chooseList) - [] - (delay (constr 1 [])) - (delay - (constr 0 - [(constr 0 [(force headList []), (force tailList [])])]))))) \ No newline at end of file +(program 1.1.0 (\ds -> constr 1 [])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.eval.golden index 3df4971aa2e..20faaafb28c 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.eval.golden @@ -1,6 +1,6 @@ -CPU: 3_501_952 -Memory: 16_060 -Term Size: 139 -Flat Size: 141 +CPU: 1_637_344 +Memory: 8_736 +Term Size: 106 +Flat Size: 116 (constr 0 (con integer 1)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.pir.golden index 1ea7157caad..9f7ae84d1c1 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.pir.golden @@ -9,15 +9,7 @@ let !mkCons : all a. a -> list a -> list a = mkCons !subtractInteger : integer -> integer -> integer = subtractInteger !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] in letrec ~take : all a. (\arep -> list arep) a -> integer -> list a -> list a diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.uplc.golden index 4f2dc20cf64..369f73ef62f 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementJust.uplc.golden @@ -1,35 +1,28 @@ (program 1.1.0 - ((\caseList' -> - (\take xs -> - caseList' - (constr 1 []) - (\x -> caseList' (constr 0 [x]) (\ds ds -> constr 1 [])) - (force (force take) [] 1 xs)) - ((\f -> - (\s -> f (\x -> f (\x -> f (\x -> f (\x -> s s x) x) x) x)) - (\s -> f (\x -> s s x))) - (\take arg -> - delay - (delay - (\`$dMkNil` n l -> - case - (lessThanEqualsInteger n 0) - [ (caseList' - `$dMkNil` - (\x xs -> - force mkCons - x - (force (force (take (delay (\x -> x)))) - `$dMkNil` - (subtractInteger n 1) - xs)) - l) - , `$dMkNil` ]))) - (delay (\x -> x)))) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))))) \ No newline at end of file + ((\take xs -> + case + (force (force take) [] 1 xs) + [ (constr 1 []) + , (\x xs -> case xs [(constr 0 [x]), (\ds ds -> constr 1 [])]) ]) + ((\f -> + (\s -> f (\x -> f (\x -> f (\x -> f (\x -> s s x) x) x) x)) + (\s -> f (\x -> s s x))) + (\take arg -> + delay + (delay + (\`$dMkNil` n l -> + case + (lessThanEqualsInteger n 0) + [ (case + l + [ `$dMkNil` + , (\x xs -> + force mkCons + x + (force (force (take (delay (\x -> x)))) + `$dMkNil` + (subtractInteger n 1) + xs)) ]) + , `$dMkNil` ]))) + (delay (\x -> x))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.eval.golden index 3287f7b516b..4c8aff9d0b2 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.eval.golden @@ -1,6 +1,6 @@ -CPU: 549_094 -Memory: 2_732 -Term Size: 45 -Flat Size: 58 +CPU: 288_100 +Memory: 1_900 +Term Size: 27 +Flat Size: 44 (constr 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.pir.golden index 434f291083b..5f3a4931db0 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.pir.golden @@ -7,15 +7,7 @@ let Just : a -> Maybe a Nothing : Maybe a !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] ~uniqueElement : all a. list a -> Maybe a = /\a -> caseList' diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.uplc.golden index 5915b2d2824..c70ddacfd2c 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/uniqueElementNothing.uplc.golden @@ -3,10 +3,5 @@ (\ds -> (\cse -> cse (constr 1 []) (\x -> cse (constr 0 [x]) (\ds ds -> constr 1 []))) - (\z f xs -> - force - (force (force chooseList) - xs - (delay z) - (delay (f (force headList xs) (force tailList xs))))) + (\z f xs -> case xs [z, f]) [])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.eval.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.eval.golden index 77590d54054..f1a94229a2f 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.eval.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.eval.golden @@ -1,6 +1,6 @@ -CPU: 22_448_934 -Memory: 93_792 -Term Size: 110 -Flat Size: 111 +CPU: 7_927_800 +Memory: 39_140 +Term Size: 82 +Flat Size: 92 (con (list integer) [2,4,6,8,10,12,14,16,18,20]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.pir.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.pir.golden index f4a95e0ab8d..86c21e463d9 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.pir.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.pir.golden @@ -11,15 +11,7 @@ let ~`+` : all a. (\a -> a -> a -> a) a -> a -> a -> a = /\a -> \(v : (\a -> a -> a -> a) a) -> v !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !mkCons : all a. a -> list a -> list a = mkCons ~zipWith : all a b c. diff --git a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.uplc.golden b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.uplc.golden index f49e5963301..02cf8dc75db 100644 --- a/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.uplc.golden +++ b/plutus-tx-plugin/test/BuiltinList/Budget/9.6/zipWith.uplc.golden @@ -8,23 +8,19 @@ (\go arg -> delay (\xs ys -> - (\cse -> - cse - (\x xs' -> - cse - (\y ys' -> - force mkCons - (addInteger x y) - (force (go (delay (\x -> x))) xs' ys')) - ys) - xs) - (\f xs -> - force - (force (force chooseList) - xs - (delay []) - (delay - (f (force headList xs) (force tailList xs))))))) + case + xs + [ [] + , (\x xs' -> + case + ys + [ [] + , (\y ys' -> + force mkCons + (addInteger x y) + (force (go (delay (\x -> x))) + xs' + ys')) ]) ])) (delay (\x -> x))) xs xs)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/any.eval.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/any.eval.golden index 3e894a09f84..09f9d6de05f 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/any.eval.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/any.eval.golden @@ -1,6 +1,6 @@ -CPU: 7_678_828 -Memory: 30_932 -Term Size: 52 -Flat Size: 93 +CPU: 2_992_372 +Memory: 15_764 +Term Size: 34 +Flat Size: 80 (constr 0) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/any.pir.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/any.pir.golden index 243d0fe62dd..958c9ae87d9 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/any.pir.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/any.pir.golden @@ -6,22 +6,16 @@ in letrec !go : (\a -> list data) integer -> Bool = \(ds : (\a -> list data) integer) -> - chooseList - {data} - {all dead. Bool} + case + Bool ds - (/\dead -> False) - (/\dead -> - let - !x : data = headList {data} ds - !eta : list data = tailList {data} ds - in - Bool_match - (case Bool (lessThanInteger (unIData x) 8) [True, False]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> go eta) - {all dead. dead}) - {Bool} + [ False + , (\(x : data) (eta : list data) -> + Bool_match + (case Bool (lessThanInteger (unIData x) 8) [True, False]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> go eta) + {all dead. dead}) ] in \(eta : (\a -> list data) integer) -> go eta \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/any.uplc.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/any.uplc.golden index 288279a89a1..54fe2ec3075 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/any.uplc.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/any.uplc.golden @@ -3,15 +3,10 @@ ((\go eta -> go eta) ((\s -> s s) (\s ds -> - force - (force (force chooseList) - ds - (delay (constr 1 [])) - (delay - ((\x -> - (\eta -> - case - (lessThanInteger (unIData x) 8) - [(constr 0 []), (s s eta)]) - (force tailList ds)) - (force headList ds)))))))) \ No newline at end of file + case + ds + [ (constr 1 []) + , (\x eta -> + case + (lessThanInteger (unIData x) 8) + [(constr 0 []), (s s eta)]) ])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/elem.eval.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/elem.eval.golden index c9b354e603f..5bd5f688d70 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/elem.eval.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/elem.eval.golden @@ -1,6 +1,6 @@ -CPU: 15_170_900 -Memory: 29_076 -Term Size: 50 -Flat Size: 94 +CPU: 10_484_444 +Memory: 13_908 +Term Size: 32 +Flat Size: 81 (constr 0) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/elem.pir.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/elem.pir.golden index 2e3106846ef..9e2ed735ec0 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/elem.pir.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/elem.pir.golden @@ -6,22 +6,16 @@ in letrec !go : list data -> Bool = \(xs : list data) -> - chooseList - {data} - {all dead. Bool} + case + Bool xs - (/\dead -> False) - (/\dead -> - let - !h : data = headList {data} xs - !t : list data = tailList {data} xs - in - Bool_match - (case Bool (equalsData (I 8) h) [False, True]) - {all dead. Bool} - (/\dead -> True) - (/\dead -> go t) - {all dead. dead}) - {Bool} + [ False + , (\(h : data) (t : list data) -> + Bool_match + (case Bool (equalsData (I 8) h) [False, True]) + {all dead. Bool} + (/\dead -> True) + (/\dead -> go t) + {all dead. dead}) ] in \(eta : (\a -> list data) integer) -> go eta \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/elem.uplc.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/elem.uplc.golden index 728f0c9bf46..78412adc842 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/elem.uplc.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/elem.uplc.golden @@ -3,13 +3,8 @@ ((\go eta -> go eta) ((\s -> s s) (\s xs -> - force - (force (force chooseList) - xs - (delay (constr 1 [])) - (delay - ((\h -> - (\t -> - case (equalsData (I 8) h) [(s s t), (constr 0 [])]) - (force tailList xs)) - (force headList xs)))))))) \ No newline at end of file + case + xs + [ (constr 1 []) + , (\h t -> + case (equalsData (I 8) h) [(s s t), (constr 0 [])]) ])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/filter.eval.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/filter.eval.golden index c1256bc4d4d..118b57bb8ce 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/filter.eval.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/filter.eval.golden @@ -1,6 +1,6 @@ -CPU: 10_690_487 -Memory: 43_214 -Term Size: 66 -Flat Size: 107 +CPU: 5_051_423 +Memory: 26_422 +Term Size: 51 +Flat Size: 96 (con (list data) [I 8, I 9, I 10]) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/filter.pir.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/filter.pir.golden index 9af6bbf9cf6..f1b2ef44512 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/filter.pir.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/filter.pir.golden @@ -10,13 +10,7 @@ letrec r = (\a -> list data) integer in \(z : r) (f : data -> list data -> r) (xs : list data) -> - chooseList - {data} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {data} xs) (tailList {data} xs)) - {r}) + case r xs [z, f]) [] (\(x : data) (eta : list data) -> let diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/filter.uplc.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/filter.uplc.golden index d55be4f58d3..f21783b32a6 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/filter.uplc.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/filter.uplc.golden @@ -3,16 +3,13 @@ ((\go eta -> go eta) ((\s -> s s) (\s ds -> - force - (force (force chooseList) - ds - (delay []) - (delay - ((\eta -> - (\h -> - case - (lessThanInteger h 8) - [ ((\nt -> force mkCons (iData h) nt) (s s eta)) - , (s s eta) ]) - (unIData (force headList ds))) - (force tailList ds)))))))) \ No newline at end of file + case + ds + [ [] + , (\x eta -> + (\h -> + case + (lessThanInteger h 8) + [ ((\nt -> force mkCons (iData h) nt) (s s eta)) + , (s s eta) ]) + (unIData x)) ])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/length.eval.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/length.eval.golden index ba2796807b0..e1d32899a31 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/length.eval.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/length.eval.golden @@ -1,6 +1,6 @@ -CPU: 9_659_244 -Memory: 35_712 -Term Size: 47 -Flat Size: 88 +CPU: 3_540_180 +Memory: 15_920 +Term Size: 29 +Flat Size: 75 (con integer 10) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/length.pir.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/length.pir.golden index 56c88369c90..83b09f74788 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/length.pir.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/length.pir.golden @@ -1,16 +1,9 @@ letrec !go : list data -> integer = \(xs : list data) -> - chooseList - {data} - {all dead. integer} + case + integer xs - (/\dead -> 0) - (/\dead -> - let - !ds : data = headList {data} xs - in - addInteger 1 (go (tailList {data} xs))) - {integer} + [0, (\(ds : data) (eta : list data) -> addInteger 1 (go eta))] in \(ds : (\a -> list data) integer) -> go ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/length.uplc.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/length.uplc.golden index 50737e2ac38..8779a8238e5 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/length.uplc.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/length.uplc.golden @@ -2,11 +2,4 @@ 1.1.0 ((\go ds -> go ds) ((\s -> s s) - (\s xs -> - force - (force (force chooseList) - xs - (delay 0) - (delay - ((\ds -> addInteger 1 ((\x -> s s x) (force tailList xs))) - (force headList xs)))))))) \ No newline at end of file + (\s xs -> case xs [0, (\ds eta -> addInteger 1 (s s eta))])))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/partition.eval.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/partition.eval.golden index dedea13b41d..b67aa2a12db 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/partition.eval.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/partition.eval.golden @@ -1,7 +1,7 @@ -CPU: 12_415_124 -Memory: 51_242 -Term Size: 69 -Flat Size: 115 +CPU: 6_296_060 +Memory: 31_450 +Term Size: 51 +Flat Size: 102 (constr 0 diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/partition.pir.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/partition.pir.golden index 2cbc6c8cc86..746c27310e9 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/partition.pir.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/partition.pir.golden @@ -12,13 +12,7 @@ in r = Tuple2 (list data) (list data) in \(z : r) (f : data -> list data -> r) (xs : list data) -> - chooseList - {data} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {data} xs) (tailList {data} xs)) - {r}) + case r xs [z, f]) (Tuple2 {list data} {list data} [] []) (\(h : data) (t : list data) -> Tuple2_match diff --git a/plutus-tx-plugin/test/DataList/Budget/9.6/partition.uplc.golden b/plutus-tx-plugin/test/DataList/Budget/9.6/partition.uplc.golden index ce3634f14c9..18ffc2ac20a 100644 --- a/plutus-tx-plugin/test/DataList/Budget/9.6/partition.uplc.golden +++ b/plutus-tx-plugin/test/DataList/Budget/9.6/partition.uplc.golden @@ -3,18 +3,15 @@ (\l -> (\s -> s s) (\s xs -> - force - (force (force chooseList) - xs - (delay (constr 0 [[], []])) - (delay - ((\h -> - case - ((\x -> s s x) (force tailList xs)) - [ (\ipv ipv -> - case - (lessThanInteger (unIData h) 8) - [ (constr 0 [(force mkCons h ipv), ipv]) - , (constr 0 [ipv, (force mkCons h ipv)]) ]) ]) - (force headList xs))))) + case + xs + [ (constr 0 [[], []]) + , (\h t -> + case + (s s t) + [ (\ipv ipv -> + case + (lessThanInteger (unIData h) 8) + [ (constr 0 [(force mkCons h ipv), ipv]) + , (constr 0 [ipv, (force mkCons h ipv)]) ]) ]) ]) l)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/IsData/9.6/deconstructData.pir.golden b/plutus-tx-plugin/test/IsData/9.6/deconstructData.pir.golden index 5794f71421a..1c3ceebd7c5 100644 --- a/plutus-tx-plugin/test/IsData/9.6/deconstructData.pir.golden +++ b/plutus-tx-plugin/test/IsData/9.6/deconstructData.pir.golden @@ -38,15 +38,7 @@ let (/\dead -> fB (unBData d)) {r} !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] !equalsInteger : integer -> integer -> bool = equalsInteger data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden index 2ce9b2ede06..7d211af5d46 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden @@ -53,15 +53,7 @@ let = /\(f :: * -> *) -> \(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) -> v !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r - = /\a r -> - \(z : r) (f : a -> list a -> r) (xs : list a) -> - chooseList - {a} - {all dead. r} - xs - (/\dead -> z) - (/\dead -> f (headList {a} xs) (tailList {a} xs)) - {r} + = /\a r -> \(z : r) (f : a -> list a -> r) (xs : list a) -> case r xs [z, f] in letrec ~caseData_go : list data -> List data diff --git a/plutus-tx-plugin/test/size/Golden/Rational/Serialization/fromBuiltinData.size.golden b/plutus-tx-plugin/test/size/Golden/Rational/Serialization/fromBuiltinData.size.golden index 815f89dbff5..fefb598af8c 100644 --- a/plutus-tx-plugin/test/size/Golden/Rational/Serialization/fromBuiltinData.size.golden +++ b/plutus-tx-plugin/test/size/Golden/Rational/Serialization/fromBuiltinData.size.golden @@ -1 +1 @@ -311 \ No newline at end of file +284 \ No newline at end of file