diff --git a/plutus-core/changelog.d/20240924_105256_unsafeFixIO_pretty.md b/plutus-core/changelog.d/20240924_105256_unsafeFixIO_pretty.md new file mode 100644 index 00000000000..228e05ffcc4 --- /dev/null +++ b/plutus-core/changelog.d/20240924_105256_unsafeFixIO_pretty.md @@ -0,0 +1,12 @@ + +### Removed + +- Removed `PlutusIR.Core.Instance.Pretty.Readable.PrettyPir`. + Use `PlutusCore.Pretty.Readable.PrettyReadable` instead. + +### Changed + +- Renamed `PlutusIR.Core.Instance.Pretty.Readable.prettyPirReadable` + to `PlutusCore.Pretty.Readable.prettyReadable`. +- Renamed `PlutusIR.Core.Instance.Pretty.Readable.prettyPirReadableSimple` + to `PlutusCore.Pretty.Readable.prettyReadableSimple`. diff --git a/plutus-core/plutus-core/src/PlutusCore/Pretty.hs b/plutus-core/plutus-core/src/PlutusCore/Pretty.hs index 536c9d8426f..f0bab62379a 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Pretty.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Pretty.hs @@ -50,6 +50,8 @@ module PlutusCore.Pretty -- * Readable view , ShowKinds (..) , PrettyConfigReadable (..) + , prettyReadable + , prettyReadableSimple , pcrConfigName , pcrRenderContext , pcrShowKinds diff --git a/plutus-core/plutus-core/src/PlutusCore/Pretty/Readable.hs b/plutus-core/plutus-core/src/PlutusCore/Pretty/Readable.hs index 247f3e8da2b..b35b03858f8 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Pretty/Readable.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Pretty/Readable.hs @@ -272,3 +272,11 @@ iterInterAppPrettyM fun args = let ppArg (Left ty) = prettyArg $ inBraces ty ppArg (Right term) = prettyArg term in prettyFun fun :| map ppArg args + +-- | Pretty-print something with the @PrettyConfigReadable@ config. +prettyReadable :: (PrettyReadable a) => a -> Doc ann +prettyReadable = prettyBy (botPrettyConfigReadable prettyConfigName def) + +-- | Pretty-print something with the @PrettyConfigReadableSimple@ config. +prettyReadableSimple :: (PrettyReadable a) => a -> Doc ann +prettyReadableSimple = prettyBy (botPrettyConfigReadable prettyConfigNameSimple def) diff --git a/plutus-core/plutus-ir/src/PlutusIR/Core/Instance/Pretty/Readable.hs b/plutus-core/plutus-ir/src/PlutusIR/Core/Instance/Pretty/Readable.hs index 120e404c794..e30f639fbae 100644 --- a/plutus-core/plutus-ir/src/PlutusIR/Core/Instance/Pretty/Readable.hs +++ b/plutus-core/plutus-ir/src/PlutusIR/Core/Instance/Pretty/Readable.hs @@ -11,11 +11,7 @@ {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} {-# HLINT ignore "Eta reduce" #-} -- breaks type inference -module PlutusIR.Core.Instance.Pretty.Readable - ( prettyPirReadable - , prettyPirReadableSimple - , PrettyPir - ) where +module PlutusIR.Core.Instance.Pretty.Readable () where import PlutusCore.Pretty import PlutusIR.Core.Type @@ -25,16 +21,6 @@ import Data.Profunctor import Prettyprinter import Prettyprinter.Custom -type PrettyPir = PrettyBy (PrettyConfigReadable PrettyConfigName) - --- | Pretty-print something with the @PrettyConfigReadable@ config. -prettyPirReadable :: PrettyPir a => a -> Doc ann -prettyPirReadable = prettyBy (botPrettyConfigReadable prettyConfigName def) - --- | Pretty-print something with the @PrettyConfigReadableSimple@ config. -prettyPirReadableSimple :: PrettyPir a => a -> Doc ann -prettyPirReadableSimple = prettyBy (botPrettyConfigReadable prettyConfigNameSimple def) - -- | Split an iterated 'LamAbs' (if any) into a list of variables that it binds and its body. viewLamAbs :: Term tyname name uni fun ann diff --git a/plutus-core/plutus-ir/test/PlutusIR/Core/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Core/Tests.hs index 6d7611cdc3d..c3a20e84fb7 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Core/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Core/Tests.hs @@ -1,8 +1,8 @@ module PlutusIR.Core.Tests where import PlutusCore qualified as PLC +import PlutusCore.Pretty import PlutusIR -import PlutusIR.Core.Instance.Pretty.Readable import PlutusIR.Parser (pTerm) import PlutusIR.Test @@ -25,7 +25,7 @@ test_prettyprintingReadable :: TestTree test_prettyprintingReadable = runTestNested ["plutus-ir", "test", "PlutusIR", "Core", "prettyprintingReadable"] $ map - (goldenPirDoc prettyPirReadableSimple pTerm) + (goldenPirDoc prettyReadableSimple pTerm) [ "basic" , "maybe" , "letInLet" @@ -60,4 +60,3 @@ roundTripPirTerm = decodeOrError . unflat . flat . void where decodeOrError (Right tm) = tm decodeOrError (Left err) = error (show err) - diff --git a/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs index 4d0b2212403..7fd3c02a149 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs @@ -17,12 +17,12 @@ import PlutusCore.Default import PlutusCore.Evaluation.Machine.ExBudget import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultCekParametersForTesting) import PlutusCore.Name.Unique +import PlutusCore.Pretty import PlutusCore.Quote import PlutusCore.Rename import PlutusCore.Test (toUPlc) import PlutusCore.Version (latestVersion) import PlutusIR -import PlutusIR.Core.Instance.Pretty.Readable import PlutusIR.Test () import UntypedPlutusCore qualified as UPLC import UntypedPlutusCore.Evaluation.Machine.Cek (restricting, runCekNoEmit, @@ -142,7 +142,7 @@ prop_stats_leaves :: Property prop_stats_leaves = withMaxSuccess 10 $ -- No shrinking here because we are only collecting stats forAllDoc "_,tm" genTypeAndTerm_ (const []) $ \ (_, tm) -> - tabulate "leaves" (map (filter isAlpha . show . prettyPirReadable) $ leaves tm) $ property True + tabulate "leaves" (map (filter isAlpha . show . prettyReadable) $ leaves tm) $ property True where -- Figure out what's at the leaves of the AST, -- including variable names, error, and builtins. diff --git a/plutus-core/testlib/PlutusCore/Generators/QuickCheck/GenerateTypes.hs b/plutus-core/testlib/PlutusCore/Generators/QuickCheck/GenerateTypes.hs index a2f0d8e5579..5a5e6ad6097 100644 --- a/plutus-core/testlib/PlutusCore/Generators/QuickCheck/GenerateTypes.hs +++ b/plutus-core/testlib/PlutusCore/Generators/QuickCheck/GenerateTypes.hs @@ -13,9 +13,9 @@ import PlutusCore.Core import PlutusCore.Default import PlutusCore.Name.Unique import PlutusCore.Normalize +import PlutusCore.Pretty import PlutusCore.Quote (runQuote) import PlutusIR -import PlutusIR.Core.Instance.Pretty.Readable import Control.Monad (replicateM, when) import Control.Monad.Reader (asks, local) @@ -89,9 +89,9 @@ genType k = do Right _ -> pure () Left err -> error . show $ fold - [ "genType - checkInvariants: type " <> prettyPirReadable ty - , " does not match kind " <> prettyPirReadable k - , " in context " <> prettyPirReadable ctx + [ "genType - checkInvariants: type " <> prettyReadable ty + , " does not match kind " <> prettyReadable k + , " in context " <> prettyReadable ctx , " with error message " <> fromString err ] pure ty diff --git a/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Utils.hs b/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Utils.hs index d3822afc3c3..8fda3b95806 100644 --- a/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Utils.hs +++ b/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Utils.hs @@ -14,7 +14,6 @@ import PlutusCore.Pretty import PlutusCore.Quote import PlutusIR import PlutusIR.Compiler.Datatype -import PlutusIR.Core.Instance.Pretty.Readable import PlutusIR.Subst import Data.Kind qualified as GHC @@ -43,16 +42,16 @@ ceDoc d = counterexample (render d) -- | Bind a value to a name in a property so that -- it is displayed as a `name = thing` binding if the -- property fails. -letCE :: (PrettyPir a, Testable p) +letCE :: (PrettyReadable a, Testable p) => String -> a -> (a -> p) -> Property -letCE name x k = ceDoc (fromString name <+> "=" <+> prettyPirReadable x) (k x) +letCE name x k = ceDoc (fromString name <+> "=" <+> prettyReadable x) (k x) -- | Like `forAllShrink` but displays the bound value as -- a named pretty-printed binding like `letCE` -forAllDoc :: (PrettyPir a, Testable p) +forAllDoc :: (PrettyReadable a, Testable p) => String -> Gen a -> (a -> [a]) @@ -60,14 +59,14 @@ forAllDoc :: (PrettyPir a, Testable p) -> Property forAllDoc name g shr k = forAllShrinkBlind g shr $ \ x -> - ceDoc (fromString name <+> "=" <+> prettyPirReadable x) + ceDoc (fromString name <+> "=" <+> prettyReadable x) (k x) -- | Check that a list of potential counterexamples is empty and display the -- list as a QuickCheck counterexample if its not. -assertNoCounterexamples :: PrettyPir a => [a] -> Property +assertNoCounterexamples :: (PrettyReadable a) => [a] -> Property assertNoCounterexamples [] = property True -assertNoCounterexamples bad = ceDoc (prettyPirReadable bad) False +assertNoCounterexamples bad = ceDoc (prettyReadable bad) False -- * Containers (zipper-ish, very useful for shrinking). diff --git a/plutus-core/testlib/PlutusIR/Generators/QuickCheck/GenerateTerms.hs b/plutus-core/testlib/PlutusIR/Generators/QuickCheck/GenerateTerms.hs index db18312fab6..95237da67c4 100644 --- a/plutus-core/testlib/PlutusIR/Generators/QuickCheck/GenerateTerms.hs +++ b/plutus-core/testlib/PlutusIR/Generators/QuickCheck/GenerateTerms.hs @@ -32,10 +32,10 @@ import PlutusCore.Core (argsFunKind) import PlutusCore.Default import PlutusCore.MkPlc (mkConstantOf) import PlutusCore.Name.Unique +import PlutusCore.Pretty import PlutusCore.Subst (typeSubstClosedType) import PlutusIR import PlutusIR.Compiler -import PlutusIR.Core.Instance.Pretty.Readable import PlutusIR.Subst import Control.Lens ((<&>)) @@ -55,7 +55,6 @@ import Data.Set.Lens (setOf) import Data.String import GHC.Stack import Prettyprinter -import Text.PrettyBy -- | This type keeps track of what kind of argument, term argument (`InstArg`) or -- type argument (`InstApp`) is required for a function. This type is used primarily @@ -264,10 +263,10 @@ genTerm mty = checkInvariants $ do if debug then case typeCheckTermInContext tyctx tmctx tm ty of Left err -> - (error . show $ "genTerm - checkInvariants: term " <> prettyPirReadable tm - <> " does not type check at type " <> prettyPirReadable ty - <> " in type context " <> prettyPirReadable tyctx - <> " and term context " <> prettyPirReadable tmctx + (error . show $ "genTerm - checkInvariants: term " <> prettyReadable tm + <> " does not type check at type " <> prettyReadable ty + <> " in type context " <> prettyReadable tyctx + <> " and term context " <> prettyReadable tmctx <> " with error message " <> fromString err) _ -> return (ty, tm) else diff --git a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NegativeLiterals.pir.golden b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NegativeLiterals.pir.golden index 8fad28782d2..8e83c26bfd5 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NegativeLiterals.pir.golden +++ b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NegativeLiterals.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (\(x : integer) -> - addInteger - 24680135792468013579 +\(x : integer) -> + addInteger + 24680135792468013579 + (addInteger + -99887766554433221100 (addInteger - -99887766554433221100 + 98765432109876543210 (addInteger - 98765432109876543210 + -654 (addInteger - -654 + 456 (addInteger - 456 + 13579246801357924680 (addInteger - 13579246801357924680 + -11223344556677889900 (addInteger - -11223344556677889900 - (addInteger - 12345678901234567890 - (addInteger -321 (multiplyInteger 123 x)))))))))) \ No newline at end of file + 12345678901234567890 + (addInteger -321 (multiplyInteger 123 x))))))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NoNegativeLiterals.pir.golden b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NoNegativeLiterals.pir.golden index 8fad28782d2..8e83c26bfd5 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NoNegativeLiterals.pir.golden +++ b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-NoStrict-NoNegativeLiterals.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (\(x : integer) -> - addInteger - 24680135792468013579 +\(x : integer) -> + addInteger + 24680135792468013579 + (addInteger + -99887766554433221100 (addInteger - -99887766554433221100 + 98765432109876543210 (addInteger - 98765432109876543210 + -654 (addInteger - -654 + 456 (addInteger - 456 + 13579246801357924680 (addInteger - 13579246801357924680 + -11223344556677889900 (addInteger - -11223344556677889900 - (addInteger - 12345678901234567890 - (addInteger -321 (multiplyInteger 123 x)))))))))) \ No newline at end of file + 12345678901234567890 + (addInteger -321 (multiplyInteger 123 x))))))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NegativeLiterals.pir.golden b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NegativeLiterals.pir.golden index 8fad28782d2..8e83c26bfd5 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NegativeLiterals.pir.golden +++ b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NegativeLiterals.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (\(x : integer) -> - addInteger - 24680135792468013579 +\(x : integer) -> + addInteger + 24680135792468013579 + (addInteger + -99887766554433221100 (addInteger - -99887766554433221100 + 98765432109876543210 (addInteger - 98765432109876543210 + -654 (addInteger - -654 + 456 (addInteger - 456 + 13579246801357924680 (addInteger - 13579246801357924680 + -11223344556677889900 (addInteger - -11223344556677889900 - (addInteger - 12345678901234567890 - (addInteger -321 (multiplyInteger 123 x)))))))))) \ No newline at end of file + 12345678901234567890 + (addInteger -321 (multiplyInteger 123 x))))))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NoNegativeLiterals.pir.golden b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NoNegativeLiterals.pir.golden index 8fad28782d2..8e83c26bfd5 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NoNegativeLiterals.pir.golden +++ b/plutus-tx-plugin/test/IntegerLiterals/9.6/integerLiterals-Strict-NoNegativeLiterals.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (\(x : integer) -> - addInteger - 24680135792468013579 +\(x : integer) -> + addInteger + 24680135792468013579 + (addInteger + -99887766554433221100 (addInteger - -99887766554433221100 + 98765432109876543210 (addInteger - 98765432109876543210 + -654 (addInteger - -654 + 456 (addInteger - 456 + 13579246801357924680 (addInteger - 13579246801357924680 + -11223344556677889900 (addInteger - -11223344556677889900 - (addInteger - 12345678901234567890 - (addInteger -321 (multiplyInteger 123 x)))))))))) \ No newline at end of file + 12345678901234567890 + (addInteger -321 (multiplyInteger 123 x))))))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NegativeLiterals/Spec.hs b/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NegativeLiterals/Spec.hs index f18db70247e..ec027ea86f8 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NegativeLiterals/Spec.hs +++ b/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NegativeLiterals/Spec.hs @@ -21,7 +21,7 @@ import Test.Tasty.Extras tests :: TestNested tests = testNested "IntegerLiterals" . pure $ testNestedGhc - [ goldenPir "integerLiterals-NoStrict-NegativeLiterals" integerLiterals + [ goldenPirReadable "integerLiterals-NoStrict-NegativeLiterals" integerLiterals ] integerLiterals :: CompiledCode (Integer -> Integer) diff --git a/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NoNegativeLiterals/Spec.hs b/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NoNegativeLiterals/Spec.hs index 131ced5b40a..0ec5f8062ef 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NoNegativeLiterals/Spec.hs +++ b/plutus-tx-plugin/test/IntegerLiterals/NoStrict/NoNegativeLiterals/Spec.hs @@ -20,7 +20,7 @@ import Test.Tasty.Extras tests :: TestNested tests = testNested "IntegerLiterals" . pure $ testNestedGhc - [ goldenPir "integerLiterals-NoStrict-NoNegativeLiterals" integerLiterals + [ goldenPirReadable "integerLiterals-NoStrict-NoNegativeLiterals" integerLiterals ] integerLiterals :: CompiledCode (Integer -> Integer) diff --git a/plutus-tx-plugin/test/IntegerLiterals/Strict/NegativeLiterals/Spec.hs b/plutus-tx-plugin/test/IntegerLiterals/Strict/NegativeLiterals/Spec.hs index 027974207dc..dd244b2e314 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/Strict/NegativeLiterals/Spec.hs +++ b/plutus-tx-plugin/test/IntegerLiterals/Strict/NegativeLiterals/Spec.hs @@ -21,7 +21,7 @@ import Test.Tasty.Extras tests :: TestNested tests = testNested "IntegerLiterals" . pure $ testNestedGhc - [ goldenPir "integerLiterals-Strict-NegativeLiterals" integerLiterals + [ goldenPirReadable "integerLiterals-Strict-NegativeLiterals" integerLiterals ] integerLiterals :: CompiledCode (Integer -> Integer) diff --git a/plutus-tx-plugin/test/IntegerLiterals/Strict/NoNegativeLiterals/Spec.hs b/plutus-tx-plugin/test/IntegerLiterals/Strict/NoNegativeLiterals/Spec.hs index ac458116d06..c6b5b82d8e6 100644 --- a/plutus-tx-plugin/test/IntegerLiterals/Strict/NoNegativeLiterals/Spec.hs +++ b/plutus-tx-plugin/test/IntegerLiterals/Strict/NoNegativeLiterals/Spec.hs @@ -20,7 +20,7 @@ import Test.Tasty.Extras tests :: TestNested tests = testNested "IntegerLiterals" . pure $ testNestedGhc - [ goldenPir "integerLiterals-Strict-NoNegativeLiterals" integerLiterals + [ goldenPirReadable "integerLiterals-Strict-NoNegativeLiterals" integerLiterals ] integerLiterals :: CompiledCode (Integer -> Integer) diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplication.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplication.pir.golden index fc6ae40a03d..c40f3581e57 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplication.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplication.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (let - ~defaultBody : integer = 2 - data A | A_match where - B : A - C : A - D : A +let + ~defaultBody : integer = 2 + data A | A_match where + B : A + C : A + D : A +in +\(ds : A) -> + let + !ds : A = ds in - \(ds : A) -> - let - !ds : A = ds - in - A_match - ds - {all dead. integer} - (/\dead -> 1) - (/\dead -> defaultBody) - (/\dead -> defaultBody) - {all dead. dead}) \ No newline at end of file + A_match + ds + {all dead. integer} + (/\dead -> 1) + (/\dead -> defaultBody) + (/\dead -> defaultBody) + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplicationNested.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplicationNested.pir.golden index 37bf137da63..1c9431814e0 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplicationNested.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/defaultCaseDuplicationNested.pir.golden @@ -1,32 +1,30 @@ -program - 1.1.0 - (let - ~defaultBody : integer = 3 - data A | A_match where - B : A - C : A - D : A +let + ~defaultBody : integer = 3 + data A | A_match where + B : A + C : A + D : A +in +\(ds : A) -> + let + !ds : A = ds in \(ds : A) -> let !ds : A = ds + ~defaultBody : integer + = A_match + ds + {all dead. integer} + (/\dead -> 2) + (/\dead -> defaultBody) + (/\dead -> defaultBody) + {all dead. dead} in - \(ds : A) -> - let - !ds : A = ds - ~defaultBody : integer - = A_match - ds - {all dead. integer} - (/\dead -> 2) - (/\dead -> defaultBody) - (/\dead -> defaultBody) - {all dead. dead} - in - A_match - ds - {all dead. integer} - (/\dead -> 1) - (/\dead -> defaultBody) - (/\dead -> defaultBody) - {all dead. dead}) \ No newline at end of file + A_match + ds + {all dead. integer} + (/\dead -> 1) + (/\dead -> defaultBody) + (/\dead -> defaultBody) + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/ifOpt.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/ifOpt.pir.golden index db3616eaaab..7f4a0d97bc7 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/ifOpt.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/ifOpt.pir.golden @@ -1,29 +1,27 @@ -program - 1.1.0 - (let - !divideInteger : integer -> integer -> integer = divideInteger - ~divideInteger : integer -> integer -> integer - = \(x : integer) -> +let + !divideInteger : integer -> integer -> integer = divideInteger + ~divideInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in divideInteger x y + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> let !y : integer = y in divideInteger x y - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False - !wild : Bool = equalsInteger (divideInteger 1 0) 0 - in - 1) \ No newline at end of file + ifThenElse {Bool} b True False + !wild : Bool = equalsInteger (divideInteger 1 0) 0 +in +1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/letFun.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/letFun.pir.golden index 210db8b4ce5..69c5751d728 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/letFun.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/letFun.pir.golden @@ -1,25 +1,23 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False + ifThenElse {Bool} b True False +in +\(ds : integer) -> + let + !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - \(ds : integer) -> let !ds : integer = ds in equalsInteger ds ds) \ No newline at end of file + \(ds : integer) -> let !ds : integer = ds in equalsInteger ds ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/monadicDo.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/monadicDo.pir.golden index 4d7ba359c3f..bdba29ec137 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/monadicDo.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/monadicDo.pir.golden @@ -1,51 +1,49 @@ -program - 1.1.0 - (let - data (Maybe :: * -> *) a | Maybe_match where - Just : a -> Maybe a - Nothing : Maybe a - ~`$fApplicativeMaybe_$cpure` : all a. a -> Maybe a - = /\a -> \(ds : a) -> Just {a} ds - ~`$fMonadMaybe_$c>>=` : all a b. Maybe a -> (a -> Maybe b) -> Maybe b - = /\a b -> - \(ds : Maybe a) (k : a -> Maybe b) -> - Maybe_match - {a} - ds - {all dead. Maybe b} - (\(x : a) -> /\dead -> k x) - (/\dead -> Nothing {b}) - {all dead. dead} - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y +let + data (Maybe :: * -> *) a | Maybe_match where + Just : a -> Maybe a + Nothing : Maybe a + ~`$fApplicativeMaybe_$cpure` : all a. a -> Maybe a + = /\a -> \(ds : a) -> Just {a} ds + ~`$fMonadMaybe_$c>>=` : all a b. Maybe a -> (a -> Maybe b) -> Maybe b + = /\a b -> + \(ds : Maybe a) (k : a -> Maybe b) -> + Maybe_match + {a} + ds + {all dead. Maybe b} + (\(x : a) -> /\dead -> k x) + (/\dead -> Nothing {b}) + {all dead. dead} + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(ds : Maybe integer) -> + let + !ds : Maybe integer = ds in \(ds : Maybe integer) -> let !ds : Maybe integer = ds in - \(ds : Maybe integer) -> - let - !ds : Maybe integer = ds - in - `$fMonadMaybe_$c>>=` - {integer} - {integer} - ds - (\(x' : integer) -> - let - !x' : integer = x' - in - `$fMonadMaybe_$c>>=` - {integer} - {integer} - ds - (\(y' : integer) -> - let - !y' : integer = y' - in - `$fApplicativeMaybe_$cpure` {integer} (addInteger x' y')))) \ No newline at end of file + `$fMonadMaybe_$c>>=` + {integer} + {integer} + ds + (\(x' : integer) -> + let + !x' : integer = x' + in + `$fMonadMaybe_$c>>=` + {integer} + {integer} + ds + (\(y' : integer) -> + let + !y' : integer = y' + in + `$fApplicativeMaybe_$cpure` {integer} (addInteger x' y'))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/monoId.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/monoId.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/monoId.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/monoId.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/monoK.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/monoK.pir.golden index 5a9a14aa00a..0db76b60cc2 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/monoK.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/monoK.pir.golden @@ -1,3 +1 @@ -program - 1.1.0 - (\(ds : integer) -> let !ds : integer = ds in \(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> let !ds : integer = ds in \(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/nonstrictLet.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/nonstrictLet.pir.golden index e4cf284e5b0..60b235ce2eb 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/nonstrictLet.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/nonstrictLet.pir.golden @@ -1,21 +1,19 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(ds : integer) -> + let + !ds : integer = ds in \(ds : integer) -> let !ds : integer = ds + !z : integer = addInteger ds ds in - \(ds : integer) -> - let - !ds : integer = ds - !z : integer = addInteger ds ds - in - addInteger z z) \ No newline at end of file + addInteger z z \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/patternMatchDo.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/patternMatchDo.pir.golden index 94746c1b285..7c308299578 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/patternMatchDo.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/patternMatchDo.pir.golden @@ -1,58 +1,56 @@ -program - 1.1.0 - (let - data (Maybe :: * -> *) a | Maybe_match where - Just : a -> Maybe a - Nothing : Maybe a - ~`$fApplicativeMaybe_$cpure` : all a. a -> Maybe a - = /\a -> \(ds : a) -> Just {a} ds - ~`$fMonadMaybe_$c>>=` : all a b. Maybe a -> (a -> Maybe b) -> Maybe b - = /\a b -> - \(ds : Maybe a) (k : a -> Maybe b) -> - Maybe_match - {a} - ds - {all dead. Maybe b} - (\(x : a) -> /\dead -> k x) - (/\dead -> Nothing {b}) - {all dead. dead} - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y +let + data (Maybe :: * -> *) a | Maybe_match where + Just : a -> Maybe a + Nothing : Maybe a + ~`$fApplicativeMaybe_$cpure` : all a. a -> Maybe a + = /\a -> \(ds : a) -> Just {a} ds + ~`$fMonadMaybe_$c>>=` : all a b. Maybe a -> (a -> Maybe b) -> Maybe b + = /\a b -> + \(ds : Maybe a) (k : a -> Maybe b) -> + Maybe_match + {a} + ds + {all dead. Maybe b} + (\(x : a) -> /\dead -> k x) + (/\dead -> Nothing {b}) + {all dead. dead} + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(ds : Maybe (Tuple2 integer integer)) -> + let + !ds : Maybe (Tuple2 integer integer) = ds in - \(ds : Maybe (Tuple2 integer integer)) -> + \(ds : Maybe integer) -> let - !ds : Maybe (Tuple2 integer integer) = ds + !ds : Maybe integer = ds in - \(ds : Maybe integer) -> - let - !ds : Maybe integer = ds - in - `$fMonadMaybe_$c>>=` - {Tuple2 integer integer} - {integer} - ds - (\(ds : Tuple2 integer integer) -> - Tuple2_match - {integer} - {integer} - ds - {Maybe integer} - (\(x : integer) (x : integer) -> - `$fMonadMaybe_$c>>=` - {integer} - {integer} - ds - (\(y' : integer) -> - let - !y' : integer = y' - in - `$fApplicativeMaybe_$cpure` - {integer} - (addInteger (addInteger x x) y'))))) \ No newline at end of file + `$fMonadMaybe_$c>>=` + {Tuple2 integer integer} + {integer} + ds + (\(ds : Tuple2 integer integer) -> + Tuple2_match + {integer} + {integer} + ds + {Maybe integer} + (\(x : integer) (x : integer) -> + `$fMonadMaybe_$c>>=` + {integer} + {integer} + ds + (\(y' : integer) -> + let + !y' : integer = y' + in + `$fApplicativeMaybe_$cpure` + {integer} + (addInteger (addInteger x x) y')))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLet.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLet.pir.golden index e4cf284e5b0..60b235ce2eb 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLet.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLet.pir.golden @@ -1,21 +1,19 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(ds : integer) -> + let + !ds : integer = ds in \(ds : integer) -> let !ds : integer = ds + !z : integer = addInteger ds ds in - \(ds : integer) -> - let - !ds : integer = ds - !z : integer = addInteger ds ds - in - addInteger z z) \ No newline at end of file + addInteger z z \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLetRec.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLetRec.pir.golden index a2234ea9278..1a20b5651ce 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLetRec.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/strictLetRec.pir.golden @@ -1,28 +1,26 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(ds : integer) -> + let + !ds : integer = ds in \(ds : integer) -> let !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - letrec - ~q : integer = addInteger ds z - ~z : integer = addInteger ds q - in - let - !z : integer = z - !q : integer = q - in - addInteger z z) \ No newline at end of file + letrec + ~q : integer = addInteger ds z + ~z : integer = addInteger ds q + in + let + !z : integer = z + !q : integer = q + in + addInteger z z \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/9.6/strictMultiLet.pir.golden b/plutus-tx-plugin/test/Plugin/Basic/9.6/strictMultiLet.pir.golden index d410ebbec43..033c67089e7 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/9.6/strictMultiLet.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Basic/9.6/strictMultiLet.pir.golden @@ -1,22 +1,20 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(ds : integer) -> + let + !ds : integer = ds in \(ds : integer) -> let !ds : integer = ds + !z : integer = addInteger ds ds + !q : integer = addInteger z z in - \(ds : integer) -> - let - !ds : integer = ds - !z : integer = addInteger ds ds - !q : integer = addInteger z z - in - addInteger q q) \ No newline at end of file + addInteger q q \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Basic/Spec.hs b/plutus-tx-plugin/test/Plugin/Basic/Spec.hs index 8b674e0f56c..229a111dd7a 100644 --- a/plutus-tx-plugin/test/Plugin/Basic/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Basic/Spec.hs @@ -22,7 +22,7 @@ import PlutusTx.Builtins qualified as Builtins import PlutusTx.Code (CompiledCode) import PlutusTx.Plugin (plc) import PlutusTx.Prelude qualified as P -import PlutusTx.Test (goldenPir, goldenUPlc) +import PlutusTx.Test (goldenPirReadable, goldenUPlc) import Data.Proxy (Proxy (..)) import Test.Tasty.Extras (TestNested, testNested, testNestedGhc) @@ -30,22 +30,22 @@ import Test.Tasty.Extras (TestNested, testNested, testNestedGhc) basic :: TestNested basic = testNested "Basic" . pure $ testNestedGhc - [ goldenPir "monoId" monoId - , goldenPir "monoK" monoK - , goldenPir "letFun" letFun - , goldenPir "nonstrictLet" nonstrictLet - , goldenPir "strictLet" strictLet - , goldenPir "strictMultiLet" strictMultiLet - , goldenPir "strictLetRec" strictLetRec + [ goldenPirReadable "monoId" monoId + , goldenPirReadable "monoK" monoK + , goldenPirReadable "letFun" letFun + , goldenPirReadable "nonstrictLet" nonstrictLet + , goldenPirReadable "strictLet" strictLet + , goldenPirReadable "strictMultiLet" strictMultiLet + , goldenPirReadable "strictLetRec" strictLetRec , -- must keep the scrutinee as it evaluates to error - goldenPir "ifOpt" ifOpt + goldenPirReadable "ifOpt" ifOpt , -- should fail goldenUEval "ifOptEval" [ifOpt] - , goldenPir "monadicDo" monadicDo - , goldenPir "patternMatchDo" patternMatchDo + , goldenPirReadable "monadicDo" monadicDo + , goldenPirReadable "patternMatchDo" patternMatchDo , goldenUPlc "patternMatchFailure" patternMatchFailure - , goldenPir "defaultCaseDuplication" defaultCaseDuplication - , goldenPir "defaultCaseDuplicationNested" defaultCaseDuplicationNested + , goldenPirReadable "defaultCaseDuplication" defaultCaseDuplication + , goldenPirReadable "defaultCaseDuplicationNested" defaultCaseDuplicationNested ] monoId :: CompiledCode (Integer -> Integer) diff --git a/plutus-tx-plugin/test/Plugin/Coverage/9.6/coverageCode.pir.golden b/plutus-tx-plugin/test/Plugin/Coverage/9.6/coverageCode.pir.golden index c3e9f322fe8..108ea46192d 100644 --- a/plutus-tx-plugin/test/Plugin/Coverage/9.6/coverageCode.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Coverage/9.6/coverageCode.pir.golden @@ -1,169 +1,167 @@ -program - 1.1.0 - (let - data (Maybe :: * -> *) a | Maybe_match where - Just : a -> Maybe a - Nothing : Maybe a - data Bool | Bool_match where - True : Bool - False : Bool - ~fail : - unit -> Maybe Bool - = \(ds : unit) -> - trace - {all dead a. Maybe a} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 14, _covLocEndCol = 15})" - (/\dead -> - trace - {all dead a. Maybe a} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 43, _covLocEndLine = 43, _covLocStartCol = 26, _covLocEndCol = 33})" - (/\dead -> Nothing) - {all dead. dead}) - {all dead. dead} - {Bool} - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False - ~`$fEqInteger` : (\a -> a -> a -> Bool) integer = equalsInteger - ~`&&` : Bool -> Bool -> Bool - = \(ds : Bool) (x : Bool) -> - Bool_match - ds - {all dead. Bool} - (/\dead -> x) - (/\dead -> False) - {all dead. dead} - ~`==` : all a. (\a -> a -> a -> Bool) a -> a -> a -> Bool - = /\a -> \(v : (\a -> a -> a -> Bool) a) -> v - !trace : all a. string -> a -> a = trace - ~traceBool : string -> string -> Bool -> Bool - = \(trueLabel : string) -> +let + data (Maybe :: * -> *) a | Maybe_match where + Just : a -> Maybe a + Nothing : Maybe a + data Bool | Bool_match where + True : Bool + False : Bool + ~fail : + unit -> Maybe Bool + = \(ds : unit) -> + trace + {all dead a. Maybe a} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 41, _covLocStartCol = 14, _covLocEndCol = 15})" + (/\dead -> + trace + {all dead a. Maybe a} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 43, _covLocEndLine = 43, _covLocStartCol = 26, _covLocEndCol = 33})" + (/\dead -> Nothing) + {all dead. dead}) + {all dead. dead} + {Bool} + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !trueLabel : string = trueLabel + !y : integer = y + !b : bool = equalsInteger x y in - \(falseLabel : string) -> - let - !falseLabel : string = falseLabel - in - \(c : Bool) -> - Bool_match - c - {all dead. Bool} - (/\dead -> trace {Bool} trueLabel True) - (/\dead -> trace {Bool} falseLabel False) - {all dead. dead} - ~otherFun : - integer -> Bool - = \(x : integer) -> + ifThenElse {Bool} b True False + ~`$fEqInteger` : (\a -> a -> a -> Bool) integer = equalsInteger + ~`&&` : Bool -> Bool -> Bool + = \(ds : Bool) (x : Bool) -> + Bool_match + ds + {all dead. Bool} + (/\dead -> x) + (/\dead -> False) + {all dead. dead} + ~`==` : all a. (\a -> a -> a -> Bool) a -> a -> a -> Bool + = /\a -> \(v : (\a -> a -> a -> Bool) a) -> v + !trace : all a. string -> a -> a = trace + ~traceBool : string -> string -> Bool -> Bool + = \(trueLabel : string) -> + let + !trueLabel : string = trueLabel + in + \(falseLabel : string) -> let - !x : integer = x + !falseLabel : string = falseLabel in - traceBool - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 1, _covLocEndCol = 32}) True" - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 1, _covLocEndCol = 32}) False" - (trace - {all dead. Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 1, _covLocEndCol = 32})" - (/\dead -> - traceBool - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 32}) True" - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 32}) False" - (trace - {all dead. Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 32})" - (/\dead -> - `&&` - (traceBool - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 24}) True" - "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 24}) False" - (trace - {all dead. Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 24})" - (/\dead -> - `==` - {integer} - `$fEqInteger` - (trace - {all dead. integer} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 15, _covLocEndCol = 16})" - (/\dead -> x) - {all dead. dead}) - (trace - {all dead. integer} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 22, _covLocEndCol = 23})" - (/\dead -> 5) - {all dead. dead})) - {all dead. dead})) - (trace - {all dead. Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 28, _covLocEndCol = 32})" - (/\dead -> True) - {all dead. dead})) - {all dead. dead})) - {all dead. dead}) + \(c : Bool) -> + Bool_match + c + {all dead. Bool} + (/\dead -> trace {Bool} trueLabel True) + (/\dead -> trace {Bool} falseLabel False) + {all dead. dead} + ~otherFun : + integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + traceBool + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 1, _covLocEndCol = 32}) True" + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 1, _covLocEndCol = 32}) False" + (trace + {all dead. Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 1, _covLocEndCol = 32})" + (/\dead -> + traceBool + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 32}) True" + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 32}) False" + (trace + {all dead. Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 32})" + (/\dead -> + `&&` + (traceBool + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 24}) True" + "CoverBool (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 24}) False" + (trace + {all dead. Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 14, _covLocEndCol = 24})" + (/\dead -> + `==` + {integer} + `$fEqInteger` + (trace + {all dead. integer} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 15, _covLocEndCol = 16})" + (/\dead -> x) + {all dead. dead}) + (trace + {all dead. integer} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 22, _covLocEndCol = 23})" + (/\dead -> 5) + {all dead. dead})) + {all dead. dead})) + (trace + {all dead. Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 46, _covLocEndLine = 46, _covLocStartCol = 28, _covLocEndCol = 32})" + (/\dead -> True) + {all dead. dead})) + {all dead. dead})) + {all dead. dead}) +in +\(x : Maybe integer) -> + let + !x : Maybe integer = x in - \(x : Maybe integer) -> - let - !x : Maybe integer = x - in - trace - {all dead. Maybe Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 37, _covLocEndLine = 37, _covLocStartCol = 54, _covLocEndCol = 57})" - (/\dead -> - trace - {all dead. Maybe Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 43, _covLocStartCol = 1, _covLocEndCol = 33})" - (/\dead -> - trace - {all dead. Maybe Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 43, _covLocStartCol = 9, _covLocEndCol = 33})" - (/\dead -> - Maybe_match - {integer} - x - {all dead. Maybe Bool} - (\(y : integer) -> - /\dead -> - trace - {all dead. Maybe Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 12, _covLocEndCol = 22})" - (/\dead -> - Bool_match - (otherFun - (trace - {all dead. integer} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 21, _covLocEndCol = 22})" - (/\dead -> y) - {all dead. dead})) - {all dead. Maybe Bool} - (/\dead -> - trace - {all dead. Maybe Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 26, _covLocEndCol = 36})" - (/\dead -> - Just - {Bool} - (trace - {all dead. Bool} - "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 31, _covLocEndCol = 36})" - (/\dead -> False) - {all dead. dead})) - {all dead. dead}) - (/\dead -> fail ()) - {all dead. dead}) - {all dead. dead}) - (/\dead -> fail ()) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) - {all dead. dead}) \ No newline at end of file + trace + {all dead. Maybe Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 37, _covLocEndLine = 37, _covLocStartCol = 54, _covLocEndCol = 57})" + (/\dead -> + trace + {all dead. Maybe Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 43, _covLocStartCol = 1, _covLocEndCol = 33})" + (/\dead -> + trace + {all dead. Maybe Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 41, _covLocEndLine = 43, _covLocStartCol = 9, _covLocEndCol = 33})" + (/\dead -> + Maybe_match + {integer} + x + {all dead. Maybe Bool} + (\(y : integer) -> + /\dead -> + trace + {all dead. Maybe Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 12, _covLocEndCol = 22})" + (/\dead -> + Bool_match + (otherFun + (trace + {all dead. integer} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 21, _covLocEndCol = 22})" + (/\dead -> y) + {all dead. dead})) + {all dead. Maybe Bool} + (/\dead -> + trace + {all dead. Maybe Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 26, _covLocEndCol = 36})" + (/\dead -> + Just + {Bool} + (trace + {all dead. Bool} + "CoverLocation (CovLoc {_covLocFile = \"test/Plugin/Coverage/Spec.hs\", _covLocStartLine = 42, _covLocEndLine = 42, _covLocStartCol = 31, _covLocEndCol = 36})" + (/\dead -> False) + {all dead. dead})) + {all dead. dead}) + (/\dead -> fail ()) + {all dead. dead}) + {all dead. dead}) + (/\dead -> fail ()) + {all dead. dead}) + {all dead. dead}) + {all dead. dead}) + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Coverage/Spec.hs b/plutus-tx-plugin/test/Plugin/Coverage/Spec.hs index b8c4051e318..bbecd7bd7f9 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" . pure $ testNestedGhc , mkTests "boolOtherFunction" boolOtherFunction (Set.fromList ["&&", "=="]) [37, 41, 42, 43] , mkTests "boolQualifiedDisappears" boolQualifiedDisappears Set.empty [49] ] - , goldenPir "coverageCode" boolOtherFunction ] + , goldenPirReadable "coverageCode" boolOtherFunction ] mkTests :: String -> CompiledCode t -> Set String -> [Int] -> TestTree mkTests nm cc heads ls = testGroup nm [ applicationHeadsCorrect cc heads , linesInCoverageIndex cc ls ] diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/families/associated.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/families/associated.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/families/associated.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/families/associated.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/families/associatedParam.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/families/associatedParam.pir.golden index 6f90ae74523..d7c3adc458b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/families/associatedParam.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/families/associatedParam.pir.golden @@ -1,10 +1,8 @@ -program - 1.1.0 - (let - data (Param :: * -> *) a | Param_match where - Param : a -> Param a - ~`$WParam` : all a. a -> Param a - = /\a -> \(conrep : a) -> let !conrep : a = conrep in Param {a} conrep - ~paramId : all a. Param a -> a -> a = /\a -> \(ds : Param a) (x : a) -> x - in - paramId {integer} (`$WParam` {integer} 1) 1) \ No newline at end of file +let + data (Param :: * -> *) a | Param_match where + Param : a -> Param a + ~`$WParam` : all a. a -> Param a + = /\a -> \(conrep : a) -> let !conrep : a = conrep in Param {a} conrep + ~paramId : all a. Param a -> a -> a = /\a -> \(ds : Param a) (x : a) -> x +in +paramId {integer} (`$WParam` {integer} 1) 1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicClosed.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicClosed.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicClosed.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicClosed.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicData.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicData.pir.golden index e97563d8275..66b4dddd215 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicData.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicData.pir.golden @@ -1,11 +1,9 @@ -program - 1.1.0 - (let - data `R:BasicDataBool` | `R:BasicDataBool_match` where - Inst : integer -> `R:BasicDataBool` +let + data `R:BasicDataBool` | `R:BasicDataBool_match` where + Inst : integer -> `R:BasicDataBool` +in +\(ds : `R:BasicDataBool`) -> + let + !nt : `R:BasicDataBool` = ds in - \(ds : `R:BasicDataBool`) -> - let - !nt : `R:BasicDataBool` = ds - in - `R:BasicDataBool_match` nt {integer} (\(i : integer) -> i)) \ No newline at end of file + `R:BasicDataBool_match` nt {integer} (\(i : integer) -> i) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicOpen.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicOpen.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicOpen.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/families/basicOpen.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/atPattern.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/atPattern.pir.golden index 166246d17a8..65c70a2fc94 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/atPattern.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/atPattern.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (let - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - in - \(t : Tuple2 integer integer) -> - Tuple2_match - {integer} - {integer} - t - {integer} - (\(ds : integer) (ds : integer) -> addInteger ds ds)) \ No newline at end of file +let + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(t : Tuple2 integer integer) -> + Tuple2_match + {integer} + {integer} + t + {integer} + (\(ds : integer) (ds : integer) -> addInteger ds ds) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/defaultCase.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/defaultCase.pir.golden index 11face25ff7..c74db6bca3b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/defaultCase.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/defaultCase.pir.golden @@ -1,19 +1,17 @@ -program - 1.1.0 - (let - ~defaultBody : integer = 2 - data MyMonoData | MyMonoData_match where - Mono : integer -> integer -> MyMonoData - Mono : integer -> MyMonoData - Mono : integer -> MyMonoData +let + ~defaultBody : integer = 2 + data MyMonoData | MyMonoData_match where + Mono : integer -> integer -> MyMonoData + Mono : integer -> MyMonoData + Mono : integer -> MyMonoData +in +\(ds : MyMonoData) -> + let + !ds : MyMonoData = ds in - \(ds : MyMonoData) -> - let - !ds : MyMonoData = ds - in - MyMonoData_match - ds - {integer} - (\(default_arg0 : integer) (default_arg1 : integer) -> defaultBody) - (\(default_arg0 : integer) -> defaultBody) - (\(a : integer) -> a)) \ No newline at end of file + MyMonoData_match + ds + {integer} + (\(default_arg0 : integer) (default_arg1 : integer) -> defaultBody) + (\(default_arg0 : integer) -> defaultBody) + (\(a : integer) -> a) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/enum.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/enum.pir.golden index 8b9f94a00ab..90fd2d7619f 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/enum.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/enum.pir.golden @@ -1,8 +1,6 @@ -program - 1.1.0 - (let - data MyEnum | MyEnum_match where - Enum : MyEnum - Enum : MyEnum - in - Enum) \ No newline at end of file +let + data MyEnum | MyEnum_match where + Enum : MyEnum + Enum : MyEnum +in +Enum \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/irrefutableMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/irrefutableMatch.pir.golden index 0d70c8027a0..7ad6f413be2 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/irrefutableMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/irrefutableMatch.pir.golden @@ -1,23 +1,21 @@ -program - 1.1.0 - (let - ~defaultBody : integer = (/\e -> error {e}) {integer} - data Unit | Unit_match where - Unit : Unit - ~defaultBody : integer - = Unit_match ((/\e -> error {e}) {Unit}) {integer} defaultBody - data MyMonoData | MyMonoData_match where - Mono : integer -> integer -> MyMonoData - Mono : integer -> MyMonoData - Mono : integer -> MyMonoData +let + ~defaultBody : integer = (/\e -> error {e}) {integer} + data Unit | Unit_match where + Unit : Unit + ~defaultBody : integer + = Unit_match ((/\e -> error {e}) {Unit}) {integer} defaultBody + data MyMonoData | MyMonoData_match where + Mono : integer -> integer -> MyMonoData + Mono : integer -> MyMonoData + Mono : integer -> MyMonoData +in +\(ds : MyMonoData) -> + let + !ds : MyMonoData = ds in - \(ds : MyMonoData) -> - let - !ds : MyMonoData = ds - in - MyMonoData_match - ds - {integer} - (\(default_arg0 : integer) (default_arg1 : integer) -> defaultBody) - (\(a : integer) -> a) - (\(default_arg0 : integer) -> defaultBody)) \ No newline at end of file + MyMonoData_match + ds + {integer} + (\(default_arg0 : integer) (default_arg1 : integer) -> defaultBody) + (\(a : integer) -> a) + (\(default_arg0 : integer) -> defaultBody) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCase.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCase.pir.golden index 6e430b52b48..53ccc0a8459 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCase.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCase.pir.golden @@ -1,18 +1,16 @@ -program - 1.1.0 - (let - data MyMonoData | MyMonoData_match where - Mono : integer -> integer -> MyMonoData - Mono : integer -> MyMonoData - Mono : integer -> MyMonoData +let + data MyMonoData | MyMonoData_match where + Mono : integer -> integer -> MyMonoData + Mono : integer -> MyMonoData + Mono : integer -> MyMonoData +in +\(ds : MyMonoData) -> + let + !ds : MyMonoData = ds in - \(ds : MyMonoData) -> - let - !ds : MyMonoData = ds - in - MyMonoData_match - ds - {integer} - (\(ds : integer) (b : integer) -> b) - (\(a : integer) -> a) - (\(a : integer) -> a)) \ No newline at end of file + MyMonoData_match + ds + {integer} + (\(ds : integer) (b : integer) -> b) + (\(a : integer) -> a) + (\(a : integer) -> a) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCaseStrict.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCaseStrict.pir.golden index 6e430b52b48..53ccc0a8459 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCaseStrict.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoCaseStrict.pir.golden @@ -1,18 +1,16 @@ -program - 1.1.0 - (let - data MyMonoData | MyMonoData_match where - Mono : integer -> integer -> MyMonoData - Mono : integer -> MyMonoData - Mono : integer -> MyMonoData +let + data MyMonoData | MyMonoData_match where + Mono : integer -> integer -> MyMonoData + Mono : integer -> MyMonoData + Mono : integer -> MyMonoData +in +\(ds : MyMonoData) -> + let + !ds : MyMonoData = ds in - \(ds : MyMonoData) -> - let - !ds : MyMonoData = ds - in - MyMonoData_match - ds - {integer} - (\(ds : integer) (b : integer) -> b) - (\(a : integer) -> a) - (\(a : integer) -> a)) \ No newline at end of file + MyMonoData_match + ds + {integer} + (\(ds : integer) (b : integer) -> b) + (\(a : integer) -> a) + (\(a : integer) -> a) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructed.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructed.pir.golden index 42adca87158..86162b4814b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructed.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructed.pir.golden @@ -1,11 +1,9 @@ -program - 1.1.0 - (let - data MyMonoData | MyMonoData_match where - Mono : integer -> integer -> MyMonoData - Mono : integer -> MyMonoData - Mono : integer -> MyMonoData - ~`$WMono` : integer -> MyMonoData - = \(conrep : integer) -> let !conrep : integer = conrep in Mono conrep - in - `$WMono` 1) \ No newline at end of file +let + data MyMonoData | MyMonoData_match where + Mono : integer -> integer -> MyMonoData + Mono : integer -> MyMonoData + Mono : integer -> MyMonoData + ~`$WMono` : integer -> MyMonoData + = \(conrep : integer) -> let !conrep : integer = conrep in Mono conrep +in +`$WMono` 1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructor.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructor.pir.golden index 8316a48c601..c0d22b060bb 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructor.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoConstructor.pir.golden @@ -1,19 +1,17 @@ -program - 1.1.0 - (let - data MyMonoData | MyMonoData_match where - Mono : integer -> integer -> MyMonoData - Mono : integer -> MyMonoData - Mono : integer -> MyMonoData - ~`$WMono` : integer -> integer -> MyMonoData - = \(conrep : integer) -> +let + data MyMonoData | MyMonoData_match where + Mono : integer -> integer -> MyMonoData + Mono : integer -> MyMonoData + Mono : integer -> MyMonoData + ~`$WMono` : integer -> integer -> MyMonoData + = \(conrep : integer) -> + let + !conrep : integer = conrep + in + \(conrep : integer) -> let !conrep : integer = conrep in - \(conrep : integer) -> - let - !conrep : integer = conrep - in - Mono conrep conrep - in - \(ds : integer) (ds : integer) -> `$WMono` ds ds) \ No newline at end of file + Mono conrep conrep +in +\(ds : integer) (ds : integer) -> `$WMono` ds ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoDataType.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoDataType.pir.golden index c9ae439f0ec..2349078b8cc 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoDataType.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoDataType.pir.golden @@ -1,19 +1,17 @@ -program - 1.1.0 - (let - ~defaultBody : integer = 1 - data MyMonoData | MyMonoData_match where - Mono : integer -> integer -> MyMonoData - Mono : integer -> MyMonoData - Mono : integer -> MyMonoData +let + ~defaultBody : integer = 1 + data MyMonoData | MyMonoData_match where + Mono : integer -> integer -> MyMonoData + Mono : integer -> MyMonoData + Mono : integer -> MyMonoData +in +\(ds : MyMonoData) -> + let + !ds : MyMonoData = ds in - \(ds : MyMonoData) -> - let - !ds : MyMonoData = ds - in - MyMonoData_match - ds - {integer} - (\(default_arg0 : integer) (default_arg1 : integer) -> defaultBody) - (\(i : integer) -> i) - (\(default_arg0 : integer) -> defaultBody)) \ No newline at end of file + MyMonoData_match + ds + {integer} + (\(default_arg0 : integer) (default_arg1 : integer) -> defaultBody) + (\(i : integer) -> i) + (\(default_arg0 : integer) -> defaultBody) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoRecord.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoRecord.pir.golden index ee345dd3bef..7f1ec66b89d 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoRecord.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/monoRecord.pir.golden @@ -1,8 +1,6 @@ -program - 1.1.0 - (let - data MyMonoRecord | MyMonoRecord_match where - MyMonoRecord : integer -> integer -> MyMonoRecord - in - \(ds : MyMonoRecord) -> - MyMonoRecord_match ds {integer} (\(ipv : integer) (ipv : integer) -> ipv)) \ No newline at end of file +let + data MyMonoRecord | MyMonoRecord_match where + MyMonoRecord : integer -> integer -> MyMonoRecord +in +\(ds : MyMonoRecord) -> + MyMonoRecord_match ds {integer} (\(ipv : integer) (ipv : integer) -> ipv) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/nonValueCase.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/nonValueCase.pir.golden index 051c3b778af..4066d126ead 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/nonValueCase.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/nonValueCase.pir.golden @@ -1,22 +1,20 @@ -program - 1.1.0 - (let - data MyEnum | MyEnum_match where - Enum : MyEnum - Enum : MyEnum - data Unit | Unit_match where - Unit : Unit - !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} - !unitval : unit = () - ~error : all a. Unit -> a = /\a -> \(x : Unit) -> error {a} unitval +let + data MyEnum | MyEnum_match where + Enum : MyEnum + Enum : MyEnum + data Unit | Unit_match where + Unit : Unit + !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} + !unitval : unit = () + ~error : all a. Unit -> a = /\a -> \(x : Unit) -> error {a} unitval +in +\(ds : MyEnum) -> + let + !ds : MyEnum = ds in - \(ds : MyEnum) -> - let - !ds : MyEnum = ds - in - MyEnum_match - ds - {all dead. integer} - (/\dead -> 1) - (/\dead -> error {integer} Unit) - {all dead. dead}) \ No newline at end of file + MyEnum_match + ds + {all dead. integer} + (/\dead -> 1) + (/\dead -> error {integer} Unit) + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordNewtype.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordNewtype.pir.golden index 0594af143c4..31a7a8cb53e 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordNewtype.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordNewtype.pir.golden @@ -1,8 +1,6 @@ -program - 1.1.0 - (let - data RecordNewtype | RecordNewtype_match where - RecordNewtype : integer -> RecordNewtype - in - \(ds : RecordNewtype) -> - RecordNewtype_match ds {integer} (\(ipv : integer) -> ipv)) \ No newline at end of file +let + data RecordNewtype | RecordNewtype_match where + RecordNewtype : integer -> RecordNewtype +in +\(ds : RecordNewtype) -> + RecordNewtype_match ds {integer} (\(ipv : integer) -> ipv) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordWithStrictField.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordWithStrictField.pir.golden index d004d0bfa2b..f33c08fd347 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordWithStrictField.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/recordWithStrictField.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (let - RecordNewtype = all a. a -> a - MyMonoRecord = all a. a -> a - data RecordWithStrictField | RecordWithStrictField_match where - RecordWithStrictField : - MyMonoRecord -> RecordNewtype -> RecordWithStrictField - ~strictField : RecordWithStrictField -> RecordNewtype - = \(ds : RecordWithStrictField) -> - RecordWithStrictField_match - ds - {RecordNewtype} - (\(ds : MyMonoRecord) (ds : RecordNewtype) -> ds) +let + RecordNewtype = all a. a -> a + MyMonoRecord = all a. a -> a + data RecordWithStrictField | RecordWithStrictField_match where + RecordWithStrictField : + MyMonoRecord -> RecordNewtype -> RecordWithStrictField + ~strictField : RecordWithStrictField -> RecordNewtype + = \(ds : RecordWithStrictField) -> + RecordWithStrictField_match + ds + {RecordNewtype} + (\(ds : MyMonoRecord) (ds : RecordNewtype) -> ds) +in +\(ds : RecordWithStrictField) -> + let + !ds : RecordWithStrictField = ds in - \(ds : RecordWithStrictField) -> - let - !ds : RecordWithStrictField = ds - in - strictField ds) \ No newline at end of file + strictField ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/strictDataMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/strictDataMatch.pir.golden index 0941192c29c..37516d4dedd 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/strictDataMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/strictDataMatch.pir.golden @@ -1,18 +1,16 @@ -program - 1.1.0 - (let - data (StrictTy :: * -> *) a | StrictTy_match where - StrictTy : a -> a -> StrictTy a - ~`$WStrictTy` : all a. a -> a -> StrictTy a - = /\a -> +let + data (StrictTy :: * -> *) a | StrictTy_match where + StrictTy : a -> a -> StrictTy a + ~`$WStrictTy` : all a. a -> a -> StrictTy a + = /\a -> + \(conrep : a) -> + let + !conrep : a = conrep + in \(conrep : a) -> let !conrep : a = conrep in - \(conrep : a) -> - let - !conrep : a = conrep - in - StrictTy {a} conrep conrep - in - `$WStrictTy` {integer} 1 2) \ No newline at end of file + StrictTy {a} conrep conrep +in +`$WStrictTy` {integer} 1 2 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/synonym.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/synonym.pir.golden index 0d9b8af24ca..56a6051ca2b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/synonym.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/synonym.pir.golden @@ -1 +1 @@ -program 1.1.0 1 \ No newline at end of file +1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/unusedWrapper.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/unusedWrapper.pir.golden index 8bddd86f78d..9bb64c6d49a 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/unusedWrapper.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/monomorphic/unusedWrapper.pir.golden @@ -1,17 +1,15 @@ -program - 1.1.0 - (let - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - data T | T_match where - MkT : Tuple2 integer integer -> T - ~`$WMkT` : Tuple2 integer integer -> T - = \(conrep : Tuple2 integer integer) -> - let - !conrep : Tuple2 integer integer = conrep - in - MkT conrep - ~mkT : Tuple2 integer integer -> T - = \(ds : Tuple2 integer integer) -> `$WMkT` ds - in - mkT (Tuple2 {integer} {integer} 2 1)) \ No newline at end of file +let + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b + data T | T_match where + MkT : Tuple2 integer integer -> T + ~`$WMkT` : Tuple2 integer integer -> T + = \(conrep : Tuple2 integer integer) -> + let + !conrep : Tuple2 integer integer = conrep + in + MkT conrep + ~mkT : Tuple2 integer integer -> T + = \(ds : Tuple2 integer integer) -> `$WMkT` ds +in +mkT (Tuple2 {integer} {integer} 2 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/basicNewtype.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/basicNewtype.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/basicNewtype.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/basicNewtype.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/nestedNewtypeMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/nestedNewtypeMatch.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/nestedNewtypeMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/nestedNewtypeMatch.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate2.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate2.pir.golden index 0d9b8af24ca..56a6051ca2b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeCreate2.pir.golden @@ -1 +1 @@ -program 1.1.0 1 \ No newline at end of file +1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeId.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeId.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeId.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeId.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeMatch.pir.golden index 5f274561f69..4e642ab9028 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/newtypeMatch.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : integer) -> ds) \ No newline at end of file +\(ds : integer) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/paramNewtype.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/paramNewtype.pir.golden index e00e4be5105..5038ae7ed0b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/paramNewtype.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/newtypes/paramNewtype.pir.golden @@ -1,12 +1,10 @@ -program - 1.1.0 - (let - data (Maybe :: * -> *) a | Maybe_match where - Just : a -> Maybe a - Nothing : Maybe a +let + data (Maybe :: * -> *) a | Maybe_match where + Just : a -> Maybe a + Nothing : Maybe a +in +\(ds : (\a -> Maybe a) integer) -> + let + !nt : Maybe integer = ds in - \(ds : (\a -> Maybe a) integer) -> - let - !nt : Maybe integer = ds - in - Maybe_match {integer} nt {integer} (\(i : integer) -> i) 1) \ No newline at end of file + Maybe_match {integer} nt {integer} (\(i : integer) -> i) 1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/defaultCasePoly.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/defaultCasePoly.pir.golden index 1e3240608b0..724e87f1fd3 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/defaultCasePoly.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/defaultCasePoly.pir.golden @@ -1,18 +1,16 @@ -program - 1.1.0 - (let - data (MyPolyData :: * -> * -> *) a b | MyPolyData_match where - Poly : a -> b -> MyPolyData a b - Poly : a -> MyPolyData a b +let + data (MyPolyData :: * -> * -> *) a b | MyPolyData_match where + Poly : a -> b -> MyPolyData a b + Poly : a -> MyPolyData a b +in +\(ds : MyPolyData integer integer) -> + let + !ds : MyPolyData integer integer = ds in - \(ds : MyPolyData integer integer) -> - let - !ds : MyPolyData integer integer = ds - in - MyPolyData_match - {integer} - {integer} - ds - {integer} - (\(a : integer) (ds : integer) -> a) - (\(ipv : integer) -> 2)) \ No newline at end of file + MyPolyData_match + {integer} + {integer} + ds + {integer} + (\(a : integer) (ds : integer) -> a) + (\(ipv : integer) -> 2) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyConstructed.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyConstructed.pir.golden index d54b5785af9..800a6562ad5 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyConstructed.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyConstructed.pir.golden @@ -1,19 +1,17 @@ -program - 1.1.0 - (let - data (MyPolyData :: * -> * -> *) a b | MyPolyData_match where - Poly : a -> b -> MyPolyData a b - Poly : a -> MyPolyData a b - ~`$WPoly` : all a b. a -> b -> MyPolyData a b - = /\a b -> - \(conrep : a) -> +let + data (MyPolyData :: * -> * -> *) a b | MyPolyData_match where + Poly : a -> b -> MyPolyData a b + Poly : a -> MyPolyData a b + ~`$WPoly` : all a b. a -> b -> MyPolyData a b + = /\a b -> + \(conrep : a) -> + let + !conrep : a = conrep + in + \(conrep : b) -> let - !conrep : a = conrep + !conrep : b = conrep in - \(conrep : b) -> - let - !conrep : b = conrep - in - Poly {a} {b} conrep conrep - in - `$WPoly` {integer} {integer} 1 2) \ No newline at end of file + Poly {a} {b} conrep conrep +in +`$WPoly` {integer} {integer} 1 2 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyDataType.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyDataType.pir.golden index abb1ebca972..36687c0a639 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyDataType.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/polymorphic/polyDataType.pir.golden @@ -1,18 +1,16 @@ -program - 1.1.0 - (let - data (MyPolyData :: * -> * -> *) a b | MyPolyData_match where - Poly : a -> b -> MyPolyData a b - Poly : a -> MyPolyData a b +let + data (MyPolyData :: * -> * -> *) a b | MyPolyData_match where + Poly : a -> b -> MyPolyData a b + Poly : a -> MyPolyData a b +in +\(ds : MyPolyData integer integer) -> + let + !ds : MyPolyData integer integer = ds in - \(ds : MyPolyData integer integer) -> - let - !ds : MyPolyData integer integer = ds - in - MyPolyData_match - {integer} - {integer} - ds - {integer} - (\(ipv : integer) (ipv : integer) -> 1) - (\(i : integer) -> i)) \ No newline at end of file + MyPolyData_match + {integer} + {integer} + ds + {integer} + (\(ipv : integer) (ipv : integer) -> 1) + (\(i : integer) -> i) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct.pir.golden index 4d4250e84b1..aa624641c23 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct.pir.golden @@ -1,8 +1,6 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - Nil {integer}) \ No newline at end of file +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +Nil {integer} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct2.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct2.pir.golden index b3f6e29f3e2..e4122ac43c9 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct2.pir.golden @@ -1,14 +1,12 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a - = /\a -> - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) - in - build {integer} (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 n)) \ No newline at end of file +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a + = /\a -> + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) +in +build {integer} (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 n) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct3.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct3.pir.golden index c02762ea683..6e26e83329d 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct3.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listConstruct3.pir.golden @@ -1,8 +1,6 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - Cons {integer} 1 (Cons {integer} 2 (Cons {integer} 3 (Nil {integer})))) \ No newline at end of file +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +Cons {integer} 1 (Cons {integer} 2 (Cons {integer} 3 (Nil {integer}))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listMatch.pir.golden index 487467be406..6c7d18652b1 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/listMatch.pir.golden @@ -1,17 +1,10 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +\(ds : List integer) -> + let + !ds : List integer = ds in - \(ds : List integer) -> - let - !ds : List integer = ds - in - List_match - {integer} - ds - {integer} - 0 - (\(x : integer) (ds : List integer) -> x)) \ No newline at end of file + List_match {integer} ds {integer} 0 (\(x : integer) (ds : List integer) -> x) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeConstruct.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeConstruct.pir.golden index e0a0e9088cc..b014a97f90b 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeConstruct.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeConstruct.pir.golden @@ -1,33 +1,31 @@ -program - 1.1.0 - (let - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - in - letrec - data (B :: * -> *) a | B_match where - One : a -> B a - Two : B (Tuple2 a a) -> B a - in - let - ~`$WOne` : all a. a -> B a - = /\a -> \(conrep : a) -> let !conrep : a = conrep in One {a} conrep - ~`$WTwo` : all a. B (Tuple2 a a) -> B a - = /\a -> - \(conrep : B (Tuple2 a a)) -> - let - !conrep : B (Tuple2 a a) = conrep - in - Two {a} conrep - in - `$WTwo` - {integer} - (`$WTwo` - {Tuple2 integer integer} - (`$WOne` - {Tuple2 (Tuple2 integer integer) (Tuple2 integer integer)} - (Tuple2 - {Tuple2 integer integer} - {Tuple2 integer integer} - (Tuple2 {integer} {integer} 1 2) - (Tuple2 {integer} {integer} 3 4))))) \ No newline at end of file +let + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b +in +letrec + data (B :: * -> *) a | B_match where + One : a -> B a + Two : B (Tuple2 a a) -> B a +in +let + ~`$WOne` : all a. a -> B a + = /\a -> \(conrep : a) -> let !conrep : a = conrep in One {a} conrep + ~`$WTwo` : all a. B (Tuple2 a a) -> B a + = /\a -> + \(conrep : B (Tuple2 a a)) -> + let + !conrep : B (Tuple2 a a) = conrep + in + Two {a} conrep +in +`$WTwo` + {integer} + (`$WTwo` + {Tuple2 integer integer} + (`$WOne` + {Tuple2 (Tuple2 integer integer) (Tuple2 integer integer)} + (Tuple2 + {Tuple2 integer integer} + {Tuple2 integer integer} + (Tuple2 {integer} {integer} 1 2) + (Tuple2 {integer} {integer} 3 4)))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeMatch.pir.golden index 9940e5ffaa6..9303410fa68 100644 --- a/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Data/9.6/recursive/ptreeMatch.pir.golden @@ -1,20 +1,18 @@ -program - 1.1.0 - (let - Tuple2 :: * -> * -> * = \a a -> all a. a -> a +let + Tuple2 :: * -> * -> * = \a a -> all a. a -> a +in +letrec + data (B :: * -> *) a | B_match where + One : a -> B a + Two : B (Tuple2 a a) -> B a +in +\(ds : B integer) -> + let + !ds : B integer = ds in - letrec - data (B :: * -> *) a | B_match where - One : a -> B a - Two : B (Tuple2 a a) -> B a - in - \(ds : B integer) -> - let - !ds : B integer = ds - in - B_match - {integer} - ds - {integer} - (\(a : integer) -> a) - (\(ds : B (Tuple2 integer integer)) -> 2)) \ No newline at end of file + B_match + {integer} + ds + {integer} + (\(a : integer) -> a) + (\(ds : B (Tuple2 integer integer)) -> 2) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Data/Spec.hs b/plutus-tx-plugin/test/Plugin/Data/Spec.hs index 38af5ac7eb2..1a1dbefda98 100644 --- a/plutus-tx-plugin/test/Plugin/Data/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Data/Spec.hs @@ -40,24 +40,24 @@ datat = testNested "Data" . pure . testNestedGhc $ monoData :: TestNested monoData = testNested "monomorphic" [ - goldenPir "enum" basicEnum - , goldenPir "monoDataType" monoDataType - , goldenPir "monoConstructor" monoConstructor - , goldenPir "monoConstructed" monoConstructed - , goldenPir "monoCase" monoCase - , goldenPir "monoCaseStrict" monoCaseStrict + goldenPirReadable "enum" basicEnum + , goldenPirReadable "monoDataType" monoDataType + , goldenPirReadable "monoConstructor" monoConstructor + , goldenPirReadable "monoConstructed" monoConstructed + , goldenPirReadable "monoCase" monoCase + , goldenPirReadable "monoCaseStrict" monoCaseStrict , goldenUEval "monoConstDest" [ toUPlc monoCase, toUPlc monoConstructed ] - , goldenPir "defaultCase" defaultCase - , goldenPir "irrefutableMatch" irrefutableMatch - , goldenPir "atPattern" atPattern + , goldenPirReadable "defaultCase" defaultCase + , goldenPirReadable "irrefutableMatch" irrefutableMatch + , goldenPirReadable "atPattern" atPattern , goldenUEval "monoConstDestDefault" [ toUPlc monoCase, toUPlc monoConstructed ] - , goldenPir "monoRecord" monoRecord - , goldenPir "recordNewtype" recordNewtype - , goldenPir "recordWithStrictField" recordWithStrictField - , goldenPir "unusedWrapper" unusedWrapper - , goldenPir "nonValueCase" nonValueCase - , goldenPir "strictDataMatch" strictDataMatch - , goldenPir "synonym" synonym + , goldenPirReadable "monoRecord" monoRecord + , goldenPirReadable "recordNewtype" recordNewtype + , goldenPirReadable "recordWithStrictField" recordWithStrictField + , goldenPirReadable "unusedWrapper" unusedWrapper + , goldenPirReadable "nonValueCase" nonValueCase + , goldenPirReadable "strictDataMatch" strictDataMatch + , goldenPirReadable "synonym" synonym ] data MyEnum = Enum1 | Enum2 @@ -170,9 +170,9 @@ synonym = plc (Proxy @"synonym") (1::Synonym) polyData :: TestNested polyData = testNested "polymorphic" [ - goldenPir "polyDataType" polyDataType - , goldenPir "polyConstructed" polyConstructed - , goldenPir "defaultCasePoly" defaultCasePoly + goldenPirReadable "polyDataType" polyDataType + , goldenPirReadable "polyConstructed" polyConstructed + , goldenPirReadable "defaultCasePoly" defaultCasePoly ] data MyPolyData a b = Poly1 a b | Poly2 a @@ -195,14 +195,14 @@ defaultCasePoly = plc (Proxy @"defaultCasePoly") (\(x :: MyPolyData Integer Inte newtypes :: TestNested newtypes = testNested "newtypes" [ - goldenPir "basicNewtype" basicNewtype - , goldenPir "newtypeMatch" newtypeMatch - , goldenPir "newtypeCreate" newtypeCreate - , goldenPir "newtypeId" newtypeId - , goldenPir "newtypeCreate2" newtypeCreate2 - , goldenPir "nestedNewtypeMatch" nestedNewtypeMatch + goldenPirReadable "basicNewtype" basicNewtype + , goldenPirReadable "newtypeMatch" newtypeMatch + , goldenPirReadable "newtypeCreate" newtypeCreate + , goldenPirReadable "newtypeId" newtypeId + , goldenPirReadable "newtypeCreate2" newtypeCreate2 + , goldenPirReadable "nestedNewtypeMatch" nestedNewtypeMatch , goldenUEval "newtypeCreatDest" [ toUPlc $ newtypeMatch, toUPlc $ newtypeCreate2 ] - , goldenPir "paramNewtype" paramNewtype + , goldenPirReadable "paramNewtype" paramNewtype ] newtype MyNewtype = MyNewtype Integer @@ -236,14 +236,14 @@ paramNewtype = plc (Proxy @"paramNewtype") (\(x ::ParamNewtype Integer) -> case recursiveTypes :: TestNested recursiveTypes = testNested "recursive" [ - goldenPir "listConstruct" listConstruct - , goldenPir "listConstruct2" listConstruct2 - , goldenPir "listConstruct3" listConstruct3 - , goldenPir "listMatch" listMatch + goldenPirReadable "listConstruct" listConstruct + , goldenPirReadable "listConstruct2" listConstruct2 + , goldenPirReadable "listConstruct3" listConstruct3 + , goldenPirReadable "listMatch" listMatch , goldenUEval "listConstDest" [ toUPlc listMatch, toUPlc listConstruct ] , goldenUEval "listConstDest2" [ toUPlc listMatch, toUPlc listConstruct2 ] - , goldenPir "ptreeConstruct" ptreeConstruct - , goldenPir "ptreeMatch" ptreeMatch + , goldenPirReadable "ptreeConstruct" ptreeConstruct + , goldenPirReadable "ptreeMatch" ptreeMatch , goldenUEval "ptreeConstDest" [ toUPlc ptreeMatch, toUPlc ptreeConstruct ] , goldenUEval "polyRecEval" [ toUPlc polyRec, toUPlc ptreeConstruct ] , goldenUEval "ptreeFirstEval" [ toUPlc ptreeFirst, toUPlc ptreeConstruct ] @@ -349,11 +349,11 @@ processInterList = plc (Proxy @"foldrInterList") ( typeFamilies :: TestNested typeFamilies = testNested "families" [ - goldenPir "basicClosed" basicClosed - , goldenPir "basicOpen" basicOpen - , goldenPir "associated" associated - , goldenPir "associatedParam" associatedParam - , goldenPir "basicData" basicData + goldenPirReadable "basicClosed" basicClosed + , goldenPirReadable "basicOpen" basicOpen + , goldenPirReadable "associated" associated + , goldenPirReadable "associatedParam" associatedParam + , goldenPirReadable "basicData" basicData , goldenUPlc "irreducible" irreducible ] diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/even.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/even.pir.golden index 6fddca8c052..d022832851d 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/even.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/even.pir.golden @@ -1,50 +1,48 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False - !subtractInteger : integer -> integer -> integer = subtractInteger - ~subtractInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in subtractInteger x y - in - letrec - ~even : integer -> Bool - = \(n : integer) -> - let - !n : integer = n - in - Bool_match - (equalsInteger n 0) - {all dead. Bool} - (/\dead -> True) - (/\dead -> - let - !n : integer = subtractInteger n 1 - in - Bool_match - (equalsInteger n 0) - {all dead. Bool} - (/\dead -> False) - (/\dead -> even (subtractInteger n 1)) - {all dead. dead}) - {all dead. dead} - in - even) \ No newline at end of file + ifThenElse {Bool} b True False + !subtractInteger : integer -> integer -> integer = subtractInteger + ~subtractInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in subtractInteger x y +in +letrec + ~even : integer -> Bool + = \(n : integer) -> + let + !n : integer = n + in + Bool_match + (equalsInteger n 0) + {all dead. Bool} + (/\dead -> True) + (/\dead -> + let + !n : integer = subtractInteger n 1 + in + Bool_match + (equalsInteger n 0) + {all dead. Bool} + (/\dead -> False) + (/\dead -> even (subtractInteger n 1)) + {all dead. dead}) + {all dead. dead} +in +even \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/fib.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/fib.pir.golden index f4e7e9b6b50..fa8cbee97bd 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/fib.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/fib.pir.golden @@ -1,57 +1,55 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> let !y : integer = y in addInteger x y - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False - !subtractInteger : integer -> integer -> integer = subtractInteger - ~subtractInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in subtractInteger x y - in - letrec - ~fib : integer -> integer - = \(n : integer) -> - let - !n : integer = n - in - Bool_match - (equalsInteger n 0) - {all dead. integer} - (/\dead -> 0) - (/\dead -> - Bool_match - (equalsInteger n 1) - {all dead. integer} - (/\dead -> 1) - (/\dead -> - addInteger - (fib (subtractInteger n 1)) - (fib (subtractInteger n 2))) - {all dead. dead}) - {all dead. dead} - in - fib) \ No newline at end of file + ifThenElse {Bool} b True False + !subtractInteger : integer -> integer -> integer = subtractInteger + ~subtractInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in subtractInteger x y +in +letrec + ~fib : integer -> integer + = \(n : integer) -> + let + !n : integer = n + in + Bool_match + (equalsInteger n 0) + {all dead. integer} + (/\dead -> 0) + (/\dead -> + Bool_match + (equalsInteger n 1) + {all dead. integer} + (/\dead -> 1) + (/\dead -> + addInteger + (fib (subtractInteger n 1)) + (fib (subtractInteger n 2))) + {all dead. dead}) + {all dead. dead} +in +fib \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/lazyLength.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/lazyLength.pir.golden index be60946322f..bb30be95e4d 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/lazyLength.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/lazyLength.pir.golden @@ -1,36 +1,34 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~lengthLazy : all a. List a -> integer - = /\a -> - letrec - ~go : integer -> List a -> integer - = \(acc : integer) -> - let - !acc : integer = acc - in - \(ds : List a) -> - List_match - {a} - ds - {all dead. integer} - (/\dead -> acc) - (\(ds : a) (tl : List a) -> - /\dead -> go (addInteger acc 1) tl) - {all dead. dead} - in - \(l : List a) -> let !l : List a = l in go 0 l - in - lengthLazy {integer}) \ No newline at end of file +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~lengthLazy : all a. List a -> integer + = /\a -> + letrec + ~go : integer -> List a -> integer + = \(acc : integer) -> + let + !acc : integer = acc + in + \(ds : List a) -> + List_match + {a} + ds + {all dead. integer} + (/\dead -> acc) + (\(ds : a) (tl : List a) -> + /\dead -> go (addInteger acc 1) tl) + {all dead. dead} + in + \(l : List a) -> let !l : List a = l in go 0 l +in +lengthLazy {integer} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/strictLength.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/strictLength.pir.golden index 1eb6e93fa0c..ef1af72f1b4 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/strictLength.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/strictLength.pir.golden @@ -1,36 +1,34 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~lengthStrict : all a. List a -> integer - = /\a -> - letrec - ~go : integer -> List a -> integer - = \(acc : integer) -> - let - !acc : integer = acc - in - \(ds : List a) -> - List_match - {a} - ds - {all dead. integer} - (/\dead -> acc) - (\(ds : a) (tl : List a) -> - /\dead -> go (addInteger acc 1) tl) - {all dead. dead} - in - \(l : List a) -> let !l : List a = l in go 0 l - in - lengthStrict {integer}) \ No newline at end of file +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~lengthStrict : all a. List a -> integer + = /\a -> + letrec + ~go : integer -> List a -> integer + = \(acc : integer) -> + let + !acc : integer = acc + in + \(ds : List a) -> + List_match + {a} + ds + {all dead. integer} + (/\dead -> acc) + (\(ds : a) (tl : List a) -> + /\dead -> go (addInteger acc 1) tl) + {all dead. dead} + in + \(l : List a) -> let !l : List a = l in go 0 l +in +lengthStrict {integer} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/sum.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/sum.pir.golden index 410b408a430..84e1d03d79b 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/sum.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/recursive/sum.pir.golden @@ -1,27 +1,25 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - in - letrec - ~sum : List integer -> integer - = \(ds : List integer) -> - List_match - {integer} - ds - {integer} - 0 - (\(x : integer) (xs : List integer) -> addInteger x (sum xs)) - in - sum) \ No newline at end of file +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +letrec + ~sum : List integer -> integer + = \(ds : List integer) -> + List_match + {integer} + ds + {integer} + 0 + (\(x : integer) (xs : List integer) -> addInteger x (sum xs)) +in +sum \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/allDirect.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/allDirect.pir.golden index 4dc4e539e4b..1fd6a9a57c1 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/allDirect.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/allDirect.pir.golden @@ -1,86 +1,84 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - ~nandDirect : Bool -> Bool -> Bool - = \(ds : Bool) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + ~nandDirect : Bool -> Bool -> Bool + = \(ds : Bool) -> + let + !ds : Bool = ds + in + \(ds : Bool) -> let !ds : Bool = ds in - \(ds : Bool) -> - let - !ds : Bool = ds - in - Bool_match - ds - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - ds - {all dead. Bool} - (/\dead -> False) - (/\dead -> True) - {all dead. dead}) - {all dead. dead} - ~andDirect : Bool -> Bool -> Bool - = \(ds : Bool) -> + Bool_match + ds + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + ds + {all dead. Bool} + (/\dead -> False) + (/\dead -> True) + {all dead. dead}) + {all dead. dead} + ~andDirect : Bool -> Bool -> Bool + = \(ds : Bool) -> + let + !ds : Bool = ds + in + \(ds : Bool) -> let !ds : Bool = ds in - \(ds : Bool) -> - let - !ds : Bool = ds - in - nandDirect (nandDirect ds ds) (nandDirect ds ds) - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - letrec - ~allDirect : all a. (a -> Bool) -> List a -> Bool - = /\a -> - \(p : a -> Bool) -> - let - !p : a -> Bool = p - in - \(l : List a) -> - let - !l : List a = l - in - List_match - {a} - l - {all dead. Bool} - (/\dead -> True) - (\(h : a) (t : List a) -> - /\dead -> andDirect (p h) (allDirect {a} p t)) - {all dead. dead} - in - let - ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a - = /\a -> - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - !lessThanInteger : integer -> integer -> bool = lessThanInteger - ~lessThanInteger : integer -> integer -> Bool - = \(x : integer) -> + nandDirect (nandDirect ds ds) (nandDirect ds ds) +in +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +letrec + ~allDirect : all a. (a -> Bool) -> List a -> Bool + = /\a -> + \(p : a -> Bool) -> let - !x : integer = x + !p : a -> Bool = p in - \(y : integer) -> + \(l : List a) -> let - !y : integer = y - !b : bool = lessThanInteger x y + !l : List a = l in - ifThenElse {Bool} b True False - in - allDirect - {integer} - (\(ds : integer) -> let !ds : integer = ds in lessThanInteger ds 5) - (build {integer} (/\a -> \(c : integer -> a -> a) (n : a) -> c 7 (c 6 n)))) \ No newline at end of file + List_match + {a} + l + {all dead. Bool} + (/\dead -> True) + (\(h : a) (t : List a) -> + /\dead -> andDirect (p h) (allDirect {a} p t)) + {all dead. dead} +in +let + ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a + = /\a -> + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + !lessThanInteger : integer -> integer -> bool = lessThanInteger + ~lessThanInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> + let + !y : integer = y + !b : bool = lessThanInteger x y + in + ifThenElse {Bool} b True False +in +allDirect + {integer} + (\(ds : integer) -> let !ds : integer = ds in lessThanInteger ds 5) + (build {integer} (/\a -> \(c : integer -> a -> a) (n : a) -> c 7 (c 6 n))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andDirect.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andDirect.pir.golden index d4692d0424c..f8321edaff1 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andDirect.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andDirect.pir.golden @@ -1,39 +1,37 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - ~nandDirect : Bool -> Bool -> Bool - = \(ds : Bool) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + ~nandDirect : Bool -> Bool -> Bool + = \(ds : Bool) -> + let + !ds : Bool = ds + in + \(ds : Bool) -> let !ds : Bool = ds in - \(ds : Bool) -> - let - !ds : Bool = ds - in - Bool_match - ds - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - ds - {all dead. Bool} - (/\dead -> False) - (/\dead -> True) - {all dead. dead}) - {all dead. dead} - ~andDirect : Bool -> Bool -> Bool - = \(ds : Bool) -> + Bool_match + ds + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + ds + {all dead. Bool} + (/\dead -> False) + (/\dead -> True) + {all dead. dead}) + {all dead. dead} + ~andDirect : Bool -> Bool -> Bool + = \(ds : Bool) -> + let + !ds : Bool = ds + in + \(ds : Bool) -> let !ds : Bool = ds in - \(ds : Bool) -> - let - !ds : Bool = ds - in - nandDirect (nandDirect ds ds) (nandDirect ds ds) - in - andDirect True False) \ No newline at end of file + nandDirect (nandDirect ds ds) (nandDirect ds ds) +in +andDirect True False \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andExternal.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andExternal.pir.golden index e8e63e81cad..64d1de817c1 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andExternal.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/andExternal.pir.golden @@ -1,23 +1,21 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - ~andExternal : Bool -> Bool -> Bool - = \(a : Bool) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + ~andExternal : Bool -> Bool -> Bool + = \(a : Bool) -> + let + !a : Bool = a + in + \(b : Bool) -> let - !a : Bool = a + !b : Bool = b in - \(b : Bool) -> - let - !b : Bool = b - in - Bool_match - a - {all dead. Bool} - (/\dead -> b) - (/\dead -> False) - {all dead. dead} - in - andExternal True False) \ No newline at end of file + Bool_match + a + {all dead. Bool} + (/\dead -> b) + (/\dead -> False) + {all dead. dead} +in +andExternal True False \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/applicationFunction.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/applicationFunction.pir.golden index f5a7ad7ede3..7352c717be4 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/applicationFunction.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/applicationFunction.pir.golden @@ -1,23 +1,21 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~myDollar : all a b. (a -> b) -> a -> b + = /\a b -> + \(f : a -> b) -> let - !x : integer = x + !f : a -> b = f in - \(y : integer) -> let !y : integer = y in addInteger x y - ~myDollar : all a b. (a -> b) -> a -> b - = /\a b -> - \(f : a -> b) -> - let - !f : a -> b = f - in - \(a : a) -> let !a : a = a in f a - in - myDollar - {integer} - {integer} - (\(x : integer) -> let !x : integer = x in addInteger 1 x) - 1) \ No newline at end of file + \(a : a) -> let !a : a = a in f a +in +myDollar + {integer} + {integer} + (\(x : integer) -> let !x : integer = x in addInteger 1 x) + 1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/mutualRecursionUnfoldings.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/mutualRecursionUnfoldings.pir.golden index 1ff79a6452d..7ebed3c6e26 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/mutualRecursionUnfoldings.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/mutualRecursionUnfoldings.pir.golden @@ -1,37 +1,35 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - !subtractInteger : integer -> integer -> integer = subtractInteger - in - letrec - ~evenDirect : integer -> Bool - = \(n : integer) -> - let - !n : integer = n - !b : bool = equalsInteger n 0 - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. Bool} - (/\dead -> True) - (/\dead -> oddDirect (subtractInteger n 1)) - {all dead. dead} - ~oddDirect : integer -> Bool - = \(n : integer) -> - let - !n : integer = n - !b : bool = equalsInteger n 0 - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. Bool} - (/\dead -> False) - (/\dead -> evenDirect (subtractInteger n 1)) - {all dead. dead} - in - evenDirect 4) \ No newline at end of file +let + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + !subtractInteger : integer -> integer -> integer = subtractInteger +in +letrec + ~evenDirect : integer -> Bool + = \(n : integer) -> + let + !n : integer = n + !b : bool = equalsInteger n 0 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. Bool} + (/\dead -> True) + (/\dead -> oddDirect (subtractInteger n 1)) + {all dead. dead} + ~oddDirect : integer -> Bool + = \(n : integer) -> + let + !n : integer = n + !b : bool = equalsInteger n 0 + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. Bool} + (/\dead -> False) + (/\dead -> evenDirect (subtractInteger n 1)) + {all dead. dead} +in +evenDirect 4 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/nandDirect.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/nandDirect.pir.golden index 8c9d99a15aa..af1d5a866ac 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/nandDirect.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/nandDirect.pir.golden @@ -1,29 +1,27 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - ~nandDirect : Bool -> Bool -> Bool - = \(ds : Bool) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + ~nandDirect : Bool -> Bool -> Bool + = \(ds : Bool) -> + let + !ds : Bool = ds + in + \(ds : Bool) -> let !ds : Bool = ds in - \(ds : Bool) -> - let - !ds : Bool = ds - in - Bool_match - ds - {all dead. Bool} - (/\dead -> False) - (/\dead -> - Bool_match - ds - {all dead. Bool} - (/\dead -> False) - (/\dead -> True) - {all dead. dead}) - {all dead. dead} - in - nandDirect True False) \ No newline at end of file + Bool_match + ds + {all dead. Bool} + (/\dead -> False) + (/\dead -> + Bool_match + ds + {all dead. Bool} + (/\dead -> False) + (/\dead -> True) + {all dead. dead}) + {all dead. dead} +in +nandDirect True False \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/polyMap.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/polyMap.pir.golden index e91f5bf25b7..e3f6b3e5dfe 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/polyMap.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/polyMap.pir.golden @@ -1,47 +1,45 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a + = /\a -> + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) +in +letrec + ~mapDirect : all a b. (a -> b) -> List a -> List b + = /\a b -> + \(f : a -> b) -> let - !x : integer = x + !f : a -> b = f in - \(y : integer) -> let !y : integer = y in addInteger x y - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a - = /\a -> - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) - in - letrec - ~mapDirect : all a b. (a -> b) -> List a -> List b - = /\a b -> - \(f : a -> b) -> + \(l : List a) -> let - !f : a -> b = f + !l : List a = l in - \(l : List a) -> - let - !l : List a = l - in - List_match - {a} - l - {all dead. List b} - (/\dead -> Nil {b}) - (\(x : a) (xs : List a) -> - /\dead -> Cons {b} (f x) (mapDirect {a} {b} f xs)) - {all dead. dead} - in - mapDirect - {integer} - {integer} - (addInteger 1) - (build {integer} (/\a -> \(c : integer -> a -> a) (n : a) -> c 0 (c 1 n)))) \ No newline at end of file + List_match + {a} + l + {all dead. List b} + (/\dead -> Nil {b}) + (\(x : a) (xs : List a) -> + /\dead -> Cons {b} (f x) (mapDirect {a} {b} f xs)) + {all dead. dead} +in +mapDirect + {integer} + {integer} + (addInteger 1) + (build {integer} (/\a -> \(c : integer -> a -> a) (n : a) -> c 0 (c 1 n))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelector.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelector.pir.golden index 428fc3542fc..ac032ad5a1b 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelector.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelector.pir.golden @@ -1,10 +1,8 @@ -program - 1.1.0 - (let - data MyMonoRecord | MyMonoRecord_match where - MyMonoRecord : integer -> integer -> MyMonoRecord - ~mrA : MyMonoRecord -> integer - = \(ds : MyMonoRecord) -> - MyMonoRecord_match ds {integer} (\(ds : integer) (ds : integer) -> ds) - in - \(ds : MyMonoRecord) -> let !ds : MyMonoRecord = ds in mrA ds) \ No newline at end of file +let + data MyMonoRecord | MyMonoRecord_match where + MyMonoRecord : integer -> integer -> MyMonoRecord + ~mrA : MyMonoRecord -> integer + = \(ds : MyMonoRecord) -> + MyMonoRecord_match ds {integer} (\(ds : integer) (ds : integer) -> ds) +in +\(ds : MyMonoRecord) -> let !ds : MyMonoRecord = ds in mrA ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelectorExternal.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelectorExternal.pir.golden index bfd891dd56b..0930b53ee88 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelectorExternal.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/recordSelectorExternal.pir.golden @@ -1,10 +1,8 @@ -program - 1.1.0 - (let - data MyExternalRecord | MyExternalRecord_match where - MyExternalRecord : integer -> MyExternalRecord - ~myExternal : MyExternalRecord -> integer - = \(ds : MyExternalRecord) -> - MyExternalRecord_match ds {integer} (\(ds : integer) -> ds) - in - \(ds : MyExternalRecord) -> let !ds : MyExternalRecord = ds in myExternal ds) \ No newline at end of file +let + data MyExternalRecord | MyExternalRecord_match where + MyExternalRecord : integer -> MyExternalRecord + ~myExternal : MyExternalRecord -> integer + = \(ds : MyExternalRecord) -> + MyExternalRecord_match ds {integer} (\(ds : integer) -> ds) +in +\(ds : MyExternalRecord) -> let !ds : MyExternalRecord = ds in myExternal ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2.pir.golden index 5de4434470c..bcd2a4fe9dd 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2.pir.golden @@ -1,26 +1,24 @@ -program - 1.1.0 - (let - data (UTuple2 :: * -> * -> *) a b | UTuple2_match where - UTuple2 : a -> b -> UTuple2 a b - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~unboxedTuple : UTuple2 integer integer -> integer - = \(ds : UTuple2 integer integer) -> - UTuple2_match - {integer} - {integer} - ds - {integer} - (\(i : integer) (j : integer) -> addInteger i j) +let + data (UTuple2 :: * -> * -> *) a b | UTuple2_match where + UTuple2 : a -> b -> UTuple2 a b + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~unboxedTuple : UTuple2 integer integer -> integer + = \(ds : UTuple2 integer integer) -> + UTuple2_match + {integer} + {integer} + ds + {integer} + (\(i : integer) (j : integer) -> addInteger i j) +in +\(x : integer) -> + let + !x : integer = x in - \(x : integer) -> - let - !x : integer = x - in - unboxedTuple (UTuple2 {integer} {integer} x x)) \ No newline at end of file + unboxedTuple (UTuple2 {integer} {integer} x x) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2Tuples.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2Tuples.pir.golden index 152474293af..535401b44b7 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2Tuples.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples2Tuples.pir.golden @@ -1,58 +1,56 @@ -program - 1.1.0 - (let - data (UTuple2 :: * -> * -> *) a b | UTuple2_match where - UTuple2 : a -> b -> UTuple2 a b - data (UTuple5 :: * -> * -> * -> * -> * -> *) a b c d e | UTuple5_match where - UTuple5 : a -> b -> c -> d -> e -> UTuple5 a b c d e - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~unboxedTuple : UTuple5 integer integer integer integer integer -> integer - = \(ds : UTuple5 integer integer integer integer integer) -> - UTuple5_match - {integer} - {integer} - {integer} - {integer} - {integer} - ds - {integer} - (\(i : integer) - (j : integer) - (k : integer) - (l : integer) - (m : integer) -> - addInteger (addInteger (addInteger (addInteger i j) k) l) m) - ~unboxedTuples2Tuple : - UTuple2 - (UTuple5 integer integer integer integer integer) - (UTuple5 integer integer integer integer integer) -> - integer - = \(ds : - UTuple2 - (UTuple5 integer integer integer integer integer) - (UTuple5 integer integer integer integer integer)) -> - UTuple2_match - {UTuple5 integer integer integer integer integer} - {UTuple5 integer integer integer integer integer} - ds - {integer} - (\(i : UTuple5 integer integer integer integer integer) - (j : UTuple5 integer integer integer integer integer) -> - addInteger (unboxedTuple i) (unboxedTuple j)) +let + data (UTuple2 :: * -> * -> *) a b | UTuple2_match where + UTuple2 : a -> b -> UTuple2 a b + data (UTuple5 :: * -> * -> * -> * -> * -> *) a b c d e | UTuple5_match where + UTuple5 : a -> b -> c -> d -> e -> UTuple5 a b c d e + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~unboxedTuple : UTuple5 integer integer integer integer integer -> integer + = \(ds : UTuple5 integer integer integer integer integer) -> + UTuple5_match + {integer} + {integer} + {integer} + {integer} + {integer} + ds + {integer} + (\(i : integer) + (j : integer) + (k : integer) + (l : integer) + (m : integer) -> + addInteger (addInteger (addInteger (addInteger i j) k) l) m) + ~unboxedTuples2Tuple : + UTuple2 + (UTuple5 integer integer integer integer integer) + (UTuple5 integer integer integer integer integer) -> + integer + = \(ds : + UTuple2 + (UTuple5 integer integer integer integer integer) + (UTuple5 integer integer integer integer integer)) -> + UTuple2_match + {UTuple5 integer integer integer integer integer} + {UTuple5 integer integer integer integer integer} + ds + {integer} + (\(i : UTuple5 integer integer integer integer integer) + (j : UTuple5 integer integer integer integer integer) -> + addInteger (unboxedTuple i) (unboxedTuple j)) +in +\(x : integer) -> + let + !x : integer = x in - \(x : integer) -> - let - !x : integer = x - in - unboxedTuples2Tuple - (UTuple2 - {UTuple5 integer integer integer integer integer} - {UTuple5 integer integer integer integer integer} - (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x) - (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x))) \ No newline at end of file + unboxedTuples2Tuple + (UTuple2 + {UTuple5 integer integer integer integer integer} + {UTuple5 integer integer integer integer integer} + (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x) + (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3.pir.golden index 7343906f4bd..ecb8eb6bf76 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3.pir.golden @@ -1,28 +1,26 @@ -program - 1.1.0 - (let - data (UTuple3 :: * -> * -> * -> *) a b c | UTuple3_match where - UTuple3 : a -> b -> c -> UTuple3 a b c - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~unboxedTuple : UTuple3 integer integer integer -> integer - = \(ds : UTuple3 integer integer integer) -> - UTuple3_match - {integer} - {integer} - {integer} - ds - {integer} - (\(i : integer) (j : integer) (k : integer) -> - addInteger (addInteger i j) k) +let + data (UTuple3 :: * -> * -> * -> *) a b c | UTuple3_match where + UTuple3 : a -> b -> c -> UTuple3 a b c + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~unboxedTuple : UTuple3 integer integer integer -> integer + = \(ds : UTuple3 integer integer integer) -> + UTuple3_match + {integer} + {integer} + {integer} + ds + {integer} + (\(i : integer) (j : integer) (k : integer) -> + addInteger (addInteger i j) k) +in +\(x : integer) -> + let + !x : integer = x in - \(x : integer) -> - let - !x : integer = x - in - unboxedTuple (UTuple3 {integer} {integer} {integer} x x x)) \ No newline at end of file + unboxedTuple (UTuple3 {integer} {integer} {integer} x x x) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3Tuples.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3Tuples.pir.golden index ec5c8922248..1fe1652f4cf 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3Tuples.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples3Tuples.pir.golden @@ -1,66 +1,64 @@ -program - 1.1.0 - (let - data (UTuple3 :: * -> * -> * -> *) a b c | UTuple3_match where - UTuple3 : a -> b -> c -> UTuple3 a b c - data (UTuple5 :: * -> * -> * -> * -> * -> *) a b c d e | UTuple5_match where - UTuple5 : a -> b -> c -> d -> e -> UTuple5 a b c d e - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~unboxedTuple : UTuple5 integer integer integer integer integer -> integer - = \(ds : UTuple5 integer integer integer integer integer) -> - UTuple5_match - {integer} - {integer} - {integer} - {integer} - {integer} - ds - {integer} - (\(i : integer) - (j : integer) - (k : integer) - (l : integer) - (m : integer) -> - addInteger (addInteger (addInteger (addInteger i j) k) l) m) - ~unboxedTuples3Tuple : - UTuple3 - (UTuple5 integer integer integer integer integer) - (UTuple5 integer integer integer integer integer) - (UTuple5 integer integer integer integer integer) -> - integer - = \(ds : - UTuple3 - (UTuple5 integer integer integer integer integer) - (UTuple5 integer integer integer integer integer) - (UTuple5 integer integer integer integer integer)) -> - UTuple3_match - {UTuple5 integer integer integer integer integer} - {UTuple5 integer integer integer integer integer} - {UTuple5 integer integer integer integer integer} - ds - {integer} - (\(i : UTuple5 integer integer integer integer integer) - (j : UTuple5 integer integer integer integer integer) - (k : UTuple5 integer integer integer integer integer) -> - addInteger - (addInteger (unboxedTuple i) (unboxedTuple j)) - (unboxedTuple k)) +let + data (UTuple3 :: * -> * -> * -> *) a b c | UTuple3_match where + UTuple3 : a -> b -> c -> UTuple3 a b c + data (UTuple5 :: * -> * -> * -> * -> * -> *) a b c d e | UTuple5_match where + UTuple5 : a -> b -> c -> d -> e -> UTuple5 a b c d e + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~unboxedTuple : UTuple5 integer integer integer integer integer -> integer + = \(ds : UTuple5 integer integer integer integer integer) -> + UTuple5_match + {integer} + {integer} + {integer} + {integer} + {integer} + ds + {integer} + (\(i : integer) + (j : integer) + (k : integer) + (l : integer) + (m : integer) -> + addInteger (addInteger (addInteger (addInteger i j) k) l) m) + ~unboxedTuples3Tuple : + UTuple3 + (UTuple5 integer integer integer integer integer) + (UTuple5 integer integer integer integer integer) + (UTuple5 integer integer integer integer integer) -> + integer + = \(ds : + UTuple3 + (UTuple5 integer integer integer integer integer) + (UTuple5 integer integer integer integer integer) + (UTuple5 integer integer integer integer integer)) -> + UTuple3_match + {UTuple5 integer integer integer integer integer} + {UTuple5 integer integer integer integer integer} + {UTuple5 integer integer integer integer integer} + ds + {integer} + (\(i : UTuple5 integer integer integer integer integer) + (j : UTuple5 integer integer integer integer integer) + (k : UTuple5 integer integer integer integer integer) -> + addInteger + (addInteger (unboxedTuple i) (unboxedTuple j)) + (unboxedTuple k)) +in +\(x : integer) -> + let + !x : integer = x in - \(x : integer) -> - let - !x : integer = x - in - unboxedTuples3Tuple - (UTuple3 - {UTuple5 integer integer integer integer integer} - {UTuple5 integer integer integer integer integer} - {UTuple5 integer integer integer integer integer} - (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x) - (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x) - (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x))) \ No newline at end of file + unboxedTuples3Tuple + (UTuple3 + {UTuple5 integer integer integer integer integer} + {UTuple5 integer integer integer integer integer} + {UTuple5 integer integer integer integer integer} + (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x) + (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x) + (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x)) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples4.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples4.pir.golden index 2570ca5f6d9..ee753878792 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples4.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples4.pir.golden @@ -1,29 +1,27 @@ -program - 1.1.0 - (let - data (UTuple4 :: * -> * -> * -> * -> *) a b c d | UTuple4_match where - UTuple4 : a -> b -> c -> d -> UTuple4 a b c d - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~unboxedTuple : UTuple4 integer integer integer integer -> integer - = \(ds : UTuple4 integer integer integer integer) -> - UTuple4_match - {integer} - {integer} - {integer} - {integer} - ds - {integer} - (\(i : integer) (j : integer) (k : integer) (l : integer) -> - addInteger (addInteger (addInteger i j) k) l) +let + data (UTuple4 :: * -> * -> * -> * -> *) a b c d | UTuple4_match where + UTuple4 : a -> b -> c -> d -> UTuple4 a b c d + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~unboxedTuple : UTuple4 integer integer integer integer -> integer + = \(ds : UTuple4 integer integer integer integer) -> + UTuple4_match + {integer} + {integer} + {integer} + {integer} + ds + {integer} + (\(i : integer) (j : integer) (k : integer) (l : integer) -> + addInteger (addInteger (addInteger i j) k) l) +in +\(x : integer) -> + let + !x : integer = x in - \(x : integer) -> - let - !x : integer = x - in - unboxedTuple (UTuple4 {integer} {integer} {integer} {integer} x x x x)) \ No newline at end of file + unboxedTuple (UTuple4 {integer} {integer} {integer} {integer} x x x x) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples5.pir.golden b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples5.pir.golden index 5a3ebe78fd3..e4138c7b732 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples5.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Functions/9.6/unfoldings/unboxedTuples5.pir.golden @@ -1,35 +1,33 @@ -program - 1.1.0 - (let - data (UTuple5 :: * -> * -> * -> * -> * -> *) a b c d e | UTuple5_match where - UTuple5 : a -> b -> c -> d -> e -> UTuple5 a b c d e - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y - ~unboxedTuple : UTuple5 integer integer integer integer integer -> integer - = \(ds : UTuple5 integer integer integer integer integer) -> - UTuple5_match - {integer} - {integer} - {integer} - {integer} - {integer} - ds - {integer} - (\(i : integer) - (j : integer) - (k : integer) - (l : integer) - (m : integer) -> - addInteger (addInteger (addInteger (addInteger i j) k) l) m) +let + data (UTuple5 :: * -> * -> * -> * -> * -> *) a b c d e | UTuple5_match where + UTuple5 : a -> b -> c -> d -> e -> UTuple5 a b c d e + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~unboxedTuple : UTuple5 integer integer integer integer integer -> integer + = \(ds : UTuple5 integer integer integer integer integer) -> + UTuple5_match + {integer} + {integer} + {integer} + {integer} + {integer} + ds + {integer} + (\(i : integer) + (j : integer) + (k : integer) + (l : integer) + (m : integer) -> + addInteger (addInteger (addInteger (addInteger i j) k) l) m) +in +\(x : integer) -> + let + !x : integer = x in - \(x : integer) -> - let - !x : integer = x - in - unboxedTuple - (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x)) \ No newline at end of file + unboxedTuple + (UTuple5 {integer} {integer} {integer} {integer} {integer} x x x x x) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Functions/Spec.hs b/plutus-tx-plugin/test/Plugin/Functions/Spec.hs index a44c8172252..568c4f12519 100644 --- a/plutus-tx-plugin/test/Plugin/Functions/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Functions/Spec.hs @@ -37,15 +37,15 @@ functions = testNested "Functions" . pure $ testNestedGhc recursiveFunctions :: TestNested recursiveFunctions = testNested "recursive" [ - goldenPir "fib" fib + goldenPirReadable "fib" fib , goldenUEval "fib4" [ toUPlc fib, toUPlc $ plc (Proxy @"4") (4::Integer) ] - , goldenPir "sum" sumDirect + , goldenPirReadable "sum" sumDirect , goldenUEval "sumList" [ toUPlc sumDirect, toUPlc listConstruct3 ] - , goldenPir "even" evenMutual + , goldenPirReadable "even" evenMutual , goldenUEval "even3" [ toUPlc evenMutual, toUPlc $ plc (Proxy @"3") (3::Integer) ] , goldenUEval "even4" [ toUPlc evenMutual, toUPlc $ plc (Proxy @"4") (4::Integer) ] - , goldenPir "strictLength" strictLength - , goldenPir "lazyLength" lazyLength + , goldenPirReadable "strictLength" strictLength + , goldenPirReadable "lazyLength" lazyLength ] fib :: CompiledCode (Integer -> Integer) @@ -94,24 +94,24 @@ lazyLength = plc (Proxy @"lazyLength") (lengthLazy @Integer) unfoldings :: TestNested unfoldings = testNested "unfoldings" [ - goldenPir "nandDirect" nandPlcDirect - , goldenPir "andDirect" andPlcDirect - , goldenPir "andExternal" andPlcExternal - , goldenPir "allDirect" allPlcDirect - , goldenPir "mutualRecursionUnfoldings" mutualRecursionUnfoldings - , goldenPir "recordSelector" recordSelector - , goldenPir "recordSelectorExternal" recordSelectorExternal + goldenPirReadable "nandDirect" nandPlcDirect + , goldenPirReadable "andDirect" andPlcDirect + , goldenPirReadable "andExternal" andPlcExternal + , goldenPirReadable "allDirect" allPlcDirect + , goldenPirReadable "mutualRecursionUnfoldings" mutualRecursionUnfoldings + , goldenPirReadable "recordSelector" recordSelector + , goldenPirReadable "recordSelectorExternal" recordSelectorExternal -- We used to have problems with polymorphic let bindings where the generalization was -- on the outside of the let, which hit the value restriction. Now we hit the simplifier -- it seems to sometimes float these in, but we should keep an eye on these. - , goldenPir "polyMap" polyMap - , goldenPir "applicationFunction" applicationFunction - , goldenPir "unboxedTuples2" unboxedTuples2 - , goldenPir "unboxedTuples3" unboxedTuples3 - , goldenPir "unboxedTuples4" unboxedTuples4 - , goldenPir "unboxedTuples5" unboxedTuples5 - , goldenPir "unboxedTuples2Tuples" unboxedTuples2Tuples - , goldenPir "unboxedTuples3Tuples" unboxedTuples3Tuples + , goldenPirReadable "polyMap" polyMap + , goldenPirReadable "applicationFunction" applicationFunction + , goldenPirReadable "unboxedTuples2" unboxedTuples2 + , goldenPirReadable "unboxedTuples3" unboxedTuples3 + , goldenPirReadable "unboxedTuples4" unboxedTuples4 + , goldenPirReadable "unboxedTuples5" unboxedTuples5 + , goldenPirReadable "unboxedTuples2Tuples" unboxedTuples2Tuples + , goldenPirReadable "unboxedTuples3Tuples" unboxedTuples3Tuples ] andDirect :: Bool -> Bool -> Bool diff --git a/plutus-tx-plugin/test/Plugin/Laziness/9.6/joinError.pir.golden b/plutus-tx-plugin/test/Plugin/Laziness/9.6/joinError.pir.golden index 7f3635ae812..0f97e6d623e 100644 --- a/plutus-tx-plugin/test/Plugin/Laziness/9.6/joinError.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Laziness/9.6/joinError.pir.golden @@ -1,33 +1,31 @@ -program - 1.1.0 - (let - data Unit | Unit_match where - Unit : Unit - data Bool | Bool_match where - True : Bool - False : Bool - !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} - !unitval : unit = () - ~joinError : Bool -> Bool -> Unit - = \(x : Bool) -> +let + data Unit | Unit_match where + Unit : Unit + data Bool | Bool_match where + True : Bool + False : Bool + !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} + !unitval : unit = () + ~joinError : Bool -> Bool -> Unit + = \(x : Bool) -> + let + !x : Bool = x + in + \(y : Bool) -> let - !x : Bool = x + !y : Bool = y in - \(y : Bool) -> - let - !y : Bool = y - in - Bool_match - x - {all dead. Unit} - (/\dead -> - Bool_match - y - {all dead. Unit} - (/\dead -> error {Unit} unitval) - (/\dead -> Unit) - {all dead. dead}) - (/\dead -> Unit) - {all dead. dead} - in - joinError) \ No newline at end of file + Bool_match + x + {all dead. Unit} + (/\dead -> + Bool_match + y + {all dead. Unit} + (/\dead -> error {Unit} unitval) + (/\dead -> Unit) + {all dead. dead}) + (/\dead -> Unit) + {all dead. dead} +in +joinError \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Laziness/9.6/lazyDepUnit.pir.golden b/plutus-tx-plugin/test/Plugin/Laziness/9.6/lazyDepUnit.pir.golden index 94eb661b012..685a0ff06f8 100644 --- a/plutus-tx-plugin/test/Plugin/Laziness/9.6/lazyDepUnit.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Laziness/9.6/lazyDepUnit.pir.golden @@ -1,9 +1,7 @@ -program - 1.1.0 - (let - !emptyByteString : bytestring = # - ~emptyByteString : bytestring = emptyByteString - ~monoId : bytestring -> bytestring = \(x : bytestring) -> x - ~aByteString : bytestring = monoId emptyByteString - in - aByteString) \ No newline at end of file +let + !emptyByteString : bytestring = # + ~emptyByteString : bytestring = emptyByteString + ~monoId : bytestring -> bytestring = \(x : bytestring) -> x + ~aByteString : bytestring = monoId emptyByteString +in +aByteString \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Laziness/Spec.hs b/plutus-tx-plugin/test/Plugin/Laziness/Spec.hs index 032069f10ea..9615afcf240 100644 --- a/plutus-tx-plugin/test/Plugin/Laziness/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Laziness/Spec.hs @@ -26,9 +26,9 @@ import Data.Proxy laziness :: TestNested laziness = testNested "Laziness" . pure $ testNestedGhc - [ goldenPir "joinError" joinErrorPir + [ goldenPirReadable "joinError" joinErrorPir , goldenUEval "joinErrorEval" [ toUPlc joinErrorPir, toUPlc $ plc (Proxy @"T") True, toUPlc $ plc (Proxy @"F") False] - , goldenPir "lazyDepUnit" lazyDepUnit + , goldenPirReadable "lazyDepUnit" lazyDepUnit ] joinErrorPir :: CompiledCode (Bool -> Bool -> ()) diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/and.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/and.pir.golden index 01260387ea4..88f78cf1f41 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/and.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/and.pir.golden @@ -1,21 +1,19 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool +let + data Bool | Bool_match where + True : Bool + False : Bool +in +\(ds : Bool) -> + let + !ds : Bool = ds in \(ds : Bool) -> let !ds : Bool = ds in - \(ds : Bool) -> - let - !ds : Bool = ds - in - Bool_match - ds - {all dead. Bool} - (/\dead -> ds) - (/\dead -> False) - {all dead. dead}) \ No newline at end of file + Bool_match + ds + {all dead. Bool} + (/\dead -> ds) + (/\dead -> False) + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/bool.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/bool.pir.golden index 6817f273093..cecdef91e70 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/bool.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/bool.pir.golden @@ -1,8 +1,6 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - in - True) \ No newline at end of file +let + data Bool | Bool_match where + True : Bool + False : Bool +in +True \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/bytestring.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/bytestring.pir.golden index 93bd77be176..97f704364c2 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/bytestring.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/bytestring.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : bytestring) -> ds) \ No newline at end of file +\(ds : bytestring) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData1.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData1.pir.golden index 71d4b597974..57d6f014cc7 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData1.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData1.pir.golden @@ -1,8 +1,6 @@ -program - 1.1.0 - (let - !unsafeDataAsI : data -> integer = unIData - ~unsafeDataAsI : data -> integer - = \(d : data) -> let !d : data = d in unsafeDataAsI d - in - \(ds : data) -> let !ds : data = ds in unsafeDataAsI ds) \ No newline at end of file +let + !unsafeDataAsI : data -> integer = unIData + ~unsafeDataAsI : data -> integer + = \(d : data) -> let !d : data = d in unsafeDataAsI d +in +\(ds : data) -> let !ds : data = ds in unsafeDataAsI ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden index 59e0c7c3397..79a1e8f856f 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/deconstructorData2.pir.golden @@ -1,127 +1,124 @@ -program - 1.1.0 - (let - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - ~`$fFunctorTuple2_$cfmap` : all c a b. (a -> b) -> Tuple2 c a -> Tuple2 c b - = /\c a b -> - \(f : a -> b) -> - let - !f : a -> b = f - in - \(ds : Tuple2 c a) -> - Tuple2_match - {c} - {a} - ds - {Tuple2 c b} - (\(c : c) (a : a) -> Tuple2 {c} {b} c (f a)) - ~`$fFunctorTuple2` : - all c. (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) (Tuple2 c) - = `$fFunctorTuple2_$cfmap` - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - ~`$fFunctorList_$cfmap` : all a b. (a -> b) -> List a -> List b - = /\a b -> - \(f : a -> b) -> - let - !f : a -> b = f - in - letrec - ~go : List a -> List b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. List b} - (/\dead -> Nil {b}) - (\(x : a) (xs : List a) -> - /\dead -> Cons {b} (f x) (go xs)) - {all dead. dead} - in - \(eta : List a) -> go eta - ~`$fFunctorList` : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) List - = `$fFunctorList_$cfmap` - ~`.` : all b c a. (b -> c) -> (a -> b) -> a -> c - = /\b c a -> \(f : b -> c) (g : a -> b) (x : a) -> f (g x) - ~fmap : - all (f :: * -> *). - (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f -> - (all a b. (a -> b) -> f a -> f b) - = /\(f :: * -> *) -> - \(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) -> v - ~`$fHasFromOpaqueBuiltinDataBuiltinData_$cfromOpaque` : data -> data - = \(eta : data) -> eta - !chooseList : all a b. list a -> b -> b -> b = chooseList - !head : all a. list a -> a = headList - !tail : all a. list a -> list a = tailList - !unitval : unit = () - ~`$fHasFromOpaqueBuiltinListList_$cfromOpaque` : - all arep a. (\arep a -> arep -> a) arep a -> list arep -> List a - = /\arep a -> - \(`$dHasFromOpaque` : (\arep a -> arep -> a) arep a) -> - letrec - ~go : list arep -> List a - = \(l : list arep) -> - let - !l : list arep = l - in - chooseList - {arep} - {unit -> List a} - l - (\(ds : unit) -> Nil {a}) - (\(ds : unit) -> - Cons - {a} - (`$dHasFromOpaque` (head {arep} l)) - (go (tail {arep} l))) - unitval - in - \(eta : list arep) -> go eta - !fst : all a b. pair a b -> a = fstPair - !snd : all a b. pair a b -> b = sndPair - !unsafeDataAsConstr : data -> pair integer (list data) = unConstrData - ~unsafeDataAsConstr : data -> Tuple2 integer (List data) - = \(d : data) -> +let + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b + ~`$fFunctorTuple2_$cfmap` : all c a b. (a -> b) -> Tuple2 c a -> Tuple2 c b + = /\c a b -> + \(f : a -> b) -> + let + !f : a -> b = f + in + \(ds : Tuple2 c a) -> + Tuple2_match + {c} + {a} + ds + {Tuple2 c b} + (\(c : c) (a : a) -> Tuple2 {c} {b} c (f a)) + ~`$fFunctorTuple2` : + all c. (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) (Tuple2 c) + = `$fFunctorTuple2_$cfmap` +in +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + ~`$fFunctorList_$cfmap` : all a b. (a -> b) -> List a -> List b + = /\a b -> + \(f : a -> b) -> let - !d : data = d - !p : pair integer (list data) = unsafeDataAsConstr d + !f : a -> b = f in - Tuple2 - {integer} - {List data} - (fst {integer} {list data} p) - (let - !a : list data = snd {integer} {list data} p - in - `$fHasFromOpaqueBuiltinListList_$cfromOpaque` - {data} - {data} - `$fHasFromOpaqueBuiltinDataBuiltinData_$cfromOpaque` - a) - !unsafeDataAsI : data -> integer = unIData - ~unsafeDataAsI : data -> integer - = \(d : data) -> let !d : data = d in unsafeDataAsI d + letrec + ~go : List a -> List b + = \(ds : List a) -> + List_match + {a} + ds + {all dead. List b} + (/\dead -> Nil {b}) + (\(x : a) (xs : List a) -> /\dead -> Cons {b} (f x) (go xs)) + {all dead. dead} + in + \(eta : List a) -> go eta + ~`$fFunctorList` : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) List + = `$fFunctorList_$cfmap` + ~`.` : all b c a. (b -> c) -> (a -> b) -> a -> c + = /\b c a -> \(f : b -> c) (g : a -> b) (x : a) -> f (g x) + ~fmap : + all (f :: * -> *). + (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f -> + (all a b. (a -> b) -> f a -> f b) + = /\(f :: * -> *) -> + \(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) -> v + ~`$fHasFromOpaqueBuiltinDataBuiltinData_$cfromOpaque` : data -> data + = \(eta : data) -> eta + !chooseList : all a b. list a -> b -> b -> b = chooseList + !head : all a. list a -> a = headList + !tail : all a. list a -> list a = tailList + !unitval : unit = () + ~`$fHasFromOpaqueBuiltinListList_$cfromOpaque` : + all arep a. (\arep a -> arep -> a) arep a -> list arep -> List a + = /\arep a -> + \(`$dHasFromOpaque` : (\arep a -> arep -> a) arep a) -> + letrec + ~go : list arep -> List a + = \(l : list arep) -> + let + !l : list arep = l + in + chooseList + {arep} + {unit -> List a} + l + (\(ds : unit) -> Nil {a}) + (\(ds : unit) -> + Cons + {a} + (`$dHasFromOpaque` (head {arep} l)) + (go (tail {arep} l))) + unitval + in + \(eta : list arep) -> go eta + !fst : all a b. pair a b -> a = fstPair + !snd : all a b. pair a b -> b = sndPair + !unsafeDataAsConstr : data -> pair integer (list data) = unConstrData + ~unsafeDataAsConstr : data -> Tuple2 integer (List data) + = \(d : data) -> + let + !d : data = d + !p : pair integer (list data) = unsafeDataAsConstr d + in + Tuple2 + {integer} + {List data} + (fst {integer} {list data} p) + (let + !a : list data = snd {integer} {list data} p + in + `$fHasFromOpaqueBuiltinListList_$cfromOpaque` + {data} + {data} + `$fHasFromOpaqueBuiltinDataBuiltinData_$cfromOpaque` + a) + !unsafeDataAsI : data -> integer = unIData + ~unsafeDataAsI : data -> integer + = \(d : data) -> let !d : data = d in unsafeDataAsI d +in +\(ds : data) -> + let + !ds : data = ds in - \(ds : data) -> - let - !ds : data = ds - in - `.` - {List data -> List integer} - {Tuple2 integer (List data) -> Tuple2 integer (List integer)} - {data -> integer} - (fmap - {Tuple2 integer} - (`$fFunctorTuple2` {integer}) - {List data} - {List integer}) - (fmap {List} `$fFunctorList` {data} {integer}) - unsafeDataAsI - (unsafeDataAsConstr ds)) \ No newline at end of file + `.` + {List data -> List integer} + {Tuple2 integer (List data) -> Tuple2 integer (List integer)} + {data -> integer} + (fmap + {Tuple2 integer} + (`$fFunctorTuple2` {integer}) + {List data} + {List integer}) + (fmap {List} `$fFunctorList` {data} {integer}) + unsafeDataAsI + (unsafeDataAsConstr ds) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/emptyByteString.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/emptyByteString.pir.golden index 93bd77be176..97f704364c2 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/emptyByteString.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/emptyByteString.pir.golden @@ -1 +1 @@ -program 1.1.0 (\(ds : bytestring) -> ds) \ No newline at end of file +\(ds : bytestring) -> ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/encodeUtf8.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/encodeUtf8.pir.golden index 1baeeabe040..f2ab1e64bcd 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/encodeUtf8.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/encodeUtf8.pir.golden @@ -1,7 +1,5 @@ -program - 1.1.0 - (let - !encodeUtf : string -> bytestring = encodeUtf8 - ~encodeUtf : string -> bytestring = encodeUtf - in - encodeUtf "abc") \ No newline at end of file +let + !encodeUtf : string -> bytestring = encodeUtf8 + ~encodeUtf : string -> bytestring = encodeUtf +in +encodeUtf "abc" \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/error.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/error.pir.golden index d46d4314de9..659f24f0f9d 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/error.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/error.pir.golden @@ -1,9 +1,7 @@ -program - 1.1.0 - (let - !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} - !unitval : unit = () - Unit = all a. a -> a - ~error : all a. Unit -> a = /\a -> \(x : Unit) -> error {a} unitval - in - error {integer}) \ No newline at end of file +let + !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} + !unitval : unit = () + Unit = all a. a -> a + ~error : all a. Unit -> a = /\a -> \(x : Unit) -> error {a} unitval +in +error {integer} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/ifThenElse.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/ifThenElse.pir.golden index fd644ee88bd..d606dbd777b 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/ifThenElse.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/ifThenElse.pir.golden @@ -1,34 +1,32 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False + ifThenElse {Bool} b True False +in +\(ds : integer) -> + let + !ds : integer = ds in \(ds : integer) -> let !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - Bool_match - (equalsInteger ds ds) - {all dead. integer} - (/\dead -> ds) - (/\dead -> ds) - {all dead. dead}) \ No newline at end of file + Bool_match + (equalsInteger ds ds) + {all dead. integer} + (/\dead -> ds) + (/\dead -> ds) + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/int.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/int.pir.golden index 0d9b8af24ca..56a6051ca2b 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/int.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/int.pir.golden @@ -1 +1 @@ -program 1.1.0 1 \ No newline at end of file +1 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/int2.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/int2.pir.golden index 71e8cc5eae5..d8263ee9860 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/int2.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/int2.pir.golden @@ -1 +1 @@ -program 1.1.0 2 \ No newline at end of file +2 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intCompare.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intCompare.pir.golden index 0e6729c2c85..012f049af58 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intCompare.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intCompare.pir.golden @@ -1,25 +1,23 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - !lessThanInteger : integer -> integer -> bool = lessThanInteger - ~lessThanInteger : integer -> integer -> Bool - = \(x : integer) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + !lessThanInteger : integer -> integer -> bool = lessThanInteger + ~lessThanInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = lessThanInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = lessThanInteger x y - in - ifThenElse {Bool} b True False + ifThenElse {Bool} b True False +in +\(ds : integer) -> + let + !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - \(ds : integer) -> let !ds : integer = ds in lessThanInteger ds ds) \ No newline at end of file + \(ds : integer) -> let !ds : integer = ds in lessThanInteger ds ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intDiv.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intDiv.pir.golden index fd061087ebf..ac7a5f4cadc 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intDiv.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intDiv.pir.golden @@ -1,16 +1,14 @@ -program - 1.1.0 - (let - !divideInteger : integer -> integer -> integer = divideInteger - ~divideInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in divideInteger x y +let + !divideInteger : integer -> integer -> integer = divideInteger + ~divideInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in divideInteger x y +in +\(ds : integer) -> + let + !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - \(ds : integer) -> let !ds : integer = ds in divideInteger ds ds) \ No newline at end of file + \(ds : integer) -> let !ds : integer = ds in divideInteger ds ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intEq.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intEq.pir.golden index 210db8b4ce5..69c5751d728 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intEq.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intEq.pir.golden @@ -1,25 +1,23 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False + ifThenElse {Bool} b True False +in +\(ds : integer) -> + let + !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - \(ds : integer) -> let !ds : integer = ds in equalsInteger ds ds) \ No newline at end of file + \(ds : integer) -> let !ds : integer = ds in equalsInteger ds ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intPlus.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intPlus.pir.golden index f07957a3925..627ef3aa6ba 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/intPlus.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/intPlus.pir.golden @@ -1,16 +1,14 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> let !y : integer = y in addInteger x y +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y +in +\(ds : integer) -> + let + !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - \(ds : integer) -> let !ds : integer = ds in addInteger ds ds) \ No newline at end of file + \(ds : integer) -> let !ds : integer = ds in addInteger ds ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/serialiseData.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/serialiseData.pir.golden index ec8dd895f3b..0de267dc2c2 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/serialiseData.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/serialiseData.pir.golden @@ -1,7 +1,5 @@ -program - 1.1.0 - (let - !serialiseData : data -> bytestring = serialiseData - ~serialiseData : data -> bytestring = serialiseData - in - serialiseData) \ No newline at end of file +let + !serialiseData : data -> bytestring = serialiseData + ~serialiseData : data -> bytestring = serialiseData +in +serialiseData \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/string.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/string.pir.golden index eeb1da5e892..faba86b595e 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/string.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/string.pir.golden @@ -1 +1 @@ -program 1.1.0 "text" \ No newline at end of file +"text" \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/stringLiteral.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/stringLiteral.pir.golden index bf29f9f2f71..4f44a21051e 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/stringLiteral.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/stringLiteral.pir.golden @@ -1 +1 @@ -program 1.1.0 "abc" \ No newline at end of file +"abc" \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/trace.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/trace.pir.golden index fc3a8aed30f..df4aaf4a0a8 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/trace.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/trace.pir.golden @@ -1,9 +1,7 @@ -program - 1.1.0 - (let - data Unit | Unit_match where - Unit : Unit - !trace : all a. string -> a -> a = trace - ~trace : all a. string -> a -> a = trace - in - \(ds : string) -> let !ds : string = ds in trace {Unit} ds Unit) \ No newline at end of file +let + data Unit | Unit_match where + Unit : Unit + !trace : all a. string -> a -> a = trace + ~trace : all a. string -> a -> a = trace +in +\(ds : string) -> let !ds : string = ds in trace {Unit} ds Unit \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/traceComplex.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/traceComplex.pir.golden index b8a086b0efb..9bdc8f73019 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/traceComplex.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/traceComplex.pir.golden @@ -1,31 +1,29 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !trace : all a. string -> a -> a = trace - ~trace : all a. string -> a -> a = trace - data Unit | Unit_match where - Unit : Unit - !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} - !unitval : unit = () - ~traceError : all a. string -> a - = /\a -> - \(str : string) -> - let - !str : string = str - !x : Unit = trace {Unit} str Unit - in - error {a} unitval +let + data Bool | Bool_match where + True : Bool + False : Bool + !trace : all a. string -> a -> a = trace + ~trace : all a. string -> a -> a = trace + data Unit | Unit_match where + Unit : Unit + !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} + !unitval : unit = () + ~traceError : all a. string -> a + = /\a -> + \(str : string) -> + let + !str : string = str + !x : Unit = trace {Unit} str Unit + in + error {a} unitval +in +\(ds : Bool) -> + let + !ds : Bool = ds in - \(ds : Bool) -> - let - !ds : Bool = ds - in - Bool_match - ds - {all dead. Unit} - (/\dead -> trace {Unit} "yes" Unit) - (/\dead -> traceError {Unit} "no") - {all dead. dead}) \ No newline at end of file + Bool_match + ds + {all dead. Unit} + (/\dead -> trace {Unit} "yes" Unit) + (/\dead -> traceError {Unit} "no") + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/tuple.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/tuple.pir.golden index 5ef927c3dfd..b0da8b103ae 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/tuple.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/tuple.pir.golden @@ -1,7 +1,5 @@ -program - 1.1.0 - (let - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - in - Tuple2 {integer} {integer} 1 2) \ No newline at end of file +let + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b +in +Tuple2 {integer} {integer} 1 2 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/tupleMatch.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/tupleMatch.pir.golden index 56298407fe9..c591a939a5a 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/tupleMatch.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/tupleMatch.pir.golden @@ -1,13 +1,11 @@ -program - 1.1.0 - (let - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - in - \(ds : Tuple2 integer integer) -> - Tuple2_match - {integer} - {integer} - ds - {integer} - (\(ipv : integer) (ipv : integer) -> ipv)) \ No newline at end of file +let + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b +in +\(ds : Tuple2 integer integer) -> + Tuple2_match + {integer} + {integer} + ds + {integer} + (\(ipv : integer) (ipv : integer) -> ipv) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/verify.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/verify.pir.golden index 9c78f87257a..6c3b806161e 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/verify.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/verify.pir.golden @@ -1,27 +1,29 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - !verifyEd25519Signature : bytestring -> bytestring -> bytestring -> bool - = verifyEd25519Signature - ~verifyEd25519Signature : bytestring -> bytestring -> bytestring -> Bool - = \(pubKey : bytestring) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + !verifyEd25519Signature : bytestring -> bytestring -> bytestring -> bool + = verifyEd25519Signature + ~verifyEd25519Signature : bytestring -> bytestring -> bytestring -> Bool + = \(pubKey : bytestring) -> + let + !pubKey : bytestring = pubKey + in + \(message : bytestring) -> let - !pubKey : bytestring = pubKey + !message : bytestring = message in - \(message : bytestring) -> + \(signature : bytestring) -> let - !message : bytestring = message + !signature : bytestring = signature + !b : bool = verifyEd25519Signature pubKey message signature in - \(signature : bytestring) -> - let - !signature : bytestring = signature - !b : bool = verifyEd25519Signature pubKey message signature - in - ifThenElse {Bool} b True False + ifThenElse {Bool} b True False +in +\(ds : bytestring) -> + let + !ds : bytestring = ds in \(ds : bytestring) -> let @@ -31,8 +33,4 @@ program let !ds : bytestring = ds in - \(ds : bytestring) -> - let - !ds : bytestring = ds - in - verifyEd25519Signature ds ds ds) \ No newline at end of file + verifyEd25519Signature ds ds ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/9.6/void.pir.golden b/plutus-tx-plugin/test/Plugin/Primitives/9.6/void.pir.golden index ff9202015b3..078a8c43c43 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/9.6/void.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Primitives/9.6/void.pir.golden @@ -1,43 +1,41 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - ~fail : unit -> Bool = \(ds : unit) -> False - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + ~fail : unit -> Bool = \(ds : unit) -> False + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False + ifThenElse {Bool} b True False +in +\(ds : integer) -> + let + !ds : integer = ds in \(ds : integer) -> let !ds : integer = ds + !x' : Bool = equalsInteger ds ds + !y' : Bool = equalsInteger ds ds in - \(ds : integer) -> - let - !ds : integer = ds - !x' : Bool = equalsInteger ds ds - !y' : Bool = equalsInteger ds ds - in - Bool_match - x' - {all dead. Bool} - (/\dead -> - Bool_match - y' - {all dead. Bool} - (/\dead -> True) - (/\dead -> fail ()) - {all dead. dead}) - (/\dead -> fail ()) - {all dead. dead}) \ No newline at end of file + Bool_match + x' + {all dead. Bool} + (/\dead -> + Bool_match + y' + {all dead. Bool} + (/\dead -> True) + (/\dead -> fail ()) + {all dead. dead}) + (/\dead -> fail ()) + {all dead. dead} \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Primitives/Spec.hs b/plutus-tx-plugin/test/Plugin/Primitives/Spec.hs index 1fabfd93a7a..d105fa4d5df 100644 --- a/plutus-tx-plugin/test/Plugin/Primitives/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Primitives/Spec.hs @@ -26,28 +26,28 @@ import Data.Proxy primitives :: TestNested primitives = testNested "Primitives" . pure $ testNestedGhc - [ goldenPir "string" string - , goldenPir "int" int - , goldenPir "int2" int2 - , goldenPir "bool" bool - , goldenPir "and" andPlc + [ goldenPirReadable "string" string + , goldenPirReadable "int" int + , goldenPirReadable "int2" int2 + , goldenPirReadable "bool" bool + , goldenPirReadable "and" andPlc , goldenUEval "andApply" [ toUPlc andPlc, toUPlc $ plc (Proxy @"T") True, toUPlc $ plc (Proxy @"F") False ] - , goldenPir "tuple" tuple - , goldenPir "tupleMatch" tupleMatch + , goldenPirReadable "tuple" tuple + , goldenPirReadable "tupleMatch" tupleMatch , goldenUEval "tupleConstDest" [ toUPlc tupleMatch, toUPlc tuple ] - , goldenPir "intCompare" intCompare - , goldenPir "intEq" intEq + , goldenPirReadable "intCompare" intCompare + , goldenPirReadable "intEq" intEq , goldenUEval "intEqApply" [ toUPlc intEq, toUPlc int, toUPlc int ] - , goldenPir "void" void - , goldenPir "intPlus" intPlus - , goldenPir "intDiv" intDiv + , goldenPirReadable "void" void + , goldenPirReadable "intPlus" intPlus + , goldenPirReadable "intDiv" intDiv , goldenUEval "intPlusApply" [ toUPlc intPlus, toUPlc int, toUPlc int2 ] - , goldenPir "error" errorPlc - , goldenPir "ifThenElse" ifThenElse + , goldenPirReadable "error" errorPlc + , goldenPirReadable "ifThenElse" ifThenElse , goldenUEval "ifThenElseApply" [ toUPlc ifThenElse, toUPlc int, toUPlc int2 ] - , goldenPir "emptyByteString" emptyByteString + , goldenPirReadable "emptyByteString" emptyByteString , goldenUEval "emptyByteStringApply" [ getPlcNoAnn emptyByteString, snd (liftProgramDef Builtins.emptyByteString) ] - , goldenPir "bytestring" bytestring + , goldenPirReadable "bytestring" bytestring , goldenUEval "bytestringApply" [ getPlcNoAnn bytestring, snd (liftProgramDef ("hello" ::Builtins.BuiltinByteString)) ] , goldenUEval "sha2_256" [ getPlcNoAnn sha2, snd (liftProgramDef ("hello" :: Builtins.BuiltinByteString))] , goldenUEval "equalsByteString" [ getPlcNoAnn bsEquals, snd (liftProgramDef ("hello" :: Builtins.BuiltinByteString)), snd (liftProgramDef ("hello" :: Builtins.BuiltinByteString))] @@ -56,22 +56,22 @@ primitives = testNested "Primitives" . pure $ testNestedGhc , goldenUEval "lengthOfByteString" [ getPlcNoAnn bsLength, snd (liftProgramDef ("hello" :: Builtins.BuiltinByteString))] , goldenUEval "indexByteString" [ getPlcNoAnn bsIndex, snd (liftProgramDef ("hello" :: Builtins.BuiltinByteString)), snd (liftProgramDef (0 :: Integer))] , goldenUEval "consByteString" [ getPlcNoAnn bsCons, snd (liftProgramDef (104 :: Integer)), snd (liftProgramDef ("ello" :: Builtins.BuiltinByteString))] - , goldenPir "verify" verify - , goldenPir "trace" trace - , goldenPir "traceComplex" traceComplex - , goldenPir "stringLiteral" stringLiteral + , goldenPirReadable "verify" verify + , goldenPirReadable "trace" trace + , goldenPirReadable "traceComplex" traceComplex + , goldenPirReadable "stringLiteral" stringLiteral , goldenUEval "equalsString" [ getPlcNoAnn stringEquals, snd (liftProgramDef ("hello" :: Builtins.BuiltinString)), snd (liftProgramDef ("hello" :: Builtins.BuiltinString))] - , goldenPir "encodeUtf8" stringEncode - , goldenPir "serialiseData" dataEncode + , goldenPirReadable "encodeUtf8" stringEncode + , goldenPirReadable "serialiseData" dataEncode , goldenUEval "serialiseDataApply" [ toUPlc dataEncode, toUPlc constructData1 ] , goldenUEval "constructData1" [ constructData1 ] -- It's interesting to look at one of these to make sure all the specialisation is working out nicely and for -- debugging when it isn't - , goldenPir "deconstructorData1" deconstructData1 + , goldenPirReadable "deconstructorData1" deconstructData1 -- Check that matchData works (and isn't too strict) , goldenUEval "matchData1" [ toUPlc matchData1, toUPlc constructData1 ] , goldenUEval "deconstructData1" [ toUPlc deconstructData1, toUPlc constructData1 ] - , goldenPir "deconstructorData2" deconstructData2 + , goldenPirReadable "deconstructorData2" deconstructData2 , goldenUEval "deconstructData2" [ toUPlc deconstructData2, toUPlc constructData2 ] , goldenUEval "deconstructData3" [ toUPlc deconstructData3, toUPlc constructData3 ] , goldenUEval "writeBits-integerToByteString" [ writeBitsIntegerToByteString ] diff --git a/plutus-tx-plugin/test/Plugin/Profiling/9.6/addInt.pir.golden b/plutus-tx-plugin/test/Plugin/Profiling/9.6/addInt.pir.golden index 06bbaba84bf..14d644ea86c 100644 --- a/plutus-tx-plugin/test/Plugin/Profiling/9.6/addInt.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Profiling/9.6/addInt.pir.golden @@ -1,32 +1,30 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x - in - \(y : integer) -> - let - !y : integer = y - in - trace - {unit -> integer} - "entering addInteger" - (\(thunk : unit) -> - trace {integer} "exiting addInteger" (addInteger x y)) - () - ~addInt : integer -> integer -> integer - = \(x : integer) -> - let - !x : integer = x + !y : integer = y in trace - {unit -> integer -> integer} - "entering addInt" + {unit -> integer} + "entering addInteger" (\(thunk : unit) -> - trace {integer -> integer} "exiting addInt" (addInteger x)) + trace {integer} "exiting addInteger" (addInteger x y)) () - in - addInt) \ No newline at end of file + ~addInt : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + trace + {unit -> integer -> integer} + "entering addInt" + (\(thunk : unit) -> + trace {integer -> integer} "exiting addInt" (addInteger x)) + () +in +addInt \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Profiling/9.6/fib.pir.golden b/plutus-tx-plugin/test/Plugin/Profiling/9.6/fib.pir.golden index e719359599f..fe8508177d9 100644 --- a/plutus-tx-plugin/test/Plugin/Profiling/9.6/fib.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Profiling/9.6/fib.pir.golden @@ -1,96 +1,91 @@ -program - 1.1.0 - (let - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> +let + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y in - \(y : integer) -> - let - !y : integer = y - in - trace - {unit -> integer} - "entering addInteger" - (\(thunk : unit) -> - trace {integer} "exiting addInteger" (addInteger x y)) - () - data Bool | Bool_match where - True : Bool - False : Bool - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> - let - !x : integer = x - in - \(y : integer) -> - let - !y : integer = y - in - trace - {unit -> Bool} - "entering equalsInteger" - (\(thunk : unit) -> - trace - {Bool} - "exiting equalsInteger" - (let - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False)) - () - !subtractInteger : integer -> integer -> integer = subtractInteger - ~subtractInteger : integer -> integer -> integer - = \(x : integer) -> + trace + {unit -> integer} + "entering addInteger" + (\(thunk : unit) -> + trace {integer} "exiting addInteger" (addInteger x y)) + () + data Bool | Bool_match where + True : Bool + False : Bool + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y in - \(y : integer) -> - let - !y : integer = y - in - trace - {unit -> integer} - "entering subtractInteger" - (\(thunk : unit) -> - trace - {integer} - "exiting subtractInteger" - (subtractInteger x y)) - () - in - letrec - ~fib : integer -> integer - = \(n : integer) -> + trace + {unit -> Bool} + "entering equalsInteger" + (\(thunk : unit) -> + trace + {Bool} + "exiting equalsInteger" + (let + !b : bool = equalsInteger x y + in + ifThenElse {Bool} b True False)) + () + !subtractInteger : integer -> integer -> integer = subtractInteger + ~subtractInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !n : integer = n + !y : integer = y in trace {unit -> integer} - "entering fib" + "entering subtractInteger" (\(thunk : unit) -> - trace - {integer} - "exiting fib" - (Bool_match - (equalsInteger n 0) - {all dead. integer} - (/\dead -> 0) - (/\dead -> - Bool_match - (equalsInteger n 1) - {all dead. integer} - (/\dead -> 1) - (/\dead -> - addInteger - (fib (subtractInteger n 1)) - (fib (subtractInteger n 2))) - {all dead. dead}) - {all dead. dead})) + trace {integer} "exiting subtractInteger" (subtractInteger x y)) () - in - fib) \ No newline at end of file +in +letrec + ~fib : integer -> integer + = \(n : integer) -> + let + !n : integer = n + in + trace + {unit -> integer} + "entering fib" + (\(thunk : unit) -> + trace + {integer} + "exiting fib" + (Bool_match + (equalsInteger n 0) + {all dead. integer} + (/\dead -> 0) + (/\dead -> + Bool_match + (equalsInteger n 1) + {all dead. integer} + (/\dead -> 1) + (/\dead -> + addInteger + (fib (subtractInteger n 1)) + (fib (subtractInteger n 2))) + {all dead. dead}) + {all dead. dead})) + () +in +fib \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Profiling/9.6/idCode.pir.golden b/plutus-tx-plugin/test/Plugin/Profiling/9.6/idCode.pir.golden index 8dba2c447fe..d0496727c56 100644 --- a/plutus-tx-plugin/test/Plugin/Profiling/9.6/idCode.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Profiling/9.6/idCode.pir.golden @@ -1,13 +1,11 @@ -program - 1.1.0 - (let - ~id : all a. a -> a - = /\a -> - \(x : a) -> - trace - {unit -> a} - "entering id" - (\(thunk : unit) -> trace {a} "exiting id" x) - () - in - id {integer} (id {integer} 1)) \ No newline at end of file +let + ~id : all a. a -> a + = /\a -> + \(x : a) -> + trace + {unit -> a} + "entering id" + (\(thunk : unit) -> trace {a} "exiting id" x) + () +in +id {integer} (id {integer} 1) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Profiling/Spec.hs b/plutus-tx-plugin/test/Plugin/Profiling/Spec.hs index b611b8b7603..6014351ea18 100644 --- a/plutus-tx-plugin/test/Plugin/Profiling/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Profiling/Spec.hs @@ -28,7 +28,7 @@ import PlutusCore.Test (ToUPlc (toUPlc), goldenUEvalLogs) import PlutusTx.Builtins qualified as Builtins import PlutusTx.Code (CompiledCode) import PlutusTx.Plugin (plc) -import PlutusTx.Test (goldenPir) +import PlutusTx.Test (goldenPirReadable) import Data.Functor.Identity import Data.Proxy (Proxy (Proxy)) @@ -38,7 +38,7 @@ profiling :: TestNested profiling = testNested "Profiling" . pure $ do testNestedGhc - [ goldenPir "fib" fibTest + [ goldenPirReadable "fib" fibTest , goldenUEvalLogs "fib4" [ toUPlc fibTest @@ -49,7 +49,7 @@ profiling = [ toUPlc factTest , toUPlc $ plc (Proxy @"4") (4 :: Integer) ] - , goldenPir "addInt" addIntTest + , goldenPirReadable "addInt" addIntTest , goldenUEvalLogs "addInt3" [ toUPlc addIntTest @@ -73,7 +73,7 @@ profiling = [ toUPlc letRecInFunTest , toUPlc $ plc (Proxy @"3") (3 :: Integer) ] - , goldenPir "idCode" idTest + , goldenPirReadable "idCode" idTest , goldenUEvalLogs "id" [toUPlc idTest] , goldenUEvalLogs "swap" [toUPlc swapTest] , goldenUEvalLogs diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/compareTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/compareTest.pir.golden index 7644ed22f9f..4f0ac1fb5c6 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/compareTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/compareTest.pir.golden @@ -1,181 +1,179 @@ -program - 1.1.0 - (let - !equalsInteger : integer -> integer -> bool = equalsInteger - !lessThanEqualsInteger : integer -> integer -> bool = lessThanEqualsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - data Bool | Bool_match where - True : Bool - False : Bool - data Ordering | Ordering_match where - EQ : Ordering - GT : Ordering - LT : Ordering - ~`$fOrdInteger_$ccompare` : integer -> integer -> Ordering - = \(eta : integer) -> +let + !equalsInteger : integer -> integer -> bool = equalsInteger + !lessThanEqualsInteger : integer -> integer -> bool = lessThanEqualsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + data Bool | Bool_match where + True : Bool + False : Bool + data Ordering | Ordering_match where + EQ : Ordering + GT : Ordering + LT : Ordering + ~`$fOrdInteger_$ccompare` : integer -> integer -> Ordering + = \(eta : integer) -> + let + !x : integer = eta + in + \(eta : integer) -> let - !x : integer = eta + !y : integer = eta + !b : bool = equalsInteger x y in - \(eta : integer) -> - let - !y : integer = eta - !b : bool = equalsInteger x y - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. Ordering} - (/\dead -> EQ) - (/\dead -> - let - !b : bool = lessThanEqualsInteger x y - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. Ordering} - (/\dead -> LT) - (/\dead -> GT) - {all dead. dead}) - {all dead. dead} - ~`$fOrdInteger_$cmax` : integer -> integer -> integer - = \(x : integer) -> + Bool_match + (ifThenElse {Bool} b True False) + {all dead. Ordering} + (/\dead -> EQ) + (/\dead -> + let + !b : bool = lessThanEqualsInteger x y + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. Ordering} + (/\dead -> LT) + (/\dead -> GT) + {all dead. dead}) + {all dead. dead} + ~`$fOrdInteger_$cmax` : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = lessThanEqualsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = lessThanEqualsInteger x y - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. integer} - (/\dead -> y) - (/\dead -> x) - {all dead. dead} - ~`$fOrdInteger_$cmin` : integer -> integer -> integer - = \(x : integer) -> + Bool_match + (ifThenElse {Bool} b True False) + {all dead. integer} + (/\dead -> y) + (/\dead -> x) + {all dead. dead} + ~`$fOrdInteger_$cmin` : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = lessThanEqualsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = lessThanEqualsInteger x y - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. integer} - (/\dead -> x) - (/\dead -> y) - {all dead. dead} - ~equalsInteger : integer -> integer -> Bool - = \(x : integer) -> + Bool_match + (ifThenElse {Bool} b True False) + {all dead. integer} + (/\dead -> x) + (/\dead -> y) + {all dead. dead} + ~equalsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = equalsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = equalsInteger x y - in - ifThenElse {Bool} b True False - !lessThanInteger : integer -> integer -> bool = lessThanInteger - ~greaterThanEqualsInteger : integer -> integer -> Bool - = \(x : integer) -> + ifThenElse {Bool} b True False + !lessThanInteger : integer -> integer -> bool = lessThanInteger + ~greaterThanEqualsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y in - \(y : integer) -> - let - !y : integer = y - in - ifThenElse {Bool} (lessThanInteger x y) False True - ~greaterThanInteger : integer -> integer -> Bool - = \(x : integer) -> + ifThenElse {Bool} (lessThanInteger x y) False True + ~greaterThanInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y in - \(y : integer) -> - let - !y : integer = y - in - ifThenElse {Bool} (lessThanEqualsInteger x y) False True - ~lessThanEqualsInteger : integer -> integer -> Bool - = \(x : integer) -> + ifThenElse {Bool} (lessThanEqualsInteger x y) False True + ~lessThanEqualsInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = lessThanEqualsInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = lessThanEqualsInteger x y - in - ifThenElse {Bool} b True False - ~lessThanInteger : integer -> integer -> Bool - = \(x : integer) -> + ifThenElse {Bool} b True False + ~lessThanInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = lessThanInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = lessThanInteger x y - in - ifThenElse {Bool} b True False - data (Ord :: * -> *) a | Ord_match where - CConsOrd : - (\a -> a -> a -> Bool) a -> - (a -> a -> Ordering) -> - (a -> a -> Bool) -> - (a -> a -> Bool) -> - (a -> a -> Bool) -> - (a -> a -> Bool) -> - (a -> a -> a) -> - (a -> a -> a) -> - Ord a - ~`$fOrdInteger` : Ord integer - = CConsOrd - {integer} - equalsInteger - `$fOrdInteger_$ccompare` - lessThanInteger - lessThanEqualsInteger - greaterThanInteger - greaterThanEqualsInteger - `$fOrdInteger_$cmax` - `$fOrdInteger_$cmin` - ~compare : all a. Ord a -> a -> a -> Ordering - = /\a -> - \(v : Ord a) -> - Ord_match - {a} - v - {a -> a -> Ordering} - (\(v : (\a -> a -> a -> Bool) a) - (v : a -> a -> Ordering) - (v : a -> a -> Bool) - (v : a -> a -> Bool) - (v : a -> a -> Bool) - (v : a -> a -> Bool) - (v : a -> a -> a) - (v : a -> a -> a) -> - v) - ~opCompare : all a. Ord a -> a -> a -> Ordering - = /\a -> - \(`$dOrd` : Ord a) (a : a) -> + ifThenElse {Bool} b True False + data (Ord :: * -> *) a | Ord_match where + CConsOrd : + (\a -> a -> a -> Bool) a -> + (a -> a -> Ordering) -> + (a -> a -> Bool) -> + (a -> a -> Bool) -> + (a -> a -> Bool) -> + (a -> a -> Bool) -> + (a -> a -> a) -> + (a -> a -> a) -> + Ord a + ~`$fOrdInteger` : Ord integer + = CConsOrd + {integer} + equalsInteger + `$fOrdInteger_$ccompare` + lessThanInteger + lessThanEqualsInteger + greaterThanInteger + greaterThanEqualsInteger + `$fOrdInteger_$cmax` + `$fOrdInteger_$cmin` + ~compare : all a. Ord a -> a -> a -> Ordering + = /\a -> + \(v : Ord a) -> + Ord_match + {a} + v + {a -> a -> Ordering} + (\(v : (\a -> a -> a -> Bool) a) + (v : a -> a -> Ordering) + (v : a -> a -> Bool) + (v : a -> a -> Bool) + (v : a -> a -> Bool) + (v : a -> a -> Bool) + (v : a -> a -> a) + (v : a -> a -> a) -> + v) + ~opCompare : all a. Ord a -> a -> a -> Ordering + = /\a -> + \(`$dOrd` : Ord a) (a : a) -> + let + !a : a = a + in + \(b : a) -> let - !a : a = a + !b : a = b in - \(b : a) -> - let - !b : a = b - in - Ordering_match - (compare {a} `$dOrd` a b) - {all dead. Ordering} - (/\dead -> EQ) - (/\dead -> LT) - (/\dead -> GT) - {all dead. dead} - in - opCompare {integer} `$fOrdInteger` 1 2) \ No newline at end of file + Ordering_match + (compare {a} `$dOrd` a b) + {all dead. Ordering} + (/\dead -> EQ) + (/\dead -> LT) + (/\dead -> GT) + {all dead. dead} +in +opCompare {integer} `$fOrdInteger` 1 2 \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/concatTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/concatTest.pir.golden index e607ce51f5b..1ac5dc685b4 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/concatTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/concatTest.pir.golden @@ -1,104 +1,102 @@ -program - 1.1.0 - (letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b - = /\a b -> - \(f : a -> b -> b) -> +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b + = /\a b -> + \(f : a -> b -> b) -> + let + !f : a -> b -> b = f + in + \(z : b) -> let - !f : a -> b -> b = f + !z : b = z in - \(z : b) -> - let - !z : b = z - in - letrec - ~go : List a -> b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. b} - (/\dead -> z) - (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) - {all dead. dead} - in - \(eta : List a) -> go eta - ~`$fFoldableList` : - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) List - = `$fFoldableList_$cfoldr` - ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a - = /\a -> - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) - ~concat : - all (t :: * -> *) a. - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> - t (List a) -> - List a - = /\(t :: * -> *) a -> - \(`$dFoldable` : - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t) - (xs : t (List a)) -> - let - !xs : t (List a) = xs + letrec + ~go : List a -> b + = \(ds : List a) -> + List_match + {a} + ds + {all dead. b} + (/\dead -> z) + (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) + {all dead. dead} in - build - {a} - (/\b -> - \(c : a -> b -> b) -> + \(eta : List a) -> go eta + ~`$fFoldableList` : + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) List + = `$fFoldableList_$cfoldr` + ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a + = /\a -> + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) + ~concat : + all (t :: * -> *) a. + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> + t (List a) -> + List a + = /\(t :: * -> *) a -> + \(`$dFoldable` : + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t) + (xs : t (List a)) -> + let + !xs : t (List a) = xs + in + build + {a} + (/\b -> + \(c : a -> b -> b) -> + let + !c : a -> b -> b = c + in + \(n : b) -> let - !c : a -> b -> b = c + !n : b = n in - \(n : b) -> - let - !n : b = n - in - `$dFoldable` - {List a} - {b} - (\(x : List a) -> + `$dFoldable` + {List a} + {b} + (\(x : List a) -> + let + !x : List a = x + in + \(y : b) -> let - !x : List a = x + !y : b = y + in + letrec + ~go : List a -> b + = \(ds : List a) -> + List_match + {a} + ds + {all dead. b} + (/\dead -> y) + (\(x : a) (xs : List a) -> + /\dead -> c x (go xs)) + {all dead. dead} in - \(y : b) -> - let - !y : b = y - in - letrec - ~go : List a -> b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. b} - (/\dead -> y) - (\(x : a) (xs : List a) -> - /\dead -> c x (go xs)) - {all dead. dead} - in - go x) - n - xs) - in - concat - {List} - {integer} - `$fFoldableList` - (build - {List integer} - (/\a -> - \(c : List integer -> a -> a) (n : a) -> - c - (build - {integer} - (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 (c 2 n))) - (c - (build - {integer} - (/\a -> \(c : integer -> a -> a) (n : a) -> c 3 (c 4 n))) - n)))) \ No newline at end of file + go x) + n + xs) +in +concat + {List} + {integer} + `$fFoldableList` + (build + {List integer} + (/\a -> + \(c : List integer -> a -> a) (n : a) -> + c + (build + {integer} + (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 (c 2 n))) + (c + (build + {integer} + (/\a -> \(c : integer -> a -> a) (n : a) -> c 3 (c 4 n))) + n))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/defaultMethods.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/defaultMethods.pir.golden index 217841ad939..69c90394e46 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/defaultMethods.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/defaultMethods.pir.golden @@ -1,36 +1,33 @@ -program - 1.1.0 - (let - data (DefaultMethods :: * -> *) a | DefaultMethods_match where - CConsDefaultMethods : (a -> integer) -> (a -> integer) -> DefaultMethods a - ~method : all a. DefaultMethods a -> a -> integer - = /\a -> - \(v : DefaultMethods a) -> - DefaultMethods_match - {a} - v - {a -> integer} - (\(v : a -> integer) (v : a -> integer) -> v) - ~f : all a. DefaultMethods a -> a -> integer - = /\a -> - \(`$dDefaultMethods` : DefaultMethods a) (a : a) -> - let - !a : a = a - in - method {a} `$dDefaultMethods` a - ~`$fDefaultMethodsInteger_$cmethod` : integer -> integer - = \(a : integer) -> a - !addInteger : integer -> integer -> integer = addInteger - ~`$fDefaultMethodsInteger_$cmethod` : integer -> integer - = \(a : integer) -> let !a : integer = a in addInteger a 1 - ~`$fDefaultMethodsInteger` : DefaultMethods integer - = CConsDefaultMethods - {integer} - `$fDefaultMethodsInteger_$cmethod` - `$fDefaultMethodsInteger_$cmethod` +let + data (DefaultMethods :: * -> *) a | DefaultMethods_match where + CConsDefaultMethods : (a -> integer) -> (a -> integer) -> DefaultMethods a + ~method : all a. DefaultMethods a -> a -> integer + = /\a -> + \(v : DefaultMethods a) -> + DefaultMethods_match + {a} + v + {a -> integer} + (\(v : a -> integer) (v : a -> integer) -> v) + ~f : all a. DefaultMethods a -> a -> integer + = /\a -> + \(`$dDefaultMethods` : DefaultMethods a) (a : a) -> + let + !a : a = a + in + method {a} `$dDefaultMethods` a + ~`$fDefaultMethodsInteger_$cmethod` : integer -> integer = \(a : integer) -> a + !addInteger : integer -> integer -> integer = addInteger + ~`$fDefaultMethodsInteger_$cmethod` : integer -> integer + = \(a : integer) -> let !a : integer = a in addInteger a 1 + ~`$fDefaultMethodsInteger` : DefaultMethods integer + = CConsDefaultMethods + {integer} + `$fDefaultMethodsInteger_$cmethod` + `$fDefaultMethodsInteger_$cmethod` +in +\(ds : integer) -> + let + !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - f {integer} `$fDefaultMethodsInteger` ds) \ No newline at end of file + f {integer} `$fDefaultMethodsInteger` ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/fmapDefaultTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/fmapDefaultTest.pir.golden index 4c6d50985cf..f2e2551314b 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/fmapDefaultTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/fmapDefaultTest.pir.golden @@ -1,209 +1,196 @@ -program - 1.1.0 - (let - ~v : integer = 1 - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> +let + ~v : integer = 1 + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + ~`$fAdditiveSemigroupInteger` : (\a -> a -> a -> a) integer = addInteger + ~`+` : all a. (\a -> a -> a -> a) a -> a -> a -> a + = /\a -> \(v : (\a -> a -> a -> a) a) -> v + ~v : integer -> integer -> integer + = `+` {integer} `$fAdditiveSemigroupInteger` +in +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b + = /\a b -> + \(f : a -> b -> b) -> let - !x : integer = x + !f : a -> b -> b = f in - \(y : integer) -> let !y : integer = y in addInteger x y - ~`$fAdditiveSemigroupInteger` : (\a -> a -> a -> a) integer = addInteger - ~`+` : all a. (\a -> a -> a -> a) a -> a -> a -> a - = /\a -> \(v : (\a -> a -> a -> a) a) -> v - ~v : integer -> integer -> integer - = `+` {integer} `$fAdditiveSemigroupInteger` - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b - = /\a b -> - \(f : a -> b -> b) -> + \(z : b) -> let - !f : a -> b -> b = f - in - \(z : b) -> - let - !z : b = z - in - letrec - ~go : List a -> b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. b} - (/\dead -> z) - (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) - {all dead. dead} - in - \(eta : List a) -> go eta - ~`$fFunctorList_$cfmap` : all a b. (a -> b) -> List a -> List b - = /\a b -> - \(f : a -> b) -> - let - !f : a -> b = f - in - letrec - ~go : List a -> List b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. List b} - (/\dead -> Nil {b}) - (\(x : a) (xs : List a) -> - /\dead -> Cons {b} (f x) (go xs)) - {all dead. dead} - in - \(eta : List a) -> go eta - data (Applicative :: (* -> *) -> *) (f :: * -> *) | Applicative_match where - CConsApplicative : - (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f -> - (all a. a -> f a) -> - (all a b. f (a -> b) -> f a -> f b) -> - Applicative f - ~`$p1Applicative` : - all (f :: * -> *). - Applicative f -> (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f - = /\(f :: * -> *) -> - \(v : Applicative f) -> - Applicative_match - {f} - v - {(\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) - (v : all a. a -> f a) - (v : all a b. f (a -> b) -> f a -> f b) -> - v) - ~`<*>` : - all (f :: * -> *). Applicative f -> (all a b. f (a -> b) -> f a -> f b) - = /\(f :: * -> *) -> - \(v : Applicative f) -> - Applicative_match - {f} - v - {all a b. f (a -> b) -> f a -> f b} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) - (v : all a. a -> f a) - (v : all a b. f (a -> b) -> f a -> f b) -> - v) - ~pure : all (f :: * -> *). Applicative f -> (all a. a -> f a) - = /\(f :: * -> *) -> - \(v : Applicative f) -> - Applicative_match - {f} - v - {all a. a -> f a} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) - (v : all a. a -> f a) - (v : all a b. f (a -> b) -> f a -> f b) -> - v) - ~`$fTraversableList_$ctraverse` : - all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> List a -> f (List b) - = /\(f :: * -> *) a b -> - \(`$dApplicative` : Applicative f) (f : a -> f b) -> - let - !f : a -> f b = f + !z : b = z in letrec - ~go : List a -> f (List b) + ~go : List a -> b = \(ds : List a) -> List_match {a} ds - {all dead. f (List b)} - (/\dead -> pure {f} `$dApplicative` {List b} (Nil {b})) - (\(x : a) (xs : List a) -> - /\dead -> - let - !x : f b = f x - in - `<*>` - {f} - `$dApplicative` - {List b} - {List b} - (`$p1Applicative` - {f} - `$dApplicative` - {b} - {List b -> List b} - (\(ds : b) (ds : List b) -> Cons {b} ds ds) - x) - (go xs)) + {all dead. b} + (/\dead -> z) + (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) {all dead. dead} in \(eta : List a) -> go eta - data (Traversable :: (* -> *) -> *) (t :: * -> *) | Traversable_match where - CConsTraversable : - (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t -> - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> - (all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> t a -> f (t b)) -> - Traversable t - ~`$fTraversableList` : Traversable List - = CConsTraversable - {List} - `$fFunctorList_$cfmap` - `$fFoldableList_$cfoldr` - `$fTraversableList_$ctraverse` - ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a - = /\a -> - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) - ~`$fApplicativeIdentity_$cpure` : all a. a -> (\a -> a) a - = /\a -> \(ds : a) -> ds - ~id : all a. a -> a = /\a -> \(x : a) -> x - ~`$fApplicativeIdentity` : Applicative (\a -> a) - = CConsApplicative - {\a -> a} - (/\a b -> id {a -> b}) - `$fApplicativeIdentity_$cpure` - (/\a b -> id {a -> b}) - ~traverse : - all (t :: * -> *). - Traversable t -> - (all (f :: * -> *) a b. Applicative f -> (a -> f b) -> t a -> f (t b)) - = /\(t :: * -> *) -> - \(v : Traversable t) -> - Traversable_match - {t} - v - {all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> t a -> f (t b)} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t) - (v : - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) - t) - (v : - all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> t a -> f (t b)) -> - v) - ~fmapDefault : - all (t :: * -> *) a b. Traversable t -> (a -> b) -> t a -> t b - = /\(t :: * -> *) a b -> - \(`$dTraversable` : Traversable t) -> - traverse - {t} - `$dTraversable` - {\a -> a} - {a} - {b} - `$fApplicativeIdentity` - in - fmapDefault - {List} - {integer} - {integer} - `$fTraversableList` - (\(v : integer) -> v v v) - (build - {integer} - (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 (c 2 (c 3 (c 4 n)))))) \ No newline at end of file + ~`$fFunctorList_$cfmap` : all a b. (a -> b) -> List a -> List b + = /\a b -> + \(f : a -> b) -> + let + !f : a -> b = f + in + letrec + ~go : List a -> List b + = \(ds : List a) -> + List_match + {a} + ds + {all dead. List b} + (/\dead -> Nil {b}) + (\(x : a) (xs : List a) -> /\dead -> Cons {b} (f x) (go xs)) + {all dead. dead} + in + \(eta : List a) -> go eta + data (Applicative :: (* -> *) -> *) (f :: * -> *) | Applicative_match where + CConsApplicative : + (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f -> + (all a. a -> f a) -> + (all a b. f (a -> b) -> f a -> f b) -> + Applicative f + ~`$p1Applicative` : + all (f :: * -> *). + Applicative f -> (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f + = /\(f :: * -> *) -> + \(v : Applicative f) -> + Applicative_match + {f} + v + {(\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) + (v : all a. a -> f a) + (v : all a b. f (a -> b) -> f a -> f b) -> + v) + ~`<*>` : + all (f :: * -> *). Applicative f -> (all a b. f (a -> b) -> f a -> f b) + = /\(f :: * -> *) -> + \(v : Applicative f) -> + Applicative_match + {f} + v + {all a b. f (a -> b) -> f a -> f b} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) + (v : all a. a -> f a) + (v : all a b. f (a -> b) -> f a -> f b) -> + v) + ~pure : all (f :: * -> *). Applicative f -> (all a. a -> f a) + = /\(f :: * -> *) -> + \(v : Applicative f) -> + Applicative_match + {f} + v + {all a. a -> f a} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) + (v : all a. a -> f a) + (v : all a b. f (a -> b) -> f a -> f b) -> + v) + ~`$fTraversableList_$ctraverse` : + all (f :: * -> *) a b. Applicative f -> (a -> f b) -> List a -> f (List b) + = /\(f :: * -> *) a b -> + \(`$dApplicative` : Applicative f) (f : a -> f b) -> + let + !f : a -> f b = f + in + letrec + ~go : List a -> f (List b) + = \(ds : List a) -> + List_match + {a} + ds + {all dead. f (List b)} + (/\dead -> pure {f} `$dApplicative` {List b} (Nil {b})) + (\(x : a) (xs : List a) -> + /\dead -> + let + !x : f b = f x + in + `<*>` + {f} + `$dApplicative` + {List b} + {List b} + (`$p1Applicative` + {f} + `$dApplicative` + {b} + {List b -> List b} + (\(ds : b) (ds : List b) -> Cons {b} ds ds) + x) + (go xs)) + {all dead. dead} + in + \(eta : List a) -> go eta + data (Traversable :: (* -> *) -> *) (t :: * -> *) | Traversable_match where + CConsTraversable : + (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t -> + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> + (all (f :: * -> *) a b. Applicative f -> (a -> f b) -> t a -> f (t b)) -> + Traversable t + ~`$fTraversableList` : Traversable List + = CConsTraversable + {List} + `$fFunctorList_$cfmap` + `$fFoldableList_$cfoldr` + `$fTraversableList_$ctraverse` + ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a + = /\a -> + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) + ~`$fApplicativeIdentity_$cpure` : all a. a -> (\a -> a) a + = /\a -> \(ds : a) -> ds + ~id : all a. a -> a = /\a -> \(x : a) -> x + ~`$fApplicativeIdentity` : Applicative (\a -> a) + = CConsApplicative + {\a -> a} + (/\a b -> id {a -> b}) + `$fApplicativeIdentity_$cpure` + (/\a b -> id {a -> b}) + ~traverse : + all (t :: * -> *). + Traversable t -> + (all (f :: * -> *) a b. Applicative f -> (a -> f b) -> t a -> f (t b)) + = /\(t :: * -> *) -> + \(v : Traversable t) -> + Traversable_match + {t} + v + {all (f :: * -> *) a b. + Applicative f -> (a -> f b) -> t a -> f (t b)} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t) + (v : + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t) + (v : + all (f :: * -> *) a b. + Applicative f -> (a -> f b) -> t a -> f (t b)) -> + v) + ~fmapDefault : all (t :: * -> *) a b. Traversable t -> (a -> b) -> t a -> t b + = /\(t :: * -> *) a b -> + \(`$dTraversable` : Traversable t) -> + traverse {t} `$dTraversable` {\a -> a} {a} {b} `$fApplicativeIdentity` +in +fmapDefault + {List} + {integer} + {integer} + `$fTraversableList` + (\(v : integer) -> v v v) + (build + {integer} + (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 (c 2 (c 3 (c 4 n))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/multiFunction.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/multiFunction.pir.golden index 4dad97a8f09..1aec2f14641 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/multiFunction.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/multiFunction.pir.golden @@ -1,79 +1,77 @@ -program - 1.1.0 - (let - data Animal | Animal_match where - Cat : Animal - Dog : Animal - data Bool | Bool_match where - True : Bool - False : Bool - data (PersonLike :: * -> *) a | PersonLike_match where - CConsPersonLike : (a -> integer) -> (a -> Animal -> Bool) -> PersonLike a - ~age : all a. PersonLike a -> a -> integer - = /\a -> - \(v : PersonLike a) -> - PersonLike_match - {a} - v - {a -> integer} - (\(v : a -> integer) (v : a -> Animal -> Bool) -> v) - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - !lessThanInteger : integer -> integer -> bool = lessThanInteger - ~lessThanInteger : integer -> integer -> Bool - = \(x : integer) -> +let + data Animal | Animal_match where + Cat : Animal + Dog : Animal + data Bool | Bool_match where + True : Bool + False : Bool + data (PersonLike :: * -> *) a | PersonLike_match where + CConsPersonLike : (a -> integer) -> (a -> Animal -> Bool) -> PersonLike a + ~age : all a. PersonLike a -> a -> integer + = /\a -> + \(v : PersonLike a) -> + PersonLike_match + {a} + v + {a -> integer} + (\(v : a -> integer) (v : a -> Animal -> Bool) -> v) + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + !lessThanInteger : integer -> integer -> bool = lessThanInteger + ~lessThanInteger : integer -> integer -> Bool + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let - !x : integer = x + !y : integer = y + !b : bool = lessThanInteger x y in - \(y : integer) -> - let - !y : integer = y - !b : bool = lessThanInteger x y - in - ifThenElse {Bool} b True False - ~likesAnimal : all a. PersonLike a -> a -> Animal -> Bool - = /\a -> - \(v : PersonLike a) -> - PersonLike_match - {a} - v - {a -> Animal -> Bool} - (\(v : a -> integer) (v : a -> Animal -> Bool) -> v) - ~predicate : all p. PersonLike p -> p -> Bool - = /\p -> - \(`$dPersonLike` : PersonLike p) (p : p) -> - let - !p : p = p - in - Bool_match - (likesAnimal {p} `$dPersonLike` p Cat) - {all dead. Bool} - (/\dead -> lessThanInteger (age {p} `$dPersonLike` p) 30) - (/\dead -> False) - {all dead. dead} - data Person | Person_match where - Jane : Person - Jim : Person - ~`$cage` : Person -> integer - = \(ds : Person) -> Person_match ds {integer} 35 30 - ~`$clikesAnimal` : Person -> Animal -> Bool - = \(ds : Person) (ds : Animal) -> - Person_match - ds + ifThenElse {Bool} b True False + ~likesAnimal : all a. PersonLike a -> a -> Animal -> Bool + = /\a -> + \(v : PersonLike a) -> + PersonLike_match + {a} + v + {a -> Animal -> Bool} + (\(v : a -> integer) (v : a -> Animal -> Bool) -> v) + ~predicate : all p. PersonLike p -> p -> Bool + = /\p -> + \(`$dPersonLike` : PersonLike p) (p : p) -> + let + !p : p = p + in + Bool_match + (likesAnimal {p} `$dPersonLike` p Cat) {all dead. Bool} - (/\dead -> - Animal_match - ds - {all dead. Bool} - (/\dead -> True) - (/\dead -> False) - {all dead. dead}) + (/\dead -> lessThanInteger (age {p} `$dPersonLike` p) 30) (/\dead -> False) {all dead. dead} - ~`$fPersonLikePerson` : PersonLike Person - = CConsPersonLike {Person} `$cage` `$clikesAnimal` + data Person | Person_match where + Jane : Person + Jim : Person + ~`$cage` : Person -> integer + = \(ds : Person) -> Person_match ds {integer} 35 30 + ~`$clikesAnimal` : Person -> Animal -> Bool + = \(ds : Person) (ds : Animal) -> + Person_match + ds + {all dead. Bool} + (/\dead -> + Animal_match + ds + {all dead. Bool} + (/\dead -> True) + (/\dead -> False) + {all dead. dead}) + (/\dead -> False) + {all dead. dead} + ~`$fPersonLikePerson` : PersonLike Person + = CConsPersonLike {Person} `$cage` `$clikesAnimal` +in +\(ds : Person) -> + let + !ds : Person = ds in - \(ds : Person) -> - let - !ds : Person = ds - in - predicate {Person} `$fPersonLikePerson` ds) \ No newline at end of file + predicate {Person} `$fPersonLikePerson` ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/partialApplication.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/partialApplication.pir.golden index 23bb296c13c..34b7ddd4f9d 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/partialApplication.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/partialApplication.pir.golden @@ -1,40 +1,38 @@ -program - 1.1.0 - (let - data Bool | Bool_match where - True : Bool - False : Bool - data Ordering | Ordering_match where - EQ : Ordering - GT : Ordering - LT : Ordering - !equalsInteger : integer -> integer -> bool = equalsInteger - !ifThenElse : all a. bool -> a -> a -> a = ifThenElse - !lessThanEqualsInteger : integer -> integer -> bool = lessThanEqualsInteger - ~`$fOrdInteger_$ccompare` : integer -> integer -> Ordering - = \(eta : integer) -> +let + data Bool | Bool_match where + True : Bool + False : Bool + data Ordering | Ordering_match where + EQ : Ordering + GT : Ordering + LT : Ordering + !equalsInteger : integer -> integer -> bool = equalsInteger + !ifThenElse : all a. bool -> a -> a -> a = ifThenElse + !lessThanEqualsInteger : integer -> integer -> bool = lessThanEqualsInteger + ~`$fOrdInteger_$ccompare` : integer -> integer -> Ordering + = \(eta : integer) -> + let + !x : integer = eta + in + \(eta : integer) -> let - !x : integer = eta + !y : integer = eta + !b : bool = equalsInteger x y in - \(eta : integer) -> - let - !y : integer = eta - !b : bool = equalsInteger x y - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. Ordering} - (/\dead -> EQ) - (/\dead -> - let - !b : bool = lessThanEqualsInteger x y - in - Bool_match - (ifThenElse {Bool} b True False) - {all dead. Ordering} - (/\dead -> LT) - (/\dead -> GT) - {all dead. dead}) - {all dead. dead} - in - `$fOrdInteger_$ccompare`) \ No newline at end of file + Bool_match + (ifThenElse {Bool} b True False) + {all dead. Ordering} + (/\dead -> EQ) + (/\dead -> + let + !b : bool = lessThanEqualsInteger x y + in + Bool_match + (ifThenElse {Bool} b True False) + {all dead. Ordering} + (/\dead -> LT) + (/\dead -> GT) + {all dead. dead}) + {all dead. dead} +in +`$fOrdInteger_$ccompare` \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sequenceTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sequenceTest.pir.golden index 1c30e916b20..ec622a29857 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sequenceTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sequenceTest.pir.golden @@ -1,236 +1,222 @@ -program - 1.1.0 - (let - data (Maybe :: * -> *) a | Maybe_match where - Just : a -> Maybe a - Nothing : Maybe a - ~`$fApplicativeMaybe_$c<*>` : all a b. Maybe (a -> b) -> Maybe a -> Maybe b - = /\a b -> - \(ds : Maybe (a -> b)) (ds : Maybe a) -> +let + data (Maybe :: * -> *) a | Maybe_match where + Just : a -> Maybe a + Nothing : Maybe a + ~`$fApplicativeMaybe_$c<*>` : all a b. Maybe (a -> b) -> Maybe a -> Maybe b + = /\a b -> + \(ds : Maybe (a -> b)) (ds : Maybe a) -> + Maybe_match + {a -> b} + ds + {all dead. Maybe b} + (\(ipv : a -> b) -> + /\dead -> + Maybe_match + {a} + ds + {all dead. Maybe b} + (\(ipv : a) -> /\dead -> Just {b} (ipv ipv)) + (/\dead -> Nothing {b}) + {all dead. dead}) + (/\dead -> Nothing {b}) + {all dead. dead} + ~`$fApplicativeMaybe_$cpure` : all a. a -> Maybe a + = /\a -> \(ds : a) -> Just {a} ds + ~`$fFunctorMaybe_$cfmap` : all a b. (a -> b) -> Maybe a -> Maybe b + = /\a b -> + \(f : a -> b) -> + let + !f : a -> b = f + in + \(ds : Maybe a) -> Maybe_match - {a -> b} + {a} ds {all dead. Maybe b} - (\(ipv : a -> b) -> - /\dead -> - Maybe_match - {a} - ds - {all dead. Maybe b} - (\(ipv : a) -> /\dead -> Just {b} (ipv ipv)) - (/\dead -> Nothing {b}) - {all dead. dead}) + (\(a : a) -> /\dead -> Just {b} (f a)) (/\dead -> Nothing {b}) {all dead. dead} - ~`$fApplicativeMaybe_$cpure` : all a. a -> Maybe a - = /\a -> \(ds : a) -> Just {a} ds - ~`$fFunctorMaybe_$cfmap` : all a b. (a -> b) -> Maybe a -> Maybe b - = /\a b -> - \(f : a -> b) -> - let - !f : a -> b = f - in - \(ds : Maybe a) -> - Maybe_match - {a} - ds - {all dead. Maybe b} - (\(a : a) -> /\dead -> Just {b} (f a)) - (/\dead -> Nothing {b}) - {all dead. dead} - data (Applicative :: (* -> *) -> *) (f :: * -> *) | Applicative_match where - CConsApplicative : - (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f -> - (all a. a -> f a) -> - (all a b. f (a -> b) -> f a -> f b) -> - Applicative f - ~`$fApplicativeMaybe` : Applicative Maybe - = CConsApplicative - {Maybe} - `$fFunctorMaybe_$cfmap` - `$fApplicativeMaybe_$cpure` - `$fApplicativeMaybe_$c<*>` - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b - = /\a b -> - \(f : a -> b -> b) -> - let - !f : a -> b -> b = f - in - \(z : b) -> - let - !z : b = z - in - letrec - ~go : List a -> b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. b} - (/\dead -> z) - (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) - {all dead. dead} - in - \(eta : List a) -> go eta - ~`$fFunctorList_$cfmap` : all a b. (a -> b) -> List a -> List b - = /\a b -> - \(f : a -> b) -> - let - !f : a -> b = f - in - letrec - ~go : List a -> List b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. List b} - (/\dead -> Nil {b}) - (\(x : a) (xs : List a) -> - /\dead -> Cons {b} (f x) (go xs)) - {all dead. dead} - in - \(eta : List a) -> go eta - ~`$p1Applicative` : - all (f :: * -> *). - Applicative f -> (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f - = /\(f :: * -> *) -> - \(v : Applicative f) -> - Applicative_match - {f} - v - {(\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) - (v : all a. a -> f a) - (v : all a b. f (a -> b) -> f a -> f b) -> - v) - ~`<*>` : - all (f :: * -> *). Applicative f -> (all a b. f (a -> b) -> f a -> f b) - = /\(f :: * -> *) -> - \(v : Applicative f) -> - Applicative_match - {f} - v - {all a b. f (a -> b) -> f a -> f b} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) - (v : all a. a -> f a) - (v : all a b. f (a -> b) -> f a -> f b) -> - v) - ~pure : all (f :: * -> *). Applicative f -> (all a. a -> f a) - = /\(f :: * -> *) -> - \(v : Applicative f) -> - Applicative_match - {f} - v - {all a. a -> f a} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) - (v : all a. a -> f a) - (v : all a b. f (a -> b) -> f a -> f b) -> - v) - ~`$fTraversableList_$ctraverse` : - all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> List a -> f (List b) - = /\(f :: * -> *) a b -> - \(`$dApplicative` : Applicative f) (f : a -> f b) -> + data (Applicative :: (* -> *) -> *) (f :: * -> *) | Applicative_match where + CConsApplicative : + (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f -> + (all a. a -> f a) -> + (all a b. f (a -> b) -> f a -> f b) -> + Applicative f + ~`$fApplicativeMaybe` : Applicative Maybe + = CConsApplicative + {Maybe} + `$fFunctorMaybe_$cfmap` + `$fApplicativeMaybe_$cpure` + `$fApplicativeMaybe_$c<*>` +in +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b + = /\a b -> + \(f : a -> b -> b) -> + let + !f : a -> b -> b = f + in + \(z : b) -> let - !f : a -> f b = f + !z : b = z in letrec - ~go : List a -> f (List b) + ~go : List a -> b = \(ds : List a) -> List_match {a} ds - {all dead. f (List b)} - (/\dead -> pure {f} `$dApplicative` {List b} (Nil {b})) - (\(x : a) (xs : List a) -> - /\dead -> - let - !x : f b = f x - in - `<*>` - {f} - `$dApplicative` - {List b} - {List b} - (`$p1Applicative` - {f} - `$dApplicative` - {b} - {List b -> List b} - (\(ds : b) (ds : List b) -> Cons {b} ds ds) - x) - (go xs)) + {all dead. b} + (/\dead -> z) + (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) {all dead. dead} in \(eta : List a) -> go eta - data (Traversable :: (* -> *) -> *) (t :: * -> *) | Traversable_match where - CConsTraversable : - (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t -> - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> - (all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> t a -> f (t b)) -> - Traversable t - ~`$fTraversableList` : Traversable List - = CConsTraversable - {List} - `$fFunctorList_$cfmap` - `$fFoldableList_$cfoldr` - `$fTraversableList_$ctraverse` - ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a - = /\a -> - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) - ~id : all a. a -> a = /\a -> \(x : a) -> x - ~traverse : - all (t :: * -> *). - Traversable t -> - (all (f :: * -> *) a b. Applicative f -> (a -> f b) -> t a -> f (t b)) - = /\(t :: * -> *) -> - \(v : Traversable t) -> - Traversable_match - {t} - v - {all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> t a -> f (t b)} - (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t) - (v : - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) - t) - (v : - all (f :: * -> *) a b. - Applicative f -> (a -> f b) -> t a -> f (t b)) -> - v) - ~sequence : - all (t :: * -> *) (f :: * -> *) a. - Traversable t -> Applicative f -> t (f a) -> f (t a) - = /\(t :: * -> *) (f :: * -> *) a -> - \(`$dTraversable` : Traversable t) - (`$dApplicative` : Applicative f) -> - traverse - {t} - `$dTraversable` - {f} - {f a} - {a} - `$dApplicative` - (id {f a}) - in - sequence - {List} - {Maybe} - {integer} - `$fTraversableList` - `$fApplicativeMaybe` - (build - {Maybe integer} - (/\a -> - \(c : Maybe integer -> a -> a) (n : a) -> - c (Just {integer} 1) (c (Just {integer} 2) n)))) \ No newline at end of file + ~`$fFunctorList_$cfmap` : all a b. (a -> b) -> List a -> List b + = /\a b -> + \(f : a -> b) -> + let + !f : a -> b = f + in + letrec + ~go : List a -> List b + = \(ds : List a) -> + List_match + {a} + ds + {all dead. List b} + (/\dead -> Nil {b}) + (\(x : a) (xs : List a) -> /\dead -> Cons {b} (f x) (go xs)) + {all dead. dead} + in + \(eta : List a) -> go eta + ~`$p1Applicative` : + all (f :: * -> *). + Applicative f -> (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f + = /\(f :: * -> *) -> + \(v : Applicative f) -> + Applicative_match + {f} + v + {(\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) + (v : all a. a -> f a) + (v : all a b. f (a -> b) -> f a -> f b) -> + v) + ~`<*>` : + all (f :: * -> *). Applicative f -> (all a b. f (a -> b) -> f a -> f b) + = /\(f :: * -> *) -> + \(v : Applicative f) -> + Applicative_match + {f} + v + {all a b. f (a -> b) -> f a -> f b} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) + (v : all a. a -> f a) + (v : all a b. f (a -> b) -> f a -> f b) -> + v) + ~pure : all (f :: * -> *). Applicative f -> (all a. a -> f a) + = /\(f :: * -> *) -> + \(v : Applicative f) -> + Applicative_match + {f} + v + {all a. a -> f a} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) f) + (v : all a. a -> f a) + (v : all a b. f (a -> b) -> f a -> f b) -> + v) + ~`$fTraversableList_$ctraverse` : + all (f :: * -> *) a b. Applicative f -> (a -> f b) -> List a -> f (List b) + = /\(f :: * -> *) a b -> + \(`$dApplicative` : Applicative f) (f : a -> f b) -> + let + !f : a -> f b = f + in + letrec + ~go : List a -> f (List b) + = \(ds : List a) -> + List_match + {a} + ds + {all dead. f (List b)} + (/\dead -> pure {f} `$dApplicative` {List b} (Nil {b})) + (\(x : a) (xs : List a) -> + /\dead -> + let + !x : f b = f x + in + `<*>` + {f} + `$dApplicative` + {List b} + {List b} + (`$p1Applicative` + {f} + `$dApplicative` + {b} + {List b -> List b} + (\(ds : b) (ds : List b) -> Cons {b} ds ds) + x) + (go xs)) + {all dead. dead} + in + \(eta : List a) -> go eta + data (Traversable :: (* -> *) -> *) (t :: * -> *) | Traversable_match where + CConsTraversable : + (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t -> + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> + (all (f :: * -> *) a b. Applicative f -> (a -> f b) -> t a -> f (t b)) -> + Traversable t + ~`$fTraversableList` : Traversable List + = CConsTraversable + {List} + `$fFunctorList_$cfmap` + `$fFoldableList_$cfoldr` + `$fTraversableList_$ctraverse` + ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a + = /\a -> + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) + ~id : all a. a -> a = /\a -> \(x : a) -> x + ~traverse : + all (t :: * -> *). + Traversable t -> + (all (f :: * -> *) a b. Applicative f -> (a -> f b) -> t a -> f (t b)) + = /\(t :: * -> *) -> + \(v : Traversable t) -> + Traversable_match + {t} + v + {all (f :: * -> *) a b. + Applicative f -> (a -> f b) -> t a -> f (t b)} + (\(v : (\(f :: * -> *) -> all a b. (a -> b) -> f a -> f b) t) + (v : + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t) + (v : + all (f :: * -> *) a b. + Applicative f -> (a -> f b) -> t a -> f (t b)) -> + v) + ~sequence : + all (t :: * -> *) (f :: * -> *) a. + Traversable t -> Applicative f -> t (f a) -> f (t a) + = /\(t :: * -> *) (f :: * -> *) a -> + \(`$dTraversable` : Traversable t) (`$dApplicative` : Applicative f) -> + traverse {t} `$dTraversable` {f} {f a} {a} `$dApplicative` (id {f a}) +in +sequence + {List} + {Maybe} + {integer} + `$fTraversableList` + `$fApplicativeMaybe` + (build + {Maybe integer} + (/\a -> + \(c : Maybe integer -> a -> a) (n : a) -> + c (Just {integer} 1) (c (Just {integer} 2) n))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedBasic.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedBasic.pir.golden index a7c54e1ad50..09ef8230c5f 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedBasic.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedBasic.pir.golden @@ -1,13 +1,7 @@ -program - 1.1.0 - (let - ~`$csize` : integer -> integer = \(x : integer) -> x - ~`$fSizedInteger` : (\a -> a -> integer) integer = `$csize` - ~size : all a. (\a -> a -> integer) a -> a -> integer - = /\a -> \(v : (\a -> a -> integer) a) -> v - in - \(ds : integer) -> - let - !ds : integer = ds - in - size {integer} `$fSizedInteger` ds) \ No newline at end of file +let + ~`$csize` : integer -> integer = \(x : integer) -> x + ~`$fSizedInteger` : (\a -> a -> integer) integer = `$csize` + ~size : all a. (\a -> a -> integer) a -> a -> integer + = /\a -> \(v : (\a -> a -> integer) a) -> v +in +\(ds : integer) -> let !ds : integer = ds in size {integer} `$fSizedInteger` ds \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedPair.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedPair.pir.golden index af12b31b5e0..17c98d88022 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedPair.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sizedPair.pir.golden @@ -1,52 +1,44 @@ -program - 1.1.0 - (let - data (Tuple2 :: * -> * -> *) a b | Tuple2_match where - Tuple2 : a -> b -> Tuple2 a b - !addInteger : integer -> integer -> integer = addInteger - ~`$csize` : - all a b. - (\a -> a -> integer) a -> - (\a -> a -> integer) b -> - Tuple2 a b -> - integer - = /\a b -> - \(`$dSized` : (\a -> a -> integer) a) - (`$dSized` : (\a -> a -> integer) b) - (ds : Tuple2 a b) -> - Tuple2_match - {a} - {b} - ds - {integer} - (\(a : a) (b : b) -> - let - !x : integer = `$dSized` a - !y : integer = `$dSized` b - in - addInteger x y) - ~`$fSizedTuple2` : - all a b. - (\a -> a -> integer) a -> - (\a -> a -> integer) b -> - (\a -> a -> integer) (Tuple2 a b) - = `$csize` - ~`$csize` : integer -> integer = \(x : integer) -> x - ~`$fSizedInteger` : (\a -> a -> integer) integer = `$csize` - ~`$dSized` : (\a -> a -> integer) (Tuple2 integer integer) - = `$fSizedTuple2` {integer} {integer} `$fSizedInteger` `$fSizedInteger` - ~size : all a. (\a -> a -> integer) a -> a -> integer - = /\a -> \(v : (\a -> a -> integer) a) -> v +let + data (Tuple2 :: * -> * -> *) a b | Tuple2_match where + Tuple2 : a -> b -> Tuple2 a b + !addInteger : integer -> integer -> integer = addInteger + ~`$csize` : + all a b. + (\a -> a -> integer) a -> (\a -> a -> integer) b -> Tuple2 a b -> integer + = /\a b -> + \(`$dSized` : (\a -> a -> integer) a) + (`$dSized` : (\a -> a -> integer) b) + (ds : Tuple2 a b) -> + Tuple2_match + {a} + {b} + ds + {integer} + (\(a : a) (b : b) -> + let + !x : integer = `$dSized` a + !y : integer = `$dSized` b + in + addInteger x y) + ~`$fSizedTuple2` : + all a b. + (\a -> a -> integer) a -> + (\a -> a -> integer) b -> + (\a -> a -> integer) (Tuple2 a b) + = `$csize` + ~`$csize` : integer -> integer = \(x : integer) -> x + ~`$fSizedInteger` : (\a -> a -> integer) integer = `$csize` + ~`$dSized` : (\a -> a -> integer) (Tuple2 integer integer) + = `$fSizedTuple2` {integer} {integer} `$fSizedInteger` `$fSizedInteger` + ~size : all a. (\a -> a -> integer) a -> a -> integer + = /\a -> \(v : (\a -> a -> integer) a) -> v +in +\(ds : integer) -> + let + !ds : integer = ds in \(ds : integer) -> let !ds : integer = ds in - \(ds : integer) -> - let - !ds : integer = ds - in - size - {Tuple2 integer integer} - `$dSized` - (Tuple2 {integer} {integer} ds ds)) \ No newline at end of file + size {Tuple2 integer integer} `$dSized` (Tuple2 {integer} {integer} ds ds) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sumTest.pir.golden b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sumTest.pir.golden index 59c4302fcbd..dea384bcb8e 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sumTest.pir.golden +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/9.6/sumTest.pir.golden @@ -1,94 +1,89 @@ -program - 1.1.0 - (let - ~`$fAdditiveMonoidInteger_$czero` : integer = 0 - !addInteger : integer -> integer -> integer = addInteger - ~addInteger : integer -> integer -> integer - = \(x : integer) -> +let + ~`$fAdditiveMonoidInteger_$czero` : integer = 0 + !addInteger : integer -> integer -> integer = addInteger + ~addInteger : integer -> integer -> integer + = \(x : integer) -> + let + !x : integer = x + in + \(y : integer) -> let !y : integer = y in addInteger x y + data (AdditiveMonoid :: * -> *) a | AdditiveMonoid_match where + CConsAdditiveMonoid : (\a -> a -> a -> a) a -> a -> AdditiveMonoid a + ~`$fAdditiveMonoidInteger` : AdditiveMonoid integer + = CConsAdditiveMonoid {integer} addInteger `$fAdditiveMonoidInteger_$czero` +in +letrec + data (List :: * -> *) a | List_match where + Nil : List a + Cons : a -> List a -> List a +in +let + ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b + = /\a b -> + \(f : a -> b -> b) -> let - !x : integer = x + !f : a -> b -> b = f in - \(y : integer) -> let !y : integer = y in addInteger x y - data (AdditiveMonoid :: * -> *) a | AdditiveMonoid_match where - CConsAdditiveMonoid : (\a -> a -> a -> a) a -> a -> AdditiveMonoid a - ~`$fAdditiveMonoidInteger` : AdditiveMonoid integer - = CConsAdditiveMonoid - {integer} - addInteger - `$fAdditiveMonoidInteger_$czero` - in - letrec - data (List :: * -> *) a | List_match where - Nil : List a - Cons : a -> List a -> List a - in - let - ~`$fFoldableList_$cfoldr` : all a b. (a -> b -> b) -> b -> List a -> b - = /\a b -> - \(f : a -> b -> b) -> + \(z : b) -> let - !f : a -> b -> b = f + !z : b = z in - \(z : b) -> - let - !z : b = z - in - letrec - ~go : List a -> b - = \(ds : List a) -> - List_match - {a} - ds - {all dead. b} - (/\dead -> z) - (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) - {all dead. dead} - in - \(eta : List a) -> go eta - ~`$fFoldableList` : - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) List - = `$fFoldableList_$cfoldr` - ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a - = /\a -> - \(g : all b. (a -> b -> b) -> b -> b) -> - g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) - ~`$p1AdditiveMonoid` : all a. AdditiveMonoid a -> (\a -> a -> a -> a) a - = /\a -> - \(v : AdditiveMonoid a) -> - AdditiveMonoid_match - {a} - v - {(\a -> a -> a -> a) a} - (\(v : (\a -> a -> a -> a) a) (v : a) -> v) - ~zero : all a. AdditiveMonoid a -> a - = /\a -> - \(v : AdditiveMonoid a) -> - AdditiveMonoid_match - {a} - v - {a} - (\(v : (\a -> a -> a -> a) a) (v : a) -> v) - ~sum : - all (t :: * -> *) a. - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> - AdditiveMonoid a -> - t a -> - a - = /\(t :: * -> *) a -> - \(`$dFoldable` : - (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t) - (`$dAdditiveMonoid` : AdditiveMonoid a) -> - `$dFoldable` - {a} - {a} - (`$p1AdditiveMonoid` {a} `$dAdditiveMonoid`) - (zero {a} `$dAdditiveMonoid`) - in - sum - {List} - {integer} - `$fFoldableList` - `$fAdditiveMonoidInteger` - (build - {integer} - (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 (c 2 (c 3 (c 4 n)))))) \ No newline at end of file + letrec + ~go : List a -> b + = \(ds : List a) -> + List_match + {a} + ds + {all dead. b} + (/\dead -> z) + (\(x : a) (xs : List a) -> /\dead -> f x (go xs)) + {all dead. dead} + in + \(eta : List a) -> go eta + ~`$fFoldableList` : + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) List + = `$fFoldableList_$cfoldr` + ~build : all a. (all b. (a -> b -> b) -> b -> b) -> List a + = /\a -> + \(g : all b. (a -> b -> b) -> b -> b) -> + g {List a} (\(ds : a) (ds : List a) -> Cons {a} ds ds) (Nil {a}) + ~`$p1AdditiveMonoid` : all a. AdditiveMonoid a -> (\a -> a -> a -> a) a + = /\a -> + \(v : AdditiveMonoid a) -> + AdditiveMonoid_match + {a} + v + {(\a -> a -> a -> a) a} + (\(v : (\a -> a -> a -> a) a) (v : a) -> v) + ~zero : all a. AdditiveMonoid a -> a + = /\a -> + \(v : AdditiveMonoid a) -> + AdditiveMonoid_match + {a} + v + {a} + (\(v : (\a -> a -> a -> a) a) (v : a) -> v) + ~sum : + all (t :: * -> *) a. + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t -> + AdditiveMonoid a -> + t a -> + a + = /\(t :: * -> *) a -> + \(`$dFoldable` : + (\(t :: * -> *) -> all a b. (a -> b -> b) -> b -> t a -> b) t) + (`$dAdditiveMonoid` : AdditiveMonoid a) -> + `$dFoldable` + {a} + {a} + (`$p1AdditiveMonoid` {a} `$dAdditiveMonoid`) + (zero {a} `$dAdditiveMonoid`) +in +sum + {List} + {integer} + `$fFoldableList` + `$fAdditiveMonoidInteger` + (build + {integer} + (/\a -> \(c : integer -> a -> a) (n : a) -> c 1 (c 2 (c 3 (c 4 n))))) \ No newline at end of file diff --git a/plutus-tx-plugin/test/Plugin/Typeclasses/Spec.hs b/plutus-tx-plugin/test/Plugin/Typeclasses/Spec.hs index cfcd91b7095..b6199613054 100644 --- a/plutus-tx-plugin/test/Plugin/Typeclasses/Spec.hs +++ b/plutus-tx-plugin/test/Plugin/Typeclasses/Spec.hs @@ -28,16 +28,16 @@ import Data.Proxy typeclasses :: TestNested typeclasses = testNested "Typeclasses" . pure $ testNestedGhc - [ goldenPir "sizedBasic" sizedBasic - , goldenPir "sizedPair" sizedPair - , goldenPir "multiFunction" multiFunction - , goldenPir "defaultMethods" defaultMethods - , goldenPir "partialApplication" partialApplication - , goldenPir "sequenceTest" sequenceTest - , goldenPir "compareTest" compareTest - , goldenPir "concatTest" concatTest - , goldenPir "sumTest" sumTest - , goldenPir "fmapDefaultTest" fmapDefaultTest + [ goldenPirReadable "sizedBasic" sizedBasic + , goldenPirReadable "sizedPair" sizedPair + , goldenPirReadable "multiFunction" multiFunction + , goldenPirReadable "defaultMethods" defaultMethods + , goldenPirReadable "partialApplication" partialApplication + , goldenPirReadable "sequenceTest" sequenceTest + , goldenPirReadable "compareTest" compareTest + , goldenPirReadable "concatTest" concatTest + , goldenPirReadable "sumTest" sumTest + , goldenPirReadable "fmapDefaultTest" fmapDefaultTest ] class Sized a where diff --git a/plutus-tx-plugin/test/StdLib/9.6/errorTrace.pir.golden b/plutus-tx-plugin/test/StdLib/9.6/errorTrace.pir.golden index b0adcc556ce..d424f796f68 100644 --- a/plutus-tx-plugin/test/StdLib/9.6/errorTrace.pir.golden +++ b/plutus-tx-plugin/test/StdLib/9.6/errorTrace.pir.golden @@ -1,18 +1,16 @@ -program - 1.1.0 - (let - data Unit | Unit_match where - Unit : Unit - !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} - !trace : all a. string -> a -> a = trace - !unitval : unit = () - ~traceError : all a. string -> a - = /\a -> - \(str : string) -> - let - !str : string = str - !x : Unit = trace {Unit} str Unit - in - error {a} unitval - in - traceError {integer} "") \ No newline at end of file +let + data Unit | Unit_match where + Unit : Unit + !error : all a. unit -> a = /\a -> \(thunk : unit) -> error {a} + !trace : all a. string -> a -> a = trace + !unitval : unit = () + ~traceError : all a. string -> a + = /\a -> + \(str : string) -> + let + !str : string = str + !x : Unit = trace {Unit} str Unit + in + error {a} unitval +in +traceError {integer} "" \ No newline at end of file diff --git a/plutus-tx-plugin/test/StdLib/Spec.hs b/plutus-tx-plugin/test/StdLib/Spec.hs index 0057ab7d3c1..86d655681c4 100644 --- a/plutus-tx-plugin/test/StdLib/Spec.hs +++ b/plutus-tx-plugin/test/StdLib/Spec.hs @@ -35,7 +35,7 @@ import PlutusTx.Ord qualified as PlutusTx import PlutusTx.Plugin (plc) import PlutusTx.Prelude qualified as PlutusTx import PlutusTx.Ratio qualified as Ratio -import PlutusTx.Test (goldenPir) +import PlutusTx.Test (goldenPirReadable) import Test.Tasty (TestName, TestTree) import Test.Tasty.Hedgehog (testPropertyNamed) import Test.Tasty.HUnit (assertFailure, testCase, (@?=)) @@ -54,7 +54,7 @@ tests = , embed $ testPropertyNamed "divMod" "testDivMod" testDivMod , embed $ testPropertyNamed "quotRem" "testQuotRem" testQuotRem , embed $ testPropertyNamed "Eq @Data" "eqData" eqData - , goldenPir "errorTrace" errorTrace + , goldenPirReadable "errorTrace" errorTrace ] -- We really should use something like "Control.Exception.Enclosed" here and in other similar diff --git a/plutus-tx/testlib/PlutusTx/Test.hs b/plutus-tx/testlib/PlutusTx/Test.hs index edc247bf3b2..16cdadbb60f 100644 --- a/plutus-tx/testlib/PlutusTx/Test.hs +++ b/plutus-tx/testlib/PlutusTx/Test.hs @@ -52,7 +52,6 @@ import PlutusCore.Pretty import PlutusCore.Pretty qualified as PLC import PlutusCore.Test import PlutusIR.Analysis.Builtins as PIR -import PlutusIR.Core.Instance.Pretty.Readable (prettyPirReadableSimple) import PlutusIR.Core.Type (progTerm) import PlutusIR.Test () import PlutusIR.Transform.RewriteRules as PIR @@ -118,12 +117,16 @@ goldenBudget name compiledCode = goldenUEvalBudget name [compiledCode] -- Compilation testing +-- | Does not print uniques. goldenPir :: (PrettyUni uni, Pretty fun, uni `PLC.Everywhere` Flat, Flat fun) => String -> CompiledCodeIn uni fun a -> TestNested -goldenPir name value = nestedGoldenVsDoc name ".pir" $ prettyPirReadableSimple $ getPirNoAnn value +goldenPir name value = + nestedGoldenVsDoc name ".pir" + . maybe "PIR not found in CompiledCode" (prettyClassicSimple . view progTerm) + $ getPirNoAnn value -- | Does not print uniques. goldenPirReadable :: @@ -133,7 +136,7 @@ goldenPirReadable :: TestNested goldenPirReadable name value = nestedGoldenVsDoc name ".pir" - . maybe "PIR not found in CompiledCode" (prettyPirReadableSimple . view progTerm) + . maybe "PIR not found in CompiledCode" (prettyReadableSimple . view progTerm) $ getPirNoAnn value goldenPirBy ::