diff --git a/plutus-benchmark/lists/test/Sum/left-fold-built-in.budget.golden b/plutus-benchmark/lists/test/Sum/left-fold-built-in.budget.golden index c3dad1d4b3f..ed804e9f785 100644 --- a/plutus-benchmark/lists/test/Sum/left-fold-built-in.budget.golden +++ b/plutus-benchmark/lists/test/Sum/left-fold-built-in.budget.golden @@ -1,2 +1,2 @@ -({cpu: 160559654 -| mem: 504532}) \ No newline at end of file +({cpu: 174359654 +| mem: 564532}) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Sum/left-fold-data.budget.golden b/plutus-benchmark/lists/test/Sum/left-fold-data.budget.golden index 98d721fae3f..3278e9c0ba1 100644 --- a/plutus-benchmark/lists/test/Sum/left-fold-data.budget.golden +++ b/plutus-benchmark/lists/test/Sum/left-fold-data.budget.golden @@ -1,2 +1,2 @@ -({cpu: 378574685 -| mem: 1148162}) \ No newline at end of file +({cpu: 398364389 +| mem: 1245330}) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Sum/right-fold-built-in.budget.golden b/plutus-benchmark/lists/test/Sum/right-fold-built-in.budget.golden index ba994d8016f..d7c073dd717 100644 --- a/plutus-benchmark/lists/test/Sum/right-fold-built-in.budget.golden +++ b/plutus-benchmark/lists/test/Sum/right-fold-built-in.budget.golden @@ -1,2 +1,2 @@ -({cpu: 167459654 -| mem: 534532}) \ No newline at end of file +({cpu: 181259654 +| mem: 594532}) \ No newline at end of file diff --git a/plutus-benchmark/lists/test/Sum/right-fold-data.budget.golden b/plutus-benchmark/lists/test/Sum/right-fold-data.budget.golden index 5b5eaa2b478..c1ee65a7eb3 100644 --- a/plutus-benchmark/lists/test/Sum/right-fold-data.budget.golden +++ b/plutus-benchmark/lists/test/Sum/right-fold-data.budget.golden @@ -1,2 +1,2 @@ -({cpu: 385474685 -| mem: 1178162}) \ No newline at end of file +({cpu: 405264389 +| mem: 1275330}) \ No newline at end of file diff --git a/plutus-benchmark/nofib/src/PlutusBenchmark/NoFib/LastPiece.hs b/plutus-benchmark/nofib/src/PlutusBenchmark/NoFib/LastPiece.hs index 1bb9fab7730..822ee0513f3 100644 --- a/plutus-benchmark/nofib/src/PlutusBenchmark/NoFib/LastPiece.hs +++ b/plutus-benchmark/nofib/src/PlutusBenchmark/NoFib/LastPiece.hs @@ -5,6 +5,8 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} +{-# OPTIONS_GHC -fno-specialise #-} +{-# OPTIONS_GHC -fno-strictness #-} {-% Last piece puzzle, adapted from nofib/spectral/last-piece. This is a solver for a jigsaw problem: diff --git a/plutus-benchmark/nofib/test/Spec.hs b/plutus-benchmark/nofib/test/Spec.hs index e4176c0367d..641bed2777c 100644 --- a/plutus-benchmark/nofib/test/Spec.hs +++ b/plutus-benchmark/nofib/test/Spec.hs @@ -46,7 +46,7 @@ testClausify = testGroup "clausify" , testCase "formula3" $ mkClausifyTest Clausify.F3 , testCase "formula4" $ mkClausifyTest Clausify.F4 , testCase "formula5" $ mkClausifyTest Clausify.F5 - , Tx.fitsInto "formula1 (size)" (Clausify.mkClausifyCode Clausify.F1) 3304 + , Tx.fitsInto "formula1 (size)" (Clausify.mkClausifyCode Clausify.F1) 3521 , runTestNested $ Tx.goldenBudget "formulaBudget" $ Clausify.mkClausifyCode Clausify.F1 ] @@ -95,7 +95,7 @@ testQueens = testGroup "queens" , runTestNested $ Tx.goldenBudget "queens5budget" $ Queens.mkQueensCode 5 Queens.Bt ] - , Tx.fitsInto "Bt (size)" (Queens.mkQueensCode 5 Queens.Bt) 1943 + , Tx.fitsInto "Bt (size)" (Queens.mkQueensCode 5 Queens.Bt) 2034 ] ---------------- Primes ---------------- diff --git a/plutus-benchmark/nofib/test/formulaBudget.budget.golden b/plutus-benchmark/nofib/test/formulaBudget.budget.golden index ac4e6a09b4d..cadcbea35b6 100644 --- a/plutus-benchmark/nofib/test/formulaBudget.budget.golden +++ b/plutus-benchmark/nofib/test/formulaBudget.budget.golden @@ -1,2 +1,2 @@ -({cpu: 9146695908 -| mem: 38237448}) \ No newline at end of file +({cpu: 5164038908 +| mem: 20921548}) \ No newline at end of file diff --git a/plutus-benchmark/nofib/test/knightsBudget.budget.golden b/plutus-benchmark/nofib/test/knightsBudget.budget.golden index 3473143a1a6..f801d388ce2 100644 --- a/plutus-benchmark/nofib/test/knightsBudget.budget.golden +++ b/plutus-benchmark/nofib/test/knightsBudget.budget.golden @@ -1,2 +1,2 @@ -({cpu: 4484460298 -| mem: 15072240}) \ No newline at end of file +({cpu: 6557595072 +| mem: 21801204}) \ No newline at end of file diff --git a/plutus-benchmark/nofib/test/queens4budget.budget.golden b/plutus-benchmark/nofib/test/queens4budget.budget.golden index b4a07797dbf..b54bc4ff2c9 100644 --- a/plutus-benchmark/nofib/test/queens4budget.budget.golden +++ b/plutus-benchmark/nofib/test/queens4budget.budget.golden @@ -1,2 +1,2 @@ -({cpu: 9369717305 -| mem: 33848842}) \ No newline at end of file +({cpu: 9946650905 +| mem: 35910610}) \ No newline at end of file diff --git a/plutus-benchmark/nofib/test/queens5budget.budget.golden b/plutus-benchmark/nofib/test/queens5budget.budget.golden index 94091a5eeb0..27fc724a1c2 100644 --- a/plutus-benchmark/nofib/test/queens5budget.budget.golden +++ b/plutus-benchmark/nofib/test/queens5budget.budget.golden @@ -1,2 +1,2 @@ -({cpu: 128906178648 -| mem: 453182780}) \ No newline at end of file +({cpu: 138199584478 +| mem: 486584420}) \ No newline at end of file diff --git a/plutus-benchmark/plutus-benchmark.cabal b/plutus-benchmark/plutus-benchmark.cabal index 0ad0f6349cc..ae75a247325 100644 --- a/plutus-benchmark/plutus-benchmark.cabal +++ b/plutus-benchmark/plutus-benchmark.cabal @@ -38,10 +38,13 @@ common lang ImportQualifiedPost ScopedTypeVariables StandaloneDeriving + Strict ghc-options: -fno-specialise -fno-spec-constr -fno-ignore-interface-pragmas - -fno-omit-interface-pragmas + -fno-omit-interface-pragmas -fno-strictness + -fno-unbox-strict-fields -fno-unbox-small-strict-fields + -fforce-recomp ghc-options: -Wall -Wnoncanonical-monad-instances -Wincomplete-uni-patterns diff --git a/plutus-benchmark/script-contexts/test/checkScriptContexEqualityData-20.budget.golden b/plutus-benchmark/script-contexts/test/checkScriptContexEqualityData-20.budget.golden index 5548cf6e0f9..3572aa58a3e 100644 --- a/plutus-benchmark/script-contexts/test/checkScriptContexEqualityData-20.budget.golden +++ b/plutus-benchmark/script-contexts/test/checkScriptContexEqualityData-20.budget.golden @@ -1,2 +1,2 @@ -({cpu: 60584597 -| mem: 200602}) \ No newline at end of file +({cpu: 60653597 +| mem: 200902}) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/checkScriptContext1-20.budget.golden b/plutus-benchmark/script-contexts/test/checkScriptContext1-20.budget.golden index a7ccc065432..ad9dd419476 100644 --- a/plutus-benchmark/script-contexts/test/checkScriptContext1-20.budget.golden +++ b/plutus-benchmark/script-contexts/test/checkScriptContext1-20.budget.golden @@ -1,2 +1,2 @@ -({cpu: 424297997 -| mem: 1316969}) \ No newline at end of file +({cpu: 32842097 +| mem: 104340}) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/checkScriptContext1-4.budget.golden b/plutus-benchmark/script-contexts/test/checkScriptContext1-4.budget.golden index 24ebe58f8d2..ad9dd419476 100644 --- a/plutus-benchmark/script-contexts/test/checkScriptContext1-4.budget.golden +++ b/plutus-benchmark/script-contexts/test/checkScriptContext1-4.budget.golden @@ -1,2 +1,2 @@ -({cpu: 124093245 -| mem: 389193}) \ No newline at end of file +({cpu: 32842097 +| mem: 104340}) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/checkScriptContext2-20.budget.golden b/plutus-benchmark/script-contexts/test/checkScriptContext2-20.budget.golden index 89a12e3357a..ad9dd419476 100644 --- a/plutus-benchmark/script-contexts/test/checkScriptContext2-20.budget.golden +++ b/plutus-benchmark/script-contexts/test/checkScriptContext2-20.budget.golden @@ -1,2 +1,2 @@ -({cpu: 405027508 -| mem: 1254326}) \ No newline at end of file +({cpu: 32842097 +| mem: 104340}) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/checkScriptContext2-4.budget.golden b/plutus-benchmark/script-contexts/test/checkScriptContext2-4.budget.golden index 671ec7bc35f..ad9dd419476 100644 --- a/plutus-benchmark/script-contexts/test/checkScriptContext2-4.budget.golden +++ b/plutus-benchmark/script-contexts/test/checkScriptContext2-4.budget.golden @@ -1,2 +1,2 @@ -({cpu: 118430388 -| mem: 371382}) \ No newline at end of file +({cpu: 32842097 +| mem: 104340}) \ No newline at end of file diff --git a/plutus-benchmark/script-contexts/test/checkScriptContextEqualityTerm-20.budget.golden b/plutus-benchmark/script-contexts/test/checkScriptContextEqualityTerm-20.budget.golden index 9ffa4c11653..e23b7b777b5 100644 --- a/plutus-benchmark/script-contexts/test/checkScriptContextEqualityTerm-20.budget.golden +++ b/plutus-benchmark/script-contexts/test/checkScriptContextEqualityTerm-20.budget.golden @@ -1,2 +1,2 @@ -({cpu: 573072251 -| mem: 2333646}) \ No newline at end of file +({cpu: 608860251 +| mem: 2489246}) \ No newline at end of file diff --git a/plutus-core/plutus-ir/src/PlutusIR/Purity.hs b/plutus-core/plutus-ir/src/PlutusIR/Purity.hs index 1d03fb5446d..f293672221a 100644 --- a/plutus-core/plutus-ir/src/PlutusIR/Purity.hs +++ b/plutus-core/plutus-ir/src/PlutusIR/Purity.hs @@ -5,17 +5,20 @@ module PlutusIR.Purity ( isPure + , FirstEffectfulTerm (..) , firstEffectfulTerm + , firstEffectfulTerm2 , asBuiltinApp , isSaturated , BuiltinApp (..) , Arg (..) ) where +import PlutusCore.Builtin import PlutusIR +import Control.Applicative import Data.List.NonEmpty qualified as NE -import PlutusCore.Builtin -- | An argument taken by a builtin: could be a term of a type. data Arg tyname name uni fun a = TypeArg (Type tyname uni a) | TermArg (Term tyname name uni fun a) @@ -127,6 +130,53 @@ isPure ver varStrictness = go TermBind _ Strict _ rhs -> go rhs _ -> True +data FirstEffectfulTerm tyname name uni fun a + = FirstEffectfulTerm (Term tyname name uni fun a) + | Uncertain + +{- | +Try to identify the first sub term which will be evaluated in the given term and +which could have an effect. 'Nothing' indicates that there's no term to evaluate. +-} +firstEffectfulTerm2 :: + forall tyname name uni fun a. + Term tyname name uni fun a -> + Maybe (FirstEffectfulTerm tyname name uni fun a) +firstEffectfulTerm2 = goTerm + where + goTerm :: Term tyname name uni fun a -> Maybe (FirstEffectfulTerm tyname name uni fun a) + goTerm = \case + Let _ NonRec bs b -> goBindings (NE.toList bs) <|> goTerm b + + Apply _ fun args -> goTerm fun <|> goTerm args + TyInst _ t _ -> goTerm t + IWrap _ _ _ t -> goTerm t + Unwrap _ t -> goTerm t + Constr _ _ _ [] -> Nothing + Constr _ _ _ ts -> asum $ goTerm <$> ts + Case _ _ t _ -> goTerm t + + t@Var{} -> Just (FirstEffectfulTerm t) + t@Error{} -> Just (FirstEffectfulTerm t) + Builtin{} -> Nothing + + -- Hard to know what gets evaluated first in a recursive let-binding, + -- just give up and return `Uncertain` + (Let _ Rec _ _) -> Just Uncertain + TyAbs{} -> Nothing + LamAbs{} -> Nothing + Constant{} -> Nothing + + goBindings :: + [Binding tyname name uni fun a] -> + Maybe (FirstEffectfulTerm tyname name uni fun a) + goBindings [] = Nothing + goBindings (b:bs) = case b of + -- Only strict term bindings can cause effects + TermBind _ Strict _ rhs -> goTerm rhs + _ -> goBindings bs + + {- | Try to identify the first sub term which will be evaluated in the given term and which could have an effect. 'Nothing' indicates that we don't know, this function diff --git a/plutus-core/plutus-ir/src/PlutusIR/Transform/Inline/Utils.hs b/plutus-core/plutus-ir/src/PlutusIR/Transform/Inline/Utils.hs index 2f44db75c81..2598652f9fd 100644 --- a/plutus-core/plutus-ir/src/PlutusIR/Transform/Inline/Utils.hs +++ b/plutus-core/plutus-ir/src/PlutusIR/Transform/Inline/Utils.hs @@ -18,7 +18,7 @@ import PlutusCore.Subst (typeSubstTyNamesM) import PlutusIR import PlutusIR.Analysis.Dependencies qualified as Deps import PlutusIR.Analysis.Usages qualified as Usages -import PlutusIR.Purity (firstEffectfulTerm, isPure) +import PlutusIR.Purity (FirstEffectfulTerm (..), firstEffectfulTerm2, isPure) import PlutusIR.Transform.Rename () import PlutusPrelude @@ -300,9 +300,9 @@ effectSafe body s n purity = do -- This can in the worst case traverse a lot of the term, which could lead to us -- doing ~quadratic work as we process the program. However in practice most term -- types will make it give up, so it's not too bad. - let immediatelyEvaluated = case firstEffectfulTerm body of - Just (Var _ n') -> n == n' - _ -> False + let immediatelyEvaluated = case firstEffectfulTerm2 body of + Just (FirstEffectfulTerm (Var _ n')) -> n == n' + _ -> False pure $ case s of Strict -> purity || immediatelyEvaluated NonStrict -> True diff --git a/plutus-ledger-api/plutus-ledger-api.cabal b/plutus-ledger-api/plutus-ledger-api.cabal index b2963803e8a..58ab5916b95 100644 --- a/plutus-ledger-api/plutus-ledger-api.cabal +++ b/plutus-ledger-api/plutus-ledger-api.cabal @@ -44,6 +44,7 @@ common lang -Wincomplete-record-updates -Wredundant-constraints -Widentities -Wunused-packages -Wmissing-deriving-strategies -fobject-code -fno-ignore-interface-pragmas -fno-omit-interface-pragmas + -fno-strictness library import: lang diff --git a/plutus-tx-plugin/plutus-tx-plugin.cabal b/plutus-tx-plugin/plutus-tx-plugin.cabal index d14354e9961..5c42e9ade9e 100644 --- a/plutus-tx-plugin/plutus-tx-plugin.cabal +++ b/plutus-tx-plugin/plutus-tx-plugin.cabal @@ -40,6 +40,7 @@ common lang -Wincomplete-record-updates -Wredundant-constraints -Widentities -Wunused-packages -Wmissing-deriving-strategies -fobject-code -fno-ignore-interface-pragmas -fno-omit-interface-pragmas + -fforce-recomp common ghc-version-support -- See the section on GHC versions in CONTRIBUTING @@ -115,7 +116,7 @@ executable gen-plugin-opts-doc default-language: Haskell2010 test-suite plutus-tx-tests - import: lang, ghc-version-support + import: lang, ghc-version-support -- test output changes after 9.2, bad for golden tests if impl(ghc >=9.3) @@ -124,9 +125,9 @@ test-suite plutus-tx-tests if flag(use-ghc-stub) buildable: False - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Spec.hs + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Spec.hs other-modules: Budget.Spec IsData.Spec @@ -169,20 +170,29 @@ test-suite plutus-tx-tests , template-haskell , text + default-extensions: Strict + -- NOTE: -g makes the plugin give better errors - ghc-options: -g + ghc-options: + -g -fno-strictness -fno-unbox-strict-fields + -fno-unbox-small-strict-fields test-suite size - import: lang, ghc-version-support + import: lang, ghc-version-support -- needs plutus-tx-plugin but it looks unused - ghc-options: -Wno-unused-packages - type: exitcode-stdio-1.0 - main-is: Main.hs - hs-source-dirs: test/size + ghc-options: -Wno-unused-packages + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: test/size build-depends: , base >=4.9 && <5.0 , plutus-tx-plugin ^>=1.7 , plutus-tx:{plutus-tx, plutus-tx-testlib} ^>=1.7 , tagged , tasty + + default-extensions: Strict + ghc-options: + -fno-strictness -fno-unbox-strict-fields + -fno-unbox-small-strict-fields diff --git a/plutus-tx-plugin/src/PlutusTx/Compiler/Type.hs b/plutus-tx-plugin/src/PlutusTx/Compiler/Type.hs index 94497ba302a..e4cc55c35e7 100644 --- a/plutus-tx-plugin/src/PlutusTx/Compiler/Type.hs +++ b/plutus-tx-plugin/src/PlutusTx/Compiler/Type.hs @@ -280,7 +280,7 @@ mkConstructorType dc = pure $ PIR.mkIterTyFun annMayInline args resultType ghcStrictnessNote :: GHC.SDoc -ghcStrictnessNote = "Note: GHC can generate these unexpectedly, you may need '-fno-strictness', '-fno-specialise', or '-fno-spec-constr'" +ghcStrictnessNote = "Note: GHC can generate these unexpectedly, you may need '-fno-strictness', '-fno-specialise', '-fno-spec-constr', '-fno-unbox-strict-fields', or '-fno-unbox-small-strict-fields'." -- | Get the constructors of the given 'TyCon' as PLC terms. getConstructors :: CompilingDefault uni fun m ann => GHC.TyCon -> m [PIRTerm uni fun] diff --git a/plutus-tx-plugin/test/Budget/Spec.hs b/plutus-tx-plugin/test/Budget/Spec.hs index 8207d719c19..5c666a23def 100644 --- a/plutus-tx-plugin/test/Budget/Spec.hs +++ b/plutus-tx-plugin/test/Budget/Spec.hs @@ -7,6 +7,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -fforce-recomp #-} {-# OPTIONS_GHC -fplugin PlutusTx.Plugin #-} {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:defer-errors #-} {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:context-level=0 #-} diff --git a/plutus-tx-plugin/test/Budget/andCheap.pir-readable.golden b/plutus-tx-plugin/test/Budget/andCheap.pir-readable.golden index 57788ea456d..dca57f442d4 100644 --- a/plutus-tx-plugin/test/Budget/andCheap.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/andCheap.pir-readable.golden @@ -27,20 +27,23 @@ letrec {all dead. dead}) {all dead. dead} in -and - ((let - a = List Bool - in - \(c : Bool -> a -> a) - (n : a) -> - c - False - (c - True +let + !ls : List Bool + = (let + a = List Bool + in + \(c : Bool -> a -> a) + (n : a) -> + c + False (c True (c True - (c True (c True (c True (c True (c True (c True n)))))))))) - (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) - (Nil {Bool})) \ No newline at end of file + (c + True + (c True (c True (c True (c True (c True (c True n)))))))))) + (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) + (Nil {Bool}) +in +and ls \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/andExpensive.pir-readable.golden b/plutus-tx-plugin/test/Budget/andExpensive.pir-readable.golden index 3147a00b7e0..4146643324e 100644 --- a/plutus-tx-plugin/test/Budget/andExpensive.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/andExpensive.pir-readable.golden @@ -27,20 +27,23 @@ letrec {all dead. dead}) {all dead. dead} in -and - ((let - a = List Bool - in - \(c : Bool -> a -> a) - (n : a) -> - c - True - (c +let + !ls : List Bool + = (let + a = List Bool + in + \(c : Bool -> a -> a) + (n : a) -> + c True (c True (c True - (c True (c True (c True (c True (c True (c True n)))))))))) - (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) - (Nil {Bool})) \ No newline at end of file + (c + True + (c True (c True (c True (c True (c True (c True n)))))))))) + (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) + (Nil {Bool}) +in +and ls \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/applicative.pir-readable.golden b/plutus-tx-plugin/test/Budget/applicative.pir-readable.golden index 9f3aea1bd94..e91e4d86674 100644 --- a/plutus-tx-plugin/test/Budget/applicative.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/applicative.pir-readable.golden @@ -2,7 +2,6 @@ let data (Maybe :: * -> *) a | Maybe_match where Just : a -> Maybe a Nothing : Maybe a - !x : Maybe integer = Just {integer} 1 !y : Maybe integer = Just {integer} 2 !ds : Maybe (integer -> integer) = (let @@ -25,7 +24,7 @@ let (/\dead -> Nothing {b}) {all dead. dead}) (\(x : integer) (y : integer) -> addInteger x y) - x + (Just {integer} 1) in Maybe_match {integer -> integer} diff --git a/plutus-tx-plugin/test/Budget/orCheap.pir-readable.golden b/plutus-tx-plugin/test/Budget/orCheap.pir-readable.golden index f9962eaeff8..e0cdbba7970 100644 --- a/plutus-tx-plugin/test/Budget/orCheap.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/orCheap.pir-readable.golden @@ -27,22 +27,25 @@ letrec {all dead. dead}) {all dead. dead} in -or - ((let - a = List Bool - in - \(c : Bool -> a -> a) - (n : a) -> - c - True - (c - False +let + !ls : List Bool + = (let + a = List Bool + in + \(c : Bool -> a -> a) + (n : a) -> + c + True (c False (c False (c False - (c False (c False (c False (c False (c False n)))))))))) - (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) - (Nil {Bool})) \ No newline at end of file + (c + False + (c False (c False (c False (c False (c False n)))))))))) + (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) + (Nil {Bool}) +in +or ls \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/orExpensive.pir-readable.golden b/plutus-tx-plugin/test/Budget/orExpensive.pir-readable.golden index d926122d631..92d4e63c6f3 100644 --- a/plutus-tx-plugin/test/Budget/orExpensive.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/orExpensive.pir-readable.golden @@ -27,15 +27,14 @@ letrec {all dead. dead}) {all dead. dead} in -or - ((let - a = List Bool - in - \(c : Bool -> a -> a) - (n : a) -> - c - False - (c +let + !ls : List Bool + = (let + a = List Bool + in + \(c : Bool -> a -> a) + (n : a) -> + c False (c False @@ -43,6 +42,10 @@ or False (c False - (c False (c False (c False (c False (c False n)))))))))) - (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) - (Nil {Bool})) \ No newline at end of file + (c + False + (c False (c False (c False (c False (c False n)))))))))) + (\(ds : Bool) (ds : List Bool) -> Cons {Bool} ds ds) + (Nil {Bool}) +in +or ls \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/show.budget.golden b/plutus-tx-plugin/test/Budget/show.budget.golden index 8b3c5c391e5..14280b20fd1 100644 --- a/plutus-tx-plugin/test/Budget/show.budget.golden +++ b/plutus-tx-plugin/test/Budget/show.budget.golden @@ -1,2 +1,2 @@ -({cpu: 4608602372 -| mem: 13854201}) \ No newline at end of file +({cpu: 2999070219 +| mem: 9055404}) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/show.pir-readable.golden b/plutus-tx-plugin/test/Budget/show.pir-readable.golden index cbe9acd0fb3..00cb174efd1 100644 --- a/plutus-tx-plugin/test/Budget/show.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/show.pir-readable.golden @@ -14,13 +14,14 @@ letrec = \(acc : List integer) (n : integer) -> let - ~q : integer = quotientInteger n y + !x : integer = quotientInteger n y + !b : bool = equalsInteger x 0 in Bool_match - (ifThenElse {Bool} (equalsInteger q 0) True False) + (ifThenElse {Bool} b True False) {all dead. List integer} (/\dead -> Cons {integer} (remainderInteger n y) acc) - (/\dead -> go (Cons {integer} (remainderInteger n y) acc) q) + (/\dead -> go (Cons {integer} (remainderInteger n y) acc) x) {all dead. dead} in letrec @@ -42,181 +43,214 @@ let !id : all a. a -> a = /\a -> \(x : a) -> x in letrec - !`$w$cshowsPrec` - : integer -> List string -> List string - = \(w : integer) -> + !`$fShowBuiltinByteString_$cshowsPrec` + : integer -> integer -> List string -> List string + = \(p : integer) + (n : integer) -> + let + !b : bool = lessThanInteger n 0 + in Bool_match - (ifThenElse {Bool} (lessThanInteger w 0) True False) + (ifThenElse {Bool} b True False) {all dead. List string -> List string} (/\dead -> - \(x : List string) -> - Cons {string} "-" (`$w$cshowsPrec` (subtractInteger 0 w) x)) + \(eta : List string) -> + let + !g : List string -> List string + = `$fShowBuiltinByteString_$cshowsPrec` + p + (subtractInteger 0 n) + in + Cons {string} "-" (g eta)) (/\dead -> foldr {integer} {List string -> List string} (\(digit : integer) (acc : List string -> List string) - (x : List string) -> + (eta : List string) -> Cons {string} - (Bool_match - (ifThenElse {Bool} (equalsInteger digit 0) True False) - {all dead. string} - (/\dead -> "0") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger digit 1) - True - False) - {all dead. string} - (/\dead -> "1") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger digit 2) - True - False) - {all dead. string} - (/\dead -> "2") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger digit 3) - True - False) - {all dead. string} - (/\dead -> "3") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger digit 4) - True - False) - {all dead. string} - (/\dead -> "4") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger digit 5) - True - False) - {all dead. string} - (/\dead -> "5") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger digit 6) - True - False) - {all dead. string} - (/\dead -> "6") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger - digit - 7) - True - False) - {all dead. string} - (/\dead -> "7") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger - digit - 8) - True - False) - {all dead. - string} - (/\dead -> "8") - (/\dead -> - Bool_match - (ifThenElse - {Bool} - (equalsInteger - digit - 9) - True - False) - {string} - "9" - "") - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - (acc x)) + (let + !b : bool = equalsInteger digit 0 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. string} + (/\dead -> "0") + (/\dead -> + let + !b : bool = equalsInteger digit 1 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. string} + (/\dead -> "1") + (/\dead -> + let + !b : bool = equalsInteger digit 2 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. string} + (/\dead -> "2") + (/\dead -> + let + !b : bool = equalsInteger digit 3 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. string} + (/\dead -> "3") + (/\dead -> + let + !b : bool = equalsInteger digit 4 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. string} + (/\dead -> "4") + (/\dead -> + let + !b : bool = equalsInteger digit 5 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. string} + (/\dead -> "5") + (/\dead -> + let + !b : bool + = equalsInteger digit 6 + in + Bool_match + (ifThenElse + {Bool} + b + True + False) + {all dead. string} + (/\dead -> "6") + (/\dead -> + let + !b : bool + = equalsInteger + digit + 7 + in + Bool_match + (ifThenElse + {Bool} + b + True + False) + {all dead. string} + (/\dead -> "7") + (/\dead -> + let + !b : bool + = equalsInteger + digit + 8 + in + Bool_match + (ifThenElse + {Bool} + b + True + False) + {all dead. string} + (/\dead -> "8") + (/\dead -> + let + !b + : bool + = equalsInteger + digit + 9 + in + Bool_match + (ifThenElse + {Bool} + b + True + False) + {string} + "9" + "") + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + (acc eta)) (id {List string}) - (go (Nil {integer}) w)) + (go (Nil {integer}) n)) {all dead. dead} in let !toHex : integer -> List string -> List string = \(x : integer) -> + let + !b : bool = lessThanEqualsInteger x 9 + in Bool_match - (ifThenElse {Bool} (lessThanEqualsInteger x 9) True False) + (ifThenElse {Bool} b True False) {all dead. List string -> List string} - (/\dead -> `$w$cshowsPrec` x) + (/\dead -> `$fShowBuiltinByteString_$cshowsPrec` 0 x) (/\dead -> + let + !b : bool = equalsInteger x 10 + in Bool_match - (ifThenElse {Bool} (equalsInteger x 10) True False) + (ifThenElse {Bool} b True False) {all dead. List string -> List string} (/\dead -> \(ds : List string) -> Cons {string} "a" ds) (/\dead -> + let + !b : bool = equalsInteger x 11 + in Bool_match - (ifThenElse {Bool} (equalsInteger x 11) True False) + (ifThenElse {Bool} b True False) {all dead. List string -> List string} (/\dead -> \(ds : List string) -> Cons {string} "b" ds) (/\dead -> + let + !b : bool = equalsInteger x 12 + in Bool_match - (ifThenElse {Bool} (equalsInteger x 12) True False) + (ifThenElse {Bool} b True False) {all dead. List string -> List string} (/\dead -> \(ds : List string) -> Cons {string} "c" ds) (/\dead -> + let + !b : bool = equalsInteger x 13 + in Bool_match - (ifThenElse - {Bool} - (equalsInteger x 13) - True - False) + (ifThenElse {Bool} b True False) {all dead. List string -> List string} (/\dead -> \(ds : List string) -> Cons {string} "d" ds) (/\dead -> + let + !b : bool = equalsInteger x 14 + in Bool_match - (ifThenElse - {Bool} - (equalsInteger x 14) - True - False) + (ifThenElse {Bool} b True False) {all dead. List string -> List string} (/\dead -> \(ds : List string) -> Cons {string} "e" ds) (/\dead -> + let + !b : bool = equalsInteger x 15 + in Bool_match - (ifThenElse - {Bool} - (equalsInteger x 15) - True - False) + (ifThenElse {Bool} b True False) {List string -> List string} (\(ds : List string) -> Cons {string} "f" ds) @@ -228,7 +262,7 @@ let {all dead. dead}) {all dead. dead}) {all dead. dead} - !w : bytestring = #5468697320697320616e206578616d706c65 + !s : bytestring = #5468697320697320616e206578616d706c65 !x : integer = -1234567890 in letrec @@ -244,9 +278,6 @@ letrec {all dead. dead} in let - !`$fShowInteger_$cshowsPrec` - : integer -> integer -> List string -> List string - = \(w : integer) (w : integer) -> `$w$cshowsPrec` w data (Tuple2 :: * -> * -> *) a b | Tuple2_match where Tuple2 : a -> b -> Tuple2 a b in @@ -263,8 +294,11 @@ letrec (\(y : a) (ys : List a) -> /\dead -> + let + !b : bool = equalsInteger ds 1 + in Bool_match - (ifThenElse {Bool} (equalsInteger ds 1) True False) + (ifThenElse {Bool} b True False) {all dead. Tuple2 (List a) (List a)} (/\dead -> Tuple2 @@ -297,47 +331,15 @@ letrec {string} ds {all dead. integer} - (/\dead -> eta) + (/\dead -> divideInteger eta 2) (\(x : string) (xs : List string) -> /\dead -> go xs (addInteger eta 1)) {all dead. dead} in -let - data (UTuple2 :: * -> * -> *) a b | UTuple2_match where - UTuple2 : a -> b -> UTuple2 a b -in letrec !concatBuiltinStrings : List string -> string = \(ds : List string) -> - let - ~ds : Tuple2 (List string) (List string) - = let - !w : integer = divideInteger (go ds 0) 2 - in - UTuple2_match - {List string} - {List string} - (Bool_match - (ifThenElse {Bool} (lessThanEqualsInteger w 0) True False) - {all dead. UTuple2 (List string) (List string)} - (/\dead -> - UTuple2 {List string} {List string} (Nil {string}) ds) - (/\dead -> - Tuple2_match - {List string} - {List string} - (go {string} w ds) - {UTuple2 (List string) (List string)} - (\(ww : List string) - (ww : List string) -> - UTuple2 {List string} {List string} ww ww)) - {all dead. dead}) - {Tuple2 (List string) (List string)} - (\(ww : List string) - (ww : List string) -> - Tuple2 {List string} {List string} ww ww) - in Nil_match {string} ds @@ -353,34 +355,42 @@ letrec (\(ipv : string) (ipv : List string) -> /\dead -> - appendString - (Tuple2_match - {List string} - {List string} - ds - {string} - (\(ys : List string) - (zs : List string) -> - concatBuiltinStrings ys)) - (Tuple2_match - {List string} - {List string} - ds - {string} - (\(ys : List string) - (zs : List string) -> - concatBuiltinStrings zs))) + Tuple2_match + {List string} + {List string} + (let + !n : integer = go (Cons {string} x ds) 0 + !xs : List string = Cons {string} x ds + !b : bool = lessThanEqualsInteger n 0 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. Tuple2 (List string) (List string)} + (/\dead -> + Tuple2 {List string} {List string} (Nil {string}) xs) + (/\dead -> go {string} n xs) + {all dead. dead}) + {string} + (\(ipv : List string) + (ipv : List string) -> + appendString + (concatBuiltinStrings ipv) + (concatBuiltinStrings ipv))) {all dead. dead}) in let !`$fShowInteger_$cshow` : integer -> string = \(x : integer) -> - concatBuiltinStrings (`$fShowInteger_$cshowsPrec` 0 x (Nil {string})) + concatBuiltinStrings + (`$fShowBuiltinByteString_$cshowsPrec` 0 x (Nil {string})) data (Show :: * -> *) a | Show_match where CConsShow : (integer -> a -> List string -> List string) -> (a -> string) -> Show a ~`$fShowInteger` : Show integer - = CConsShow {integer} `$fShowInteger_$cshowsPrec` `$fShowInteger_$cshow` + = CConsShow + {integer} + `$fShowBuiltinByteString_$cshowsPrec` + `$fShowInteger_$cshow` data (Tuple5 :: * -> * -> * -> * -> * -> *) a b c d e | Tuple5_match where Tuple5 : a -> b -> c -> d -> e -> Tuple5 a b c d e !showsPrec : all a. Show a -> integer -> a -> List string -> List string @@ -398,20 +408,29 @@ let = trace {integer} (concatBuiltinStrings - (foldr - {integer} - {List string -> List string} - (\(i : integer) -> - let - ~x : integer = indexByteString w i - in - \(acc : List string -> List string) - (x : List string) -> - toHex (divideInteger x 16) (toHex (modInteger x 16) (acc x))) - (id {List string}) - (`$fEnumBool_$cenumFromTo` - 0 - (subtractInteger (lengthOfByteString w) 1)) + ((let + !len : integer = lengthOfByteString s + in + foldr + {integer} + {List string -> List string} + (\(i : integer) + (acc : List string -> List string) + (eta : List string) -> + (let + !x : integer = indexByteString s i + in + \(eta : List string) -> + let + !f : List string -> List string + = toHex (divideInteger x 16) + !g : List string -> List string + = toHex (modInteger x 16) + in + f (g eta)) + (acc eta)) + (id {List string}) + (`$fEnumBool_$cenumFromTo` 0 (subtractInteger len 1))) (Nil {string}))) a !d : integer @@ -447,7 +466,7 @@ let (\(ds : List string) -> Cons {string} "[]" ds) (\(x : integer) (xs : List integer) - (x : List string) -> + (eta : List string) -> Cons {string} "[" @@ -458,83 +477,82 @@ let {List string -> List string} (\(a : integer) (acc : List string -> List string) - (x : List string) -> - Cons {string} "," (showElem a (acc x))) + (eta : List string) -> + Cons {string} "," (showElem a (acc eta))) (id {List string}) xs - (Cons {string} "]" x))))) + (Cons {string} "]" eta))))) (Nil {string}))) d - !x : integer - = trace - {integer} - (let - !w : Show integer = `$fShowInteger` - !w : Show integer = `$fShowInteger` - !w : Show integer = `$fShowInteger` - !w : Show integer = `$fShowInteger` - !w : Show integer = `$fShowInteger` - !w : Tuple5 integer integer integer integer integer - = Tuple5 {integer} {integer} {integer} {integer} {integer} a a c d e - in - Tuple5_match +in +multiplyInteger + (trace + {integer} + (let + !`$dShow` : Show integer = `$fShowInteger` + !`$dShow` : Show integer = `$fShowInteger` + !`$dShow` : Show integer = `$fShowInteger` + !`$dShow` : Show integer = `$fShowInteger` + !`$dShow` : Show integer = `$fShowInteger` + !x : Tuple5 integer integer integer integer integer + = Tuple5 {integer} {integer} {integer} {integer} {integer} a a c d e + in + concatBuiltinStrings + (Tuple5_match {integer} {integer} {integer} {integer} {integer} - w - {string} - (\(ww : integer) - (ww : integer) - (ww : integer) - (ww : integer) - (ww : integer) -> - concatBuiltinStrings - (let - !x : List string = Nil {string} - in - Cons - {string} - "(" - (showsPrec - {integer} - w - 0 - ww - (Cons - {string} - "," - (showsPrec - {integer} - w - 0 - ww - (Cons - {string} - "," - (showsPrec - {integer} - w - 0 - ww - (Cons - {string} - "," - (showsPrec - {integer} - w - 0 - ww - (Cons - {string} - "," - (showsPrec - {integer} - w - 0 - ww - (Cons {string} ")" x))))))))))))) - e -in -multiplyInteger x 2 \ No newline at end of file + x + {List string -> List string} + (\(ipv : integer) + (ipv : integer) + (ipv : integer) + (ipv : integer) + (ipv : integer) + (x : List string) -> + Cons + {string} + "(" + (showsPrec + {integer} + `$dShow` + 0 + ipv + (Cons + {string} + "," + (showsPrec + {integer} + `$dShow` + 0 + ipv + (Cons + {string} + "," + (showsPrec + {integer} + `$dShow` + 0 + ipv + (Cons + {string} + "," + (showsPrec + {integer} + `$dShow` + 0 + ipv + (Cons + {string} + "," + (showsPrec + {integer} + `$dShow` + 0 + ipv + (Cons {string} ")" x))))))))))) + (Nil {string}))) + e) + 2 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/show.uplc-readable.golden b/plutus-tx-plugin/test/Budget/show.uplc-readable.golden index ab6a2523ce1..1d1fa6deade 100644 --- a/plutus-tx-plugin/test/Budget/show.uplc-readable.golden +++ b/plutus-tx-plugin/test/Budget/show.uplc-readable.golden @@ -3,208 +3,208 @@ program 1.1.0 ((\fix1 -> (\go -> (\foldr -> (\id -> - (\`$w$cshowsPrec` -> + (\`$fShowBuiltinByteString_$cshowsPrec` -> (\x -> - (\w -> + (\s -> (\toHex -> (\`$fEnumBool_$cenumFromTo` -> - (\`$fShowInteger_$cshowsPrec` -> + (\go -> (\go -> - (\go -> - (\concatBuiltinStrings -> - (\`$fShowInteger_$cshow` -> - (\a -> - (\c -> - (\d -> - (\showsPrec -> - (\`$fShowInteger` -> - (\e -> - (\x -> - multiplyInteger - x - 2) - (force trace - (concatBuiltinStrings - (constr 1 [ "(" - , (showsPrec - `$fShowInteger` - 0 - a - (constr 1 [ "," - , (showsPrec - `$fShowInteger` - 0 - a - (constr 1 [ "," - , (showsPrec - `$fShowInteger` - 0 - c - (constr 1 [ "," - , (showsPrec - `$fShowInteger` - 0 - d - (constr 1 [ "," - , (showsPrec - `$fShowInteger` - 0 - e - (constr 1 [ ")" - , (constr 0 [ ]) ])) ])) ])) ])) ])) ])) - e)) + (\concatBuiltinStrings -> + (\`$fShowInteger_$cshow` -> + (\a -> + (\c -> + (\d -> + (\showsPrec -> + (\`$fShowInteger` -> + (\e -> + multiplyInteger (force trace (concatBuiltinStrings - ((\showElem -> - constr 1 [ "[" - , (showElem - a - (force (force (foldr - (delay (\x -> - x)))) - (\a - acc - x -> - constr 1 [ "," - , (showElem - a - (acc - x)) ]) - id - (constr 1 [ a - , (constr 1 [ c - , (constr 1 [ d - , (constr 0 [ ]) ]) ]) ]) - (constr 1 [ "]" - , (constr 0 [ ]) ]))) ]) - (showsPrec - `$fShowInteger` - 0))) - d)) - (constr 0 [ `$fShowInteger_$cshowsPrec` - , `$fShowInteger_$cshow` ])) - (\v -> - case v [ (\v - v -> - v) ])) - (force trace - (case (force ifThenElse - (lessThanEqualsInteger - c - 0) - (constr 1 [ ]) - (constr 0 [ ])) [ "True" - , "False" ]) - c)) + (constr 1 [ "(" + , (showsPrec + `$fShowInteger` + 0 + a + (constr 1 [ "," + , (showsPrec + `$fShowInteger` + 0 + a + (constr 1 [ "," + , (showsPrec + `$fShowInteger` + 0 + c + (constr 1 [ "," + , (showsPrec + `$fShowInteger` + 0 + d + (constr 1 [ "," + , (showsPrec + `$fShowInteger` + 0 + e + (constr 1 [ ")" + , (constr 0 [ ]) ])) ])) ])) ])) ])) ])) + e) + 2) + (force trace + (concatBuiltinStrings + ((\showElem -> + constr 1 [ "[" + , (showElem + a + (force (force (foldr + (delay (\x -> + x)))) + (\a + acc + eta -> + constr 1 [ "," + , (showElem + a + (acc + eta)) ]) + id + (constr 1 [ a + , (constr 1 [ c + , (constr 1 [ d + , (constr 0 [ ]) ]) ]) ]) + (constr 1 [ "]" + , (constr 0 [ ]) ]))) ]) + (showsPrec + `$fShowInteger` + 0))) + d)) + (constr 0 [ `$fShowBuiltinByteString_$cshowsPrec` + , `$fShowInteger_$cshow` ])) + (\v -> + case v [ (\v + v -> + v) ])) (force trace - (concatBuiltinStrings - (force (force (foldr + (case (force ifThenElse + (lessThanEqualsInteger + c + 0) + (constr 1 [ ]) + (constr 0 [ ])) [ "True" + , "False" ]) + c)) + (force trace + (concatBuiltinStrings + ((\len -> + force (force (foldr (delay (\x -> x)))) (\i acc - x -> - toHex - (divideInteger - (indexByteString - w - i) - 16) - (toHex - (modInteger - (indexByteString - w - i) - 16) - (acc - x))) + eta -> + (\x + eta -> + (\f -> + (\g -> + f + (g + eta)) + (toHex + (modInteger + x + 16))) + (toHex + (divideInteger + x + 16))) + (indexByteString + s + i) + (acc + eta)) id (`$fEnumBool_$cenumFromTo` 0 (subtractInteger - (lengthOfByteString - w) - 1)) - (constr 0 [ ]))) - a)) - (force trace - (`$fShowInteger_$cshow` - x) - x)) - (\x -> - concatBuiltinStrings - (`$fShowInteger_$cshowsPrec` - 0 - x - (constr 0 [ ])))) - (fix1 - (\concatBuiltinStrings - ds -> - case ds [ "" - , (\x - ds -> - force (case ds [ (delay x) - , (\ipv - ipv -> - delay ((\ds -> - appendString - (case (force ds) [ (\ys - zs -> - concatBuiltinStrings - ys) ]) - (case (force ds) [ (\ys - zs -> - concatBuiltinStrings - zs) ])) - (delay ((\w -> - case (force (case (force ifThenElse - (lessThanEqualsInteger - w - 0) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay (constr 0 [ (constr 0 [ ]) - , ds ])) - , (delay (case (force (go - (delay (\x -> - x))) - w - ds) [ (\ww - ww -> - constr 0 [ ww - , ww ]) ])) ])) [ (\ww - ww -> - constr 0 [ ww - , ww ]) ]) - (divideInteger - (go - ds - 0) - 2))))) ])) ]))) + len + 1))) + (lengthOfByteString + s) + (constr 0 [ ]))) + a)) + (force trace + (`$fShowInteger_$cshow` + x) + x)) + (\x -> + concatBuiltinStrings + (`$fShowBuiltinByteString_$cshowsPrec` + 0 + x + (constr 0 [])))) (fix1 - (\go - ds - eta -> - force (case ds [ (delay eta) - , (\x - xs -> - delay (go - xs - (addInteger - eta - 1))) ])))) + (\concatBuiltinStrings + ds -> + case ds [ "" + , (\x + ds -> + force (case ds [ (delay x) + , (\ipv + ipv -> + delay (case ((\n -> + (\xs -> + (\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay (constr 0 [ (constr 0 [ ]) + , xs ])) + , (delay (force (go + (delay (\x -> + x))) + n + xs)) ])) + (lessThanEqualsInteger + n + 0)) + (constr 1 [ x + , ds ])) + (go + (constr 1 [ x + , ds ]) + 0)) [ (\ipv + ipv -> + appendString + (concatBuiltinStrings + ipv) + (concatBuiltinStrings + ipv)) ])) ])) ]))) (fix1 (\go - arg -> - delay (\ds - ds -> - force (case ds [ (delay (constr 0 [ (constr 0 [ ]) - , (constr 0 [ ]) ])) - , (\y - ys -> - delay (force (case (force ifThenElse - (equalsInteger - ds - 1) + ds + eta -> + force (case ds [ (delay (divideInteger + eta + 2)) + , (\x + xs -> + delay (go + xs + (addInteger + eta + 1))) ])))) + (fix1 + (\go + arg -> + delay (\ds + ds -> + force (case ds [ (delay (constr 0 [ (constr 0 [ ]) + , (constr 0 [ ]) ])) + , (\y + ys -> + delay ((\b -> + force (case (force ifThenElse + b (constr 0 [ ]) (constr 1 [ ])) [ (delay (constr 0 [ (constr 1 [ y , (constr 0 [ ]) ]) @@ -219,8 +219,10 @@ program 1.1.0 ((\fix1 -> ws -> constr 0 [ (constr 1 [ y , zs ]) - , ws ]) ])) ]))) ]))))) - (\w w -> `$w$cshowsPrec` w)) + , ws ]) ])) ])) + (equalsInteger + ds + 1))) ]))))) (fix1 (\`$fEnumBool_$cenumFromTo` x @@ -238,152 +240,191 @@ program 1.1.0 ((\fix1 -> 1) y) ])) ])))) (\x -> - force (case (force ifThenElse - (lessThanEqualsInteger - x - 9) - (constr 0 []) - (constr 1 [ ])) [ (delay (`$w$cshowsPrec` - x)) - , (delay (force (case (force ifThenElse - (equalsInteger - x - 10) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay (\ds -> - constr 1 [ "a" - , ds ])) - , (delay (force (case (force ifThenElse - (equalsInteger - x - 11) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay (\ds -> - constr 1 [ "b" - , ds ])) - , (delay (force (case (force ifThenElse - (equalsInteger - x - 12) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay (\ds -> - constr 1 [ "c" - , ds ])) - , (delay (force (case (force ifThenElse - (equalsInteger - x - 13) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay (\ds -> - constr 1 [ "d" - , ds ])) - , (delay (force (case (force ifThenElse - (equalsInteger - x - 14) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay (\ds -> - constr 1 [ "e" - , ds ])) - , (delay (case (force ifThenElse - (equalsInteger - x - 15) - (constr 0 [ ]) - (constr 1 [ ])) [ (\ds -> - constr 1 [ "f" - , ds ]) - , (\ds -> - constr 1 [ "" - , ds ]) ])) ]))) ]))) ]))) ]))) ]))) ]))) + (\b -> + force (case (force ifThenElse + b + (constr 0 []) + (constr 1 [ ])) [ (delay (`$fShowBuiltinByteString_$cshowsPrec` + 0 + x)) + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay (\ds -> + constr 1 [ "a" + , ds ])) + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay (\ds -> + constr 1 [ "b" + , ds ])) + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay (\ds -> + constr 1 [ "c" + , ds ])) + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay (\ds -> + constr 1 [ "d" + , ds ])) + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay (\ds -> + constr 1 [ "e" + , ds ])) + , (delay ((\b -> + case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (\ds -> + constr 1 [ "f" + , ds ]) + , (\ds -> + constr 1 [ "" + , ds ]) ]) + (equalsInteger + x + 15))) ])) + (equalsInteger + x + 14))) ])) + (equalsInteger + x + 13))) ])) + (equalsInteger + x + 12))) ])) + (equalsInteger + x + 11))) ])) + (equalsInteger + x + 10))) ])) + (lessThanEqualsInteger x 9))) #5468697320697320616e206578616d706c65) -1234567890) (fix1 - (\`$w$cshowsPrec` - w -> - force (case (force ifThenElse - (lessThanInteger w 0) - (constr 0 []) - (constr 1 [ ])) [ (delay (\x -> - constr 1 [ "-" - , (`$w$cshowsPrec` - (subtractInteger - 0 - w) - x) ])) - , (delay (force (force (foldr - (delay (\x -> - x)))) - (\digit - acc - x -> - constr 1 [ (force (case (force ifThenElse - (equalsInteger - digit - 0) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "0") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 1) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "1") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 2) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "2") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 3) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "3") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 4) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "4") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 5) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "5") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 6) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "6") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 7) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "7") - , (delay (force (case (force ifThenElse - (equalsInteger - digit - 8) - (constr 0 [ ]) - (constr 1 [ ])) [ (delay "8") - , (delay (case (force ifThenElse - (equalsInteger - digit - 9) - (constr 0 [ ]) - (constr 1 [ ])) [ "9" - , "" ])) ]))) ]))) ]))) ]))) ]))) ]))) ]))) ]))) ])) - , (acc - x) ]) - id - (go - (constr 0 [ ]) - w))) ])))) + (\`$fShowBuiltinByteString_$cshowsPrec` + p + n -> + (\b -> + force (case (force ifThenElse + b + (constr 0 []) + (constr 1 [ ])) [ (delay (\eta -> + (\g -> + constr 1 [ "-" + , (g + eta) ]) + (`$fShowBuiltinByteString_$cshowsPrec` + p + (subtractInteger + 0 + n)))) + , (delay (force (force (foldr + (delay (\x -> + x)))) + (\digit + acc + eta -> + constr 1 [ ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "0") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "1") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "2") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "3") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "4") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "5") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "6") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "7") + , (delay ((\b -> + force (case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ (delay "8") + , (delay ((\b -> + case (force ifThenElse + b + (constr 0 [ ]) + (constr 1 [ ])) [ "9" + , "" ]) + (equalsInteger + digit + 9))) ])) + (equalsInteger + digit + 8))) ])) + (equalsInteger + digit + 7))) ])) + (equalsInteger + digit + 6))) ])) + (equalsInteger + digit + 5))) ])) + (equalsInteger + digit + 4))) ])) + (equalsInteger + digit + 3))) ])) + (equalsInteger + digit + 2))) ])) + (equalsInteger + digit + 1))) ])) + (equalsInteger + digit + 0)) + , (acc + eta) ]) + id + (go + (constr 0 [ ]) + n))) ])) + (lessThanInteger n 0)))) (\x -> x)) (fix1 (\foldr @@ -406,22 +447,22 @@ program 1.1.0 ((\fix1 -> (\go acc n -> - force (case (force ifThenElse - (equalsInteger - (quotientInteger n y) - 0) - (constr 0 []) - (constr 1 [ ])) [ (delay (constr 1 [ (remainderInteger - n - y) - , acc ])) - , (delay (go - (constr 1 [ (remainderInteger - n - y) - , acc ]) - (quotientInteger - n - y))) ])))) + (\x -> + (\b -> + force (case (force ifThenElse + b + (constr 0 []) + (constr 1 [ ])) [ (delay (constr 1 [ (remainderInteger + n + y) + , acc ])) + , (delay (go + (constr 1 [ (remainderInteger + n + y) + , acc ]) + x)) ])) + (equalsInteger x 0)) + (quotientInteger n y)))) 10) (\f -> (\s -> s s) (\s x -> f (s s) x))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/sum.pir-readable.golden b/plutus-tx-plugin/test/Budget/sum.pir-readable.golden index da4a46f0c9d..f188c9d0895 100644 --- a/plutus-tx-plugin/test/Budget/sum.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/sum.pir-readable.golden @@ -6,6 +6,15 @@ in let data (AdditiveMonoid :: * -> *) a | AdditiveMonoid_match where CConsAdditiveMonoid : (\a -> a -> a -> a) a -> a -> AdditiveMonoid a + !ls : List integer + = (let + a = List integer + in + \(c : integer -> a -> a) + (n : a) -> + c 1 (c 2 (c 3 (c 4 (c 5 (c 6 (c 7 (c 8 (c 9 (c 10 n)))))))))) + (\(ds : integer) (ds : List integer) -> Cons {integer} ds ds) + (Nil {integer}) in (let !`$dAdditiveMonoid` : AdditiveMonoid integer @@ -38,11 +47,4 @@ in {all dead. dead} in \(eta : List integer) -> go eta) - ((let - a = List integer - in - \(c : integer -> a -> a) - (n : a) -> - c 1 (c 2 (c 3 (c 4 (c 5 (c 6 (c 7 (c 8 (c 9 (c 10 n)))))))))) - (\(ds : integer) (ds : List integer) -> Cons {integer} ds ds) - (Nil {integer})) \ No newline at end of file + ls \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/toFromData.budget.golden b/plutus-tx-plugin/test/Budget/toFromData.budget.golden index 0663c223a85..f9ce4709943 100644 --- a/plutus-tx-plugin/test/Budget/toFromData.budget.golden +++ b/plutus-tx-plugin/test/Budget/toFromData.budget.golden @@ -1,2 +1,2 @@ -({cpu: 10741457 -| mem: 30692}) \ No newline at end of file +({cpu: 7866288 +| mem: 21228}) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Budget/toFromData.pir-readable.golden b/plutus-tx-plugin/test/Budget/toFromData.pir-readable.golden index ea583bdfc86..38605c9468a 100644 --- a/plutus-tx-plugin/test/Budget/toFromData.pir-readable.golden +++ b/plutus-tx-plugin/test/Budget/toFromData.pir-readable.golden @@ -1,6 +1,4 @@ let - data Unit | Unit_match where - Unit : Unit data (Tuple3 :: * -> * -> * -> *) a b c | Tuple3_match where Tuple3 : a -> b -> c -> Tuple3 a b c data Bool | Bool_match where @@ -13,6 +11,11 @@ let Just : a -> Maybe a Nothing : Maybe a !reconstructCaseError : string = "PT1" + 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} !unitval : unit = () in (let @@ -43,15 +46,7 @@ in = headList {data} (sndPair {integer} {list data} tup) in Left {integer} {b} (`$dUnsafeFromData` arg)) - (\(ds : unit) -> - let - !thunk : unit - = let - !wild : Unit = trace {Unit} reconstructCaseError Unit - in - unitval - in - error {Either integer b}) + (\(ds : unit) -> traceError {Either integer b} reconstructCaseError) unitval) unitval) unIData @@ -63,111 +58,75 @@ in let !tup : pair integer (list data) = unConstrData d !index : integer = fstPair {integer} {list data} tup + !arg : data = headList {data} (sndPair {integer} {list data} tup) in ifThenElse {unit -> Maybe a} (equalsInteger index 0) - (\(ds : unit) -> - let - !arg : data = headList {data} (sndPair {integer} {list data} tup) - in - Just {a} (`$dUnsafeFromData` arg)) + (\(ds : unit) -> Just {a} (`$dUnsafeFromData` arg)) (\(ds : unit) -> ifThenElse {unit -> Maybe a} (equalsInteger index 1) (\(ds : unit) -> Nothing {a}) - (\(ds : unit) -> - let - !thunk : unit - = let - !wild : Unit = trace {Unit} reconstructCaseError Unit - in - unitval - in - error {Maybe a}) + (\(ds : unit) -> traceError {Maybe a} reconstructCaseError) unitval) unitval) (\(d : data) -> let !tup : pair integer (list data) = unConstrData d - ~t : list data = sndPair {integer} {list data} tup - ~t : list data = tailList {data} t !index : integer = fstPair {integer} {list data} tup + !t : list data = sndPair {integer} {list data} tup + !arg : data = headList {data} t + !t : list data = tailList {data} t + !arg : data = headList {data} t + !arg : data = headList {data} (tailList {data} t) in ifThenElse {unit -> Tuple3 Bool integer Bool} (equalsInteger index 0) (\(ds : unit) -> - let - !arg : data = headList {data} t - !arg : data = headList {data} t - !arg : data = headList {data} (tailList {data} t) - in Tuple3 {Bool} {integer} {Bool} (let - !tup : pair integer (list data) = unConstrData arg - !index : integer = fstPair {integer} {list data} tup + !index : integer + = fstPair {integer} {list data} (unConstrData arg) + !fallthrough : Bool + = ifThenElse + {unit -> Bool} + (equalsInteger index 0) + (\(ds : unit) -> False) + (\(ds : unit) -> traceError {Bool} reconstructCaseError) + unitval in ifThenElse {unit -> Bool} (equalsInteger index 1) (\(ds : unit) -> True) - (\(ds : unit) -> - ifThenElse - {unit -> Bool} - (equalsInteger index 0) - (\(ds : unit) -> False) - (\(ds : unit) -> - let - !thunk : unit - = let - !wild : Unit - = trace {Unit} reconstructCaseError Unit - in - unitval - in - error {Bool}) - unitval) + (\(ds : unit) -> fallthrough) unitval) (unIData arg) (let - !tup : pair integer (list data) = unConstrData arg - !index : integer = fstPair {integer} {list data} tup + !index : integer + = fstPair {integer} {list data} (unConstrData arg) + !fallthrough : Bool + = ifThenElse + {unit -> Bool} + (equalsInteger index 0) + (\(ds : unit) -> False) + (\(ds : unit) -> traceError {Bool} reconstructCaseError) + unitval in ifThenElse {unit -> Bool} (equalsInteger index 1) (\(ds : unit) -> True) - (\(ds : unit) -> - ifThenElse - {unit -> Bool} - (equalsInteger index 0) - (\(ds : unit) -> False) - (\(ds : unit) -> - let - !thunk : unit - = let - !wild : Unit - = trace {Unit} reconstructCaseError Unit - in - unitval - in - error {Bool}) - unitval) + (\(ds : unit) -> fallthrough) unitval)) (\(ds : unit) -> - let - !thunk : unit - = let - !wild : Unit = trace {Unit} reconstructCaseError Unit - in - unitval - in - error {Tuple3 Bool integer Bool}) + traceError {Tuple3 Bool integer Bool} reconstructCaseError) unitval)) ((let b = Maybe (Tuple3 Bool integer Bool) @@ -201,33 +160,33 @@ in (mkCons {data} (`$dToData` arg) (mkNilData unitval))) (/\dead -> constrData 1 (mkNilData unitval)) {all dead. dead}) - (\(w : Tuple3 Bool integer Bool) -> + (\(ds : Tuple3 Bool integer Bool) -> Tuple3_match {Bool} {integer} {Bool} - w + ds {data} - (\(ww : Bool) - (ww : integer) - (ww : Bool) -> + (\(arg : Bool) + (arg : integer) + (arg : Bool) -> constrData 0 (mkCons {data} (Bool_match - ww + arg {all dead. data} (/\dead -> constrData 1 (mkNilData unitval)) (/\dead -> constrData 0 (mkNilData unitval)) {all dead. dead}) (mkCons {data} - (iData ww) + (iData arg) (mkCons {data} (Bool_match - ww + arg {all dead. data} (/\dead -> constrData 1 (mkNilData unitval)) (/\dead -> constrData 0 (mkNilData unitval)) diff --git a/plutus-tx-plugin/test/Budget/toFromData.uplc-readable.golden b/plutus-tx-plugin/test/Budget/toFromData.uplc-readable.golden index 45ad7febec6..0bca40ed52c 100644 --- a/plutus-tx-plugin/test/Budget/toFromData.uplc-readable.golden +++ b/plutus-tx-plugin/test/Budget/toFromData.uplc-readable.golden @@ -1,154 +1,136 @@ program 1.1.0 ((\unitval -> - (\reconstructCaseError - d -> - (\tup -> - (\index -> - force ifThenElse - (equalsInteger index 1) - (\ds -> - (\arg -> - constr 1 [ ((\tup -> - (\index -> - force ifThenElse - (equalsInteger index 0) - (\ds -> - (\arg -> - constr 0 [ ((\tup -> - (\index -> - force ifThenElse - (equalsInteger - index - 0) - (\ds -> - (\t -> - (\arg -> - (\t -> - (\arg -> - (\arg -> - constr 0 [ ((\tup -> - (\index -> - force ifThenElse - (equalsInteger - index - 1) - (\ds -> - constr 0 [ ]) - (\ds -> - force ifThenElse - (equalsInteger - index - 0) - (\ds -> - constr 1 [ ]) - (\ds -> - (\thunk -> - error) - ((\wild -> - unitval) - (force trace - reconstructCaseError - (constr 0 [ ])))) - unitval) - unitval) + (\traceError -> + (\reconstructCaseError + d -> + (\tup -> + (\index -> + force ifThenElse + (equalsInteger index 1) + (\ds -> + (\arg -> + constr 1 [ ((\tup -> + (\index -> + (\arg -> + force ifThenElse + (equalsInteger + index + 0) + (\ds -> + constr 0 [ ((\tup -> + (\index -> + (\t -> + (\arg -> + (\t -> + (\arg -> + (\arg -> + force ifThenElse + (equalsInteger + index + 0) + (\ds -> + constr 0 [ ((\index -> + (\fallthrough -> + force ifThenElse + (equalsInteger + index + 1) + (\ds -> + constr 0 [ ]) + (\ds -> + fallthrough) + unitval) + (force ifThenElse + (equalsInteger + index + 0) + (\ds -> + constr 1 [ ]) + (\ds -> + traceError + reconstructCaseError) + unitval)) (force (force fstPair) - tup)) - (unConstrData - arg)) - , (unIData - arg) - , ((\tup -> - (\index -> - force ifThenElse - (equalsInteger - index - 1) - (\ds -> - constr 0 [ ]) - (\ds -> - force ifThenElse - (equalsInteger - index - 0) - (\ds -> - constr 1 [ ]) - (\ds -> - (\thunk -> - error) - ((\wild -> - unitval) - (force trace - reconstructCaseError - (constr 0 [ ])))) - unitval) - unitval) + (unConstrData + arg))) + , (unIData + arg) + , ((\index -> + (\fallthrough -> + force ifThenElse + (equalsInteger + index + 1) + (\ds -> + constr 0 [ ]) + (\ds -> + fallthrough) + unitval) + (force ifThenElse + (equalsInteger + index + 0) + (\ds -> + constr 1 [ ]) + (\ds -> + traceError + reconstructCaseError) + unitval)) (force (force fstPair) - tup)) - (unConstrData - arg)) ]) - (force headList - (force tailList - (force t)))) - (force headList - (force t))) - (delay (force tailList - (force t)))) - (force headList - (force t))) - (delay (force (force sndPair) - tup))) - (\ds -> - (\thunk -> - error) - ((\wild -> - unitval) - (force trace - reconstructCaseError - (constr 0 [ ])))) - unitval) - (force (force fstPair) - tup)) - (unConstrData - arg)) ]) - (force headList - (force (force sndPair) - tup))) - (\ds -> - force ifThenElse - (equalsInteger - index - 1) - (\ds -> constr 1 []) - (\ds -> - (\thunk -> - error) - ((\wild -> - unitval) - (force trace - reconstructCaseError - (constr 0 [ ])))) - unitval) - unitval) - (force (force fstPair) tup)) - (unConstrData arg)) ]) - (force headList (force (force sndPair) tup))) - (\ds -> - force ifThenElse - (equalsInteger index 0) - (\ds -> - (\arg -> constr 0 [(unIData arg)]) - (force headList - (force (force sndPair) tup))) - (\ds -> - (\thunk -> error) - ((\wild -> unitval) - (force trace - reconstructCaseError - (constr 0 [])))) - unitval) - unitval) - (force (force fstPair) tup)) - (unConstrData d)) - "PT1" + (unConstrData + arg))) ]) + (\ds -> + traceError + reconstructCaseError) + unitval) + (force headList + (force tailList + t))) + (force headList + t)) + (force tailList + t)) + (force headList + t)) + (force (force sndPair) + tup)) + (force (force fstPair) + tup)) + (unConstrData + arg)) ]) + (\ds -> + force ifThenElse + (equalsInteger + index + 1) + (\ds -> + constr 1 [ ]) + (\ds -> + traceError + reconstructCaseError) + unitval) + unitval) + (force headList + (force (force sndPair) + tup))) + (force (force fstPair) + tup)) + (unConstrData arg)) ]) + (force headList + (force (force sndPair) tup))) + (\ds -> + force ifThenElse + (equalsInteger index 0) + (\ds -> + (\arg -> constr 0 [(unIData arg)]) + (force headList + (force (force sndPair) tup))) + (\ds -> traceError reconstructCaseError) + unitval) + unitval) + (force (force fstPair) tup)) + (unConstrData d)) + "PT1") + (\str -> (\x -> error) (force trace str (constr 0 []))) (constrData 1 (force mkCons diff --git a/plutus-tx-plugin/test/IsData/deconstructData.pir.golden b/plutus-tx-plugin/test/IsData/deconstructData.pir.golden index 77cfe94ffca..68b289c3911 100644 --- a/plutus-tx-plugin/test/IsData/deconstructData.pir.golden +++ b/plutus-tx-plugin/test/IsData/deconstructData.pir.golden @@ -2,9 +2,6 @@ 1.1.0 (let (nonrec) - (datatypebind - (datatype (tyvardecl Unit (type)) Unit_match (vardecl Unit Unit)) - ) (datatypebind (datatype (tyvardecl Tuple2 (fun (type) (fun (type) (type)))) @@ -13,24 +10,6 @@ (vardecl Tuple2 (fun a (fun b [ [ Tuple2 a ] b ]))) ) ) - (termbind - (strict) - (vardecl - chooseData - (all - a (type) (fun (con data) (fun a (fun a (fun a (fun a (fun a a)))))) - ) - ) - (builtin chooseData) - ) - (termbind - (strict) - (vardecl - chooseList - (all a (type) (all b (type) (fun [ (con list) a ] (fun b (fun b b))))) - ) - (builtin chooseList) - ) (termbind (strict) (vardecl equalsInteger (fun (con integer) (fun (con integer) (con bool)))) @@ -46,18 +25,26 @@ ) (termbind (strict) - (vardecl fst (all a (type) (all b (type) (fun [ [ (con pair) a ] b ] a)))) - (builtin fstPair) + (vardecl ifThenElse (all a (type) (fun (con bool) (fun a (fun a a))))) + (builtin ifThenElse) ) (termbind (strict) - (vardecl head (all a (type) (fun [ (con list) a ] a))) - (builtin headList) + (vardecl + chooseData + (all + a (type) (fun (con data) (fun a (fun a (fun a (fun a (fun a a)))))) + ) + ) + (builtin chooseData) ) (termbind (strict) - (vardecl ifThenElse (all a (type) (fun (con bool) (fun a (fun a a))))) - (builtin ifThenElse) + (vardecl fst (all a (type) (all b (type) (fun [ [ (con pair) a ] b ] a)))) + (builtin fstPair) + ) + (datatypebind + (datatype (tyvardecl Unit (type)) Unit_match (vardecl Unit Unit)) ) (termbind (strict) @@ -66,10 +53,9 @@ ) (termbind (strict) - (vardecl tail (all a (type) (fun [ (con list) a ] [ (con list) a ]))) - (builtin tailList) + (vardecl unsafeDataAsB (fun (con data) (con bytestring))) + (builtin unBData) ) - (termbind (strict) (vardecl unitval (con unit)) (con unit ())) (termbind (strict) (vardecl @@ -80,243 +66,617 @@ ) (builtin unConstrData) ) + (termbind + (strict) + (vardecl unsafeDataAsI (fun (con data) (con integer))) + (builtin unIData) + ) + (termbind + (strict) + (vardecl unsafeDataAsList (fun (con data) [ (con list) (con data) ])) + (builtin unListData) + ) (termbind (strict) (vardecl - `$fFromDataTuple2_$cfromBuiltinData` + unsafeDataAsMap + (fun (con data) [ (con list) [ [ (con pair) (con data) ] (con data) ] ]) + ) + (builtin unMapData) + ) + (termbind + (strict) + (vardecl + matchData' (all - a + r (type) - (all - b - (type) + (fun + (con data) (fun - [ (lam a (type) (fun (con data) [ Maybe a ])) a ] + (fun (con integer) (fun [ (con list) (con data) ] r)) (fun - [ (lam a (type) (fun (con data) [ Maybe a ])) b ] - (fun (con data) [ Maybe [ [ Tuple2 a ] b ] ]) + (fun [ (con list) [ [ (con pair) (con data) ] (con data) ] ] r) + (fun + (fun [ (con list) (con data) ] r) + (fun (fun (con integer) r) (fun (fun (con bytestring) r) r)) + ) ) ) ) ) ) (abs - a + r (type) - (abs - b - (type) + (lam + d + (con data) (lam - `$dFromData` - [ (lam a (type) (fun (con data) [ Maybe a ])) a ] + constrCase + (fun (con integer) (fun [ (con list) (con data) ] r)) (lam - `$dFromData` - [ (lam a (type) (fun (con data) [ Maybe a ])) b ] + mapCase + (fun [ (con list) [ [ (con pair) (con data) ] (con data) ] ] r) (lam - d - (con data) - (let - (nonrec) - (termbind - (nonstrict) - (vardecl - tup - [ [ (con pair) (con integer) ] [ (con list) (con data) ] ] - ) - [ unsafeDataAsConstr d ] - ) - (termbind - (nonstrict) - (vardecl l [ (con list) (con data) ]) - [ { { snd (con integer) } [ (con list) (con data) ] } tup ] - ) - (termbind - (nonstrict) - (vardecl l [ (con list) (con data) ]) - [ { tail (con data) } l ] - ) - (termbind - (nonstrict) - (vardecl nilCase [ Maybe [ [ Tuple2 a ] b ] ]) - { + listCase + (fun [ (con list) (con data) ] r) + (lam + iCase + (fun (con integer) r) + (lam + bCase + (fun (con bytestring) r) + (let + (nonrec) + (termbind (strict) (vardecl d (con data)) d) + (termbind + (strict) + (vardecl + constrCase + (fun (con integer) (fun [ (con list) (con data) ] r)) + ) + constrCase + ) + (termbind + (strict) + (vardecl + mapCase + (fun + [ + (con list) + [ [ (con pair) (con data) ] (con data) ] + ] + r + ) + ) + mapCase + ) + (termbind + (strict) + (vardecl listCase (fun [ (con list) (con data) ] r)) + listCase + ) + (termbind + (strict) (vardecl iCase (fun (con integer) r)) iCase + ) + (termbind + (strict) (vardecl bCase (fun (con bytestring) r)) bCase + ) [ [ - { + [ [ - { Maybe_match a } - [ `$dFromData` [ { head (con data) } l ] ] - ] - (all dead (type) [ Maybe [ [ Tuple2 a ] b ] ]) - } - (lam - ipv - a - (abs - dead - (type) - { + [ [ - [ - { + [ { chooseData (fun Unit r) } d ] + (lam + ds + Unit + (let + (nonrec) + (termbind + (strict) + (vardecl + tup + [ + [ (con pair) (con integer) ] + [ (con list) (con data) ] + ] + ) + [ unsafeDataAsConstr d ] + ) [ - { Maybe_match b } [ - `$dFromData` [ { head (con data) } l ] + constrCase + [ + { + { fst (con integer) } + [ (con list) (con data) ] + } + tup + ] ] - ] - (all - dead (type) [ Maybe [ [ Tuple2 a ] b ] ] - ) - } - (lam - ipv - b - (abs - dead - (type) [ - { Just [ [ Tuple2 a ] b ] } - [ [ { { Tuple2 a } b } ipv ] ipv ] + { + { snd (con integer) } + [ (con list) (con data) ] + } + tup ] - ) + ] ) - ] - (abs - dead (type) { Nothing [ [ Tuple2 a ] b ] } ) ] - (all dead (type) dead) - } - ) - ) - ] - (abs dead (type) { Nothing [ [ Tuple2 a ] b ] }) - ] - (all dead (type) dead) - } - ) - (termbind - (nonstrict) - (vardecl lvl [ Maybe [ [ Tuple2 a ] b ] ]) - [ - [ - [ - [ - { - { chooseList (con data) } - (fun Unit [ Maybe [ [ Tuple2 a ] b ] ]) - } - [ { tail (con data) } l ] + (lam ds Unit [ mapCase [ unsafeDataAsMap d ] ]) + ] + (lam ds Unit [ listCase [ unsafeDataAsList d ] ]) + ] + (lam ds Unit [ iCase [ unsafeDataAsI d ] ]) ] - (lam ds Unit nilCase) + (lam ds Unit [ bCase [ unsafeDataAsB d ] ]) ] - (lam ds Unit { Nothing [ [ Tuple2 a ] b ] }) + Unit ] - Unit - ] + ) ) + ) + ) + ) + ) + ) + ) + ) + (termbind + (strict) + (vardecl + chooseList + (all a (type) (all b (type) (fun [ (con list) a ] (fun b (fun b b))))) + ) + (builtin chooseList) + ) + (termbind + (strict) + (vardecl head (all a (type) (fun [ (con list) a ] a))) + (builtin headList) + ) + (termbind + (strict) + (vardecl tail (all a (type) (fun [ (con list) a ] [ (con list) a ]))) + (builtin tailList) + ) + (termbind + (strict) + (vardecl + matchList + (all + a + (type) + (all + r + (type) + (fun + [ (con list) a ] (fun r (fun (fun a (fun [ (con list) a ] r)) r)) + ) + ) + ) + ) + (abs + a + (type) + (abs + r + (type) + (lam + l + [ (con list) a ] + (lam + nilCase + r + (lam + consCase + (fun a (fun [ (con list) a ] r)) + (let + (nonrec) + (termbind (strict) (vardecl l [ (con list) a ]) l) + (termbind (strict) (vardecl nilCase r) nilCase) (termbind - (nonstrict) - (vardecl lvl [ Maybe [ [ Tuple2 a ] b ] ]) - [ - [ - [ - [ - { - { chooseList (con data) } - (fun Unit [ Maybe [ [ Tuple2 a ] b ] ]) - } - l - ] - (lam ds Unit { Nothing [ [ Tuple2 a ] b ] }) - ] - (lam ds Unit lvl) - ] - Unit - ] + (strict) + (vardecl consCase (fun a (fun [ (con list) a ] r))) + consCase ) (termbind (nonstrict) - (vardecl x [ Maybe [ [ Tuple2 a ] b ] ]) + (vardecl lvl r) + [ [ consCase [ { head a } l ] ] [ { tail a } l ] ] + ) + [ [ [ - [ - [ - { - { chooseList (con data) } - (fun Unit [ Maybe [ [ Tuple2 a ] b ] ]) - } - l - ] - (lam ds Unit { Nothing [ [ Tuple2 a ] b ] }) - ] - (lam ds Unit lvl) + [ { { chooseList a } (fun Unit r) } l ] + (lam ds Unit nilCase) ] - Unit + (lam ds Unit lvl) ] - ) + Unit + ] + ) + ) + ) + ) + ) + ) + ) + (termbind (strict) (vardecl unitval (con unit)) (con unit ())) + (termbind + (strict) + (vardecl + `$fFromDataTuple2_$cfromBuiltinData` + (all + a + (type) + (all + b + (type) + (fun + [ (lam a (type) (fun (con data) [ Maybe a ])) a ] + (fun + [ (lam a (type) (fun (con data) [ Maybe a ])) b ] + (fun (con data) [ Maybe [ [ Tuple2 a ] b ] ]) + ) + ) + ) + ) + ) + (abs + a + (type) + (abs + b + (type) + (lam + `$dFromData` + [ (lam a (type) (fun (con data) [ Maybe a ])) a ] + (lam + `$dFromData` + [ (lam a (type) (fun (con data) [ Maybe a ])) b ] + (lam + d + (con data) + (let + (nonrec) + (termbind (strict) (vardecl d (con data)) d) [ [ [ [ [ - [ - [ - { - chooseData - (fun Unit [ Maybe [ [ Tuple2 a ] b ] ]) - } - d - ] + [ { matchData' [ Maybe [ [ Tuple2 a ] b ] ] } d ] + (lam + index + (con integer) (lam - ds - Unit - [ - [ + args + [ (con list) (con data) ] + (let + (nonrec) + (termbind + (strict) (vardecl index (con integer)) index + ) + (termbind + (strict) + (vardecl args [ (con list) (con data) ]) + args + ) + (termbind + (strict) + (vardecl + indexMatchCase + [ Maybe [ [ Tuple2 a ] b ] ] + ) [ [ - { - ifThenElse - (fun - (con unit) + [ + { + { matchList (con data) } [ Maybe [ [ Tuple2 a ] b ] ] + } + args + ] + { Nothing [ [ Tuple2 a ] b ] } + ] + (lam + arg + (con data) + (lam + t + [ (con list) (con data) ] + (let + (nonrec) + (termbind + (strict) + (vardecl arg (con data)) + arg + ) + (termbind + (strict) + (vardecl + t [ (con list) (con data) ] + ) + t + ) + [ + [ + [ + { + { matchList (con data) } + [ Maybe [ [ Tuple2 a ] b ] ] + } + t + ] + { Nothing [ [ Tuple2 a ] b ] } + ] + (lam + arg + (con data) + (lam + t + [ (con list) (con data) ] + (let + (nonrec) + (termbind + (strict) + (vardecl arg (con data)) + arg + ) + (termbind + (strict) + (vardecl + t + [ + (con list) (con data) + ] + ) + t + ) + [ + [ + [ + { + { + matchList + (con data) + } + [ + Maybe + [ [ Tuple2 a ] b ] + ] + } + t + ] + { + [ + [ + { + [ + { + Maybe_match + a + } + [ + `$dFromData` + arg + ] + ] + (all + dead + (type) + [ + Maybe + [ + [ + Tuple2 a + ] + b + ] + ] + ) + } + (lam + ipv + a + (abs + dead + (type) + { + [ + [ + { + [ + { + Maybe_match + b + } + [ + `$dFromData` + arg + ] + ] + (all + dead + (type) + [ + Maybe + [ + [ + Tuple2 + a + ] + b + ] + ] + ) + } + (lam + ipv + b + (abs + dead + (type) + [ + { + Just + [ + [ + Tuple2 + a + ] + b + ] + } + [ + [ + { + { + Tuple2 + a + } + b + } + ipv + ] + ipv + ] + ] + ) + ) + ] + (abs + dead + (type) + { + Nothing + [ + [ + Tuple2 + a + ] + b + ] + } + ) + ] + (all + dead + (type) + dead + ) + } + ) + ) + ] + (abs + dead + (type) + (let + (nonrec) + (termbind + (strict) + (vardecl + ds + [ Maybe b ] + ) + [ + `$dFromData` + arg + ] + ) + { + Nothing + [ + [ Tuple2 a ] + b + ] + } + ) + ) + ] + (all dead (type) dead) + } + ] + (lam + ds + (con data) + (lam + ds + [ + (con list) + (con data) + ] + { + Nothing + [ [ Tuple2 a ] b ] + } + ) + ) + ] + ) + ) + ) + ] ) - } + ) + ) + ] + ) + [ + [ + [ [ + { + ifThenElse + (fun + (con unit) + [ Maybe [ [ Tuple2 a ] b ] ] + ) + } [ - equalsInteger - [ - { - { fst (con integer) } - [ (con list) (con data) ] - } - tup - ] + [ equalsInteger index ] + (con integer 0) ] - (con integer 0) ] + (lam ds (con unit) indexMatchCase) ] - (lam ds (con unit) x) + (lam + ds + (con unit) + { Nothing [ [ Tuple2 a ] b ] } + ) ] - (lam - ds - (con unit) - { Nothing [ [ Tuple2 a ] b ] } - ) + unitval ] - unitval - ] + ) ) - ] - (lam ds Unit { Nothing [ [ Tuple2 a ] b ] }) + ) ] - (lam ds Unit { Nothing [ [ Tuple2 a ] b ] }) + (lam + ds + [ + (con list) + [ [ (con pair) (con data) ] (con data) ] + ] + { Nothing [ [ Tuple2 a ] b ] } + ) ] - (lam ds Unit { Nothing [ [ Tuple2 a ] b ] }) + (lam + ds + [ (con list) (con data) ] + { Nothing [ [ Tuple2 a ] b ] } + ) ] - (lam ds Unit { Nothing [ [ Tuple2 a ] b ] }) + (lam ds (con integer) { Nothing [ [ Tuple2 a ] b ] }) ] - Unit + (lam ds (con bytestring) { Nothing [ [ Tuple2 a ] b ] }) ] ) ) @@ -349,11 +709,6 @@ ) `$fFromDataTuple2_$cfromBuiltinData` ) - (termbind - (strict) - (vardecl unsafeDataAsI (fun (con data) (con integer))) - (builtin unIData) - ) (termbind (strict) (vardecl @@ -363,25 +718,44 @@ (lam d (con data) - [ + (let + (nonrec) + (termbind (strict) (vardecl d (con data)) d) [ [ [ [ [ - [ { chooseData (fun Unit [ Maybe (con integer) ]) } d ] - (lam ds Unit { Nothing (con integer) }) + [ { matchData' [ Maybe (con integer) ] } d ] + (lam + ds + (con integer) + (lam + ds [ (con list) (con data) ] { Nothing (con integer) } + ) + ) ] - (lam ds Unit { Nothing (con integer) }) + (lam + ds + [ (con list) [ [ (con pair) (con data) ] (con data) ] ] + { Nothing (con integer) } + ) ] - (lam ds Unit { Nothing (con integer) }) + (lam ds [ (con list) (con data) ] { Nothing (con integer) }) ] - (lam ds Unit [ { Just (con integer) } [ unsafeDataAsI d ] ]) + (lam + i + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl i (con integer)) i) + [ { Just (con integer) } i ] + ) + ) ] - (lam ds Unit { Nothing (con integer) }) + (lam ds (con bytestring) { Nothing (con integer) }) ] - Unit - ] + ) ) ) (termbind @@ -427,13 +801,17 @@ (lam ds (con data) - [ + (let + (nonrec) + (termbind (strict) (vardecl ds (con data)) ds) [ - { fromBuiltinData [ [ Tuple2 (con integer) ] (con integer) ] } - `$dFromData` + [ + { fromBuiltinData [ [ Tuple2 (con integer) ] (con integer) ] } + `$dFromData` + ] + ds ] - ds - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/IsData/mono.ueval.golden b/plutus-tx-plugin/test/IsData/mono.ueval.golden index 1dd2b8ed5d3..909c9d8ccc8 100644 --- a/plutus-tx-plugin/test/IsData/mono.ueval.golden +++ b/plutus-tx-plugin/test/IsData/mono.ueval.golden @@ -1 +1 @@ -(constr 0) \ No newline at end of file +Failure \ No newline at end of file diff --git a/plutus-tx-plugin/test/IsData/unsafeDeconstructData.pir.golden b/plutus-tx-plugin/test/IsData/unsafeDeconstructData.pir.golden index c1e82ee90af..170605ed45f 100644 --- a/plutus-tx-plugin/test/IsData/unsafeDeconstructData.pir.golden +++ b/plutus-tx-plugin/test/IsData/unsafeDeconstructData.pir.golden @@ -2,9 +2,46 @@ 1.1.0 (let (nonrec) + (termbind + (strict) (vardecl reconstructCaseError (con string)) (con string "PT1") + ) (datatypebind (datatype (tyvardecl Unit (type)) Unit_match (vardecl Unit Unit)) ) + (termbind + (strict) + (vardecl error (all a (type) (fun (con unit) a))) + (abs a (type) (lam thunk (con unit) (error a))) + ) + (termbind + (strict) + (vardecl trace (all a (type) (fun (con string) (fun a a)))) + (builtin trace) + ) + (termbind (strict) (vardecl unitval (con unit)) (con unit ())) + (termbind + (strict) + (vardecl traceError (all a (type) (fun (con string) a))) + (abs + a + (type) + (lam + str + (con string) + (let + (nonrec) + (termbind (strict) (vardecl str (con string)) str) + (termbind (strict) (vardecl x Unit) [ [ { trace Unit } str ] Unit ]) + [ { error a } unitval ] + ) + ) + ) + ) + (termbind + (strict) + (vardecl fallthrough (all a (type) a)) + (abs a (type) [ { traceError a } reconstructCaseError ]) + ) (datatypebind (datatype (tyvardecl Tuple2 (fun (type) (fun (type) (type)))) @@ -18,11 +55,6 @@ (vardecl equalsInteger (fun (con integer) (fun (con integer) (con bool)))) (builtin equalsInteger) ) - (termbind - (strict) - (vardecl error (all a (type) (fun (con unit) a))) - (abs a (type) (lam thunk (con unit) (error a))) - ) (termbind (strict) (vardecl fst (all a (type) (all b (type) (fun [ [ (con pair) a ] b ] a)))) @@ -38,9 +70,6 @@ (vardecl ifThenElse (all a (type) (fun (con bool) (fun a (fun a a))))) (builtin ifThenElse) ) - (termbind - (strict) (vardecl reconstructCaseError (con string)) (con string "PT1") - ) (termbind (strict) (vardecl snd (all a (type) (all b (type) (fun [ [ (con pair) a ] b ] b)))) @@ -51,12 +80,6 @@ (vardecl tail (all a (type) (fun [ (con list) a ] [ (con list) a ]))) (builtin tailList) ) - (termbind - (strict) - (vardecl trace (all a (type) (fun (con string) (fun a a)))) - (builtin trace) - ) - (termbind (strict) (vardecl unitval (con unit)) (con unit ())) (termbind (strict) (vardecl @@ -93,94 +116,75 @@ (abs b (type) - (let - (nonrec) - (termbind - (nonstrict) - (vardecl x [ [ Tuple2 a ] b ]) - [ - { error [ [ Tuple2 a ] b ] } + (lam + `$dUnsafeFromData` + [ (lam a (type) (fun (con data) a)) a ] + (lam + `$dUnsafeFromData` + [ (lam a (type) (fun (con data) a)) b ] + (lam + d + (con data) (let (nonrec) + (termbind (strict) (vardecl d (con data)) d) (termbind (strict) - (vardecl wild Unit) - [ [ { trace Unit } reconstructCaseError ] Unit ] - ) - unitval - ) - ] - ) - (lam - `$dUnsafeFromData` - [ (lam a (type) (fun (con data) a)) a ] - (lam - `$dUnsafeFromData` - [ (lam a (type) (fun (con data) a)) b ] - (lam - d - (con data) - (let - (nonrec) - (termbind - (strict) - (vardecl - tup - [ - [ (con pair) (con integer) ] [ (con list) (con data) ] - ] - ) - [ unsafeDataAsConstr d ] - ) - (termbind - (nonstrict) - (vardecl t [ (con list) (con data) ]) - [ - { { snd (con integer) } [ (con list) (con data) ] } tup - ] - ) - (termbind - (nonstrict) - (vardecl x [ [ Tuple2 a ] b ]) - (let - (nonrec) - (termbind - (strict) - (vardecl arg (con data)) - [ { head (con data) } t ] - ) - (termbind - (strict) - (vardecl arg (con data)) - [ { head (con data) } [ { tail (con data) } t ] ] - ) - [ - [ { { Tuple2 a } b } [ `$dUnsafeFromData` arg ] ] - [ `$dUnsafeFromData` arg ] - ] - ) - ) - (termbind - (strict) - (vardecl index (con integer)) - [ - { { fst (con integer) } [ (con list) (con data) ] } tup - ] + (vardecl + tup + [ [ (con pair) (con integer) ] [ (con list) (con data) ] ] ) + [ unsafeDataAsConstr d ] + ) + (termbind + (strict) + (vardecl index (con integer)) + [ { { fst (con integer) } [ (con list) (con data) ] } tup ] + ) + (termbind + (strict) + (vardecl t [ (con list) (con data) ]) + [ { { snd (con integer) } [ (con list) (con data) ] } tup ] + ) + (termbind + (strict) (vardecl arg (con data)) [ { head (con data) } t ] + ) + (termbind + (nonstrict) + (vardecl indexMatchCase a) + [ `$dUnsafeFromData` arg ] + ) + (termbind + (strict) + (vardecl t [ (con list) (con data) ]) + [ { tail (con data) } t ] + ) + (termbind + (strict) (vardecl arg (con data)) [ { head (con data) } t ] + ) + (termbind + (nonstrict) + (vardecl indexMatchCase b) + [ `$dUnsafeFromData` arg ] + ) + (termbind + (nonstrict) + (vardecl x [ [ Tuple2 a ] b ]) + [ [ { { Tuple2 a } b } indexMatchCase ] indexMatchCase ] + ) + [ [ [ [ - [ - { ifThenElse (fun (con unit) [ [ Tuple2 a ] b ]) } - [ [ equalsInteger index ] (con integer 0) ] - ] - (lam ds (con unit) x) + { ifThenElse (fun (con unit) [ [ Tuple2 a ] b ]) } + [ [ equalsInteger index ] (con integer 0) ] ] (lam ds (con unit) x) ] - unitval + (lam ds (con unit) { fallthrough [ [ Tuple2 a ] b ] }) ] - ) + unitval + ] ) ) ) @@ -240,6 +244,11 @@ `$fUnsafeFromDataInteger` ] ) + (termbind + (strict) + (vardecl fallthrough (all a (type) a)) + (abs a (type) [ { traceError a } reconstructCaseError ]) + ) (datatypebind (datatype (tyvardecl Maybe (fun (type) (type))) @@ -263,67 +272,33 @@ (abs a (type) - (let - (nonrec) - (termbind - (nonstrict) - (vardecl x [ Maybe a ]) - [ - { error [ Maybe a ] } - (let - (nonrec) - (termbind - (strict) - (vardecl wild Unit) - [ [ { trace Unit } reconstructCaseError ] Unit ] - ) - unitval - ) - ] - ) + (lam + `$dUnsafeFromData` + [ (lam a (type) (fun (con data) a)) a ] (lam - `$dUnsafeFromData` - [ (lam a (type) (fun (con data) a)) a ] - (lam - d - (con data) - (let - (nonrec) - (termbind - (strict) - (vardecl - tup - [ [ (con pair) (con integer) ] [ (con list) (con data) ] ] - ) - [ unsafeDataAsConstr d ] + d + (con data) + (let + (nonrec) + (termbind (strict) (vardecl d (con data)) d) + (termbind + (strict) + (vardecl + tup [ [ (con pair) (con integer) ] [ (con list) (con data) ] ] ) - (termbind - (nonstrict) - (vardecl x [ Maybe a ]) - (let - (nonrec) - (termbind - (strict) - (vardecl arg (con data)) - [ - { head (con data) } - [ - { { snd (con integer) } [ (con list) (con data) ] } - tup - ] - ] - ) - [ { Just a } [ `$dUnsafeFromData` arg ] ] - ) - ) - (termbind - (strict) - (vardecl index (con integer)) - [ { { fst (con integer) } [ (con list) (con data) ] } tup ] - ) - (termbind - (nonstrict) - (vardecl x [ Maybe a ]) + [ unsafeDataAsConstr d ] + ) + (termbind + (strict) + (vardecl index (con integer)) + [ { { fst (con integer) } [ (con list) (con data) ] } tup ] + ) + (termbind + (strict) + (vardecl fallthrough (all a (type) [ Maybe a ])) + (abs + a + (type) [ [ [ @@ -333,25 +308,43 @@ ] (lam ds (con unit) { Nothing a }) ] - (lam ds (con unit) x) + (lam ds (con unit) { fallthrough [ Maybe a ] }) ] unitval ] ) + ) + (termbind + (strict) + (vardecl t [ (con list) (con data) ]) + [ { { snd (con integer) } [ (con list) (con data) ] } tup ] + ) + (termbind + (strict) (vardecl arg (con data)) [ { head (con data) } t ] + ) + (termbind + (nonstrict) + (vardecl indexMatchCase a) + [ `$dUnsafeFromData` arg ] + ) + (termbind + (nonstrict) + (vardecl x [ Maybe a ]) + [ { Just a } indexMatchCase ] + ) + [ [ [ [ - [ - { ifThenElse (fun (con unit) [ Maybe a ]) } - [ [ equalsInteger index ] (con integer 0) ] - ] - (lam ds (con unit) x) + { ifThenElse (fun (con unit) [ Maybe a ]) } + [ [ equalsInteger index ] (con integer 0) ] ] (lam ds (con unit) x) ] - unitval + (lam ds (con unit) { fallthrough a }) ] - ) + unitval + ] ) ) ) @@ -401,16 +394,20 @@ (lam ds (con data) - [ + (let + (nonrec) + (termbind (strict) (vardecl ds (con data)) ds) [ - { - unsafeFromBuiltinData - [ Maybe [ [ Tuple2 (con integer) ] (con integer) ] ] - } - `$dUnsafeFromData` + [ + { + unsafeFromBuiltinData + [ Maybe [ [ Tuple2 (con integer) ] (con integer) ] ] + } + `$dUnsafeFromData` + ] + ds ] - ds - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/ifOpt.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/ifOpt.pir.golden index 8aaa587c2d5..609bdf39b56 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/ifOpt.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/ifOpt.pir.golden @@ -14,7 +14,20 @@ (vardecl divideInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ divideInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ divideInteger x ] y ] + ) + ) + ) ) (datatypebind (datatype @@ -43,7 +56,13 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Basic/letFun.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/letFun.pir.golden index 50c6d0acca6..5439a86cab6 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/letFun.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/letFun.pir.golden @@ -29,10 +29,29 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) + ) + ) + ) + (lam + ds + (con integer) + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ equalsInteger ds ] ds ] ) ) ) - equalsInteger ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/monadicDo.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/monadicDo.pir.golden index d0185906dbc..4f0d3919f8d 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/monadicDo.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/monadicDo.pir.golden @@ -60,7 +60,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (lam ds @@ -68,24 +81,39 @@ (lam ds [ Maybe (con integer) ] - [ - [ { { `$fMonadMaybe_$c>>=` (con integer) } (con integer) } ds ] - (lam - x' - (con integer) - [ - [ { { `$fMonadMaybe_$c>>=` (con integer) } (con integer) } ds ] - (lam - y' - (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds [ Maybe (con integer) ]) ds) + (termbind (strict) (vardecl ds [ Maybe (con integer) ]) ds) + [ + [ { { `$fMonadMaybe_$c>>=` (con integer) } (con integer) } ds ] + (lam + x' + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x' (con integer)) x') [ - { `$fApplicativeMaybe_$cpure` (con integer) } - [ [ addInteger x' ] y' ] + [ + { { `$fMonadMaybe_$c>>=` (con integer) } (con integer) } ds + ] + (lam + y' + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl y' (con integer)) y') + [ + { `$fApplicativeMaybe_$cpure` (con integer) } + [ [ addInteger x' ] y' ] + ] + ) + ) ] ) - ] - ) - ] + ) + ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Basic/monoK.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/monoK.pir.golden index cb84c946829..cfa4ac0ee32 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/monoK.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/monoK.pir.golden @@ -1 +1,12 @@ -(program 1.1.0 (lam ds (con integer) (lam ds (con integer) ds))) \ No newline at end of file +(program + 1.1.0 + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (lam ds (con integer) ds) + ) + ) +) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/nonstrictLet.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/nonstrictLet.pir.golden index a8514542684..d05eba6f91d 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/nonstrictLet.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/nonstrictLet.pir.golden @@ -10,7 +10,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (lam ds @@ -20,9 +33,9 @@ (con integer) (let (nonrec) - (termbind - (nonstrict) (vardecl z (con integer)) [ [ addInteger ds ] ds ] - ) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl z (con integer)) [ [ addInteger ds ] ds ]) [ [ addInteger z ] z ] ) ) diff --git a/plutus-tx-plugin/test/Plugin/Basic/patternMatchDo.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/patternMatchDo.pir.golden index 91c9fb1cac9..a77783e488f 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/patternMatchDo.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/patternMatchDo.pir.golden @@ -68,7 +68,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (lam ds @@ -76,49 +89,63 @@ (lam ds [ Maybe (con integer) ] - [ - [ - { - { - `$fMonadMaybe_$c>>=` [ [ Tuple2 (con integer) ] (con integer) ] - } - (con integer) - } + (let + (nonrec) + (termbind + (strict) + (vardecl ds [ Maybe [ [ Tuple2 (con integer) ] (con integer) ] ]) ds - ] - (lam - ds - [ [ Tuple2 (con integer) ] (con integer) ] + ) + (termbind (strict) (vardecl ds [ Maybe (con integer) ]) ds) + [ [ { - [ { { Tuple2_match (con integer) } (con integer) } ds ] - [ Maybe (con integer) ] - } - (lam - x + { + `$fMonadMaybe_$c>>=` + [ [ Tuple2 (con integer) ] (con integer) ] + } (con integer) + } + ds + ] + (lam + ds + [ [ Tuple2 (con integer) ] (con integer) ] + [ + { + [ { { Tuple2_match (con integer) } (con integer) } ds ] + [ Maybe (con integer) ] + } (lam x (con integer) - [ + (lam + x + (con integer) [ - { { `$fMonadMaybe_$c>>=` (con integer) } (con integer) } - ds - ] - (lam - y' - (con integer) [ - { `$fApplicativeMaybe_$cpure` (con integer) } - [ [ addInteger [ [ addInteger x ] x ] ] y' ] + { { `$fMonadMaybe_$c>>=` (con integer) } (con integer) } + ds ] - ) - ] + (lam + y' + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl y' (con integer)) y') + [ + { `$fApplicativeMaybe_$cpure` (con integer) } + [ [ addInteger [ [ addInteger x ] x ] ] y' ] + ] + ) + ) + ] + ) ) - ) - ] - ) - ] + ] + ) + ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Basic/strictLet.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/strictLet.pir.golden index 7102666b6cc..d05eba6f91d 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/strictLet.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/strictLet.pir.golden @@ -10,7 +10,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (lam ds @@ -20,6 +33,8 @@ (con integer) (let (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) (termbind (strict) (vardecl z (con integer)) [ [ addInteger ds ] ds ]) [ [ addInteger z ] z ] ) diff --git a/plutus-tx-plugin/test/Plugin/Basic/strictLetRec.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/strictLetRec.pir.golden index 6d55130cbc3..092ff29c943 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/strictLetRec.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/strictLetRec.pir.golden @@ -10,7 +10,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (lam ds @@ -19,18 +32,23 @@ ds (con integer) (let - (rec) - (termbind - (nonstrict) (vardecl q (con integer)) [ [ addInteger ds ] z ] - ) - (termbind - (nonstrict) (vardecl z (con integer)) [ [ addInteger ds ] q ] - ) + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) (let - (nonrec) - (termbind (strict) (vardecl z (con integer)) z) - (termbind (strict) (vardecl q (con integer)) q) - [ [ addInteger z ] z ] + (rec) + (termbind + (nonstrict) (vardecl q (con integer)) [ [ addInteger ds ] z ] + ) + (termbind + (nonstrict) (vardecl z (con integer)) [ [ addInteger ds ] q ] + ) + (let + (nonrec) + (termbind (strict) (vardecl z (con integer)) z) + (termbind (strict) (vardecl q (con integer)) q) + [ [ addInteger z ] z ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Basic/strictMultiLet.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/strictMultiLet.pir.golden index 452af6fdd29..9900221f067 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/strictMultiLet.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/strictMultiLet.pir.golden @@ -10,7 +10,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (lam ds @@ -20,6 +33,8 @@ (con integer) (let (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) (termbind (strict) (vardecl z (con integer)) [ [ addInteger ds ] ds ]) (termbind (strict) (vardecl q (con integer)) [ [ addInteger z ] z ]) [ [ addInteger q ] q ] diff --git a/plutus-tx-plugin/test/Plugin/Coverage/Spec.hs b/plutus-tx-plugin/test/Plugin/Coverage/Spec.hs index 2a1a98168bc..02d863320a2 100644 --- a/plutus-tx-plugin/test/Plugin/Coverage/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Coverage/Spec.hs @@ -56,7 +56,7 @@ coverage = testNested "Coverage" [ mkTests "noBool" noBool Set.empty [30] , mkTests "boolTrueFalse" boolTrueFalse (Set.singleton "&&") [33] , mkTests "boolOtherFunction" boolOtherFunction (Set.fromList ["&&", "=="]) [36, 40, 41, 42] - , mkTests "boolOtherFunctionSimplifiesAway" boolOtherFunctionSimplifiesAway (Set.fromList ["&&", "=="]) [48] + , mkTests "boolOtherFunctionSimplifiesAway" boolOtherFunctionSimplifiesAway (Set.fromList ["&&", "==", "otherFun"]) [48] , mkTests "boolQualifiedDisappears" boolQualifiedDisappears Set.empty [51] ] , goldenPir "coverageCode" boolOtherFunction ] diff --git a/plutus-tx-plugin/test/Plugin/Coverage/coverageCode.pir.golden b/plutus-tx-plugin/test/Plugin/Coverage/coverageCode.pir.golden index 4a6767ecace..ec13e19f7b6 100644 --- a/plutus-tx-plugin/test/Plugin/Coverage/coverageCode.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Coverage/coverageCode.pir.golden @@ -31,10 +31,29 @@ { (builtin trace) (all dead (type) (all a (type) [ Maybe a ])) } (con string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 26, _covLocEndCol = 33})" + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 40, _covLocEndLine = 40, _covLocStartCol = 14, _covLocEndCol = 15})" ) ] - (abs dead (type) Nothing) + (abs + dead + (type) + { + [ + [ + { + (builtin trace) + (all dead (type) (all a (type) [ Maybe a ])) + } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 26, _covLocEndCol = 33})" + ) + ] + (abs dead (type) Nothing) + ] + (all dead (type) dead) + } + ) ] (all dead (type) dead) } @@ -61,7 +80,13 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -122,16 +147,21 @@ (lam c Bool - { - [ + (let + (nonrec) + (termbind (strict) (vardecl trueLabel (con string)) trueLabel) + (termbind (strict) (vardecl falseLabel (con string)) falseLabel) + { [ - { [ Bool_match c ] (all dead (type) Bool) } - (abs dead (type) [ [ { trace Bool } trueLabel ] True ]) + [ + { [ Bool_match c ] (all dead (type) Bool) } + (abs dead (type) [ [ { trace Bool } trueLabel ] True ]) + ] + (abs dead (type) [ [ { trace Bool } falseLabel ] False ]) ] - (abs dead (type) [ [ { trace Bool } falseLabel ] False ]) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) @@ -168,92 +198,131 @@ (abs dead (type) - [ + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) [ - `&&` [ [ - [ - traceBool - (con - string - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 24}) True" - ) - ] + traceBool (con string - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 24}) False" + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 32}) True" ) ] - { + (con + string + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 32}) False" + ) + ] + { + [ [ + { (builtin trace) (all dead (type) Bool) } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 32})" + ) + ] + (abs + dead + (type) [ - { (builtin trace) (all dead (type) Bool) } - (con - string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 24})" - ) - ] - (abs - dead - (type) [ + `&&` [ - [ { `==` (con integer) } `$fEqInteger` ] + [ + [ + traceBool + (con + string + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 24}) True" + ) + ] + (con + string + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 24}) False" + ) + ] { [ [ - { - (builtin trace) - (all dead (type) (con integer)) - } + { (builtin trace) (all dead (type) Bool) } (con string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 15, _covLocEndCol = 16})" + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 14, _covLocEndCol = 24})" ) ] - (abs dead (type) x) + (abs + dead + (type) + [ + [ + [ + { `==` (con integer) } `$fEqInteger` + ] + { + [ + [ + { + (builtin trace) + (all + dead (type) (con integer) + ) + } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 15, _covLocEndCol = 16})" + ) + ] + (abs dead (type) x) + ] + (all dead (type) dead) + } + ] + { + [ + [ + { + (builtin trace) + (all dead (type) (con integer)) + } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 22, _covLocEndCol = 23})" + ) + ] + (abs dead (type) (con integer 5)) + ] + (all dead (type) dead) + } + ] + ) ] (all dead (type) dead) } ] - { + ] + { + [ [ - [ - { - (builtin trace) - (all dead (type) (con integer)) - } - (con - string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 22, _covLocEndCol = 23})" - ) - ] - (abs dead (type) (con integer 5)) + { (builtin trace) (all dead (type) Bool) } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 28, _covLocEndCol = 32})" + ) ] - (all dead (type) dead) - } - ] - ) - ] - (all dead (type) dead) - } - ] - ] - { - [ - [ - { (builtin trace) (all dead (type) Bool) } - (con - string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 45, _covLocEndLine = 45, _covLocStartCol = 28, _covLocEndCol = 32})" + (abs dead (type) True) + ] + (all dead (type) dead) + } + ] ) ] - (abs dead (type) True) - ] - (all dead (type) dead) - } - ] + (all dead (type) dead) + } + ] + ) ) ] (all dead (type) dead) @@ -288,66 +357,46 @@ (abs dead (type) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl x [ Maybe (con integer) ]) x) + { [ - { - [ { Maybe_match (con integer) } x ] - (all dead (type) [ Maybe Bool ]) - } - (lam - y - (con integer) - (abs - dead - (type) - { + [ + { (builtin trace) (all dead (type) [ Maybe Bool ]) } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 40, _covLocEndLine = 42, _covLocStartCol = 9, _covLocEndCol = 33})" + ) + ] + (abs + dead + (type) + { + [ [ - [ - { - (builtin trace) - (all dead (type) [ Maybe Bool ]) - } - (con - string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 12, _covLocEndCol = 22})" - ) - ] - (abs - dead - (type) - { - [ + { + [ { Maybe_match (con integer) } x ] + (all dead (type) [ Maybe Bool ]) + } + (lam + y + (con integer) + (abs + dead + (type) + { [ - { - [ - Bool_match - [ - otherFun - { - [ - [ - { - (builtin trace) - (all - dead - (type) - (con integer) - ) - } - (con - string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 21, _covLocEndCol = 22})" - ) - ] - (abs dead (type) y) - ] - (all dead (type) dead) - } - ] - ] - (all dead (type) [ Maybe Bool ]) - } + [ + { + (builtin trace) + (all dead (type) [ Maybe Bool ]) + } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 12, _covLocEndCol = 22})" + ) + ] (abs dead (type) @@ -355,59 +404,119 @@ [ [ { - (builtin trace) + [ + Bool_match + [ + otherFun + { + [ + [ + { + (builtin trace) + (all + dead + (type) + (con integer) + ) + } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 21, _covLocEndCol = 22})" + ) + ] + (abs dead (type) y) + ] + (all dead (type) dead) + } + ] + ] (all dead (type) [ Maybe Bool ] ) } - (con - string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 26, _covLocEndCol = 36})" - ) - ] - (abs - dead - (type) - [ - { Just Bool } + (abs + dead + (type) { [ [ { (builtin trace) - (all dead (type) Bool) + (all + dead + (type) + [ Maybe Bool ] + ) } (con string - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 31, _covLocEndCol = 36})" + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 26, _covLocEndCol = 36})" ) ] - (abs dead (type) False) + (abs + dead + (type) + [ + { Just Bool } + { + [ + [ + { + (builtin + trace + ) + (all + dead + (type) + Bool + ) + } + (con + string + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 31, _covLocEndCol = 36})" + ) + ] + (abs + dead + (type) + False + ) + ] + (all + dead (type) dead + ) + } + ] + ) ] (all dead (type) dead) } - ] + ) + ] + (abs + dead + (type) + [ fail (con unit ()) ] ) ] (all dead (type) dead) } ) ] - (abs dead (type) [ fail (con unit ()) ]) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ] - (all dead (type) dead) - } - ) + (abs dead (type) [ fail (con unit ()) ]) + ] + (all dead (type) dead) + } ) ] - (abs dead (type) [ fail (con unit ()) ]) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ] (all dead (type) dead) diff --git a/plutus-tx-plugin/test/Plugin/Data/families/associatedParam.pir.golden b/plutus-tx-plugin/test/Plugin/Data/families/associatedParam.pir.golden index 9665ae68fa4..f04607a8d95 100644 --- a/plutus-tx-plugin/test/Plugin/Data/families/associatedParam.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/families/associatedParam.pir.golden @@ -10,13 +10,31 @@ (vardecl Param (fun a [ Param a ])) ) ) + (termbind + (strict) + (vardecl `$WParam` (all a (type) (fun a [ Param a ]))) + (abs + a + (type) + (lam + dt + a + (let + (nonrec) (termbind (strict) (vardecl dt a) dt) [ { Param a } dt ] + ) + ) + ) + ) (termbind (strict) (vardecl paramId (all a (type) (fun [ Param a ] (fun a a)))) (abs a (type) (lam ds [ Param a ] (lam x a x))) ) [ - [ { paramId (con integer) } [ { Param (con integer) } (con integer 1) ] ] + [ + { paramId (con integer) } + [ { `$WParam` (con integer) } (con integer 1) ] + ] (con integer 1) ] ) diff --git a/plutus-tx-plugin/test/Plugin/Data/families/basicData.pir.golden b/plutus-tx-plugin/test/Plugin/Data/families/basicData.pir.golden index eb1fd7f9aa8..a95b8770411 100644 --- a/plutus-tx-plugin/test/Plugin/Data/families/basicData.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/families/basicData.pir.golden @@ -13,10 +13,14 @@ (lam ds `R:BasicDataBool` - [ - { [ RConsBasicDataBool_match ds ] (con integer) } - (lam i (con integer) i) - ] + (let + (nonrec) + (termbind (strict) (vardecl nt `R:BasicDataBool`) ds) + [ + { [ RConsBasicDataBool_match nt ] (con integer) } + (lam i (con integer) i) + ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/monomorphic/atPattern.pir.golden b/plutus-tx-plugin/test/Plugin/Data/monomorphic/atPattern.pir.golden index 8751f544e9a..15570aed595 100644 --- a/plutus-tx-plugin/test/Plugin/Data/monomorphic/atPattern.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/monomorphic/atPattern.pir.golden @@ -18,7 +18,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (lam t diff --git a/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructed.pir.golden b/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructed.pir.golden index a617d46f1d0..f02792df59b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructed.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructed.pir.golden @@ -12,6 +12,17 @@ (vardecl Mono (fun (con integer) MyMonoData)) ) ) - [ Mono (con integer 1) ] + (termbind + (strict) + (vardecl `$WMono` (fun (con integer) MyMonoData)) + (lam + dt + (con integer) + (let + (nonrec) (termbind (strict) (vardecl dt (con integer)) dt) [ Mono dt ] + ) + ) + ) + [ `$WMono` (con integer 1) ] ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructor.pir.golden b/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructor.pir.golden index 8609d6a5ee3..3632ccf30fe 100644 --- a/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructor.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoConstructor.pir.golden @@ -12,6 +12,24 @@ (vardecl Mono (fun (con integer) MyMonoData)) ) ) - (lam ds (con integer) (lam ds (con integer) [ [ Mono ds ] ds ])) + (termbind + (strict) + (vardecl `$WMono` (fun (con integer) (fun (con integer) MyMonoData))) + (lam + dt + (con integer) + (lam + dt + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl dt (con integer)) dt) + (termbind (strict) (vardecl dt (con integer)) dt) + [ [ Mono dt ] dt ] + ) + ) + ) + ) + (lam ds (con integer) (lam ds (con integer) [ [ `$WMono` ds ] ds ])) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoRecord.pir.golden b/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoRecord.pir.golden index 6c3340f33a8..6203af33245 100644 --- a/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoRecord.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/monomorphic/monoRecord.pir.golden @@ -15,10 +15,14 @@ (lam ds MyMonoRecord - [ - { [ MyMonoRecord_match ds ] (con integer) } - (lam i (con integer) (lam ds (con integer) i)) - ] + (let + (nonrec) + (termbind (strict) (vardecl ds MyMonoRecord) ds) + [ + { [ MyMonoRecord_match ds ] (con integer) } + (lam i (con integer) (lam ds (con integer) i)) + ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordNewtype.pir.golden b/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordNewtype.pir.golden index 9d0f2127805..41b09a2efd6 100644 --- a/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordNewtype.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordNewtype.pir.golden @@ -13,7 +13,13 @@ (lam ds RecordNewtype - [ { [ RecordNewtype_match ds ] (con integer) } (lam ds (con integer) ds) ] + (let + (nonrec) + (termbind (strict) (vardecl ds RecordNewtype) ds) + [ + { [ RecordNewtype_match ds ] (con integer) } (lam ds (con integer) ds) + ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordWithStrictField.pir.golden b/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordWithStrictField.pir.golden index 98f7fb1f522..77d64d63085 100644 --- a/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordWithStrictField.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/monomorphic/recordWithStrictField.pir.golden @@ -2,14 +2,7 @@ 1.1.0 (let (nonrec) - (datatypebind - (datatype - (tyvardecl RecordNewtype (type)) - - RecordNewtype_match - (vardecl RecordNewtype (fun (con integer) RecordNewtype)) - ) - ) + (typebind (tyvardecl RecordNewtype (type)) (all a (type) (fun a a))) (typebind (tyvardecl MyMonoRecord (type)) (all a (type) (fun a a))) (datatypebind (datatype @@ -18,7 +11,7 @@ RecordWithStrictField_match (vardecl RecordWithStrictField - (fun MyMonoRecord (fun (con integer) RecordWithStrictField)) + (fun MyMonoRecord (fun RecordNewtype RecordWithStrictField)) ) ) ) @@ -30,10 +23,18 @@ RecordWithStrictField [ { [ RecordWithStrictField_match ds ] RecordNewtype } - (lam ds MyMonoRecord (lam dt (con integer) [ RecordNewtype dt ])) + (lam ds MyMonoRecord (lam ds RecordNewtype ds)) ] ) ) - strictField + (lam + ds + RecordWithStrictField + (let + (nonrec) + (termbind (strict) (vardecl ds RecordWithStrictField) ds) + [ strictField ds ] + ) + ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/polymorphic/polyConstructed.pir.golden b/plutus-tx-plugin/test/Plugin/Data/polymorphic/polyConstructed.pir.golden index 89bd1e41c75..b0fd9ae74d8 100644 --- a/plutus-tx-plugin/test/Plugin/Data/polymorphic/polyConstructed.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/polymorphic/polyConstructed.pir.golden @@ -11,8 +11,37 @@ (vardecl Poly (fun a [ [ MyPolyData a ] b ])) ) ) + (termbind + (strict) + (vardecl + `$WPoly` + (all a (type) (all b (type) (fun a (fun b [ [ MyPolyData a ] b ])))) + ) + (abs + a + (type) + (abs + b + (type) + (lam + dt + a + (lam + dt + b + (let + (nonrec) + (termbind (strict) (vardecl dt a) dt) + (termbind (strict) (vardecl dt b) dt) + [ [ { { Poly a } b } dt ] dt ] + ) + ) + ) + ) + ) + ) [ - [ { { Poly (con integer) } (con integer) } (con integer 1) ] + [ { { `$WPoly` (con integer) } (con integer) } (con integer 1) ] (con integer 2) ] ) diff --git a/plutus-tx-plugin/test/Plugin/Data/recursive/interListConstruct.tplc-read.golden b/plutus-tx-plugin/test/Plugin/Data/recursive/interListConstruct.tplc-read.golden index be4127b9208..9e2e766d384 100644 --- a/plutus-tx-plugin/test/Plugin/Data/recursive/interListConstruct.tplc-read.golden +++ b/plutus-tx-plugin/test/Plugin/Data/recursive/interListConstruct.tplc-read.golden @@ -1,262 +1,282 @@ -program 1.1.0 ((/\(InterList_i0 :: * -> * -> *) -> - \(InterCons_i0 - : all a_i0 - b_i0. - a_i2 -> b_i1 -> InterList_i4 b_i1 a_i2 -> InterList_i4 - a_i2 - b_i1) - (InterNil_i0 : all a_i0 b_i0. InterList_i5 a_i2 b_i1) - (InterList_match_i0 - : all a_i0 - b_i0. - InterList_i6 - a_i2 - b_i1 -> (all out_InterList_i0. - (a_i3 -> b_i2 -> InterList_i7 - b_i2 - a_i3 -> out_InterList_i1) -> out_InterList_i1 -> out_InterList_i1)) -> - (/\Bool_i0 -> - \(True_i0 : Bool_i2) - (False_i0 : Bool_i3) - (Bool_match_i0 - : Bool_i4 -> (all out_Bool_i0. - out_Bool_i1 -> out_Bool_i1 -> out_Bool_i1)) -> - InterCons_i7 - {integer} - {Bool_i4} - 0 - False_i2 - (InterCons_i7 - {Bool_i4} +program 1.1.0 ((/\Bool_i0 -> + \(True_i0 : Bool_i2) + (False_i0 : Bool_i3) + (Bool_match_i0 + : Bool_i4 -> (all out_Bool_i0. + out_Bool_i1 -> out_Bool_i1 -> out_Bool_i1)) -> + (/\(InterList_i0 :: * -> * -> *) -> + \(InterCons_i0 + : all a_i0 + b_i0. + a_i2 -> b_i1 -> InterList_i4 + b_i1 + a_i2 -> InterList_i4 a_i2 b_i1) + (InterNil_i0 : all a_i0 b_i0. InterList_i5 a_i2 b_i1) + (InterList_match_i0 + : all a_i0 + b_i0. + InterList_i6 + a_i2 + b_i1 -> (all out_InterList_i0. + (a_i3 -> b_i2 -> InterList_i7 + b_i2 + a_i3 -> out_InterList_i1) -> out_InterList_i1 -> out_InterList_i1)) -> + (\(`$WInterCons_i0` + : all a_i0 + b_i0. + a_i2 -> b_i1 -> InterList_i7 + b_i1 + a_i2 -> InterList_i7 + a_i2 + b_i1) -> + `$WInterCons_i1` {integer} - False_i2 - -1 - (InterCons_i7 + {Bool_i9} + 0 + False_i7 + (`$WInterCons_i1` + {Bool_i9} {integer} - {Bool_i4} - 42 - True_i3 - (InterNil_i6 {Bool_i4} {integer})))) - {sop [] []} - (constr (sop [] []) 0 []) - (constr (sop [] []) 1 []) - (\(x_i0 : sop [] []) -> - /\out_Bool_i0 -> - \(case_True_i0 : out_Bool_i2) - (case_False_i0 : out_Bool_i3) -> - case out_Bool_i3 x_i4 [ case_True_i2 - , case_False_i1 ])) - {\a_i0 - b_i0 -> - ifix (\(rec_i0 :: ((* -> * -> *) -> *) -> *) - (spine_i0 :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 :: * -> * -> *) - a_i0 - b_i0 -> - sop [a_i2, b_i1, (InterList_i3 b_i1 a_i2)] []) - (\a_i0 - b_i0 -> - rec_i4 - (\(dat_i0 :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 :: * -> * -> *) -> - dat_i1 a_i3 b_i2)} - (/\a_i0 - b_i0 -> - \(arg_0_i0 : a_i3) - (arg_1_i0 : b_i3) - (arg_2_i0 - : (\a_i0 - b_i0 -> - ifix (\(rec_i0 :: ((* -> * -> *) -> *) -> *) - (spine_i0 :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 :: * -> * -> *) - a_i0 - b_i0 -> - sop [ a_i2 - , b_i1 - , (InterList_i3 b_i1 a_i2) ] []) - (\a_i0 - b_i0 -> - rec_i4 - (\(dat_i0 :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)) - b_i4 - a_i5) -> - iwrap (\(rec_i0 :: ((* -> * -> *) -> *) -> *) - (spine_i0 :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 :: * -> * -> *) - a_i0 - b_i0 -> - sop [ a_i2 - , b_i1 - , (InterList_i3 b_i1 a_i2) ] []) - (\a_i0 + False_i7 + -1 + (`$WInterCons_i1` + {integer} + {Bool_i9} + 42 + True_i8 + (InterNil_i3 {Bool_i9} {integer})))) + (/\a_i0 + b_i0 -> + \(dt_i0 : a_i3) + (dt_i0 : b_i3) + (dt_i0 : InterList_i9 b_i4 a_i5) -> + InterCons_i8 {a_i5} {b_i4} dt_i3 dt_i2 dt_i1)) + {\a_i0 + b_i0 -> + ifix (\(rec_i0 :: ((* -> * -> *) -> *) -> *) + (spine_i0 :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 :: * -> * -> *) + a_i0 b_i0 -> - rec_i4 - (\(dat_i0 :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i6 - b_i5) (constr (sop [ a_i5 - , b_i4 - , ((\a_i0 - b_i0 -> - ifix (\(rec_i0 - :: ((* -> * -> *) -> *) -> *) - (spine_i0 - :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 - :: * -> * -> *) - a_i0 - b_i0 -> - sop [ a_i2 - , b_i1 - , (InterList_i3 - b_i1 - a_i2) ] [ ]) - (\a_i0 - b_i0 -> - rec_i4 - (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)) - b_i4 - a_i5) ] [ ]) 0 [ arg_0_i3 - , arg_1_i2 - , arg_2_i1 ])) - (/\a_i0 - b_i0 -> - iwrap (\(rec_i0 :: ((* -> * -> *) -> *) -> *) - (spine_i0 :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 :: * -> * -> *) - a_i0 - b_i0 -> - sop [ a_i2 - , b_i1 - , (InterList_i3 b_i1 a_i2) ] []) - (\a_i0 - b_i0 -> - rec_i4 - (\(dat_i0 :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2) (constr (sop [ a_i2 - , b_i1 - , ((\a_i0 - b_i0 -> - ifix (\(rec_i0 - :: ((* -> * -> *) -> *) -> *) - (spine_i0 - :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 - :: * -> * -> *) - a_i0 - b_i0 -> - sop [ a_i2 - , b_i1 - , (InterList_i3 - b_i1 - a_i2) ] [ ]) - (\a_i0 - b_i0 -> - rec_i4 - (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)) - b_i1 - a_i2) ] [ ]) 1 [ ])) - (/\a_i0 - b_i0 -> - \(x_i0 - : (\a_i0 - b_i0 -> - ifix (\(rec_i0 :: ((* -> * -> *) -> *) -> *) - (spine_i0 :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 :: * -> * -> *) - a_i0 - b_i0 -> - sop [ a_i2 - , b_i1 - , (InterList_i3 b_i1 a_i2) ] []) - (\a_i0 - b_i0 -> - rec_i4 - (\(dat_i0 :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)) - a_i3 - b_i2) -> - /\out_InterList_i0 -> - \(case_InterCons_i0 - : a_i5 -> b_i4 -> (\a_i0 - b_i0 -> - ifix (\(rec_i0 - :: ((* -> * -> *) -> *) -> *) - (spine_i0 - :: (* -> * -> *) -> *) -> - spine_i1 - ((\(InterList_i0 - :: * -> * -> *) - a_i0 - b_i0 -> - sop [ a_i2 - , b_i1 - , (InterList_i3 - b_i1 - a_i2) ] [ ]) - (\a_i0 - b_i0 -> - rec_i4 - (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)))) (\(dat_i0 - :: * -> * -> *) -> - dat_i1 - a_i3 - b_i2)) - b_i4 - a_i5 -> out_InterList_i2) - (case_InterNil_i0 : out_InterList_i3) -> - case out_InterList_i3 (unwrap x_i4) [ case_InterCons_i2 - , case_InterNil_i1 ])) \ No newline at end of file + sop [ a_i2 + , b_i1 + , (InterList_i3 b_i1 a_i2) ] []) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 a_i3 b_i2)} + (/\a_i0 + b_i0 -> + \(arg_0_i0 : a_i3) + (arg_1_i0 : b_i3) + (arg_2_i0 + : (\a_i0 + b_i0 -> + ifix (\(rec_i0 :: ((* -> * -> *) -> *) -> *) + (spine_i0 :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 :: * -> * -> *) + a_i0 + b_i0 -> + sop [ a_i2 + , b_i1 + , (InterList_i3 + b_i1 + a_i2) ] []) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)) + b_i4 + a_i5) -> + iwrap (\(rec_i0 :: ((* -> * -> *) -> *) -> *) + (spine_i0 :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 :: * -> * -> *) + a_i0 + b_i0 -> + sop [ a_i2 + , b_i1 + , (InterList_i3 b_i1 a_i2) ] []) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i6 + b_i5) (constr (sop [ a_i5 + , b_i4 + , ((\a_i0 + b_i0 -> + ifix (\(rec_i0 + :: ((* -> * -> *) -> *) -> *) + (spine_i0 + :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 + :: * -> * -> *) + a_i0 + b_i0 -> + sop [ a_i2 + , b_i1 + , (InterList_i3 + b_i1 + a_i2) ] [ ]) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)) + b_i4 + a_i5) ] [ ]) 0 [ arg_0_i3 + , arg_1_i2 + , arg_2_i1 ])) + (/\a_i0 + b_i0 -> + iwrap (\(rec_i0 :: ((* -> * -> *) -> *) -> *) + (spine_i0 :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 :: * -> * -> *) + a_i0 + b_i0 -> + sop [ a_i2 + , b_i1 + , (InterList_i3 b_i1 a_i2) ] []) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2) (constr (sop [ a_i2 + , b_i1 + , ((\a_i0 + b_i0 -> + ifix (\(rec_i0 + :: ((* -> * -> *) -> *) -> *) + (spine_i0 + :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 + :: * -> * -> *) + a_i0 + b_i0 -> + sop [ a_i2 + , b_i1 + , (InterList_i3 + b_i1 + a_i2) ] [ ]) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)) + b_i1 + a_i2) ] [ ]) 1 [ ])) + (/\a_i0 + b_i0 -> + \(x_i0 + : (\a_i0 + b_i0 -> + ifix (\(rec_i0 :: ((* -> * -> *) -> *) -> *) + (spine_i0 :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 :: * -> * -> *) + a_i0 + b_i0 -> + sop [ a_i2 + , b_i1 + , (InterList_i3 + b_i1 + a_i2) ] []) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)) + a_i3 + b_i2) -> + /\out_InterList_i0 -> + \(case_InterCons_i0 + : a_i5 -> b_i4 -> (\a_i0 + b_i0 -> + ifix (\(rec_i0 + :: ((* -> * -> *) -> *) -> *) + (spine_i0 + :: (* -> * -> *) -> *) -> + spine_i1 + ((\(InterList_i0 + :: * -> * -> *) + a_i0 + b_i0 -> + sop [ a_i2 + , b_i1 + , (InterList_i3 + b_i1 + a_i2) ] [ ]) + (\a_i0 + b_i0 -> + rec_i4 + (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)))) (\(dat_i0 + :: * -> * -> *) -> + dat_i1 + a_i3 + b_i2)) + b_i4 + a_i5 -> out_InterList_i2) + (case_InterNil_i0 : out_InterList_i3) -> + case out_InterList_i3 (unwrap x_i4) [ case_InterCons_i2 + , case_InterNil_i1 ])) + {sop [] []} + (constr (sop [] []) 0 []) + (constr (sop [] []) 1 []) + (\(x_i0 : sop [] []) -> + /\out_Bool_i0 -> + \(case_True_i0 : out_Bool_i2) + (case_False_i0 : out_Bool_i3) -> + case out_Bool_i3 x_i4 [case_True_i2, case_False_i1])) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/recursive/ptreeConstruct.pir.golden b/plutus-tx-plugin/test/Plugin/Data/recursive/ptreeConstruct.pir.golden index 002bca15dee..61d971ca59a 100644 --- a/plutus-tx-plugin/test/Plugin/Data/recursive/ptreeConstruct.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/recursive/ptreeConstruct.pir.golden @@ -21,37 +21,76 @@ (vardecl Two (fun [ B [ [ Tuple2 a ] a ] ] [ B a ])) ) ) - [ - { Two (con integer) } + (let + (nonrec) + (termbind + (strict) + (vardecl `$WOne` (all a (type) (fun a [ B a ]))) + (abs + a + (type) + (lam + dt + a + (let + (nonrec) (termbind (strict) (vardecl dt a) dt) [ { One a } dt ] + ) + ) + ) + ) + (termbind + (strict) + (vardecl + `$WTwo` (all a (type) (fun [ B [ [ Tuple2 a ] a ] ] [ B a ])) + ) + (abs + a + (type) + (lam + dt + [ B [ [ Tuple2 a ] a ] ] + (let + (nonrec) + (termbind (strict) (vardecl dt [ B [ [ Tuple2 a ] a ] ]) dt) + [ { Two a } dt ] + ) + ) + ) + ) [ - { Two [ [ Tuple2 (con integer) ] (con integer) ] } + { `$WTwo` (con integer) } [ - { - One - [ - [ Tuple2 [ [ Tuple2 (con integer) ] (con integer) ] ] - [ [ Tuple2 (con integer) ] (con integer) ] - ] - } + { `$WTwo` [ [ Tuple2 (con integer) ] (con integer) ] } [ - [ - { - { Tuple2 [ [ Tuple2 (con integer) ] (con integer) ] } - [ [ Tuple2 (con integer) ] (con integer) ] - } + { + `$WOne` [ - [ { { Tuple2 (con integer) } (con integer) } (con integer 1) ] - (con integer 2) + [ Tuple2 [ [ Tuple2 (con integer) ] (con integer) ] ] + [ [ Tuple2 (con integer) ] (con integer) ] ] - ] + } [ - [ { { Tuple2 (con integer) } (con integer) } (con integer 3) ] - (con integer 4) + [ + { + { Tuple2 [ [ Tuple2 (con integer) ] (con integer) ] } + [ [ Tuple2 (con integer) ] (con integer) ] + } + [ + [ + { { Tuple2 (con integer) } (con integer) } (con integer 1) + ] + (con integer 2) + ] + ] + [ + [ { { Tuple2 (con integer) } (con integer) } (con integer 3) ] + (con integer 4) + ] ] ] ] ] - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/recursive/sameEmptyRose.uplc.golden b/plutus-tx-plugin/test/Plugin/Data/recursive/sameEmptyRose.uplc.golden index 34258294023..b1b595ea447 100644 --- a/plutus-tx-plugin/test/Plugin/Data/recursive/sameEmptyRose.uplc.golden +++ b/plutus-tx-plugin/test/Plugin/Data/recursive/sameEmptyRose.uplc.golden @@ -2,165 +2,449 @@ 1.1.0 [ (lam - fix1_i0 + fixBy_i0 [ - [ + (lam + fix3_i0 [ - (force - (delay - (lam - Nil_i0 - (lam - Cons_i0 - (lam - Nil_match_i0 - [ - [ - (force - (delay - (lam - EmptyRose_i0 - (lam - EmptyRose_match_i0 - [ - (lam - tup_i0 - [ + (lam + fix1_i0 + [ + [ + [ + (force + (delay + (lam + Nil_i0 + (lam + Cons_i0 + (lam + Nil_match_i0 + [ + [ + (force + (delay + (lam + EmptyRose_i0 (lam - map_i0 + EmptyRose_match_i0 [ (lam - tup_i0 + f_i0 [ - (lam go_i0 go_i1) - [ - (force tup_i1) - (lam arg_0_i0 arg_0_i1) - ] - ] - ) - (delay - (lam - f_i0 - [ - f_i1 + (lam + g_i0 [ - (force (force fix1_i9)) (lam - go_i0 - (lam - x_i0 - [ - EmptyRose_i7 + tup_i0 + [ + (lam + map_i0 [ - [ map_i4 go_i2 ] - [ - (force + (lam + tup_i0 + [ + (lam + g_i0 + [ + (lam + f_i0 + [ + (lam + go_i0 + go_i1 + ) + [ + (force + tup_i3 + ) + (lam + arg_0_i0 + (lam + arg_1_i0 + (lam + arg_2_i0 + arg_2_i1 + ) + ) + ) + ] + ] + ) + [ + (force + tup_i2 + ) + (lam + arg_0_i0 + (lam + arg_1_i0 + (lam + arg_2_i0 + arg_1_i2 + ) + ) + ) + ] + ] + ) [ - EmptyRose_match_i6 - x_i1 + (force tup_i1) + (lam + arg_0_i0 + (lam + arg_1_i0 + (lam + arg_2_i0 + arg_0_i3 + ) + ) + ) ] + ] + ) + [ + (force + (force + (force + (force + (force + (force + fix3_i11 + ) + ) + ) + ) + ) + ) + (delay + (lam + choose_i0 + (lam + g_i0 + (lam + f_i0 + (lam + go_i0 + [ + [ + [ + choose_i4 + (lam + arg_i0 + (delay + [ + map_i6 + go_i2 + ] + ) + ) + ] + (lam + x_i0 + [ + (lam + x_i0 + [ + (force + [ + g_i5 + (delay + (lam + x_i0 + x_i1 + ) + ) + ] + ) + [ + f_i10 + x_i1 + ] + ] + ) + x_i1 + ] + ) + ] + (lam + x_i0 + [ + (lam + x_i0 + [ + g_i9 + [ + f_i4 + x_i1 + ] + ] + ) + x_i1 + ] + ) + ] + ) + ) + ) + ) ) - (lam x_i0 x_i1) ] ] + ) + [ + (force tup_i1) + (lam + arg_0_i0 arg_0_i1 + ) + ] + ] + ) + (delay + (lam + f_i0 + [ + f_i1 + [ + (force + (force fix1_i9) + ) + (lam + map_i0 + (lam + ds_i0 + (lam + ds_i0 + [ + (lam + ds_i0 + (force + [ + [ + (force + [ + (force + Nil_match_i10 + ) + ds_i2 + ] + ) + (delay + (force + Nil_i12 + ) + ) + ] + (lam + x_i0 + (lam + xs_i0 + (delay + [ + [ + (force + Cons_i13 + ) + [ + ds_i3 + x_i2 + ] + ] + [ + [ + map_i6 + ds_i3 + ] + xs_i1 + ] + ] + ) + ) + ) + ] + ) + ) + ds_i2 + ] + ) + ) + ) + ] ] ) ) ] - ] - ) - ) - ] - ) - [ - (force tup_i1) (lam arg_0_i0 arg_0_i1) - ] - ] - ) - (delay - (lam - f_i0 - [ - f_i1 - [ - (force (force fix1_i7)) - (lam - map_i0 - (lam - ds_i0 + ) (lam ds_i0 - (force + [ [ - [ - (force - [ - (force Nil_match_i7) - ds_i1 - ] - ) - (delay (force Nil_i9)) - ] (lam - x_i0 - (lam - xs_i0 - (delay + `$WEmptyRose_i0` + `$WEmptyRose_i1` + ) + (lam + dt_i0 + [ + (lam + dt_i0 [ - [ - (force Cons_i10) - [ ds_i4 x_i2 ] - ] - [ - [ map_i5 ds_i4 ] - xs_i1 - ] + EmptyRose_i6 dt_i1 ] ) - ) + dt_i1 + ] ) ] - ) + ds_i1 + ] ) - ) + ] + ) + (lam + ds_i0 + [ + (force + [ EmptyRose_match_i2 ds_i1 ] + ) + (lam x_i0 x_i1) + ] ) ] - ] + ) ) ) - ] + ) + (lam arg_0_i0 (constr 0 arg_0_i1)) + ] + (lam + x_i0 + (delay + (lam + case_EmptyRose_i0 + (case x_i2 case_EmptyRose_i1) + ) + ) ) - ) - ) - ) - (lam arg_0_i0 (constr 0 arg_0_i1)) - ] - (lam - x_i0 - (delay - (lam - case_EmptyRose_i0 (case x_i2 case_EmptyRose_i1) + ] ) ) ) - ] + ) + ) + (delay (constr 0)) + ] + (delay + (lam arg_0_i0 (lam arg_1_i0 (constr 1 arg_0_i2 arg_1_i1))) + ) + ] + (delay + (lam + x_i0 + (delay + (lam + case_Nil_i0 + (lam case_Cons_i0 (case x_i3 case_Nil_i2 case_Cons_i1)) + ) ) ) ) + ] + ) + (delay + (delay + (lam + f_i0 + [ + (force (delay (lam s_i0 [ s_i1 s_i1 ]))) + (lam + s_i0 + (lam + x_i0 + [ + [ + f_i3 + [ (force (delay (lam s_i0 [ s_i1 s_i1 ]))) s_i2 ] + ] + x_i1 + ] + ) + ) + ] + ) ) ) - (delay (constr 0)) ] - (delay (lam arg_0_i0 (lam arg_1_i0 (constr 1 arg_0_i2 arg_1_i1)))) - ] + ) (delay - (lam - x_i0 + (delay (delay - (lam - case_Nil_i0 - (lam case_Cons_i0 (case x_i3 case_Nil_i2 case_Cons_i1)) + (delay + (delay + (delay + (lam + f_i0 + [ + [ + (force fixBy_i2) + (lam + k_i0 + (delay + (lam + h_i0 + [ + [ + [ + h_i1 + (lam + x_i0 + [ + (force k_i3) + (lam + f_0_i0 + (lam + f_1_i0 + (lam f_2_i0 [ f_0_i3 x_i4 ]) + ) + ) + ] + ) + ] + (lam + x_i0 + [ + (force k_i3) + (lam + f_0_i0 + (lam + f_1_i0 (lam f_2_i0 [ f_1_i2 x_i4 ]) + ) + ) + ] + ) + ] + (lam + x_i0 + [ + (force k_i3) + (lam + f_0_i0 + (lam + f_1_i0 (lam f_2_i0 [ f_2_i1 x_i4 ]) + ) + ) + ] + ) + ] + ) + ) + ) + ] + f_i1 + ] + ) + ) + ) ) ) ) @@ -168,23 +452,62 @@ ] ) (delay - (delay - (lam - f_i0 - [ - (force (delay (lam s_i0 [ s_i1 s_i1 ]))) + (lam + by_i0 + [ + (force + (force + (delay + (delay + (lam + f_i0 + [ + (force (delay (lam s_i0 [ s_i1 s_i1 ]))) + (lam + s_i0 + (lam + x_i0 + [ + [ + f_i3 + [ (force (delay (lam s_i0 [ s_i1 s_i1 ]))) s_i2 ] + ] + x_i1 + ] + ) + ) + ] + ) + ) + ) + ) + ) + (lam + rec_i0 (lam - s_i0 - (lam - x_i0 - [ - [ f_i3 [ (force (delay (lam s_i0 [ s_i1 s_i1 ]))) s_i2 ] ] - x_i1 - ] + h_i0 + (delay + (lam + fr_i0 + [ + (force + [ + by_i4 + (delay + (lam + fq_i0 + [ (force [ rec_i4 h_i3 ]) [ (force h_i3) fq_i1 ] ] + ) + ) + ] + ) + fr_i1 + ] + ) ) ) - ] - ) + ) + ] ) ) ] diff --git a/plutus-tx-plugin/test/Plugin/Debug/fib.pir.golden b/plutus-tx-plugin/test/Plugin/Debug/fib.pir.golden index 804a6524126..4f03b75dc5d 100644 --- a/plutus-tx-plugin/test/Plugin/Debug/fib.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Debug/fib.pir.golden @@ -46,11 +46,27 @@ { no-src-span } y (con { no-src-span } integer) - [ + (let { no-src-span } - [ { no-src-span } { no-src-span } addInteger { no-src-span } x ] - { no-src-span } y - ] + (nonrec) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } x (con { no-src-span } integer)) + { no-src-span } x + ) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } y (con { no-src-span } integer)) + { no-src-span } y + ) + [ + { no-src-span } + [ { no-src-span } { no-src-span } addInteger { no-src-span } x ] + { no-src-span } y + ] + ) ) ) ) @@ -128,31 +144,53 @@ { no-src-span } y (con { no-src-span } integer) - [ + (let { no-src-span } - [ + (nonrec) + (termbind { no-src-span } + (strict) + (vardecl { no-src-span } x (con { no-src-span } integer)) + { no-src-span } x + ) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } y (con { no-src-span } integer)) + { no-src-span } y + ) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } b (con { no-src-span } bool)) [ { no-src-span } - { + [ { no-src-span } - { no-src-span } ifThenElse - { no-src-span } Bool - } + { no-src-span } equalsInteger + { no-src-span } x + ] + { no-src-span } y + ] + ) + [ + { no-src-span } + [ + { no-src-span } [ { no-src-span } - [ + { { no-src-span } - { no-src-span } equalsInteger - { no-src-span } x - ] - { no-src-span } y + { no-src-span } ifThenElse + { no-src-span } Bool + } + { no-src-span } b ] + { no-src-span } True ] - { no-src-span } True + { no-src-span } False ] - { no-src-span } False - ] + ) ) ) ) @@ -198,13 +236,31 @@ { no-src-span } y (con { no-src-span } integer) - [ + (let { no-src-span } + (nonrec) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } x (con { no-src-span } integer)) + { no-src-span } x + ) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } y (con { no-src-span } integer)) + { no-src-span } y + ) [ - { no-src-span } { no-src-span } subtractInteger { no-src-span } x + { no-src-span } + [ + { no-src-span } + { no-src-span } subtractInteger + { no-src-span } x + ] + { no-src-span } y ] - { no-src-span } y - ] + ) ) ) ) @@ -227,188 +283,202 @@ { no-src-span } n (con { no-src-span } integer) - { - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - [ + (let + { test/Plugin/Debug/Spec.hs:46:15-55:72 } + (nonrec) + (termbind + { test/Plugin/Debug/Spec.hs:46:15-55:72 } + (strict) + (vardecl + { test/Plugin/Debug/Spec.hs:46:15-55:72 } + n + (con { test/Plugin/Debug/Spec.hs:46:15-55:72 } integer) + ) + { test/Plugin/Debug/Spec.hs:46:15-55:72 } n + ) + { { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - { + [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - [ + { { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - Bool_match [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + Bool_match [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - equalsInteger - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:47:43-47:43 } - n + [ + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + equalsInteger + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:47:43-47:43 } + n + ] + (con + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:47:45-47:45 } + integer + 0 + ) ] + ] + (all + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + dead + ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + type) (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:47:45-47:45 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } integer - 0 ) - ] - ] - (all + ) + } + (abs { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } dead ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } type) (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:48:26-48:26 } integer + 0 ) ) - } + ] (abs { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } dead ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } type) - (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:48:26-48:26 } - integer - 0 - ) - ) - ] - (abs - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - dead - ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - type) - { - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - [ + { { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - { + [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - [ - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + { { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - Bool_match [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + Bool_match [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - equalsInteger - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:50:51-50:51 } - n + [ + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + equalsInteger + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:50:51-50:51 } + n + ] + (con + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:50:53-50:53 } + integer + 1 + ) ] + ] + (all + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + dead + ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + type) (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:50:53-50:53 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } integer - 1 ) - ] - ] - (all + ) + } + (abs { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } dead ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } type) (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:51:34-51:34 } integer + 1 ) ) - } + ] (abs { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } dead ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } type) - (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:51:34-51:34 } - integer - 1 - ) - ) - ] - (abs - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - dead - ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - type) - [ - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72 } [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72 } - addInteger [ - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72 } - fib + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72 } + addInteger [ - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72 } + fib [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71 } - subtractInteger - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71, test/Plugin/Debug/Spec.hs:54:68-54:68 } - n + [ + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71 } + subtractInteger + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71, test/Plugin/Debug/Spec.hs:54:68-54:68 } + n + ] + (con + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71, test/Plugin/Debug/Spec.hs:54:70-54:70 } + integer + 1 + ) ] - (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:54:37-54:72, test/Plugin/Debug/Spec.hs:54:42-54:71, test/Plugin/Debug/Spec.hs:54:70-54:70 } - integer - 1 - ) ] ] - ] - [ - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72 } - fib [ - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72 } + fib [ { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71 } - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71 } - subtractInteger - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71, test/Plugin/Debug/Spec.hs:55:68-55:68 } - n + [ + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71 } + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71 } + subtractInteger + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71, test/Plugin/Debug/Spec.hs:55:68-55:68 } + n + ] + (con + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71, test/Plugin/Debug/Spec.hs:55:70-55:70 } + integer + 2 + ) ] - (con - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72, test/Plugin/Debug/Spec.hs:53:33-55:72, test/Plugin/Debug/Spec.hs:55:37-55:72, test/Plugin/Debug/Spec.hs:55:42-55:71, test/Plugin/Debug/Spec.hs:55:70-55:70 } - integer - 2 - ) ] ] - ] + ) + ] + (all + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + dead + ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + type) + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } + dead ) - ] - (all - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - dead - ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - type) - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72, test/Plugin/Debug/Spec.hs:50:25-55:72 } - dead - ) - } + } + ) + ] + (all + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + dead + ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + type) + { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } + dead ) - ] - (all - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - dead - ({ test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - type) - { test/Plugin/Debug/Spec.hs:46:15-55:72, test/Plugin/Debug/Spec.hs:47:17-55:72 } - dead - ) - } + } + ) ) ) { test/Plugin/Debug/Spec.hs:45:9-57:9 } fib diff --git a/plutus-tx-plugin/test/Plugin/Debug/letFun.pir.golden b/plutus-tx-plugin/test/Plugin/Debug/letFun.pir.golden index dbfec99fe1f..5cc80d8ecb8 100644 --- a/plutus-tx-plugin/test/Plugin/Debug/letFun.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Debug/letFun.pir.golden @@ -78,35 +78,101 @@ { no-src-span } y (con { no-src-span } integer) - [ + (let { no-src-span } - [ + (nonrec) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } x (con { no-src-span } integer)) + { no-src-span } x + ) + (termbind { no-src-span } + (strict) + (vardecl { no-src-span } y (con { no-src-span } integer)) + { no-src-span } y + ) + (termbind + { no-src-span } + (strict) + (vardecl { no-src-span } b (con { no-src-span } bool)) [ { no-src-span } - { + [ { no-src-span } - { no-src-span } ifThenElse - { no-src-span } Bool - } + { no-src-span } equalsInteger + { no-src-span } x + ] + { no-src-span } y + ] + ) + [ + { no-src-span } + [ + { no-src-span } [ { no-src-span } - [ + { { no-src-span } - { no-src-span } equalsInteger - { no-src-span } x - ] - { no-src-span } y + { no-src-span } ifThenElse + { no-src-span } Bool + } + { no-src-span } b ] + { no-src-span } True ] - { no-src-span } True + { no-src-span } False + ] + ) + ) + ) + ) + (lam + { no-src-span } + ds + (con { no-src-span } integer) + (lam + { no-src-span } + ds + (con { no-src-span } integer) + (let + { test/Plugin/Debug/Spec.hs:38:9-38:87 } + (nonrec) + (termbind + { test/Plugin/Debug/Spec.hs:38:9-38:87 } + (strict) + (vardecl + { test/Plugin/Debug/Spec.hs:38:9-38:87 } + ds + (con { test/Plugin/Debug/Spec.hs:38:9-38:87 } integer) + ) + { test/Plugin/Debug/Spec.hs:38:9-38:87 } ds + ) + (termbind + { test/Plugin/Debug/Spec.hs:38:9-38:87 } + (strict) + (vardecl + { test/Plugin/Debug/Spec.hs:38:9-38:87 } + ds + (con { test/Plugin/Debug/Spec.hs:38:9-38:87 } integer) + ) + { test/Plugin/Debug/Spec.hs:38:9-38:87 } ds + ) + [ + { test/Plugin/Debug/Spec.hs:38:9-38:87, test/Plugin/Debug/Spec.hs:38:44-38:86, test/Plugin/Debug/Spec.hs:38:54-38:79 } + [ + { test/Plugin/Debug/Spec.hs:38:9-38:87, test/Plugin/Debug/Spec.hs:38:44-38:86, test/Plugin/Debug/Spec.hs:38:54-38:79 } + { test/Plugin/Debug/Spec.hs:38:9-38:87, test/Plugin/Debug/Spec.hs:38:44-38:86, test/Plugin/Debug/Spec.hs:38:54-38:79 } + equalsInteger + { test/Plugin/Debug/Spec.hs:38:9-38:87, test/Plugin/Debug/Spec.hs:38:44-38:86, test/Plugin/Debug/Spec.hs:38:54-38:79, test/Plugin/Debug/Spec.hs:38:77-38:77 } + ds ] - { no-src-span } False + { test/Plugin/Debug/Spec.hs:38:9-38:87, test/Plugin/Debug/Spec.hs:38:44-38:86, test/Plugin/Debug/Spec.hs:38:54-38:79, test/Plugin/Debug/Spec.hs:38:79-38:79 } + ds ] ) ) ) - { test/Plugin/Debug/Spec.hs:38:9-38:87, test/Plugin/Debug/Spec.hs:38:54-38:79 } - equalsInteger ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Errors/caseInt.uplc-catch.golden b/plutus-tx-plugin/test/Plugin/Errors/caseInt.uplc-catch.golden index 51f18a1b0fe..f4c22afc8b0 100644 --- a/plutus-tx-plugin/test/Plugin/Errors/caseInt.uplc-catch.golden +++ b/plutus-tx-plugin/test/Plugin/Errors/caseInt.uplc-catch.golden @@ -1,2 +1,2 @@ Error: Unsupported feature: Cannot case on a value on type: GHC.Num.Integer.Integer - Note: GHC can generate these unexpectedly, you may need '-fno-strictness', '-fno-specialise', or '-fno-spec-constr' \ No newline at end of file + Note: GHC can generate these unexpectedly, you may need '-fno-strictness', '-fno-specialise', '-fno-spec-constr', '-fno-unbox-strict-fields', or '-fno-unbox-small-strict-fields'. \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Errors/literalAppendBs.uplc-catch.golden b/plutus-tx-plugin/test/Plugin/Errors/literalAppendBs.uplc-catch.golden index 2b203649fee..e486156dc3b 100644 --- a/plutus-tx-plugin/test/Plugin/Errors/literalAppendBs.uplc-catch.golden +++ b/plutus-tx-plugin/test/Plugin/Errors/literalAppendBs.uplc-catch.golden @@ -3,18 +3,24 @@ (lam x_i0 [ - [ + (lam + x_i0 [ - (lam appendByteString_i0 (force appendByteString_i1)) - (delay + [ [ - (lam appendByteString_i0 appendByteString_i1) - (builtin appendByteString) + (lam appendByteString_i0 (force appendByteString_i1)) + (delay + [ + (lam appendByteString_i0 appendByteString_i1) + (builtin appendByteString) + ] + ) ] - ) + (con bytestring #68656c6c6f) + ] + x_i1 ] - (con bytestring #68656c6c6f) - ] + ) x_i1 ] ) diff --git a/plutus-tx-plugin/test/Plugin/Functions/recursive/even.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/recursive/even.pir.golden index d222c1e0496..2ce02dab88d 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/recursive/even.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/recursive/even.pir.golden @@ -29,7 +29,13 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -45,7 +51,20 @@ (vardecl subtractInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ subtractInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ subtractInteger x ] y ] + ) + ) + ) ) (let (rec) @@ -57,11 +76,7 @@ (con integer) (let (nonrec) - (termbind - (nonstrict) - (vardecl n (con integer)) - [ [ subtractInteger n ] (con integer 1) ] - ) + (termbind (strict) (vardecl n (con integer)) n) { [ [ @@ -74,23 +89,33 @@ (abs dead (type) - { - [ + (let + (nonrec) + (termbind + (strict) + (vardecl n (con integer)) + [ [ subtractInteger n ] (con integer 1) ] + ) + { [ - { - [ Bool_match [ [ equalsInteger n ] (con integer 0) ] ] - (all dead (type) Bool) - } - (abs dead (type) False) + [ + { + [ + Bool_match [ [ equalsInteger n ] (con integer 0) ] + ] + (all dead (type) Bool) + } + (abs dead (type) False) + ] + (abs + dead + (type) + [ even [ [ subtractInteger n ] (con integer 1) ] ] + ) ] - (abs - dead - (type) - [ even [ [ subtractInteger n ] (con integer 1) ] ] - ) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ] (all dead (type) dead) diff --git a/plutus-tx-plugin/test/Plugin/Functions/recursive/fib.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/recursive/fib.pir.golden index 8623e87972f..116dee836b9 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/recursive/fib.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/recursive/fib.pir.golden @@ -10,7 +10,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (datatypebind (datatype @@ -39,7 +52,13 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -55,7 +74,20 @@ (vardecl subtractInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ subtractInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ subtractInteger x ] y ] + ) + ) + ) ) (let (rec) @@ -65,45 +97,49 @@ (lam n (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl n (con integer)) n) + { [ - { - [ Bool_match [ [ equalsInteger n ] (con integer 0) ] ] - (all dead (type) (con integer)) - } - (abs dead (type) (con integer 0)) - ] - (abs - dead - (type) - { - [ + [ + { + [ Bool_match [ [ equalsInteger n ] (con integer 0) ] ] + (all dead (type) (con integer)) + } + (abs dead (type) (con integer 0)) + ] + (abs + dead + (type) + { [ - { - [ Bool_match [ [ equalsInteger n ] (con integer 1) ] ] - (all dead (type) (con integer)) - } - (abs dead (type) (con integer 1)) - ] - (abs - dead - (type) [ + { + [ Bool_match [ [ equalsInteger n ] (con integer 1) ] ] + (all dead (type) (con integer)) + } + (abs dead (type) (con integer 1)) + ] + (abs + dead + (type) [ - addInteger - [ fib [ [ subtractInteger n ] (con integer 1) ] ] + [ + addInteger + [ fib [ [ subtractInteger n ] (con integer 1) ] ] + ] + [ fib [ [ subtractInteger n ] (con integer 2) ] ] ] - [ fib [ [ subtractInteger n ] (con integer 2) ] ] - ] - ) - ] - (all dead (type) dead) - } - ) - ] - (all dead (type) dead) - } + ) + ] + (all dead (type) dead) + } + ) + ] + (all dead (type) dead) + } + ) ) ) fib diff --git a/plutus-tx-plugin/test/Plugin/Functions/recursive/lazyLength.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/recursive/lazyLength.pir.golden index e3e837422e2..a2621b45343 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/recursive/lazyLength.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/recursive/lazyLength.pir.golden @@ -25,7 +25,20 @@ (vardecl addInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -44,34 +57,49 @@ (lam ds [ List a ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl acc (con integer)) acc) + { [ - { - [ { Nil_match a } ds ] (all dead (type) (con integer)) - } - (abs dead (type) acc) - ] - (lam - ds - a + [ + { + [ { Nil_match a } ds ] + (all dead (type) (con integer)) + } + (abs dead (type) acc) + ] (lam - tl - [ List a ] - (abs - dead - (type) - [ [ go [ [ addInteger acc ] (con integer 1) ] ] tl ] + ds + a + (lam + tl + [ List a ] + (abs + dead + (type) + [ + [ go [ [ addInteger acc ] (con integer 1) ] ] tl + ] + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) - (lam l [ List a ] [ [ go (con integer 0) ] l ]) + (lam + l + [ List a ] + (let + (nonrec) + (termbind (strict) (vardecl l [ List a ]) l) + [ [ go (con integer 0) ] l ] + ) + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Functions/recursive/strictLength.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/recursive/strictLength.pir.golden index ad1887c6f80..440fa6e15b5 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/recursive/strictLength.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/recursive/strictLength.pir.golden @@ -25,7 +25,20 @@ (vardecl addInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -78,7 +91,15 @@ ) ) ) - (lam l [ List a ] [ [ go (con integer 0) ] l ]) + (lam + l + [ List a ] + (let + (nonrec) + (termbind (strict) (vardecl l [ List a ]) l) + [ [ go (con integer 0) ] l ] + ) + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Functions/recursive/sum.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/recursive/sum.pir.golden index 4f02ece2fbb..ec0933de16f 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/recursive/sum.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/recursive/sum.pir.golden @@ -25,7 +25,20 @@ (vardecl addInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (let (rec) diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/allDirect.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/allDirect.pir.golden index ab2f3258801..6a56b7aca44 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/allDirect.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/allDirect.pir.golden @@ -16,32 +16,40 @@ (lam ds Bool - (lam - ds - Bool - { - [ - [ - { [ Bool_match ds ] (all dead (type) Bool) } - (abs dead (type) False) - ] - (abs - dead - (type) - { + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + (lam + ds + Bool + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + { + [ [ - [ - { [ Bool_match ds ] (all dead (type) Bool) } - (abs dead (type) False) - ] - (abs dead (type) True) + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) False) ] - (all dead (type) dead) - } - ) - ] - (all dead (type) dead) - } + (abs + dead + (type) + { + [ + [ + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) False) + ] + (abs dead (type) True) + ] + (all dead (type) dead) + } + ) + ] + (all dead (type) dead) + } + ) + ) ) ) ) @@ -51,10 +59,20 @@ (lam ds Bool - (lam - ds - Bool - [ [ nandDirect [ [ nandDirect ds ] ds ] ] [ [ nandDirect ds ] ds ] ] + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + (lam + ds + Bool + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + [ + [ nandDirect [ [ nandDirect ds ] ds ] ] [ [ nandDirect ds ] ds ] + ] + ) + ) ) ) ) @@ -85,28 +103,34 @@ (lam l [ List a ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl p (fun a Bool)) p) + { [ - { [ { Nil_match a } l ] (all dead (type) Bool) } - (abs dead (type) True) - ] - (lam - h - a + [ + { [ { Nil_match a } l ] (all dead (type) Bool) } + (abs dead (type) True) + ] (lam - t - [ List a ] - (abs - dead - (type) - [ [ andDirect [ p h ] ] [ [ { allDirect a } p ] t ] ] + h + a + (lam + t + [ List a ] + (abs + dead + (type) + [ + [ andDirect [ p h ] ] [ [ { allDirect a } p ] t ] + ] + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) @@ -166,17 +190,30 @@ (lam y (con integer) - [ - [ [ { ifThenElse Bool } [ [ lessThanInteger x ] y ] ] True ] - False - ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ lessThanInteger x ] y ] + ) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) [ [ { allDirect (con integer) } - (lam ds (con integer) [ [ lessThanInteger ds ] (con integer 5) ]) + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ lessThanInteger ds ] (con integer 5) ] + ) + ) ] [ { build (con integer) } diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andDirect.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andDirect.pir.golden index 581a8511c8e..bc259f53214 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andDirect.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andDirect.pir.golden @@ -16,32 +16,40 @@ (lam ds Bool - (lam - ds - Bool - { - [ - [ - { [ Bool_match ds ] (all dead (type) Bool) } - (abs dead (type) False) - ] - (abs - dead - (type) - { + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + (lam + ds + Bool + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + { + [ [ - [ - { [ Bool_match ds ] (all dead (type) Bool) } - (abs dead (type) False) - ] - (abs dead (type) True) + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) False) ] - (all dead (type) dead) - } - ) - ] - (all dead (type) dead) - } + (abs + dead + (type) + { + [ + [ + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) False) + ] + (abs dead (type) True) + ] + (all dead (type) dead) + } + ) + ] + (all dead (type) dead) + } + ) + ) ) ) ) @@ -51,10 +59,20 @@ (lam ds Bool - (lam - ds - Bool - [ [ nandDirect [ [ nandDirect ds ] ds ] ] [ [ nandDirect ds ] ds ] ] + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + (lam + ds + Bool + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + [ + [ nandDirect [ [ nandDirect ds ] ds ] ] [ [ nandDirect ds ] ds ] + ] + ) + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andExternal.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andExternal.pir.golden index 2063dd3024a..88524d4f1f3 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andExternal.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/andExternal.pir.golden @@ -19,15 +19,21 @@ (lam b Bool - { - [ + (let + (nonrec) + (termbind (strict) (vardecl a Bool) a) + (termbind (strict) (vardecl b Bool) b) + { [ - { [ Bool_match a ] (all dead (type) Bool) } (abs dead (type) b) + [ + { [ Bool_match a ] (all dead (type) Bool) } + (abs dead (type) b) + ] + (abs dead (type) False) ] - (abs dead (type) False) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/applicationFunction.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/applicationFunction.pir.golden index 985c9563aa3..58a0ef72efd 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/applicationFunction.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/applicationFunction.pir.golden @@ -10,17 +10,59 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) (vardecl myDollar (all a (type) (all b (type) (fun (fun a b) (fun a b))))) - (abs a (type) (abs b (type) (lam f (fun a b) (lam a a [ f a ])))) + (abs + a + (type) + (abs + b + (type) + (lam + f + (fun a b) + (lam + a + a + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + (termbind (strict) (vardecl a a) a) + [ f a ] + ) + ) + ) + ) + ) ) [ [ { { myDollar (con integer) } (con integer) } - (lam x (con integer) [ [ addInteger (con integer 1) ] x ]) + (lam + x + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + [ [ addInteger (con integer 1) ] x ] + ) + ) ] (con integer 1) ] diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/mutualRecursionUnfoldings.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/mutualRecursionUnfoldings.pir.golden index a5a0973ec6a..eef2b533341 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/mutualRecursionUnfoldings.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/mutualRecursionUnfoldings.pir.golden @@ -35,35 +35,32 @@ (lam n (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl n (con integer)) n) + (termbind + (strict) + (vardecl b (con bool)) + [ [ equalsInteger n ] (con integer 0) ] + ) + { [ - { - [ - Bool_match - [ - [ - [ - { ifThenElse Bool } - [ [ equalsInteger n ] (con integer 0) ] - ] - True - ] - False - ] - ] - (all dead (type) Bool) - } - (abs dead (type) True) + [ + { + [ Bool_match [ [ [ { ifThenElse Bool } b ] True ] False ] ] + (all dead (type) Bool) + } + (abs dead (type) True) + ] + (abs + dead + (type) + [ oddDirect [ [ subtractInteger n ] (con integer 1) ] ] + ) ] - (abs - dead - (type) - [ oddDirect [ [ subtractInteger n ] (con integer 1) ] ] - ) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) (termbind @@ -72,35 +69,32 @@ (lam n (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl n (con integer)) n) + (termbind + (strict) + (vardecl b (con bool)) + [ [ equalsInteger n ] (con integer 0) ] + ) + { [ - { - [ - Bool_match - [ - [ - [ - { ifThenElse Bool } - [ [ equalsInteger n ] (con integer 0) ] - ] - True - ] - False - ] - ] - (all dead (type) Bool) - } - (abs dead (type) False) + [ + { + [ Bool_match [ [ [ { ifThenElse Bool } b ] True ] False ] ] + (all dead (type) Bool) + } + (abs dead (type) False) + ] + (abs + dead + (type) + [ evenDirect [ [ subtractInteger n ] (con integer 1) ] ] + ) ] - (abs - dead - (type) - [ evenDirect [ [ subtractInteger n ] (con integer 1) ] ] - ) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) [ evenDirect (con integer 4) ] diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/nandDirect.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/nandDirect.pir.golden index f6b81f146ce..c8d0272551b 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/nandDirect.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/nandDirect.pir.golden @@ -16,32 +16,40 @@ (lam ds Bool - (lam - ds - Bool - { - [ - [ - { [ Bool_match ds ] (all dead (type) Bool) } - (abs dead (type) False) - ] - (abs - dead - (type) - { + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + (lam + ds + Bool + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + { + [ [ - [ - { [ Bool_match ds ] (all dead (type) Bool) } - (abs dead (type) False) - ] - (abs dead (type) True) + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) False) ] - (all dead (type) dead) - } - ) - ] - (all dead (type) dead) - } + (abs + dead + (type) + { + [ + [ + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) False) + ] + (abs dead (type) True) + ] + (all dead (type) dead) + } + ) + ] + (all dead (type) dead) + } + ) + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/polyMap.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/polyMap.pir.golden index ad0ad12c904..e8c33dac64b 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/polyMap.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/polyMap.pir.golden @@ -10,7 +10,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (let (rec) @@ -75,31 +88,37 @@ (lam l [ List a ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + { [ - { [ { Nil_match a } l ] (all dead (type) [ List b ]) } - (abs dead (type) { Nil b }) - ] - (lam - x - a + [ + { + [ { Nil_match a } l ] (all dead (type) [ List b ]) + } + (abs dead (type) { Nil b }) + ] (lam - xs - [ List a ] - (abs - dead - (type) - [ - [ { Cons b } [ f x ] ] - [ [ { { mapDirect a } b } f ] xs ] - ] + x + a + (lam + xs + [ List a ] + (abs + dead + (type) + [ + [ { Cons b } [ f x ] ] + [ [ { { mapDirect a } b } f ] xs ] + ] + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelector.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelector.pir.golden index b627e19f334..073916aa1c7 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelector.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelector.pir.golden @@ -24,6 +24,10 @@ ] ) ) - mrA + (lam + ds + MyMonoRecord + (let (nonrec) (termbind (strict) (vardecl ds MyMonoRecord) ds) [ mrA ds ]) + ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelectorExternal.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelectorExternal.pir.golden index 9b6cda50a0d..fa782ad3fbe 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelectorExternal.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/recordSelectorExternal.pir.golden @@ -22,6 +22,14 @@ ] ) ) - myExternal + (lam + ds + MyExternalRecord + (let + (nonrec) + (termbind (strict) (vardecl ds MyExternalRecord) ds) + [ myExternal ds ] + ) + ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2.pir.golden index 567aa11aa08..37cd1fe3591 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2.pir.golden @@ -18,7 +18,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -41,7 +54,11 @@ (lam x (con integer) - [ unboxedTuple [ [ { { UTuple2 (con integer) } (con integer) } x ] x ] ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + [ unboxedTuple [ [ { { UTuple2 (con integer) } (con integer) } x ] x ] ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2Tuples.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2Tuples.pir.golden index 678c53cd0bb..1196a90001d 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2Tuples.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples2Tuples.pir.golden @@ -43,7 +43,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -228,13 +241,27 @@ (lam x (con integer) - [ - unboxedTuples2Tuple + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) [ + unboxedTuples2Tuple [ - { + [ { - UTuple2 + { + UTuple2 + [ + [ + [ + [ [ UTuple5 (con integer) ] (con integer) ] + (con integer) + ] + (con integer) + ] + (con integer) + ] + } [ [ [ @@ -245,29 +272,23 @@ (con integer) ] } - [ - [ - [ [ [ UTuple5 (con integer) ] (con integer) ] (con integer) ] - (con integer) - ] - (con integer) - ] - } - [ [ [ [ [ - { + [ { { - { { UTuple5 (con integer) } (con integer) } + { + { { UTuple5 (con integer) } (con integer) } + (con integer) + } (con integer) } (con integer) } - (con integer) - } + x + ] x ] x @@ -276,24 +297,24 @@ ] x ] - x ] - ] - [ [ [ [ [ - { + [ { { - { { UTuple5 (con integer) } (con integer) } + { + { { UTuple5 (con integer) } (con integer) } + (con integer) + } (con integer) } (con integer) } - (con integer) - } + x + ] x ] x @@ -302,10 +323,9 @@ ] x ] - x ] ] - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3.pir.golden index 41509c8fcaf..b2d14715cd1 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3.pir.golden @@ -18,7 +18,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -57,16 +70,22 @@ (lam x (con integer) - [ - unboxedTuple + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) [ + unboxedTuple [ - [ { { { UTuple3 (con integer) } (con integer) } (con integer) } x ] + [ + [ + { { { UTuple3 (con integer) } (con integer) } (con integer) } x + ] + x + ] x ] - x ] - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3Tuples.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3Tuples.pir.golden index f57f2d0c158..bb33771b74b 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3Tuples.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples3Tuples.pir.golden @@ -43,7 +43,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -278,15 +291,29 @@ (lam x (con integer) - [ - unboxedTuples3Tuple + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) [ + unboxedTuples3Tuple [ [ - { + [ { { - UTuple3 + { + UTuple3 + [ + [ + [ + [ [ UTuple5 (con integer) ] (con integer) ] + (con integer) + ] + (con integer) + ] + (con integer) + ] + } [ [ [ @@ -312,13 +339,29 @@ [ [ [ - [ [ UTuple5 (con integer) ] (con integer) ] (con integer) + [ + [ + { + { + { + { { UTuple5 (con integer) } (con integer) } + (con integer) + } + (con integer) + } + (con integer) + } + x + ] + x + ] + x ] - (con integer) + x ] - (con integer) + x ] - } + ] [ [ [ @@ -371,33 +414,8 @@ x ] ] - [ - [ - [ - [ - [ - { - { - { - { { UTuple5 (con integer) } (con integer) } - (con integer) - } - (con integer) - } - (con integer) - } - x - ] - x - ] - x - ] - x - ] - x - ] ] - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples4.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples4.pir.golden index 5fc53c453d3..2630dc6c138 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples4.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples4.pir.golden @@ -26,7 +26,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -85,25 +98,31 @@ (lam x (con integer) - [ - unboxedTuple + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) [ + unboxedTuple [ [ [ - { - { { { UTuple4 (con integer) } (con integer) } (con integer) } - (con integer) - } + [ + { + { + { { UTuple4 (con integer) } (con integer) } (con integer) + } + (con integer) + } + x + ] x ] x ] x ] - x ] - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples5.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples5.pir.golden index b75821f702c..1a5859b15ad 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples5.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/unfoldings/unboxedTuples5.pir.golden @@ -35,7 +35,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (strict) @@ -117,23 +130,28 @@ (lam x (con integer) - [ - unboxedTuple + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) [ + unboxedTuple [ [ [ [ - { + [ { { - { { UTuple5 (con integer) } (con integer) } + { + { { UTuple5 (con integer) } (con integer) } + (con integer) + } (con integer) } (con integer) } - (con integer) - } + x + ] x ] x @@ -142,9 +160,8 @@ ] x ] - x ] - ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Laziness/joinError.pir.golden b/plutus-tx-plugin/test/Plugin/Laziness/joinError.pir.golden index 46374a5dd3f..c490c3d26eb 100644 --- a/plutus-tx-plugin/test/Plugin/Laziness/joinError.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Laziness/joinError.pir.golden @@ -29,29 +29,34 @@ (lam y Bool - { - [ + (let + (nonrec) + (termbind (strict) (vardecl x Bool) x) + (termbind (strict) (vardecl y Bool) y) + { [ - { [ Bool_match x ] (all dead (type) Unit) } - (abs - dead - (type) - { - [ + [ + { [ Bool_match x ] (all dead (type) Unit) } + (abs + dead + (type) + { [ - { [ Bool_match y ] (all dead (type) Unit) } - (abs dead (type) joinError) + [ + { [ Bool_match y ] (all dead (type) Unit) } + (abs dead (type) joinError) + ] + (abs dead (type) Unit) ] - (abs dead (type) Unit) - ] - (all dead (type) dead) - } - ) + (all dead (type) dead) + } + ) + ] + (abs dead (type) Unit) ] - (abs dead (type) Unit) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Primitives/and.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/and.pir.golden index 80e304502da..7f05e08b24b 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/and.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/and.pir.golden @@ -16,15 +16,21 @@ (lam ds Bool - { - [ + (let + (nonrec) + (termbind (strict) (vardecl ds Bool) ds) + (termbind (strict) (vardecl ds Bool) ds) + { [ - { [ Bool_match ds ] (all dead (type) Bool) } (abs dead (type) ds) + [ + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) ds) + ] + (abs dead (type) False) ] - (abs dead (type) False) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData1.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData1.pir.golden index 6438a3338bf..cea77481300 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData1.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData1.pir.golden @@ -10,8 +10,24 @@ (termbind (strict) (vardecl unsafeDataAsI (fun (con data) (con integer))) - (lam d (con data) [ unsafeDataAsI d ]) + (lam + d + (con data) + (let + (nonrec) + (termbind (strict) (vardecl d (con data)) d) + [ unsafeDataAsI d ] + ) + ) + ) + (lam + ds + (con data) + (let + (nonrec) + (termbind (strict) (vardecl ds (con data)) ds) + [ unsafeDataAsI ds ] + ) ) - unsafeDataAsI ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData2.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData2.pir.golden index 0bb9ddeb48c..5c80214216d 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/deconstructorData2.pir.golden @@ -43,10 +43,14 @@ (lam ds [ [ Tuple2 c ] a ] - [ - { [ { { Tuple2_match c } a } ds ] [ [ Tuple2 c ] b ] } - (lam c c (lam a a [ [ { { Tuple2 c } b } c ] [ f a ] ])) - ] + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + [ + { [ { { Tuple2_match c } a } ds ] [ [ Tuple2 c ] b ] } + (lam c c (lam a a [ [ { { Tuple2 c } b } c ] [ f a ] ])) + ] + ) ) ) ) @@ -109,31 +113,35 @@ (lam l [ List a ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + { [ - { [ { Nil_match a } l ] (all dead (type) [ List b ]) } - (abs dead (type) { Nil b }) - ] - (lam - x - a + [ + { [ { Nil_match a } l ] (all dead (type) [ List b ]) } + (abs dead (type) { Nil b }) + ] (lam - xs - [ List a ] - (abs - dead - (type) - [ - [ { Cons b } [ f x ] ] - [ [ { { `$fFunctorNil_$cfmap` a } b } f ] xs ] - ] + x + a + (lam + xs + [ List a ] + (abs + dead + (type) + [ + [ { Cons b } [ f x ] ] + [ [ { { `$fFunctorNil_$cfmap` a } b } f ] xs ] + ] + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) @@ -271,32 +279,36 @@ (lam l [ (con list) (con data) ] - [ + (let + (nonrec) + (termbind (strict) (vardecl l [ (con list) (con data) ]) l) [ [ [ - { - { chooseList (con data) } - (fun (con unit) [ List (con data) ]) - } - l - ] - (lam ds (con unit) { Nil (con data) }) - ] - (lam - ds - (con unit) - [ - [ { Cons (con data) } [ { head (con data) } l ] ] [ - `$s$fFromBuiltinBuiltinListNil_$cfromBuiltin_go` - [ { tail (con data) } l ] + { + { chooseList (con data) } + (fun (con unit) [ List (con data) ]) + } + l ] + (lam ds (con unit) { Nil (con data) }) ] - ) + (lam + ds + (con unit) + [ + [ { Cons (con data) } [ { head (con data) } l ] ] + [ + `$s$fFromBuiltinBuiltinListNil_$cfromBuiltin_go` + [ { tail (con data) } l ] + ] + ] + ) + ] + unitval ] - unitval - ] + ) ) ) (let @@ -341,8 +353,9 @@ (con data) (let (nonrec) + (termbind (strict) (vardecl d (con data)) d) (termbind - (nonstrict) + (strict) (vardecl p [ @@ -358,12 +371,18 @@ { { fst (con integer) } [ (con list) (con data) ] } p ] ] - [ - `$s$fFromBuiltinBuiltinListNil_$cfromBuiltin_go` - [ - { { snd (con integer) } [ (con list) (con data) ] } p - ] - ] + (let + (nonrec) + (termbind + (strict) + (vardecl a [ (con list) (con data) ]) + [ + { { snd (con integer) } [ (con list) (con data) ] } + p + ] + ) + [ `$s$fFromBuiltinBuiltinListNil_$cfromBuiltin_go` a ] + ) ] ) ) @@ -376,50 +395,63 @@ (termbind (strict) (vardecl unsafeDataAsI (fun (con data) (con integer))) - (lam d (con data) [ unsafeDataAsI d ]) + (lam + d + (con data) + (let + (nonrec) + (termbind (strict) (vardecl d (con data)) d) + [ unsafeDataAsI d ] + ) + ) ) (lam ds (con data) - [ + (let + (nonrec) + (termbind (strict) (vardecl ds (con data)) ds) [ [ [ - { + [ { { - `.` - (fun [ List (con data) ] [ List (con integer) ]) + { + `.` + (fun [ List (con data) ] [ List (con integer) ]) + } + (fun + [ [ Tuple2 (con integer) ] [ List (con data) ] ] + [ + [ Tuple2 (con integer) ] + [ List (con integer) ] + ] + ) } - (fun - [ [ Tuple2 (con integer) ] [ List (con data) ] ] + (fun (con data) (con integer)) + } + { + { [ - [ Tuple2 (con integer) ] [ List (con integer) ] + { fmap [ Tuple2 (con integer) ] } + { `$fFunctorTuple2` (con integer) } ] - ) + [ List (con data) ] + } + [ List (con integer) ] } - (fun (con data) (con integer)) - } + ] { - { - [ - { fmap [ Tuple2 (con integer) ] } - { `$fFunctorTuple2` (con integer) } - ] - [ List (con data) ] - } - [ List (con integer) ] + { [ { fmap List } `$fFunctorNil` ] (con data) } + (con integer) } ] - { - { [ { fmap List } `$fFunctorNil` ] (con data) } - (con integer) - } + unsafeDataAsI ] - unsafeDataAsI + [ unsafeDataAsConstr ds ] ] - [ unsafeDataAsConstr ds ] - ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Primitives/ifThenElse.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/ifThenElse.pir.golden index 82e1ab7c8aa..68bfc6f4dda 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/ifThenElse.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/ifThenElse.pir.golden @@ -29,7 +29,13 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -39,19 +45,24 @@ (lam ds (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + { [ - { - [ Bool_match [ [ equalsInteger ds ] ds ] ] - (all dead (type) (con integer)) - } + [ + { + [ Bool_match [ [ equalsInteger ds ] ds ] ] + (all dead (type) (con integer)) + } + (abs dead (type) ds) + ] (abs dead (type) ds) ] - (abs dead (type) ds) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Primitives/intCompare.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/intCompare.pir.golden index 9fcc3a9dd14..1ec0eb264e7 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/intCompare.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/intCompare.pir.golden @@ -31,10 +31,31 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ lessThanInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ lessThanInteger x ] y ] + ) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) + ) + ) + ) + (lam + ds + (con integer) + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ lessThanInteger ds ] ds ] ) ) ) - lessThanInteger ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/intDiv.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/intDiv.pir.golden index 08ca911e589..5d7b0e8d5ec 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/intDiv.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/intDiv.pir.golden @@ -14,8 +14,34 @@ (vardecl divideInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ divideInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ divideInteger x ] y ] + ) + ) + ) + ) + (lam + ds + (con integer) + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ divideInteger ds ] ds ] + ) + ) ) - divideInteger ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/intEq.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/intEq.pir.golden index 50c6d0acca6..5439a86cab6 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/intEq.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/intEq.pir.golden @@ -29,10 +29,29 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) + ) + ) + ) + (lam + ds + (con integer) + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ equalsInteger ds ] ds ] ) ) ) - equalsInteger ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/intPlus.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/intPlus.pir.golden index 9fb0ee2b726..6fb31d204ce 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/intPlus.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/intPlus.pir.golden @@ -10,8 +10,34 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) + ) + (lam + ds + (con integer) + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ addInteger ds ] ds ] + ) + ) ) - addInteger ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/trace.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/trace.pir.golden index b3da2589294..362c2266480 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/trace.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/trace.pir.golden @@ -15,6 +15,14 @@ (vardecl trace (all a (type) (fun (con string) (fun a a)))) trace ) - (lam ds (con string) [ [ { trace Unit } ds ] Unit ]) + (lam + ds + (con string) + (let + (nonrec) + (termbind (strict) (vardecl ds (con string)) ds) + [ [ { trace Unit } ds ] Unit ] + ) + ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/traceComplex.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/traceComplex.pir.golden index 9c252c5dae0..00cc3726ebe 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/traceComplex.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/traceComplex.pir.golden @@ -38,16 +38,12 @@ (lam str (con string) - [ - { error a } - (let - (nonrec) - (termbind - (strict) (vardecl wild Unit) [ [ { trace Unit } str ] Unit ] - ) - unitval - ) - ] + (let + (nonrec) + (termbind (strict) (vardecl str (con string)) str) + (termbind (strict) (vardecl x Unit) [ [ { trace Unit } str ] Unit ]) + [ { error a } unitval ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Primitives/tupleMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/tupleMatch.pir.golden index a26d5a0e131..b939e03a061 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/tupleMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/tupleMatch.pir.golden @@ -13,12 +13,19 @@ (lam ds [ [ Tuple2 (con integer) ] (con integer) ] - [ - { - [ { { Tuple2_match (con integer) } (con integer) } ds ] (con integer) - } - (lam a (con integer) (lam ds (con integer) a)) - ] + (let + (nonrec) + (termbind + (strict) (vardecl ds [ [ Tuple2 (con integer) ] (con integer) ]) ds + ) + [ + { + [ { { Tuple2_match (con integer) } (con integer) } ds ] + (con integer) + } + (lam a (con integer) (lam ds (con integer) a)) + ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/verify.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/verify.pir.golden index 21169a84474..749022720df 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/verify.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/verify.pir.golden @@ -43,20 +43,40 @@ (lam signature (con bytestring) - [ - [ - [ - { ifThenElse Bool } - [ [ [ verifyEd25519Signature pubKey ] message ] signature ] - ] - True - ] - False - ] + (let + (nonrec) + (termbind (strict) (vardecl pubKey (con bytestring)) pubKey) + (termbind (strict) (vardecl message (con bytestring)) message) + (termbind (strict) (vardecl signature (con bytestring)) signature) + (termbind + (strict) + (vardecl b (con bool)) + [ [ [ verifyEd25519Signature pubKey ] message ] signature ] + ) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) + ) + ) + ) + ) + (lam + ds + (con bytestring) + (lam + ds + (con bytestring) + (lam + ds + (con bytestring) + (let + (nonrec) + (termbind (strict) (vardecl ds (con bytestring)) ds) + (termbind (strict) (vardecl ds (con bytestring)) ds) + (termbind (strict) (vardecl ds (con bytestring)) ds) + [ [ [ verifyEd25519Signature ds ] ds ] ds ] ) ) ) ) - verifyEd25519Signature ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/void.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/void.pir.golden index a366f984c26..3890caab4bd 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/void.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/void.pir.golden @@ -13,6 +13,14 @@ (termbind (strict) (vardecl fail (fun (con unit) Bool)) (lam ds (con unit) False) ) + (datatypebind + (datatype + (tyvardecl Tuple2 (fun (type) (fun (type) (type)))) + (tyvardecl a (type)) (tyvardecl b (type)) + Tuple2_match + (vardecl Tuple2 (fun a (fun b [ [ Tuple2 a ] b ]))) + ) + ) (termbind (strict) (vardecl equalsInteger (fun (con integer) (fun (con integer) (con bool)))) @@ -32,7 +40,13 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -42,35 +56,52 @@ (lam ds (con integer) - { + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl x' Bool) [ [ equalsInteger ds ] ds ]) + (termbind (strict) (vardecl y' Bool) [ [ equalsInteger ds ] ds ]) + (termbind + (nonstrict) + (vardecl ds [ [ Tuple2 Bool ] Bool ]) + [ [ { { Tuple2 Bool } Bool } x' ] y' ] + ) [ - [ - { - [ Bool_match [ [ equalsInteger ds ] ds ] ] - (all dead (type) Bool) - } - (abs - dead - (type) + { [ { { Tuple2_match Bool } Bool } ds ] Bool } + (lam + ds + Bool + (lam + ds + Bool { [ [ - { - [ Bool_match [ [ equalsInteger ds ] ds ] ] - (all dead (type) Bool) - } - (abs dead (type) True) + { [ Bool_match ds ] (all dead (type) Bool) } + (abs + dead + (type) + { + [ + [ + { [ Bool_match ds ] (all dead (type) Bool) } + (abs dead (type) True) + ] + (abs dead (type) [ fail (con unit ()) ]) + ] + (all dead (type) dead) + } + ) ] (abs dead (type) [ fail (con unit ()) ]) ] (all dead (type) dead) } ) - ] - (abs dead (type) [ fail (con unit ()) ]) + ) ] - (all dead (type) dead) - } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Profiling/addInt.pir.golden b/plutus-tx-plugin/test/Plugin/Profiling/addInt.pir.golden index 98aa46df32f..b7986507b61 100644 --- a/plutus-tx-plugin/test/Plugin/Profiling/addInt.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Profiling/addInt.pir.golden @@ -30,7 +30,12 @@ { (builtin trace) (con integer) } (con string "exiting addInteger") ] - [ [ addInteger x ] y ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) ] ) ] @@ -40,36 +45,39 @@ ) ) (termbind - (nonstrict) + (strict) (vardecl addInt (fun (con integer) (fun (con integer) (con integer)))) - [ + (lam + x + (con integer) [ [ - { - (builtin trace) - (fun - (con unit) (fun (con integer) (fun (con integer) (con integer))) - ) - } - (con string "entering addInt") - ] - (lam - thunk - (con unit) [ + { + (builtin trace) + (fun (con unit) (fun (con integer) (con integer))) + } + (con string "entering addInt") + ] + (lam + thunk + (con unit) [ - { - (builtin trace) - (fun (con integer) (fun (con integer) (con integer))) - } - (con string "exiting addInt") + [ + { (builtin trace) (fun (con integer) (con integer)) } + (con string "exiting addInt") + ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + [ addInteger x ] + ) ] - addInteger - ] - ) + ) + ] + (con unit ()) ] - (con unit ()) - ] + ) ) addInt ) diff --git a/plutus-tx-plugin/test/Plugin/Profiling/fib.pir.golden b/plutus-tx-plugin/test/Plugin/Profiling/fib.pir.golden index 6d18c133dca..794336dbb6d 100644 --- a/plutus-tx-plugin/test/Plugin/Profiling/fib.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Profiling/fib.pir.golden @@ -30,7 +30,12 @@ { (builtin trace) (con integer) } (con string "exiting addInteger") ] - [ [ addInteger x ] y ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) ] ) ] @@ -80,10 +85,15 @@ { (builtin trace) Bool } (con string "exiting equalsInteger") ] - [ - [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] - False - ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ] + ) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ] ) ] @@ -124,7 +134,12 @@ { (builtin trace) (con integer) } (con string "exiting subtractInteger") ] - [ [ subtractInteger x ] y ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ subtractInteger x ] y ] + ) ] ) ] @@ -154,53 +169,60 @@ [ { (builtin trace) (con integer) } (con string "exiting fib") ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl n (con integer)) n) + { [ - { - [ Bool_match [ [ equalsInteger n ] (con integer 0) ] ] - (all dead (type) (con integer)) - } - (abs dead (type) (con integer 0)) - ] - (abs - dead - (type) - { - [ + [ + { [ - { - [ - Bool_match - [ [ equalsInteger n ] (con integer 1) ] - ] - (all dead (type) (con integer)) - } - (abs dead (type) (con integer 1)) + Bool_match [ [ equalsInteger n ] (con integer 0) ] ] - (abs - dead - (type) + (all dead (type) (con integer)) + } + (abs dead (type) (con integer 0)) + ] + (abs + dead + (type) + { + [ [ + { + [ + Bool_match + [ [ equalsInteger n ] (con integer 1) ] + ] + (all dead (type) (con integer)) + } + (abs dead (type) (con integer 1)) + ] + (abs + dead + (type) [ - addInteger + [ + addInteger + [ + fib + [ [ subtractInteger n ] (con integer 1) ] + ] + ] [ fib - [ [ subtractInteger n ] (con integer 1) ] + [ [ subtractInteger n ] (con integer 2) ] ] ] - [ - fib [ [ subtractInteger n ] (con integer 2) ] - ] - ] - ) - ] - (all dead (type) dead) - } - ) - ] - (all dead (type) dead) - } + ) + ] + (all dead (type) dead) + } + ) + ] + (all dead (type) dead) + } + ) ] ) ] diff --git a/plutus-tx-plugin/test/Plugin/Strict/issue4645.pir.golden b/plutus-tx-plugin/test/Plugin/Strict/issue4645.pir.golden index 5b19534bf1d..0fdac07bcd6 100644 --- a/plutus-tx-plugin/test/Plugin/Strict/issue4645.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Strict/issue4645.pir.golden @@ -20,63 +20,65 @@ ) (termbind (strict) - (vardecl y [ [ Tuple2 (con integer) ] (con integer) ]) + (vardecl z [ [ Tuple2 (con integer) ] (con integer) ]) [ [ { (builtin trace) [ [ Tuple2 (con integer) ] (con integer) ] } - (con string "y") + (con string "z") ] [ - [ { { Tuple2 (con integer) } (con integer) } (con integer 1) ] - (con integer 2) + [ + { (builtin trace) [ [ Tuple2 (con integer) ] (con integer) ] } + (con string "y") + ] + [ + [ { { Tuple2 (con integer) } (con integer) } (con integer 1) ] + (con integer 2) + ] ] ] ) - (termbind - (strict) - (vardecl z [ [ Tuple2 (con integer) ] (con integer) ]) - [ + [ + { [ - { (builtin trace) [ [ Tuple2 (con integer) ] (con integer) ] } - (con string "z") + { { Tuple2_match (con integer) } (con integer) } + [ + [ + { (builtin trace) [ [ Tuple2 (con integer) ] (con integer) ] } + (con string "zz") + ] + z + ] ] - y - ] - ) - (termbind - (strict) - (vardecl t (con integer)) - [ - [ { (builtin trace) (con integer) } (con string "t") ] - [ - { + Bool + } + (lam + zz + (con integer) + (lam + ds + (con integer) + [ [ - { { Tuple2_match (con integer) } (con integer) } [ + { (builtin ifThenElse) Bool } [ - { (builtin trace) [ [ Tuple2 (con integer) ] (con integer) ] } - (con string "zz") + [ + (builtin equalsInteger) + [ + [ { (builtin trace) (con integer) } (con string "x") ] + (con integer 0) + ] + ] + [ [ { (builtin trace) (con integer) } (con string "t") ] zz ] ] - z ] + True ] - (con integer) - } - (lam zz (con integer) (lam ds (con integer) zz)) - ] - ] - ) - (termbind - (strict) - (vardecl x (con integer)) - [ [ { (builtin trace) (con integer) } (con string "x") ] (con integer 0) ] - ) - [ - [ - [ { (builtin ifThenElse) Bool } [ [ (builtin equalsInteger) x ] t ] ] - True - ] - False + False + ] + ) + ) ] ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Strict/issue4645Eval.eval-cek-log.golden b/plutus-tx-plugin/test/Plugin/Strict/issue4645Eval.eval-cek-log.golden index d8e5aae7c15..2cca996cc8b 100644 --- a/plutus-tx-plugin/test/Plugin/Strict/issue4645Eval.eval-cek-log.golden +++ b/plutus-tx-plugin/test/Plugin/Strict/issue4645Eval.eval-cek-log.golden @@ -1 +1 @@ -[y, z, zz, t, x] \ No newline at end of file +[y, z, zz, x, t] \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/compareTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/compareTest.pir.golden index cdb76cc1726..02666ddffe8 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/compareTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/compareTest.pir.golden @@ -47,56 +47,52 @@ (lam eta (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) eta) + (termbind (strict) (vardecl y (con integer)) eta) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + { [ - { - [ - Bool_match - [ + [ + { + [ Bool_match [ [ [ { ifThenElse Bool } b ] True ] False ] ] + (all dead (type) Ordering) + } + (abs dead (type) EQ) + ] + (abs + dead + (type) + (let + (nonrec) + (termbind + (strict) + (vardecl b (con bool)) + [ [ lessThanEqualsInteger x ] y ] + ) + { [ - [ { ifThenElse Bool } [ [ equalsInteger eta ] eta ] ] - True - ] - False - ] - ] - (all dead (type) Ordering) - } - (abs dead (type) EQ) - ] - (abs - dead - (type) - { - [ - [ - { [ - Bool_match - [ + { [ - [ - { ifThenElse Bool } - [ [ lessThanEqualsInteger eta ] eta ] - ] - True + Bool_match + [ [ [ { ifThenElse Bool } b ] True ] False ] ] - False - ] + (all dead (type) Ordering) + } + (abs dead (type) LT) ] - (all dead (type) Ordering) - } - (abs dead (type) LT) - ] - (abs dead (type) GT) - ] - (all dead (type) dead) - } - ) - ] - (all dead (type) dead) - } + (abs dead (type) GT) + ] + (all dead (type) dead) + } + ) + ) + ] + (all dead (type) dead) + } + ) ) ) ) @@ -112,30 +108,27 @@ (lam y (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ lessThanEqualsInteger x ] y ] + ) + { [ - { - [ - Bool_match - [ - [ - [ - { ifThenElse Bool } [ [ lessThanEqualsInteger x ] y ] - ] - True - ] - False - ] - ] - (all dead (type) (con integer)) - } - (abs dead (type) y) + [ + { + [ Bool_match [ [ [ { ifThenElse Bool } b ] True ] False ] ] + (all dead (type) (con integer)) + } + (abs dead (type) y) + ] + (abs dead (type) x) ] - (abs dead (type) x) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) @@ -151,30 +144,27 @@ (lam y (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ lessThanEqualsInteger x ] y ] + ) + { [ - { - [ - Bool_match - [ - [ - [ - { ifThenElse Bool } [ [ lessThanEqualsInteger x ] y ] - ] - True - ] - False - ] - ] - (all dead (type) (con integer)) - } - (abs dead (type) x) + [ + { + [ Bool_match [ [ [ { ifThenElse Bool } b ] True ] False ] ] + (all dead (type) (con integer)) + } + (abs dead (type) x) + ] + (abs dead (type) y) ] - (abs dead (type) y) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) @@ -187,7 +177,13 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ equalsInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -209,7 +205,14 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ lessThanInteger x ] y ] ] False ] True ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ + [ [ { ifThenElse Bool } [ [ lessThanInteger x ] y ] ] False ] True + ] + ) ) ) ) @@ -222,10 +225,17 @@ (lam y (con integer) - [ - [ [ { ifThenElse Bool } [ [ lessThanEqualsInteger x ] y ] ] False ] - True - ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ + [ + [ { ifThenElse Bool } [ [ lessThanEqualsInteger x ] y ] ] False + ] + True + ] + ) ) ) ) @@ -240,10 +250,15 @@ (lam y (con integer) - [ - [ [ { ifThenElse Bool } [ [ lessThanEqualsInteger x ] y ] ] True ] - False - ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ lessThanEqualsInteger x ] y ] + ) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -256,7 +271,15 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ lessThanInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ lessThanInteger x ] y ] + ) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -372,22 +395,29 @@ (lam b a - { - [ + (let + (nonrec) + (termbind (strict) (vardecl a a) a) + (termbind (strict) (vardecl b a) b) + { [ [ - { - [ Ordering_match [ [ [ { compare a } `$dOrd` ] a ] b ] ] - (all dead (type) Ordering) - } - (abs dead (type) EQ) + [ + { + [ + Ordering_match [ [ [ { compare a } `$dOrd` ] a ] b ] + ] + (all dead (type) Ordering) + } + (abs dead (type) EQ) + ] + (abs dead (type) LT) ] - (abs dead (type) LT) + (abs dead (type) GT) ] - (abs dead (type) GT) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/concatTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/concatTest.pir.golden index 920d2e7f277..c0925c4cddf 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/concatTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/concatTest.pir.golden @@ -35,35 +35,44 @@ (lam z b - (let - (rec) - (termbind - (strict) - (vardecl go (fun [ List a ] b)) - (lam - ds - [ List a ] - { - [ - [ - { [ { Nil_match a } ds ] (all dead (type) b) } - (abs dead (type) z) - ] - (lam - x - a - (lam - xs - [ List a ] - (abs dead (type) [ [ f x ] [ go xs ] ]) - ) - ) - ] - (all dead (type) dead) - } + (lam + eta + [ List a ] + (let + (nonrec) + (termbind (strict) (vardecl f (fun a (fun b b))) f) + (termbind (strict) (vardecl z b) z) + (let + (rec) + (termbind + (strict) + (vardecl go (fun [ List a ] b)) + (lam + ds + [ List a ] + { + [ + [ + { [ { Nil_match a } ds ] (all dead (type) b) } + (abs dead (type) z) + ] + (lam + x + a + (lam + xs + [ List a ] + (abs dead (type) [ [ f x ] [ go xs ] ]) + ) + ) + ] + (all dead (type) dead) + } + ) + ) + [ go eta ] ) ) - (lam eta [ List a ] [ go eta ]) ) ) ) @@ -170,45 +179,91 @@ (lam xs [ t [ List a ] ] - [ - { build a } - (abs - b - (type) - (lam - c - (fun a (fun b b)) + (let + (nonrec) + (termbind (strict) (vardecl xs [ t [ List a ] ]) xs) + [ + { build a } + (abs + b + (type) (lam - n - b - [ - [ + c + (fun a (fun b b)) + (lam + n + b + (let + (nonrec) + (termbind (strict) (vardecl c (fun a (fun b b))) c) + (termbind (strict) (vardecl n b) n) [ - { { `$dFoldable` [ List a ] } b } - (lam - x - [ List a ] - (lam - y - b - [ - [ - [ { { `$fFoldableNil_$cfoldr` a } b } c ] - y - ] + [ + [ + { { `$dFoldable` [ List a ] } b } + (lam x - ] - ) - ) + [ List a ] + (lam + y + b + (let + (nonrec) + (termbind + (strict) (vardecl x [ List a ]) x + ) + (termbind (strict) (vardecl y b) y) + (let + (rec) + (termbind + (strict) + (vardecl go (fun [ List a ] b)) + (lam + ds + [ List a ] + { + [ + [ + { + [ { Nil_match a } ds ] + (all dead (type) b) + } + (abs dead (type) y) + ] + (lam + x + a + (lam + xs + [ List a ] + (abs + dead + (type) + [ [ c x ] [ go xs ] ] + ) + ) + ) + ] + (all dead (type) dead) + } + ) + ) + [ go x ] + ) + ) + ) + ) + ] + n + ] + xs ] - n - ] - xs - ] + ) + ) ) ) - ) - ] + ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/defaultMethods.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/defaultMethods.pir.golden index e9311ee5f50..6c19228dc73 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/defaultMethods.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/defaultMethods.pir.golden @@ -45,7 +45,15 @@ (lam `$dDefaultMethods` [ DefaultMethods a ] - (lam a a [ [ { method a } `$dDefaultMethods` ] a ]) + (lam + a + a + (let + (nonrec) + (termbind (strict) (vardecl a a) a) + [ [ { method a } `$dDefaultMethods` ] a ] + ) + ) ) ) ) @@ -66,7 +74,15 @@ (vardecl `$fDefaultMethodsInteger_$cmethod` (fun (con integer) (con integer)) ) - (lam a (con integer) [ [ addInteger a ] (con integer 1) ]) + (lam + a + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl a (con integer)) a) + [ [ addInteger a ] (con integer 1) ] + ) + ) ) (termbind (nonstrict) @@ -80,7 +96,13 @@ ] ) (lam - ds (con integer) [ [ { f (con integer) } `$fDefaultMethodsInteger` ] ds ] + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ { f (con integer) } `$fDefaultMethodsInteger` ] ds ] + ) ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/fmapDefaultTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/fmapDefaultTest.pir.golden index e27b0ff74e9..81feaf54a12 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/fmapDefaultTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/fmapDefaultTest.pir.golden @@ -11,7 +11,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (termbind (nonstrict) @@ -73,35 +86,44 @@ (lam z b - (let - (rec) - (termbind - (strict) - (vardecl go (fun [ List a ] b)) - (lam - ds - [ List a ] - { - [ - [ - { [ { Nil_match a } ds ] (all dead (type) b) } - (abs dead (type) z) - ] - (lam - x - a - (lam - xs - [ List a ] - (abs dead (type) [ [ f x ] [ go xs ] ]) - ) - ) - ] - (all dead (type) dead) - } + (lam + eta + [ List a ] + (let + (nonrec) + (termbind (strict) (vardecl f (fun a (fun b b))) f) + (termbind (strict) (vardecl z b) z) + (let + (rec) + (termbind + (strict) + (vardecl go (fun [ List a ] b)) + (lam + ds + [ List a ] + { + [ + [ + { [ { Nil_match a } ds ] (all dead (type) b) } + (abs dead (type) z) + ] + (lam + x + a + (lam + xs + [ List a ] + (abs dead (type) [ [ f x ] [ go xs ] ]) + ) + ) + ] + (all dead (type) dead) + } + ) + ) + [ go eta ] ) ) - (lam eta [ List a ] [ go eta ]) ) ) ) @@ -132,31 +154,37 @@ (lam l [ List a ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + { [ - { [ { Nil_match a } l ] (all dead (type) [ List b ]) } - (abs dead (type) { Nil b }) - ] - (lam - x - a + [ + { + [ { Nil_match a } l ] (all dead (type) [ List b ]) + } + (abs dead (type) { Nil b }) + ] (lam - xs - [ List a ] - (abs - dead - (type) - [ - [ { Cons b } [ f x ] ] - [ [ { { `$fFunctorNil_$cfmap` a } b } f ] xs ] - ] + x + a + (lam + xs + [ List a ] + (abs + dead + (type) + [ + [ { Cons b } [ f x ] ] + [ [ { { `$fFunctorNil_$cfmap` a } b } f ] xs ] + ] + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) @@ -453,94 +481,110 @@ (lam ds [ List a ] - { - [ + (let + (nonrec) + (termbind + (strict) (vardecl ds (fun a [ f b ])) ds + ) + { [ - { - [ { Nil_match a } ds ] - (all dead (type) [ f [ List b ] ]) - } - (abs - dead - (type) - [ - { - [ { pure f } `$dApplicative` ] - [ List b ] - } - { Nil b } - ] - ) - ] - (lam - x - a - (lam - xs - [ List a ] + [ + { + [ { Nil_match a } ds ] + (all dead (type) [ f [ List b ] ]) + } (abs dead (type) [ - [ - { - { - [ { `<*>` f } `$dApplicative` ] - [ List b ] - } - [ List b ] - } + { + [ { pure f } `$dApplicative` ] + [ List b ] + } + { Nil b } + ] + ) + ] + (lam + x + a + (lam + xs + [ List a ] + (abs + dead + (type) + (let + (nonrec) + (termbind + (strict) + (vardecl x [ f b ]) + [ ds x ] + ) [ [ { { [ - { `$p1Applicative` f } - `$dApplicative` + { `<*>` f } `$dApplicative` ] - b + [ List b ] } - (fun [ List b ] [ List b ]) + [ List b ] } - (lam - ds - b - (lam - ds - [ List b ] - [ [ { Cons b } ds ] ds ] - ) - ) + [ + [ + { + { + [ + { `$p1Applicative` f } + `$dApplicative` + ] + b + } + (fun [ List b ] [ List b ]) + } + (lam + ds + b + (lam + ds + [ List b ] + [ [ { Cons b } ds ] ds ] + ) + ) + ] + x + ] ] - [ ds x ] - ] - ] - [ - [ [ - { - { + [ + [ { - `$fTraversableNil_$ctraverse` - f + { + { + `$fTraversableNil_$ctraverse` + f + } + a + } + b } - a - } - b - } - `$dApplicative` + `$dApplicative` + ] + ds + ] + xs ] - ds ] - xs - ] - ] + ) + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) @@ -686,7 +730,16 @@ (lam ds [ (lam a (type) a) (fun a b) ] - (lam ds [ (lam a (type) a) a ] [ ds ds ]) + (lam + ds + [ (lam a (type) a) a ] + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) ds) + (termbind (strict) (vardecl a a) ds) + [ f a ] + ) + ) ) ) ) @@ -722,7 +775,20 @@ (abs b (type) - (lam f (fun a b) (lam ds [ (lam a (type) a) a ] [ f ds ])) + (lam + f + (fun a b) + (lam + ds + [ (lam a (type) a) a ] + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + (termbind (strict) (vardecl a a) ds) + [ f a ] + ) + ) + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/multiFunction.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/multiFunction.pir.golden index 863b8afd783..ecd425b9595 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/multiFunction.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/multiFunction.pir.golden @@ -19,15 +19,21 @@ (lam r Bool - { - [ + (let + (nonrec) + (termbind (strict) (vardecl l Bool) l) + (termbind (strict) (vardecl r Bool) r) + { [ - { [ Bool_match l ] (all dead (type) Bool) } (abs dead (type) r) + [ + { [ Bool_match l ] (all dead (type) Bool) } + (abs dead (type) r) + ] + (abs dead (type) False) ] - (abs dead (type) False) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) @@ -90,7 +96,15 @@ (lam y (con integer) - [ [ [ { ifThenElse Bool } [ [ lessThanInteger x ] y ] ] True ] False ] + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + (termbind + (strict) (vardecl b (con bool)) [ [ lessThanInteger x ] y ] + ) + [ [ [ { ifThenElse Bool } b ] True ] False ] + ) ) ) ) @@ -125,13 +139,17 @@ (lam p p - [ - [ `&&` [ [ [ { likesAnimal p } `$dPersonLike` ] p ] Cat ] ] + (let + (nonrec) + (termbind (strict) (vardecl p p) p) [ - [ lessThanInteger [ [ { age p } `$dPersonLike` ] p ] ] - (con integer 30) + [ `&&` [ [ [ { likesAnimal p } `$dPersonLike` ] p ] Cat ] ] + [ + [ lessThanInteger [ [ { age p } `$dPersonLike` ] p ] ] + (con integer 30) + ] ] - ] + ) ) ) ) @@ -196,6 +214,14 @@ (vardecl `$fPersonLikePerson` [ PersonLike Person ]) [ [ { CConsPersonLike Person } `$cage` ] `$clikesAnimal` ] ) - (lam ds Person [ [ { predicate Person } `$fPersonLikePerson` ] ds ]) + (lam + ds + Person + (let + (nonrec) + (termbind (strict) (vardecl ds Person) ds) + [ [ { predicate Person } `$fPersonLikePerson` ] ds ] + ) + ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/partialApplication.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/partialApplication.pir.golden index 5caeea9cb25..032c300384d 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/partialApplication.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/partialApplication.pir.golden @@ -47,56 +47,52 @@ (lam eta (con integer) - { - [ + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) eta) + (termbind (strict) (vardecl y (con integer)) eta) + (termbind (strict) (vardecl b (con bool)) [ [ equalsInteger x ] y ]) + { [ - { - [ - Bool_match - [ + [ + { + [ Bool_match [ [ [ { ifThenElse Bool } b ] True ] False ] ] + (all dead (type) Ordering) + } + (abs dead (type) EQ) + ] + (abs + dead + (type) + (let + (nonrec) + (termbind + (strict) + (vardecl b (con bool)) + [ [ lessThanEqualsInteger x ] y ] + ) + { [ - [ { ifThenElse Bool } [ [ equalsInteger eta ] eta ] ] - True - ] - False - ] - ] - (all dead (type) Ordering) - } - (abs dead (type) EQ) - ] - (abs - dead - (type) - { - [ - [ - { [ - Bool_match - [ + { [ - [ - { ifThenElse Bool } - [ [ lessThanEqualsInteger eta ] eta ] - ] - True + Bool_match + [ [ [ { ifThenElse Bool } b ] True ] False ] ] - False - ] + (all dead (type) Ordering) + } + (abs dead (type) LT) ] - (all dead (type) Ordering) - } - (abs dead (type) LT) - ] - (abs dead (type) GT) - ] - (all dead (type) dead) - } - ) - ] - (all dead (type) dead) - } + (abs dead (type) GT) + ] + (all dead (type) dead) + } + ) + ) + ] + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/sequenceTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/sequenceTest.pir.golden index 43b09c666f9..7c41714487a 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/sequenceTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/sequenceTest.pir.golden @@ -99,16 +99,20 @@ (lam ds [ Maybe a ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + { [ - { [ { Maybe_match a } ds ] (all dead (type) [ Maybe b ]) } - (lam a a (abs dead (type) [ { Just b } [ f a ] ])) + [ + { [ { Maybe_match a } ds ] (all dead (type) [ Maybe b ]) } + (lam a a (abs dead (type) [ { Just b } [ f a ] ])) + ] + (abs dead (type) { Nothing b }) ] - (abs dead (type) { Nothing b }) - ] - (all dead (type) dead) - } + (all dead (type) dead) + } + ) ) ) ) @@ -193,35 +197,44 @@ (lam z b - (let - (rec) - (termbind - (strict) - (vardecl go (fun [ List a ] b)) - (lam - ds - [ List a ] - { - [ - [ - { [ { Nil_match a } ds ] (all dead (type) b) } - (abs dead (type) z) - ] - (lam - x - a - (lam - xs - [ List a ] - (abs dead (type) [ [ f x ] [ go xs ] ]) - ) - ) - ] - (all dead (type) dead) - } + (lam + eta + [ List a ] + (let + (nonrec) + (termbind (strict) (vardecl f (fun a (fun b b))) f) + (termbind (strict) (vardecl z b) z) + (let + (rec) + (termbind + (strict) + (vardecl go (fun [ List a ] b)) + (lam + ds + [ List a ] + { + [ + [ + { [ { Nil_match a } ds ] (all dead (type) b) } + (abs dead (type) z) + ] + (lam + x + a + (lam + xs + [ List a ] + (abs dead (type) [ [ f x ] [ go xs ] ]) + ) + ) + ] + (all dead (type) dead) + } + ) + ) + [ go eta ] ) ) - (lam eta [ List a ] [ go eta ]) ) ) ) @@ -252,31 +265,37 @@ (lam l [ List a ] - { - [ + (let + (nonrec) + (termbind (strict) (vardecl f (fun a b)) f) + { [ - { [ { Nil_match a } l ] (all dead (type) [ List b ]) } - (abs dead (type) { Nil b }) - ] - (lam - x - a + [ + { + [ { Nil_match a } l ] (all dead (type) [ List b ]) + } + (abs dead (type) { Nil b }) + ] (lam - xs - [ List a ] - (abs - dead - (type) - [ - [ { Cons b } [ f x ] ] - [ [ { { `$fFunctorNil_$cfmap` a } b } f ] xs ] - ] + x + a + (lam + xs + [ List a ] + (abs + dead + (type) + [ + [ { Cons b } [ f x ] ] + [ [ { { `$fFunctorNil_$cfmap` a } b } f ] xs ] + ] + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) @@ -536,94 +555,110 @@ (lam ds [ List a ] - { - [ + (let + (nonrec) + (termbind + (strict) (vardecl ds (fun a [ f b ])) ds + ) + { [ - { - [ { Nil_match a } ds ] - (all dead (type) [ f [ List b ] ]) - } - (abs - dead - (type) - [ - { - [ { pure f } `$dApplicative` ] - [ List b ] - } - { Nil b } - ] - ) - ] - (lam - x - a - (lam - xs - [ List a ] + [ + { + [ { Nil_match a } ds ] + (all dead (type) [ f [ List b ] ]) + } (abs dead (type) [ - [ - { - { - [ { `<*>` f } `$dApplicative` ] - [ List b ] - } - [ List b ] - } + { + [ { pure f } `$dApplicative` ] + [ List b ] + } + { Nil b } + ] + ) + ] + (lam + x + a + (lam + xs + [ List a ] + (abs + dead + (type) + (let + (nonrec) + (termbind + (strict) + (vardecl x [ f b ]) + [ ds x ] + ) [ [ { { [ - { `$p1Applicative` f } - `$dApplicative` + { `<*>` f } `$dApplicative` ] - b + [ List b ] } - (fun [ List b ] [ List b ]) + [ List b ] } - (lam - ds - b - (lam - ds - [ List b ] - [ [ { Cons b } ds ] ds ] - ) - ) + [ + [ + { + { + [ + { `$p1Applicative` f } + `$dApplicative` + ] + b + } + (fun [ List b ] [ List b ]) + } + (lam + ds + b + (lam + ds + [ List b ] + [ [ { Cons b } ds ] ds ] + ) + ) + ] + x + ] ] - [ ds x ] - ] - ] - [ - [ [ - { - { + [ + [ { - `$fTraversableNil_$ctraverse` - f + { + { + `$fTraversableNil_$ctraverse` + f + } + a + } + b } - a - } - b - } - `$dApplicative` + `$dApplicative` + ] + ds + ] + xs ] - ds ] - xs - ] - ] + ) + ) ) ) - ) - ] - (all dead (type) dead) - } + ] + (all dead (type) dead) + } + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/sizedBasic.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/sizedBasic.pir.golden index 582b8822956..f62ac96460e 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/sizedBasic.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/sizedBasic.pir.golden @@ -26,6 +26,14 @@ ) (abs a (type) (lam v [ (lam a (type) (fun a (con integer))) a ] v)) ) - (lam ds (con integer) [ [ { size (con integer) } `$fSizedInteger` ] ds ]) + (lam + ds + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + [ [ { size (con integer) } `$fSizedInteger` ] ds ] + ) + ) ) ) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/sizedPair.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/sizedPair.pir.golden index f5d102d6108..b662d42a0ab 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/sizedPair.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/sizedPair.pir.golden @@ -55,7 +55,20 @@ (lam a a - (lam b b [ [ addInteger [ `$dSized` a ] ] [ `$dSized` b ] ]) + (lam + b + b + (let + (nonrec) + (termbind + (strict) (vardecl x (con integer)) [ `$dSized` a ] + ) + (termbind + (strict) (vardecl y (con integer)) [ `$dSized` b ] + ) + [ [ addInteger x ] y ] + ) + ) ) ] ) @@ -130,10 +143,15 @@ (lam ds (con integer) - [ - [ { size [ [ Tuple2 (con integer) ] (con integer) ] } `$dSized` ] - [ [ { { Tuple2 (con integer) } (con integer) } ds ] ds ] - ] + (let + (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) + (termbind (strict) (vardecl ds (con integer)) ds) + [ + [ { size [ [ Tuple2 (con integer) ] (con integer) ] } `$dSized` ] + [ [ { { Tuple2 (con integer) } (con integer) } ds ] ds ] + ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/sumTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/sumTest.pir.golden index 7e113b1b4a2..c223b589696 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/sumTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/sumTest.pir.golden @@ -15,7 +15,20 @@ (termbind (strict) (vardecl addInteger (fun (con integer) (fun (con integer) (con integer)))) - (lam x (con integer) (lam y (con integer) [ [ addInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ addInteger x ] y ] + ) + ) + ) ) (datatypebind (datatype @@ -73,35 +86,44 @@ (lam z b - (let - (rec) - (termbind - (strict) - (vardecl go (fun [ List a ] b)) - (lam - ds - [ List a ] - { - [ - [ - { [ { Nil_match a } ds ] (all dead (type) b) } - (abs dead (type) z) - ] - (lam - x - a - (lam - xs - [ List a ] - (abs dead (type) [ [ f x ] [ go xs ] ]) - ) - ) - ] - (all dead (type) dead) - } + (lam + eta + [ List a ] + (let + (nonrec) + (termbind (strict) (vardecl f (fun a (fun b b))) f) + (termbind (strict) (vardecl z b) z) + (let + (rec) + (termbind + (strict) + (vardecl go (fun [ List a ] b)) + (lam + ds + [ List a ] + { + [ + [ + { [ { Nil_match a } ds ] (all dead (type) b) } + (abs dead (type) z) + ] + (lam + x + a + (lam + xs + [ List a ] + (abs dead (type) [ [ f x ] [ go xs ] ]) + ) + ) + ] + (all dead (type) dead) + } + ) + ) + [ go eta ] ) ) - (lam eta [ List a ] [ go eta ]) ) ) ) diff --git a/plutus-tx-plugin/test/StdLib/errorTrace.pir.golden b/plutus-tx-plugin/test/StdLib/errorTrace.pir.golden index a5f881a2ce9..8dd2cea19f7 100644 --- a/plutus-tx-plugin/test/StdLib/errorTrace.pir.golden +++ b/plutus-tx-plugin/test/StdLib/errorTrace.pir.golden @@ -25,16 +25,12 @@ (lam str (con string) - [ - { error a } - (let - (nonrec) - (termbind - (strict) (vardecl wild Unit) [ [ { trace Unit } str ] Unit ] - ) - unitval - ) - ] + (let + (nonrec) + (termbind (strict) (vardecl str (con string)) str) + (termbind (strict) (vardecl x Unit) [ [ { trace Unit } str ] Unit ]) + [ { error a } unitval ] + ) ) ) ) diff --git a/plutus-tx-plugin/test/TH/power.pir.golden b/plutus-tx-plugin/test/TH/power.pir.golden index 29c71cff04e..eed75ae4e4b 100644 --- a/plutus-tx-plugin/test/TH/power.pir.golden +++ b/plutus-tx-plugin/test/TH/power.pir.golden @@ -14,20 +14,39 @@ (vardecl multiplyInteger (fun (con integer) (fun (con integer) (con integer))) ) - (lam x (con integer) (lam y (con integer) [ [ multiplyInteger x ] y ])) + (lam + x + (con integer) + (lam + y + (con integer) + (let + (nonrec) + (termbind (strict) (vardecl x (con integer)) x) + (termbind (strict) (vardecl y (con integer)) y) + [ [ multiplyInteger x ] y ] + ) + ) + ) ) (lam ds (con integer) (let (nonrec) + (termbind (strict) (vardecl ds (con integer)) ds) (termbind - (nonstrict) + (strict) (vardecl y (con integer)) - [ [ multiplyInteger ds ] (con integer 1) ] - ) - (termbind - (nonstrict) (vardecl y (con integer)) [ [ multiplyInteger y ] y ] + (let + (nonrec) + (termbind + (strict) + (vardecl y (con integer)) + [ [ multiplyInteger ds ] (con integer 1) ] + ) + [ [ multiplyInteger y ] y ] + ) ) [ [ multiplyInteger y ] y ] ) diff --git a/plutus-tx-plugin/test/TH/traceRepeatedly.eval-cek-log.golden b/plutus-tx-plugin/test/TH/traceRepeatedly.eval-cek-log.golden index 06c66caeac4..28ed52e2183 100644 --- a/plutus-tx-plugin/test/TH/traceRepeatedly.eval-cek-log.golden +++ b/plutus-tx-plugin/test/TH/traceRepeatedly.eval-cek-log.golden @@ -1,5 +1 @@ -[ Making my first int -, Making my second int -, Making my first int -, Making my second int -, Adding them up: 3 ] \ No newline at end of file +[Making my second int, Making my first int, Adding them up: 3] \ No newline at end of file diff --git a/plutus-tx/plutus-tx.cabal b/plutus-tx/plutus-tx.cabal index 6dd9ef4be17..482177c57c2 100644 --- a/plutus-tx/plutus-tx.cabal +++ b/plutus-tx/plutus-tx.cabal @@ -42,8 +42,8 @@ common lang -fno-ignore-interface-pragmas -fno-omit-interface-pragmas library - import: lang - hs-source-dirs: src + import: lang + hs-source-dirs: src exposed-modules: PlutusTx PlutusTx.Applicative @@ -116,6 +116,11 @@ library , th-compat , transformers + default-extensions: Strict + ghc-options: + -fno-strictness -fno-unbox-strict-fields + -fno-unbox-small-strict-fields + library plutus-tx-testlib import: lang visibility: public diff --git a/plutus-tx/src/PlutusTx/Builtins/Internal.hs b/plutus-tx/src/PlutusTx/Builtins/Internal.hs index 69a4ba915f2..3aed0812acd 100644 --- a/plutus-tx/src/PlutusTx/Builtins/Internal.hs +++ b/plutus-tx/src/PlutusTx/Builtins/Internal.hs @@ -4,6 +4,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} + -- This ensures that we don't put *anything* about these functions into the interface -- file, otherwise GHC can be clever about the ones that are always error, even though -- they're NOINLINE! @@ -90,7 +91,7 @@ BOOL -} -- See Note [Opaque builtin types] -data BuiltinBool = BuiltinBool Bool deriving stock Data +data BuiltinBool = BuiltinBool ~Bool deriving stock Data {-# NOINLINE true #-} true :: BuiltinBool @@ -109,7 +110,7 @@ UNIT -} -- See Note [Opaque builtin types] -data BuiltinUnit = BuiltinUnit () deriving stock Data +data BuiltinUnit = BuiltinUnit ~() deriving stock Data {-# NOINLINE unitval #-} unitval :: BuiltinUnit @@ -174,7 +175,7 @@ BYTESTRING -- See Note [Opaque builtin types] -- | An opaque type representing Plutus Core ByteStrings. -data BuiltinByteString = BuiltinByteString BS.ByteString deriving stock Data +data BuiltinByteString = BuiltinByteString ~BS.ByteString deriving stock Data instance Haskell.Show BuiltinByteString where show (BuiltinByteString bs) = show bs @@ -298,7 +299,7 @@ STRING -} -- See Note [Opaque builtin types] -data BuiltinString = BuiltinString Text deriving stock Data +data BuiltinString = BuiltinString ~Text deriving stock Data instance Haskell.Show BuiltinString where show (BuiltinString t) = show t @@ -332,7 +333,7 @@ PAIR -} -- See Note [Opaque builtin types] -data BuiltinPair a b = BuiltinPair (a, b) deriving stock Data +data BuiltinPair a b = BuiltinPair ~(a, b) deriving stock Data instance (Haskell.Show a, Haskell.Show b) => Haskell.Show (BuiltinPair a b) where show (BuiltinPair p) = show p @@ -358,7 +359,7 @@ LIST -} -- See Note [Opaque builtin types] -data BuiltinList a = BuiltinList [a] deriving stock Data +data BuiltinList a = BuiltinList ~[a] deriving stock Data instance Haskell.Show a => Haskell.Show (BuiltinList a) where show (BuiltinList l) = show l