From d2809e779a162a79cc55c76c62eceb311df0b319 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 21 Apr 2024 21:27:29 +0200 Subject: [PATCH 01/40] Update README.md Signed-off-by: Yura Lazarev --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e95caee..18eb788 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,9 @@ Consider configuring [Cachix](https://docs.cachix.org/installation) as a binary ``` cachix use purescript-lua ``` +You can use this [template repository](https://github.com/Unisay/purescript-lua-template) to initialize your project. -Here is an [example](https://github.com/Unisay/purescript-lua-example) project. +Here is an another [example](https://github.com/Unisay/purescript-lua-example) project: Nginx server running Lua code using [OpenResty](https://openresty.org/). If you use [Spago](https://github.com/purescript/spago) to build your PureScript project, then you can configure `pslua` as a custom backend like this: From 98420d3c1d2a12c45dac947e563a4cd2201bc82e Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Wed, 24 Apr 2024 20:52:23 +0200 Subject: [PATCH 02/40] Fix bug with eta reduction rewrite rule --- flake.nix | 6 ++++++ .../PureScript/Backend/IR/Optimizer.hs | 12 +++++++++-- test/ps/output/Golden.Bug2.Test/corefn.json | 1 + test/ps/output/Golden.Bug2.Test/golden.ir | 21 +++++++++++++++++++ test/ps/output/Golden.Bug2.Test/golden.lua | 5 +++++ .../Golden.NameShadowing.Test/golden.ir | 16 ++++++++++++-- .../Golden.NameShadowing.Test/golden.lua | 4 +++- .../Golden.RecursiveBindings.Test/golden.ir | 16 ++++++++++++-- .../Golden.RecursiveBindings.Test/golden.lua | 4 ++-- test/ps/spago.dhall | 2 +- 10 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 test/ps/output/Golden.Bug2.Test/corefn.json create mode 100644 test/ps/output/Golden.Bug2.Test/golden.ir create mode 100644 test/ps/output/Golden.Bug2.Test/golden.lua diff --git a/flake.nix b/flake.nix index 18b9e61..3ccb1da 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,12 @@ yamlfmt ]; }; + + crossPlatforms = + p: + pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86_64 ( + pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [ p.musl64 ] + ); }; }) ]; diff --git a/lib/Language/PureScript/Backend/IR/Optimizer.hs b/lib/Language/PureScript/Backend/IR/Optimizer.hs index cb6c048..14891f0 100644 --- a/lib/Language/PureScript/Backend/IR/Optimizer.hs +++ b/lib/Language/PureScript/Backend/IR/Optimizer.hs @@ -171,6 +171,13 @@ idempotently = fix $ \i f a → let a' = f a in if a' == a then a else i f a' +-- if a' == a +-- then tr "FIXPOINT" a a +-- else tr "RETRYING" a' (i f a') +-- where +-- tr ∷ Show x ⇒ String → x → y → y +-- tr l x y = trace ("\n\n" <> l <> "\n" <> (toString . pShow) x <> "\n") y + optimizeModule ∷ UberModule → UberModule optimizeModule UberModule {..} = UberModule @@ -271,8 +278,9 @@ betaReduce = etaReduce ∷ RewriteRule Ann etaReduce = pure . \case - Abs _ (ParamNamed _ _param) (App _ m (Ref _ (Local _) 0)) → - Rewritten Recurse m + Abs _ (ParamNamed _ param) (App _ m (Ref _ (Local param') 0)) + | param == param' → + Rewritten Recurse m _ → NoChange betaReduceUnusedParams ∷ RewriteRule Ann diff --git a/test/ps/output/Golden.Bug2.Test/corefn.json b/test/ps/output/Golden.Bug2.Test/corefn.json new file mode 100644 index 0000000..3df0ad6 --- /dev/null +++ b/test/ps/output/Golden.Bug2.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,14]}},"type":"Var","value":{"identifier":"f","sourcePos":[3,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[3,17],"start":[3,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[3,17],"start":[3,16]}},"type":"Var","value":{"identifier":"b","sourcePos":[3,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,18]}},"type":"Var","value":{"identifier":"a","sourcePos":[3,1]}},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"flip"}],"exports":["flip"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Bug2","Test"],"modulePath":"golden/Golden/Bug2/Test.purs","reExports":{},"sourceSpan":{"end":[3,19],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Bug2.Test/golden.ir b/test/ps/output/Golden.Bug2.Test/golden.ir new file mode 100644 index 0000000..70517db --- /dev/null +++ b/test/ps/output/Golden.Bug2.Test/golden.ir @@ -0,0 +1,21 @@ +UberModule + { uberModuleBindings = [], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "flip", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "b" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing ( Local ( Name "b" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.Bug2.Test/golden.lua b/test/ps/output/Golden.Bug2.Test/golden.lua new file mode 100644 index 0000000..32b56ee --- /dev/null +++ b/test/ps/output/Golden.Bug2.Test/golden.lua @@ -0,0 +1,5 @@ +return { + flip = function(f) + return function(a) return function(b) return f(b)(a) end end + end +} diff --git a/test/ps/output/Golden.NameShadowing.Test/golden.ir b/test/ps/output/Golden.NameShadowing.Test/golden.ir index ca4d80c..a0cce51 100644 --- a/test/ps/output/Golden.NameShadowing.Test/golden.ir +++ b/test/ps/output/Golden.NameShadowing.Test/golden.ir @@ -51,8 +51,20 @@ UberModule ) ) ), - ( Name "c", Ref Nothing - ( Imported ( ModuleName "Golden.NameShadowing.Test" ) ( Name "f" ) ) 0 + ( Name "c", Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x1" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.NameShadowing.Test" ) ( Name "f" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "x1" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) ) ] } \ No newline at end of file diff --git a/test/ps/output/Golden.NameShadowing.Test/golden.lua b/test/ps/output/Golden.NameShadowing.Test/golden.lua index 13c6f57..272f73a 100644 --- a/test/ps/output/Golden.NameShadowing.Test/golden.lua +++ b/test/ps/output/Golden.NameShadowing.Test/golden.lua @@ -10,5 +10,7 @@ return { return M.Golden_NameShadowing_Test_f(M.Golden_NameShadowing_Test_f(x)(x1))(M.Golden_NameShadowing_Test_f(42)(1)) end end, - c = M.Golden_NameShadowing_Test_f + c = function(y) + return function(x1) return M.Golden_NameShadowing_Test_f(x1)(y) end + end } diff --git a/test/ps/output/Golden.RecursiveBindings.Test/golden.ir b/test/ps/output/Golden.RecursiveBindings.Test/golden.ir index 904224b..a08c841 100644 --- a/test/ps/output/Golden.RecursiveBindings.Test/golden.ir +++ b/test/ps/output/Golden.RecursiveBindings.Test/golden.ir @@ -96,8 +96,20 @@ UberModule ( Nothing, Name "z", LiteralInt Nothing 1 ) :| [ RecursiveGroup ( - ( Nothing, Name "a", Ref Nothing ( Local ( Name "b" ) ) 0 ) :| - [ ( Nothing, Name "b", Ref Nothing ( Local ( Name "a" ) ) 0 ) ] + ( Nothing, Name "a", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing ( Local ( Name "b" ) ) 0 ) + ( Ref Nothing ( Local ( Name "z" ) ) 0 ) + ) + ) :| + [ + ( Nothing, Name "b", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ( Ref Nothing ( Local ( Name "z" ) ) 0 ) + ) + ) + ] ), Standalone ( Nothing, Name "f", Abs Nothing ( ParamUnused Nothing ) ( Ref Nothing ( Local ( Name "a" ) ) 0 ) diff --git a/test/ps/output/Golden.RecursiveBindings.Test/golden.lua b/test/ps/output/Golden.RecursiveBindings.Test/golden.lua index c5f247f..e6c3208 100644 --- a/test/ps/output/Golden.RecursiveBindings.Test/golden.lua +++ b/test/ps/output/Golden.RecursiveBindings.Test/golden.lua @@ -57,8 +57,8 @@ return { local z = 1 local a local b - a = b - b = a + a = function() return b(z) end + b = function() return a(z) end local f = function() return a end local y = f(z)(z) return f(f(y)(y))(f(y)(0)) diff --git a/test/ps/spago.dhall b/test/ps/spago.dhall index 62545e8..6fbd3dc 100644 --- a/test/ps/spago.dhall +++ b/test/ps/spago.dhall @@ -1,5 +1,5 @@ { name = "test-project" -, dependencies = [ "effect", "prelude" ] +, dependencies = [ "console", "effect", "prelude" ] , packages = ./packages.dhall , sources = [ "golden/**/*.purs" ] } From fbc129bae52b85fab8f0fc98d5dd037f8872d7e6 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Wed, 24 Apr 2024 21:08:03 +0200 Subject: [PATCH 03/40] Remove unused golden files --- test/ps/output/Golden.Bug2.Test/corefn.json | 1 - test/ps/output/Golden.Bug2.Test/golden.ir | 21 --------------------- test/ps/output/Golden.Bug2.Test/golden.lua | 5 ----- 3 files changed, 27 deletions(-) delete mode 100644 test/ps/output/Golden.Bug2.Test/corefn.json delete mode 100644 test/ps/output/Golden.Bug2.Test/golden.ir delete mode 100644 test/ps/output/Golden.Bug2.Test/golden.lua diff --git a/test/ps/output/Golden.Bug2.Test/corefn.json b/test/ps/output/Golden.Bug2.Test/corefn.json deleted file mode 100644 index 3df0ad6..0000000 --- a/test/ps/output/Golden.Bug2.Test/corefn.json +++ /dev/null @@ -1 +0,0 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,14]}},"type":"Var","value":{"identifier":"f","sourcePos":[3,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[3,17],"start":[3,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[3,17],"start":[3,16]}},"type":"Var","value":{"identifier":"b","sourcePos":[3,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,18]}},"type":"Var","value":{"identifier":"a","sourcePos":[3,1]}},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"flip"}],"exports":["flip"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Bug2","Test"],"modulePath":"golden/Golden/Bug2/Test.purs","reExports":{},"sourceSpan":{"end":[3,19],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Bug2.Test/golden.ir b/test/ps/output/Golden.Bug2.Test/golden.ir deleted file mode 100644 index 70517db..0000000 --- a/test/ps/output/Golden.Bug2.Test/golden.ir +++ /dev/null @@ -1,21 +0,0 @@ -UberModule - { uberModuleBindings = [], uberModuleForeigns = [], uberModuleExports = - [ - ( Name "flip", Abs Nothing - ( ParamNamed Nothing ( Name "f" ) ) - ( Abs Nothing - ( ParamNamed Nothing ( Name "a" ) ) - ( Abs Nothing - ( ParamNamed Nothing ( Name "b" ) ) - ( App Nothing - ( App Nothing - ( Ref Nothing ( Local ( Name "f" ) ) 0 ) - ( Ref Nothing ( Local ( Name "b" ) ) 0 ) - ) - ( Ref Nothing ( Local ( Name "a" ) ) 0 ) - ) - ) - ) - ) - ] - } \ No newline at end of file diff --git a/test/ps/output/Golden.Bug2.Test/golden.lua b/test/ps/output/Golden.Bug2.Test/golden.lua deleted file mode 100644 index 32b56ee..0000000 --- a/test/ps/output/Golden.Bug2.Test/golden.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - flip = function(f) - return function(a) return function(b) return f(b)(a) end end - end -} From 66d7537d1d4425afb49447d3c222e4f9971c5938 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Wed, 24 Apr 2024 21:27:05 +0200 Subject: [PATCH 04/40] Use traversal based on Prisms --- lib/Language/PureScript/Backend/IR/Query.hs | 7 +- lib/Language/PureScript/Backend/IR/Types.hs | 109 ++++++++++---------- 2 files changed, 56 insertions(+), 60 deletions(-) diff --git a/lib/Language/PureScript/Backend/IR/Query.hs b/lib/Language/PureScript/Backend/IR/Query.hs index 9cdf5b9..08ff8c6 100644 --- a/lib/Language/PureScript/Backend/IR/Query.hs +++ b/lib/Language/PureScript/Backend/IR/Query.hs @@ -1,6 +1,7 @@ module Language.PureScript.Backend.IR.Query where -import Control.Monad.Trans.Accum (Accum, add, execAccum) +import Control.Lens.Plated (transformMOf) +import Control.Monad.Trans.Accum (add, execAccum) import Data.Map qualified as Map import Data.Set qualified as Set import Language.PureScript.Backend.IR.Linker (UberModule (..)) @@ -15,7 +16,7 @@ import Language.PureScript.Backend.IR.Types , countFreeRef , countFreeRefs , listGrouping - , traverseExpBottomUp + , subexpressions ) import Language.PureScript.Backend.IR.Types qualified as IR import Language.PureScript.Names (runtimeLazyName) @@ -48,7 +49,7 @@ findPrimModuleInExpr expr = collectBoundNames ∷ Exp → Set Name collectBoundNames = - (`execAccum` Set.empty) . traverseExpBottomUp @_ @(Accum (Set Name)) \e → + (`execAccum` Set.empty) . transformMOf subexpressions \e → case e of IR.Abs _ann (IR.ParamNamed _paramAnn name) _body → e <$ add (Set.singleton name) diff --git a/lib/Language/PureScript/Backend/IR/Types.hs b/lib/Language/PureScript/Backend/IR/Types.hs index fc39796..7783e7c 100644 --- a/lib/Language/PureScript/Backend/IR/Types.hs +++ b/lib/Language/PureScript/Backend/IR/Types.hs @@ -2,7 +2,7 @@ module Language.PureScript.Backend.IR.Types where -import Control.Lens (Prism', prism') +import Control.Lens (Prism', Traversal', makePrisms, prism') import Data.Deriving (deriveEq1, deriveOrd1) import Data.Map qualified as Map import Data.MonoidMap (MonoidMap) @@ -61,6 +61,19 @@ instance Semigroup Info where instance Monoid Info where mempty = Info mempty +data AlgebraicType = SumType | ProductType + deriving stock (Generic, Eq, Ord, Show, Enum, Bounded) + +newtype Index = Index {unIndex ∷ Natural} + deriving newtype (Show, Eq, Ord, Num, Enum, Real, Integral) + +data Parameter ann = ParamUnused ann | ParamNamed ann Name + deriving stock (Show, Eq, Ord) + +paramName ∷ Parameter ann → Maybe Name +paramName (ParamUnused _ann) = Nothing +paramName (ParamNamed _ann name) = Just name + data RawExp ann = LiteralInt ann Integer | LiteralFloat ann Double @@ -114,16 +127,6 @@ getAnn = \case Exception ann _ → ann ForeignImport ann _ _ _ → ann -newtype Index = Index {unIndex ∷ Natural} - deriving newtype (Show, Eq, Ord, Num, Enum, Real, Integral) - -data Parameter ann = ParamUnused ann | ParamNamed ann Name - deriving stock (Show, Eq, Ord) - -paramName ∷ Parameter ann → Maybe Name -paramName (ParamUnused _ann) = Nothing -paramName (ParamNamed _ann name) = Just name - isLiteral ∷ RawExp ann → Bool isLiteral = (||) <$> isNonRecursiveLiteral <*> isRecursiveLiteral @@ -142,9 +145,6 @@ isRecursiveLiteral = \case LiteralObject {} → True _ → False -data AlgebraicType = SumType | ProductType - deriving stock (Generic, Eq, Ord, Show, Enum, Bounded) - ctorId ∷ ModuleName → TyName → CtorName → Text ctorId modName tyName ctorName = runModuleName modName @@ -367,49 +367,40 @@ annotateExpM around annotateExp annotateParam annotateName = mkAnn ∷ RawExp ann → m (RawExp ann') mkAnn = annotateExpM around annotateExp annotateParam annotateName -traverseExpBottomUp - ∷ ∀ ann m - . Monad m - ⇒ (RawExp ann → m (RawExp ann)) - → (RawExp ann → m (RawExp ann)) -traverseExpBottomUp visit = go - where - go ∷ RawExp ann → m (RawExp ann) - go e = - visit =<< case e of - LiteralArray ann as → - LiteralArray ann <$> traverse go as - LiteralObject ann props → - LiteralObject ann <$> traverse (traverse go) props - ReflectCtor ann a → - ReflectCtor ann <$> go a - DataArgumentByIndex ann idx a → - DataArgumentByIndex ann idx <$> go a - Eq ann a b → - Eq ann <$> go a <*> go b - ArrayLength ann a → - ArrayLength ann <$> go a - ArrayIndex ann a idx → do - a' ← go a - pure $ ArrayIndex ann a' idx - ObjectProp ann a prp → do - a' ← go a - pure $ ObjectProp ann a' prp - ObjectUpdate ann a ps → - ObjectUpdate ann - <$> go a - <*> traverse (traverse go) ps - App ann a b → - App ann <$> go a <*> go b - Abs ann arg a → - Abs ann arg <$> go a - Let ann bs body → - Let ann - <$> traverse (traverse (\(a, n, expr) → (a,n,) <$> go expr)) bs - <*> go body - IfThenElse ann p th el → - IfThenElse ann <$> go p <*> go th <*> go el - _ → pure e +{-# INLINE subexpressions #-} + +-- | Get all the direct child 'RawExp's of the given 'RawExp' +subexpressions ∷ Traversal' (RawExp ann) (RawExp ann) +subexpressions go = \case + LiteralArray ann as → + LiteralArray ann <$> traverse go as + LiteralObject ann props → + LiteralObject ann <$> traverse (traverse go) props + ReflectCtor ann a → + ReflectCtor ann <$> go a + DataArgumentByIndex ann idx a → + DataArgumentByIndex ann idx <$> go a + Eq ann a b → + Eq ann <$> go a <*> go b + ArrayLength ann a → + ArrayLength ann <$> go a + ArrayIndex ann a idx → + ArrayIndex ann <$> go a <*> pure idx + ObjectProp ann a prp → + ObjectProp ann <$> go a <*> pure prp + ObjectUpdate ann a ps → + ObjectUpdate ann <$> go a <*> traverse (traverse go) ps + App ann a b → + App ann <$> go a <*> go b + Abs ann arg a → + Abs ann arg <$> go a + Let ann bs body → + Let ann + <$> traverse (traverse (\(a, n, expr) → (a,n,) <$> go expr)) bs + <*> go body + IfThenElse ann p th el → + IfThenElse ann <$> go p <*> go th <*> go el + e → pure e data RewriteMod = Recurse | Stop deriving stock (Show, Eq, Ord) @@ -760,3 +751,7 @@ shift offset namespace minIndex expression = _ → expression where go = shift offset namespace minIndex + +$(makePrisms ''AlgebraicType) +$(makePrisms ''Parameter) +$(makePrisms ''RawExp) From 7035386a327dacb7135a8c9dd363effa96f10502 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Thu, 25 Apr 2024 20:27:12 +0200 Subject: [PATCH 05/40] Golden test for evaluation result --- .../PureScript/Backend/Lua/Golden/Spec.hs | 45 +- test/ps/golden/Golden/ArrayOfUnits/Test.purs | 17 + .../Golden.ArrayOfUnits.Test/corefn.json | 1 + .../Golden.ArrayOfUnits.Test/eval/.gitignore | 1 + .../Golden.ArrayOfUnits.Test/eval/golden.txt | 4 + .../output/Golden.ArrayOfUnits.Test/golden.ir | 577 ++++++++++++++++++ .../Golden.ArrayOfUnits.Test/golden.lua | 151 +++++ .../output/Golden.HelloPrelude.Test/golden.ir | 4 +- .../Golden.HelloPrelude.Test/golden.lua | 2 +- test/ps/packages.dhall | 5 +- test/ps/spago.dhall | 2 +- 11 files changed, 796 insertions(+), 13 deletions(-) create mode 100644 test/ps/golden/Golden/ArrayOfUnits/Test.purs create mode 100644 test/ps/output/Golden.ArrayOfUnits.Test/corefn.json create mode 100644 test/ps/output/Golden.ArrayOfUnits.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.ArrayOfUnits.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.ArrayOfUnits.Test/golden.ir create mode 100644 test/ps/output/Golden.ArrayOfUnits.Test/golden.lua diff --git a/test/Language/PureScript/Backend/Lua/Golden/Spec.hs b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs index 9958006..e712f35 100644 --- a/test/Language/PureScript/Backend/Lua/Golden/Spec.hs +++ b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs @@ -19,7 +19,6 @@ import Language.PureScript.Backend.Lua.Optimizer (optimizeChunk) import Language.PureScript.Backend.Lua.Printer qualified as Printer import Language.PureScript.Backend.Types (AppOrModule (..)) import Language.PureScript.CoreFn.Reader qualified as CoreFn -import Language.PureScript.Names (ModuleName) import Language.PureScript.Names qualified as PS import Path ( Abs @@ -38,6 +37,7 @@ import Path ) import Path.IO ( AnyPath (makeRelativeToCurrentDir) + , doesFileExist , ensureDir , makeAbsolute , walkDirAccum @@ -111,14 +111,47 @@ spec = do } uberModule -- lua golden + let evalGolden = + modulePath $(mkRelDir "eval") $(mkRelFile "golden.txt") let luaGolden = modulePath $(mkRelFile "golden.lua") let luaActual = modulePath $(mkRelFile "actual.lua") luaTestName ← runIO do toFilePath <$> makeRelativeToCurrentDir luaGolden it luaTestName do defaultGolden luaGolden (Just luaActual) do - uberModule ← compileCorefn (Tagged (Rel psOutputPath)) moduleName - compileIr moduleName uberModule + appOrModule ← + (doesFileExist evalGolden) <&> \case + True → AsApplication moduleName (PS.Ident "main") + False → AsModule moduleName + cfn ← compileCorefn (Tagged (Rel psOutputPath)) moduleName + compileIr appOrModule cfn + + describe "golden files should evaluate" do + let + collectEvaluatableLuas ∷ MonadIO m ⇒ Path Rel Dir → m [Path Abs File] + collectEvaluatableLuas = walkDirAccum Nothing \_dir _subdirs files → + pure [file | file ← files, toFilePath (filename file) == "golden.txt"] + + luas ← runIO do collectEvaluatableLuas psOutputPath + for_ luas \lua → do + let evalDir = parent lua + let resActual = evalDir $(mkRelFile "actual.txt") + let resGolden = evalDir $(mkRelFile "golden.txt") + let luaGolden = parent evalDir $(mkRelFile "golden.lua") + luaTestName ← runIO do makeRelativeToCurrentDir lua + it (toFilePath luaTestName) do + defaultGolden resGolden (Just resActual) do + let process = fromString $ "lua " ++ toFilePath luaGolden + (exitCode, out) ← readProcessInterleaved process + let niceOut = + decodeUtf8 out + & lines + & fmap Text.stripStart + & filter (not . Text.null) + & unlines + & toString + exitCode `shouldBe` ExitSuccess `annotatingWith` niceOut + pure $ toText niceOut describe "golden files should typecheck" do luas ← runIO do collectLuas psOutputPath @@ -185,11 +218,11 @@ compileCorefn outputDir uberModuleName = do let uberModule = Linker.makeUberModule (LinkAsModule uberModuleName) modules pure $ optimizedUberModule uberModule -compileIr ∷ (MonadIO m, MonadMask m) ⇒ ModuleName → IR.UberModule → m Text -compileIr modname uberModule = withCurrentDir [reldir|test/ps|] do +compileIr ∷ (MonadIO m, MonadMask m) ⇒ AppOrModule → IR.UberModule → m Text +compileIr appOrModule uberModule = withCurrentDir [reldir|test/ps|] do foreignPath ← Tagged <$> makeAbsolute [reldir|foreign|] luaChunk ← - Lua.fromUberModule foreignPath (Tagged True) (AsModule modname) uberModule + Lua.fromUberModule foreignPath (Tagged True) appOrModule uberModule & handleLuaError & Oops.runOops & liftIO diff --git a/test/ps/golden/Golden/ArrayOfUnits/Test.purs b/test/ps/golden/Golden/ArrayOfUnits/Test.purs new file mode 100644 index 0000000..60d1b8c --- /dev/null +++ b/test/ps/golden/Golden/ArrayOfUnits/Test.purs @@ -0,0 +1,17 @@ +module Golden.ArrayOfUnits.Test where + +import Prelude (Unit, discard, unit) + +import Effect (Effect) +import Effect.Console (logShow) +import Data.Traversable (traverse_) +import Data.Foldable (length) + +main :: Effect Unit +main = do + let arr :: Array Unit + arr = [unit, unit, unit] + traverse_ logShow arr + let len :: Int + len = length arr + logShow len diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/corefn.json b/test/ps/output/Golden.ArrayOfUnits.Test/corefn.json new file mode 100644 index 0000000..570b7a6 --- /dev/null +++ b/test/ps/output/Golden.ArrayOfUnits.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,19],"start":[16,13]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","Foldable"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"foldableArray","moduleName":["Data","Foldable"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"length"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,10],"start":[17,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,14],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,31],"start":[12,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,24],"start":[12,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,31],"start":[13,13]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,18],"start":[13,14]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,24],"start":[13,20]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,30],"start":[13,26]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}}]}},"identifier":"arr"}],"expression":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,12],"start":[14,3]}},"type":"Var","value":{"identifier":"traverse_","moduleName":["Data","Foldable"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"foldableArray","moduleName":["Data","Foldable"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,13]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showUnit","moduleName":["Data","Show"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,21]}},"type":"Var","value":{"identifier":"arr","sourcePos":[12,7]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[15,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,17],"start":[15,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"length","moduleName":["Golden","ArrayOfUnits","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[16,20]}},"type":"Var","value":{"identifier":"arr","sourcePos":[12,7]}},"type":"App"},"identifier":"len"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ArrayOfUnits","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[17,11]}},"type":"Var","value":{"identifier":"len","sourcePos":[15,7]}},"type":"App"},"type":"Let"},"type":"Abs"},"type":"App"},"type":"Let"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Foldable"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,36],"start":[7,1]}},"moduleName":["Data","Traversable"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Unit"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,37],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","ArrayOfUnits","Test"],"modulePath":"golden/Golden/ArrayOfUnits/Test.purs","reExports":{},"sourceSpan":{"end":[17,14],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/eval/.gitignore b/test/ps/output/Golden.ArrayOfUnits.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.ArrayOfUnits.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/eval/golden.txt b/test/ps/output/Golden.ArrayOfUnits.Test/eval/golden.txt new file mode 100644 index 0000000..8786a2d --- /dev/null +++ b/test/ps/output/Golden.ArrayOfUnits.Test/eval/golden.txt @@ -0,0 +1,4 @@ +unit +unit +unit +3 diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir new file mode 100644 index 0000000..52e2626 --- /dev/null +++ b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir @@ -0,0 +1,577 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Unit", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs" + [ ( Just Always, Name "unit" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Foldable", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Foldable" ) ".spago/foldable-traversable/v6.1.0/src/Data/Foldable.purs" + [ ( Nothing, Name "foldrArray" ), ( Nothing, Name "foldlArray" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Semigroupoid", qnameName = Name "semigroupoidFn" + }, LiteralObject Nothing + [ + ( PropName "compose", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "g" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "g" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "semiringInt" + }, LiteralObject Nothing + [ + ( PropName "add", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intAdd" ) + ), + ( PropName "zero", LiteralInt Nothing 0 ), + ( PropName "mul", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMul" ) + ), + ( PropName "one", LiteralInt Nothing 1 ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Apply", qnameName = Name "apply" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "apply" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Foldable", qnameName = Name "foldr" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "foldr" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.Foldable", qnameName = Name "foldableArray" + }, LiteralObject Nothing + [ + ( PropName "foldr", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Foldable" ) ( Name "foreign" ) ) 0 ) + ( PropName "foldrArray" ) + ), + ( PropName "foldl", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Foldable" ) ( Name "foreign" ) ) 0 ) + ( PropName "foldlArray" ) + ), + ( PropName "foldMap", Abs Nothing + ( ParamNamed Nothing ( Name "dictMonoid" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Foldable" ) ( Name "foldr" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Foldable" ) ( Name "foldableArray" ) ) 0 + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictMonoid" ) ) 0 ) + ( PropName "Semigroup0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "append" ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictMonoid" ) ) 0 ) + ( PropName "mempty" ) + ) + ) + ) + ) + ] + ) :| [] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Apply" ) ( Name "apply" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "logShow" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictShow" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictShow" ) ) 0 ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "main", Let Nothing + ( Standalone + ( Nothing, Name "arr", LiteralArray Nothing + [ ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Unit" ) ( Name "foreign" ) ) 0 ) + ( PropName "unit" ), ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Unit" ) ( Name "foreign" ) ) 0 ) + ( PropName "unit" ), ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Unit" ) ( Name "foreign" ) ) 0 ) + ( PropName "unit" ) + ] + ) :| [] + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Foldable" ) ( Name "foldr" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Foldable" ) ( Name "foldableArray" ) ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Semigroupoid" ) + ( Name "semigroupoidFn" ) + ) 0 + ) + ( PropName "compose" ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Apply" ) ( Name "apply" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "Functor0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "map" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "identity", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ), + ( PropName "Semigroupoid0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported + ( ModuleName "Control.Semigroupoid" ) + ( Name "semigroupoidFn" ) + ) 0 + ) + ) + ] + ) + ( PropName "identity" ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "show", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "unit" ) + ) + ] + ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Unit" ) ( Name "foreign" ) ) 0 ) + ( PropName "unit" ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "arr" ) ) 0 ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow" ) ) 0 ) + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ) + ( PropName "showIntImpl" ) + ) + ] + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Foldable" ) ( Name "foldableArray" ) ) 0 + ) + ( PropName "foldl" ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "c" ) ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "add" ) + ) + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "one" ) + ) + ) + ( Ref Nothing ( Local ( Name "c" ) ) 0 ) + ) + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "zero" ) + ) + ) + ( Ref Nothing ( Local ( Name "arr" ) ) 0 ) + ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua b/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua new file mode 100644 index 0000000..b02e938 --- /dev/null +++ b/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua @@ -0,0 +1,151 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_Unit_foreign = { unit = {} } +M.Data_Semiring_foreign = { + intAdd = function(x) return function(y) return x + y end end, + intMul = function(x) return function(y) return x * y end end +} +M.Data_Foldable_foreign = { + foldrArray = function(f) + return function(init) + return function(xs) + local acc = init + local len = #xs + for i = len, 1, -1 do acc = f(xs[i])(acc) end + return acc + end + end + end, + foldlArray = function(f) + return function(init) + return function(xs) + local acc = init + local len = #xs + for i = 1, len do acc = f(acc)(xs[i]) end + return acc + end + end + end +} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Control_Semigroupoid_semigroupoidFn = { + compose = function(f) + return function(g) return function(x) return f(g(x)) end end + end +} +M.Data_Semiring_semiringInt = { + add = M.Data_Semiring_foreign.intAdd, + zero = 0, + mul = M.Data_Semiring_foreign.intMul, + one = 1 +} +M.Control_Apply_apply = function(dict) return dict.apply end +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Data_Foldable_foldr = function(dict) return dict.foldr end +M.Data_Foldable_foldableArray = { + foldr = M.Data_Foldable_foreign.foldrArray, + foldl = M.Data_Foldable_foreign.foldlArray, + foldMap = function(dictMonoid) + return function(f) + return M.Data_Foldable_foldr(M.Data_Foldable_foldableArray)(function(x) + return (dictMonoid.Semigroup0()).append(f(x)) + end)(dictMonoid.mempty) + end + end +} +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f)) + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Effect_Console_logShow = function(dictShow) + return function(a) + return (function(s) return function() print(s) end end)(dictShow.show(a)) + end +end +return (function() + local arr = { + [1] = M.Data_Unit_foreign.unit, + [2] = M.Data_Unit_foreign.unit, + [3] = M.Data_Unit_foreign.unit + } + return M.Control_Bind_bind(M.Effect_bindEffect)(M.Data_Foldable_foldr(M.Data_Foldable_foldableArray)(M.Control_Semigroupoid_semigroupoidFn.compose(function( a ) + return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(((M.Effect_applicativeEffect.Apply0()).Functor0()).map(function( ) + return function(x) return x end + end)(a)) + end)(M.Effect_Console_logShow({ + show = function() return "unit" end + })))(M.Control_Applicative_pure(M.Effect_applicativeEffect)(M.Data_Unit_foreign.unit))(arr))(function( ) + return M.Effect_Console_logShow({ + show = function(n) return tostring(n) end + })(M.Data_Foldable_foldableArray.foldl(function(c) + return function() + return M.Data_Semiring_semiringInt.add(M.Data_Semiring_semiringInt.one)(c) + end + end)(M.Data_Semiring_semiringInt.zero)(arr)) + end) +end)()() diff --git a/test/ps/output/Golden.HelloPrelude.Test/golden.ir b/test/ps/output/Golden.HelloPrelude.Test/golden.ir index bc77225..e7afbf6 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/golden.ir +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.ir @@ -206,8 +206,8 @@ UberModule ) ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Unit" ) ".spago/prelude/v7.1.1/src/Data/Unit.purs" - [ ( Nothing, Name "unit" ) ] + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs" + [ ( Just Always, Name "unit" ) ] ) ( PropName "unit" ) ) diff --git a/test/ps/output/Golden.HelloPrelude.Test/golden.lua b/test/ps/output/Golden.HelloPrelude.Test/golden.lua index 37b7c0c..16977dd 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/golden.lua +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.lua @@ -70,4 +70,4 @@ M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() Functor0 = function() return M.Effect_Lazy_functorEffect(0) end } end) -return { main = M.Control_Applicative_pure(M.Effect_applicativeEffect)(nil) } +return { main = M.Control_Applicative_pure(M.Effect_applicativeEffect)({}) } diff --git a/test/ps/packages.dhall b/test/ps/packages.dhall index 0327fc0..1a3ab9d 100644 --- a/test/ps/packages.dhall +++ b/test/ps/packages.dhall @@ -3,8 +3,7 @@ let upstream-ps = sha256:50c4ee579bf2c38671ac97df821c2cc4221fb3f6ad79c807bb6e4597ab6d1e95 let upstream-lua = - https://github.com/Unisay/purescript-lua-package-sets/releases/download/psc-0.15.15-20240416/packages.dhall - sha256:e68b7752ca4dee0f0578a2e40159caf6d1290a711777931b20d10d807823b52d + https://github.com/Unisay/purescript-lua-package-sets/releases/download/psc-0.15.15-20240425/packages.dhall + sha256:3721bc8a2f6681e16fb505b8b0256650d9fd47977755fde9947852343888f14b in upstream-ps // upstream-lua - diff --git a/test/ps/spago.dhall b/test/ps/spago.dhall index 6fbd3dc..d7992f0 100644 --- a/test/ps/spago.dhall +++ b/test/ps/spago.dhall @@ -1,5 +1,5 @@ { name = "test-project" -, dependencies = [ "console", "effect", "prelude" ] +, dependencies = [ "console", "effect", "foldable-traversable", "prelude" ] , packages = ./packages.dhall , sources = [ "golden/**/*.purs" ] } From bef2ba667f395705bf3102fa17e7e22af8f3b694 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Fri, 26 Apr 2024 18:55:12 +0200 Subject: [PATCH 06/40] Fibonacci evaluation test --- test/ps/golden/Golden/Fibonacci/Test.purs | 13 ++ .../output/Golden.Fibonacci.Test/corefn.json | 1 + .../Golden.Fibonacci.Test/eval/.gitignore | 1 + .../Golden.Fibonacci.Test/eval/golden.txt | 1 + .../ps/output/Golden.Fibonacci.Test/golden.ir | 133 ++++++++++++++++++ .../output/Golden.Fibonacci.Test/golden.lua | 24 ++++ 6 files changed, 173 insertions(+) create mode 100644 test/ps/golden/Golden/Fibonacci/Test.purs create mode 100644 test/ps/output/Golden.Fibonacci.Test/corefn.json create mode 100644 test/ps/output/Golden.Fibonacci.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.Fibonacci.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.Fibonacci.Test/golden.ir create mode 100644 test/ps/output/Golden.Fibonacci.Test/golden.lua diff --git a/test/ps/golden/Golden/Fibonacci/Test.purs b/test/ps/golden/Golden/Fibonacci/Test.purs new file mode 100644 index 0000000..0b227f0 --- /dev/null +++ b/test/ps/golden/Golden/Fibonacci/Test.purs @@ -0,0 +1,13 @@ +module Golden.Fibonacci.Test where + +import Prelude +import Effect (Effect) +import Effect.Console (logShow) + +fib :: Int -> Int +fib 0 = 0 +fib 1 = 1 +fib n = fib (n - 1) + fib (n - 2) + +main :: Effect Unit +main = logShow $ fib 32 -- 2178309 diff --git a/test/ps/output/Golden.Fibonacci.Test/corefn.json b/test/ps/output/Golden.Fibonacci.Test/corefn.json new file mode 100644 index 0000000..0017a21 --- /dev/null +++ b/test/ps/output/Golden.Fibonacci.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[10,22],"start":[10,21]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"add"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[10,17],"start":[10,16]}},"type":"Var","value":{"identifier":"sub","moduleName":["Data","Ring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"ringInt","moduleName":["Data","Ring"]}},"type":"App"},"identifier":"sub"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,6],"start":[8,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,6],"start":[9,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,6],"start":[10,5]}},"binderType":"VarBinder","identifier":"n"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,12],"start":[10,9]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"sub","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,15],"start":[10,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[10,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,26],"start":[10,23]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,23]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"sub","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,28]}},"type":"Var","value":{"identifier":"n","sourcePos":[10,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,32]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"fib"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,20],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,15],"start":[13,8]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[13,15],"start":[13,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,21],"start":[13,18]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,22]}},"type":"Literal","value":{"literalType":"IntLiteral","value":32}},"type":"App"},"type":"App"},"identifier":"main"}],"exports":["fib","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Ring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Golden","Fibonacci","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Fibonacci","Test"],"modulePath":"golden/Golden/Fibonacci/Test.purs","reExports":{},"sourceSpan":{"end":[13,24],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Fibonacci.Test/eval/.gitignore b/test/ps/output/Golden.Fibonacci.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.Fibonacci.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.Fibonacci.Test/eval/golden.txt b/test/ps/output/Golden.Fibonacci.Test/eval/golden.txt new file mode 100644 index 0000000..2eb03fe --- /dev/null +++ b/test/ps/output/Golden.Fibonacci.Test/eval/golden.txt @@ -0,0 +1 @@ +2178309 diff --git a/test/ps/output/Golden.Fibonacci.Test/golden.ir b/test/ps/output/Golden.Fibonacci.Test/golden.ir new file mode 100644 index 0000000..8296ee6 --- /dev/null +++ b/test/ps/output/Golden.Fibonacci.Test/golden.ir @@ -0,0 +1,133 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "semiringInt" + }, LiteralObject Nothing + [ + ( PropName "add", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intAdd" ) + ), + ( PropName "zero", LiteralInt Nothing 0 ), + ( PropName "mul", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMul" ) + ), + ( PropName "one", LiteralInt Nothing 1 ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.Fibonacci.Test", qnameName = Name "sub" + }, ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "sub", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.0/src/Data/Ring.purs" + [ ( Nothing, Name "intSub" ) ] + ) + ( PropName "intSub" ) + ), + ( PropName "Semiring0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 ) + ) + ] + ) + ( PropName "sub" ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Golden.Fibonacci.Test", qnameName = Name "fib" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 0 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( LiteralInt Nothing 0 ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 1 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( LiteralInt Nothing 1 ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "add" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.Fibonacci.Test" ) ( Name "fib" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.Fibonacci.Test" ) ( Name "sub" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.Fibonacci.Test" ) ( Name "fib" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.Fibonacci.Test" ) ( Name "sub" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 2 ) + ) + ) + ) + ) + ) + ) :| [] + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "fib", Ref Nothing + ( Imported ( ModuleName "Golden.Fibonacci.Test" ) ( Name "fib" ) ) 0 + ), + ( Name "main", App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ) + ( PropName "showIntImpl" ) + ) + ] + ) + ( PropName "show" ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Golden.Fibonacci.Test" ) ( Name "fib" ) ) 0 ) + ( LiteralInt Nothing 32 ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.Fibonacci.Test/golden.lua b/test/ps/output/Golden.Fibonacci.Test/golden.lua new file mode 100644 index 0000000..047d996 --- /dev/null +++ b/test/ps/output/Golden.Fibonacci.Test/golden.lua @@ -0,0 +1,24 @@ +local M = {} +M.Data_Semiring_foreign = { + intAdd = function(x) return function(y) return x + y end end, + intMul = function(x) return function(y) return x * y end end +} +M.Data_Semiring_semiringInt = { + add = M.Data_Semiring_foreign.intAdd, + zero = 0, + mul = M.Data_Semiring_foreign.intMul, + one = 1 +} +M.Golden_Fibonacci_Test_sub = function(x) return function(y) return x - y end end +M.Golden_Fibonacci_Test_fib = function(v) + if 0 == v then + return 0 + else + if 1 == v then + return 1 + else + return M.Data_Semiring_semiringInt.add(M.Golden_Fibonacci_Test_fib(M.Golden_Fibonacci_Test_sub(v)(1)))(M.Golden_Fibonacci_Test_fib(M.Golden_Fibonacci_Test_sub(v)(2))) + end + end +end +return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(M.Golden_Fibonacci_Test_fib(32)))() From 833cec843f18841eb1f710e83f1f7ed7b22c1c74 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Tue, 10 Sep 2024 20:11:12 +0200 Subject: [PATCH 07/40] Fix: eta reduction --- .hspec-failures | 1 + .../PureScript/Backend/IR/Optimizer.hs | 5 ++-- test/ps/golden/Golden/Inline/Test.purs | 15 +++++++++++- test/ps/output/Golden.Inline.Test/corefn.json | 2 +- test/ps/output/Golden.Inline.Test/golden.ir | 23 +++++++++++++++++-- test/ps/output/Golden.Inline.Test/golden.lua | 8 ++++++- 6 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 .hspec-failures diff --git a/.hspec-failures b/.hspec-failures new file mode 100644 index 0000000..c44345d --- /dev/null +++ b/.hspec-failures @@ -0,0 +1 @@ +FailureReport {failureReportSeed = 1246204243, failureReportMaxSuccess = 100, failureReportMaxSize = 100, failureReportMaxDiscardRatio = 10, failureReportPaths = []} \ No newline at end of file diff --git a/lib/Language/PureScript/Backend/IR/Optimizer.hs b/lib/Language/PureScript/Backend/IR/Optimizer.hs index 14891f0..bf56d22 100644 --- a/lib/Language/PureScript/Backend/IR/Optimizer.hs +++ b/lib/Language/PureScript/Backend/IR/Optimizer.hs @@ -279,13 +279,12 @@ etaReduce ∷ RewriteRule Ann etaReduce = pure . \case Abs _ (ParamNamed _ param) (App _ m (Ref _ (Local param') 0)) - | param == param' → + | param == param' && countFreeRef (Local param) m == 0 → Rewritten Recurse m _ → NoChange betaReduceUnusedParams ∷ RewriteRule Ann -betaReduceUnusedParams = - pure . \case +betaReduceUnusedParams = pure . \case App _ (Abs _ (ParamUnused _) body) _arg → Rewritten Recurse body _ → NoChange diff --git a/test/ps/golden/Golden/Inline/Test.purs b/test/ps/golden/Golden/Inline/Test.purs index 447ac04..f4902ff 100644 --- a/test/ps/golden/Golden/Inline/Test.purs +++ b/test/ps/golden/Golden/Inline/Test.purs @@ -1,4 +1,9 @@ -module Golden.Inline.Test where +module Golden.Inline.Test + ( main + , Mu + , runMu + , iMu + ) where main :: Int main = @@ -7,3 +12,11 @@ main = in let y :: forall b. b -> Int y _ = 2 in x y + +newtype Mu a = MkMu (Mu a -> a) + +runMu :: forall a. Mu a -> a +runMu mu@(MkMu f) = f mu + +iMu :: Mu Int +iMu = MkMu runMu diff --git a/test/ps/output/Golden.Inline.Test/corefn.json b/test/ps/output/Golden.Inline.Test/corefn.json index 36ae11a..3105748 100644 --- a/test/ps/output/Golden.Inline.Test/corefn.json +++ b/test/ps/output/Golden.Inline.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,12],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[5,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,14],"start":[6,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"Abs"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[7,6]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[7,11]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[7,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[8,18],"start":[8,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"Abs"},"identifier":"y"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,10]}},"type":"Var","value":{"identifier":"x","sourcePos":[5,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[7,11]}},"type":"App"},"type":"Let"},"type":"Let"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Inline","Test"],"modulePath":"golden/Golden/Inline/Test.purs","reExports":{},"sourceSpan":{"end":[9,13],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,32],"start":[16,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[16,32],"start":[16,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,32],"start":[16,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"MkMu"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,7]}},"binder":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[19,17],"start":[19,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,17],"start":[19,16]}},"binderType":"VarBinder","identifier":"f"}],"constructorName":{"identifier":"MkMu","moduleName":["Golden","Inline","Test"]},"typeName":{"identifier":"Mu","moduleName":["Golden","Inline","Test"]}},"binderType":"NamedBinder","identifier":"mu"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,22],"start":[19,21]}},"type":"Var","value":{"identifier":"f","sourcePos":[19,16]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,23]}},"type":"Var","value":{"identifier":"mu","sourcePos":[19,7]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"runMu"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,12],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[10,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,30],"start":[10,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,30],"start":[10,7]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,14],"start":[11,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"Abs"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[12,6]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,34],"start":[12,11]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,34],"start":[12,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,18],"start":[13,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"Abs"},"identifier":"y"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,11],"start":[14,10]}},"type":"Var","value":{"identifier":"x","sourcePos":[10,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[14,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[14,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[12,11]}},"type":"App"},"type":"Let"},"type":"Let"},"identifier":"main"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,14],"start":[21,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[22,11],"start":[22,7]}},"type":"Var","value":{"identifier":"MkMu","moduleName":["Golden","Inline","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,12]}},"type":"Var","value":{"identifier":"runMu","moduleName":["Golden","Inline","Test"]}},"type":"App"},"identifier":"iMu"}],"exports":["main","runMu","iMu"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[1,1]}},"moduleName":["Golden","Inline","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Inline","Test"],"modulePath":"golden/Golden/Inline/Test.purs","reExports":{},"sourceSpan":{"end":[22,17],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Inline.Test/golden.ir b/test/ps/output/Golden.Inline.Test/golden.ir index 7547681..648a313 100644 --- a/test/ps/output/Golden.Inline.Test/golden.ir +++ b/test/ps/output/Golden.Inline.Test/golden.ir @@ -1,4 +1,23 @@ UberModule - { uberModuleBindings = [], uberModuleForeigns = [], uberModuleExports = - [ ( Name "main", LiteralInt Nothing 1 ) ] + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Golden.Inline.Test", qnameName = Name "runMu" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "main", LiteralInt Nothing 1 ), + ( Name "runMu", Ref Nothing + ( Imported ( ModuleName "Golden.Inline.Test" ) ( Name "runMu" ) ) 0 + ), + ( Name "iMu", Ref Nothing + ( Imported ( ModuleName "Golden.Inline.Test" ) ( Name "runMu" ) ) 0 + ) + ] } \ No newline at end of file diff --git a/test/ps/output/Golden.Inline.Test/golden.lua b/test/ps/output/Golden.Inline.Test/golden.lua index 2764a01..9e0c091 100644 --- a/test/ps/output/Golden.Inline.Test/golden.lua +++ b/test/ps/output/Golden.Inline.Test/golden.lua @@ -1 +1,7 @@ -return { main = 1 } +local M = {} +M.Golden_Inline_Test_runMu = function(v) return v(v) end +return { + main = 1, + runMu = M.Golden_Inline_Test_runMu, + iMu = M.Golden_Inline_Test_runMu +} From f384b927c7ee5ca4902449a1ccd469bee6172bcd Mon Sep 17 00:00:00 2001 From: UnrelatedString Date: Tue, 29 Apr 2025 01:52:50 -0400 Subject: [PATCH 08/40] this should work now i think --- lib/Language/PureScript/Backend/Lua/Fixture.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Language/PureScript/Backend/Lua/Fixture.hs b/lib/Language/PureScript/Backend/Lua/Fixture.hs index c341a20..d28bf70 100644 --- a/lib/Language/PureScript/Backend/Lua/Fixture.hs +++ b/lib/Language/PureScript/Backend/Lua/Fixture.hs @@ -61,7 +61,7 @@ objectUpdate = local function #{Name.toText objectUpdateName}(o, patches) local o_copy = {} for k, v in pairs(o) do - local patch_v = patches + local patch_v = patches[k] if patch_v ~= nil then o_copy[k] = patch_v else From 684b8d2c32524394c51577636a258e71d00cfefb Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Wed, 30 Apr 2025 10:28:22 +0200 Subject: [PATCH 09/40] update golden file --- .hspec-failures | 2 +- test/ps/output/Golden.RecordsUpdate.Test/golden.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.hspec-failures b/.hspec-failures index c44345d..b2268de 100644 --- a/.hspec-failures +++ b/.hspec-failures @@ -1 +1 @@ -FailureReport {failureReportSeed = 1246204243, failureReportMaxSuccess = 100, failureReportMaxSize = 100, failureReportMaxDiscardRatio = 10, failureReportPaths = []} \ No newline at end of file +FailureReport {failureReportSeed = 781992162, failureReportMaxSuccess = 100, failureReportMaxSize = 100, failureReportMaxDiscardRatio = 10, failureReportPaths = []} \ No newline at end of file diff --git a/test/ps/output/Golden.RecordsUpdate.Test/golden.lua b/test/ps/output/Golden.RecordsUpdate.Test/golden.lua index a8993c5..2ee76b6 100644 --- a/test/ps/output/Golden.RecordsUpdate.Test/golden.lua +++ b/test/ps/output/Golden.RecordsUpdate.Test/golden.lua @@ -1,7 +1,7 @@ local function PSLUA_object_update(o, patches) local o_copy = {} for k, v in pairs(o) do - local patch_v = patches + local patch_v = patches[k] if patch_v ~= nil then o_copy[k] = patch_v else From a2ad1fecb4456e08e6ea754481d0ed9c7c48fe76 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Tue, 14 Oct 2025 18:07:02 +0200 Subject: [PATCH 10/40] docs: add CLAUDE.md with project architecture and development guide Comprehensive documentation covering: - Build system and common development commands - Complete compilation pipeline architecture (CoreFn -> IR -> Lua) - Code style conventions (Fourmolu, HLint, unicode syntax) - Testing strategy with golden tests and property-based tests - Development workflow and debugging tips This provides essential context for understanding the multi-stage compiler architecture and project conventions. --- CLAUDE.md | 284 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..fb7abaa --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,284 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +This is `pslua` - a PureScript to Lua compiler backend. It takes PureScript CoreFn (the PureScript compiler's intermediate representation) and compiles it to Lua. The project supports dead code elimination (DCE), code inlining, FFI with Lua, and can emit either Lua modules or standalone applications. + +## Build System & Commands + +The project uses **Nix with flakes** for reproducible builds and **Cabal** for Haskell development. + +### Development Environment + +```bash +# Enter development shell (provides all tools) +nix develop + +# Or use direnv (if configured) +direnv allow +``` + +### Building + +```bash +# Build the project +cabal build + +# Build specific component +cabal build exe:pslua +cabal build lib:pslua +``` + +### Testing + +```bash +# Run all tests with detailed output +cabal test all --test-show-details=direct + +# Run specific test suite +cabal test spec + +# Run tests in watch mode (requires ghcid) +ghcid --command="cabal repl test:spec" --test=":main" +``` + +The test suite includes: +- **Unit tests**: Property-based testing with Hedgehog +- **Golden tests**: Compiles PureScript test modules from `test/ps/golden/Golden/*/Test.purs` to Lua and compares against golden files +- **Evaluation tests**: Runs generated Lua code and verifies output +- **Luacheck tests**: Validates generated Lua code syntax + +### Testing PureScript Code + +Golden tests require compiling PureScript sources first: + +```bash +# Compile PureScript test sources (from test/ps directory) +cd test/ps +spago build -u '-g corefn' +cd ../.. +``` + +### Resetting Golden Files + +```bash +# Remove all golden files and regenerate them +./scripts/golden_reset +``` + +This finds all files named `golden.*` in `test/ps/output` and deletes them, then runs `cabal test` to regenerate them. + +### Code Formatting & Linting + +```bash +# Format Haskell code with Fourmolu +fourmolu -i lib/ exe/ test/ + +# Or use treefmt to format all files +treefmt + +# Run HLint +hlint lib/ exe/ test/ + +# Check Lua files +luacheck --quiet --std min test/ps/output/ +``` + +### Running the Compiler + +```bash +# Build and run +cabal run pslua -- --help + +# Or after building +./dist-newstyle/build/x86_64-linux/ghc-9.8.1/pslua-0.1.0.0/x/pslua/build/pslua/pslua --help + +# Or via nix +nix run . -- --help +``` + +Typical usage: +```bash +pslua \ + --foreign-path ./foreign \ + --ps-output ./output \ + --lua-output-file ./dist/Main.lua \ + --entry Main.main +``` + +## Code Architecture + +### Compilation Pipeline + +The compilation happens in several distinct phases: + +``` +PureScript Source → CoreFn → IR → Lua → Optimized Lua +``` + +1. **CoreFn Reading** (`Language.PureScript.CoreFn.*`) + - Reads PureScript compiler's CoreFn JSON output + - Parses module structure, imports, and expressions + +2. **IR Translation** (`Language.PureScript.Backend.IR.*`) + - Converts CoreFn to an intermediate representation (IR) + - IR is simpler than CoreFn but still high-level + - Handles data declarations, bindings, and module structure + +3. **IR Optimization** (`Language.PureScript.Backend.IR.Optimizer`) + - Performs optimizations on IR: + - Eta reduction/expansion + - Beta reduction + - Constant folding + - Case-of-case transformation + - **Inliner** (`IR.Inliner`): Marks expressions for inlining + - **Dead Code Elimination** (`IR.DCE`): Removes unused bindings + +4. **Linking** (`Language.PureScript.Backend.IR.Linker`) + - Creates an "UberModule" containing all reachable code + - Supports two modes: + - `LinkAsModule`: Creates a Lua module (returns a table) + - `LinkAsApplication`: Creates a runnable Lua script (calls entry point) + +5. **Lua Code Generation** (`Language.PureScript.Backend.Lua`) + - Converts optimized IR to Lua AST + - Handles foreign imports via FFI + - Manages name mangling and scope + +6. **Lua Optimization** (`Language.PureScript.Backend.Lua.Optimizer`) + - Optimizes generated Lua code + +7. **Lua Printing** (`Language.PureScript.Backend.Lua.Printer`) + - Pretty-prints Lua AST to text + +### Key Module Structure + +**CoreFn Layer** (`Language.PureScript.CoreFn.*`): +- `CoreFn.Reader`: Reads CoreFn JSON from disk +- `CoreFn.FromJSON`: JSON deserialization +- `CoreFn.Expr`: CoreFn expression types +- `CoreFn.Traversals`: Traversal utilities + +**IR Layer** (`Language.PureScript.Backend.IR.*`): +- `IR.Types`: Core IR data types (`RawExp`, `Module`, `Binding`) +- `IR.Names`: Name types (`Qualified`, `ModuleName`, etc.) +- `IR.Linker`: Creates UberModule from multiple modules +- `IR.Optimizer`: IR-level optimizations +- `IR.DCE`: Dead code elimination +- `IR.Inliner`: Inlining annotations and logic + +**Lua Backend** (`Language.PureScript.Backend.Lua.*`): +- `Lua.Types`: Lua AST types (`Chunk`, `Statement`, `Exp`) +- `Lua.Name`: Safe Lua identifier generation +- `Lua.Printer`: Pretty-printing Lua code +- `Lua.Optimizer`: Lua-level optimizations +- `Lua.DCE`: Lua-specific DCE +- `Lua.Linker.Foreign`: FFI support for Lua foreign modules +- `Lua.Fixture`: Runtime support code injected into output + +**Main Entry** (`Language.PureScript.Backend`): +- `compileModules`: Top-level compilation function orchestrating the pipeline + +### Important Concepts + +**De Bruijn Indices**: The IR uses De Bruijn indices for variable references. A `Ref` contains: +- A qualified name +- An index indicating which binding of that name to reference + +**Groupings**: Bindings are wrapped in `Grouping`: +- `Standalone`: Non-recursive binding +- `RecursiveGroup`: Mutually recursive bindings + +**AppOrModule**: Determines compilation mode: +- `AsModule ModuleName`: Generate a Lua module +- `AsApplication ModuleName Ident`: Generate an executable that calls the entry point + +**UberModule**: A flattened representation of all modules after linking, containing: +- All reachable bindings +- Module exports +- Foreign imports + +## Code Style + +### Haskell Style + +This project follows specific Haskell style conventions: + +- **Indentation**: 2 spaces (enforced by Fourmolu) +- **Line length**: Max 80 characters +- **Unicode**: Always use unicode syntax (`∷` instead of `::`, `→` instead of `->`) +- **Prelude**: Uses Relude (not base Prelude) +- **Imports**: Explicit qualified imports preferred +- **Extensions**: Many enabled by default (see `pslua.cabal` common stanza) + +### Formatting Configuration + +- **Fourmolu** (`fourmolu.yaml`): + - 2-space indentation + - 80-character column limit + - Leading commas and function arrows + - Unicode always + - Multi-line Haddock style + +- **HLint** (`.hlint.yaml`): + - Configured with project-specific extensions + - Run with `--color --cpp-simple -XQuasiQuotes -XImportQualifiedPost` + +### Section Comments + +Use section-style comments to organize code: + +```haskell +-------------------------------------------------------------------------------- +-- Section Title --------------------------------------------------------------- + +code here... +``` + +Both lines should be exactly 80 characters. Helper functions go at the bottom after a "Helper Functions" or "Utility Functions" section. + +## Testing Strategy + +### Golden Tests + +Golden tests are the primary integration testing mechanism: + +1. PureScript test files in `test/ps/golden/Golden/*/Test.purs` +2. Compiled to CoreFn with `spago build -u '-g corefn'` +3. Test suite reads CoreFn, compiles to IR, generates Lua +4. Compares against golden files: + - `golden.ir` - Intermediate representation + - `golden.lua` - Generated Lua code + - `eval/golden.txt` - Execution output (if module has a `main` function) + +To add a new golden test: +1. Create `test/ps/golden/Golden/NewTest/Test.purs` +2. Run `cabal test` - it will fail and create `actual.*` files +3. Review the actual files +4. Rename `actual.*` to `golden.*` if correct +5. Commit the golden files + +### Property-Based Tests + +The project uses Hedgehog for property-based testing: +- Generators in `test/Language/PureScript/Backend/IR/Gen.hs` +- Tests in `test/Language/PureScript/Backend/IR/Spec.hs` and similar + +## Development Workflow + +1. Make code changes in `lib/` or `exe/` +2. Format code: `fourmolu -i lib/ exe/ test/` +3. Run HLint: `hlint lib/ exe/ test/` +4. Run tests: `cabal test all --test-show-details=direct` +5. If golden tests fail, inspect `actual.*` files in `test/ps/output/` +6. Update golden files if changes are correct + +## Debugging Tips + +- The IR and Lua types have `Show` instances - use `pShowOpt` for pretty debug output +- Golden test failures show diffs between expected and actual +- Use `actual.*` files alongside `golden.*` files to debug compilation issues +- Check `test/ps/output/Golden.*/` directories for generated IR and Lua +- Lua evaluation errors are captured in the test output From 235f36ea74825eb591c52dec60056a2c81b82251 Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Tue, 14 Oct 2025 18:07:11 +0200 Subject: [PATCH 11/40] chore: update flake dependencies Update Nix flake inputs: - easy-purescript-nix: 117fd96 -> b5ded0a - flake-utils: b1d9ab7 -> 11707dc - haskell.nix and related Hackage inputs updated Standard dependency update from nix flake update. --- flake.lock | 376 ++++++++++++++++++++++------------------------------- 1 file changed, 158 insertions(+), 218 deletions(-) diff --git a/flake.lock b/flake.lock index 7e7d4f9..8ad284c 100644 --- a/flake.lock +++ b/flake.lock @@ -88,11 +88,11 @@ "flake-utils": "flake-utils" }, "locked": { - "lastModified": 1710161569, - "narHash": "sha256-lcIRIOFCdIWEGyKyG/tB4KvxM9zoWuBRDxW+T+mvIb0=", + "lastModified": 1754252604, + "narHash": "sha256-Ta/HhK3BJ/yG7IYUWvqhOyQw5+R/a0fLAJeusFTNmKk=", "owner": "justinwoo", "repo": "easy-purescript-nix", - "rev": "117fd96acb69d7d1727df95b6fde9d8715e031fc", + "rev": "b5ded0a376d29605f5c7b27c6d55600028995bac", "type": "github" }, "original": { @@ -141,11 +141,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -154,68 +154,47 @@ "type": "github" } }, - "ghc-8.6.5-iohk": { + "hackage": { "flake": false, "locked": { - "lastModified": 1600920045, - "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", + "lastModified": 1760401501, + "narHash": "sha256-9OHoxOoHLi/ucvi4k3M/li1HhBWY5Xn4VAi4+6cmskQ=", "owner": "input-output-hk", - "repo": "ghc", - "rev": "95713a6ecce4551240da7c96b6176f980af75cae", + "repo": "hackage.nix", + "rev": "8a529b6761743b2d582d1ecaca0df1454a729168", "type": "github" }, "original": { "owner": "input-output-hk", - "ref": "release/8.6.5-iohk", - "repo": "ghc", + "repo": "hackage.nix", "type": "github" } }, - "ghc910X": { - "flake": false, - "locked": { - "lastModified": 1711543129, - "narHash": "sha256-MUI07CxYOng7ZwHnMCw0ugY3HmWo2p/f4r07CGV7OAM=", - "ref": "ghc-9.10", - "rev": "6ecd5f2ff97af53c7334f2d8581651203a2c6b7d", - "revCount": 62607, - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - }, - "original": { - "ref": "ghc-9.10", - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - } - }, - "ghc911": { + "hackage-for-stackage": { "flake": false, "locked": { - "lastModified": 1711538967, - "narHash": "sha256-KSdOJ8seP3g30FaC2du8QjU9vumMnmzPR5wfkVRXQMk=", - "ref": "refs/heads/master", - "rev": "0acfe391583d77a72051d505f05fab0ada056c49", - "revCount": 62632, - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" + "lastModified": 1760401490, + "narHash": "sha256-23yoe4d68cmiLV+f+NeU2ZIdVRUEF/m4tfysliCp0Vc=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "19dfc080114658671e820e460da77a68e34662e5", + "type": "github" }, "original": { - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" + "owner": "input-output-hk", + "ref": "for-stackage", + "repo": "hackage.nix", + "type": "github" } }, - "hackage": { + "hackage-internal": { "flake": false, "locked": { - "lastModified": 1713659097, - "narHash": "sha256-HLnaRb/Q6hOnNj/5Unz7xsmO5b2gcrFr3nKdUQgMchQ=", + "lastModified": 1750307553, + "narHash": "sha256-iiafNoeLHwlSLQTyvy8nPe2t6g5AV4PPcpMeH/2/DLs=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "515f09ec65043eee03970616f389c379258d2c53", + "rev": "f7867baa8817fab296528f4a4ec39d1c7c4da4f3", "type": "github" }, "original": { @@ -232,42 +211,43 @@ "cabal-36": "cabal-36", "cardano-shell": "cardano-shell", "flake-compat": "flake-compat", - "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", - "ghc910X": "ghc910X", - "ghc911": "ghc911", "hackage": "hackage", + "hackage-for-stackage": "hackage-for-stackage", + "hackage-internal": "hackage-internal", + "hls": "hls", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", + "hls-2.10": "hls-2.10", + "hls-2.11": "hls-2.11", "hls-2.2": "hls-2.2", "hls-2.3": "hls-2.3", "hls-2.4": "hls-2.4", "hls-2.5": "hls-2.5", "hls-2.6": "hls-2.6", "hls-2.7": "hls-2.7", + "hls-2.8": "hls-2.8", + "hls-2.9": "hls-2.9", "hpc-coveralls": "hpc-coveralls", - "hydra": "hydra", "iserv-proxy": "iserv-proxy", "nixpkgs": [ "haskellNix", "nixpkgs-unstable" ], - "nixpkgs-2003": "nixpkgs-2003", - "nixpkgs-2105": "nixpkgs-2105", - "nixpkgs-2111": "nixpkgs-2111", - "nixpkgs-2205": "nixpkgs-2205", - "nixpkgs-2211": "nixpkgs-2211", "nixpkgs-2305": "nixpkgs-2305", "nixpkgs-2311": "nixpkgs-2311", + "nixpkgs-2405": "nixpkgs-2405", + "nixpkgs-2411": "nixpkgs-2411", + "nixpkgs-2505": "nixpkgs-2505", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1713660611, - "narHash": "sha256-v1234hmQ4kdOkWf+STY1tdeZM8V8hgU7tHqhgmoC1Bw=", + "lastModified": 1760403127, + "narHash": "sha256-Nx7bintaRzBarcV3S92xw5P68CdE+9/KkwjWibThd/M=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "f5b0f70e987cba6944121856973cbd1507053a20", + "rev": "8244bb25bacd06f80fb7d79537eede0d6449faf6", "type": "github" }, "original": { @@ -276,6 +256,22 @@ "type": "github" } }, + "hls": { + "flake": false, + "locked": { + "lastModified": 1741604408, + "narHash": "sha256-tuq3+Ip70yu89GswZ7DSINBpwRprnWnl6xDYnS4GOsc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "682d6894c94087da5e566771f25311c47e145359", + "type": "github" + }, + "original": { + "owner": "haskell", + "repo": "haskell-language-server", + "type": "github" + } + }, "hls-1.10": { "flake": false, "locked": { @@ -310,6 +306,40 @@ "type": "github" } }, + "hls-2.10": { + "flake": false, + "locked": { + "lastModified": 1743069404, + "narHash": "sha256-q4kDFyJDDeoGqfEtrZRx4iqMVEC2MOzCToWsFY+TOzY=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "2318c61db3a01e03700bd4b05665662929b7fe8b", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.10.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.11": { + "flake": false, + "locked": { + "lastModified": 1747306193, + "narHash": "sha256-/MmtpF8+FyQlwfKHqHK05BdsxC9LHV70d/FiMM7pzBM=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "46ef4523ea4949f47f6d2752476239f1c6d806fe", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.11.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, "hls-2.2": { "flake": false, "locked": { @@ -412,256 +442,166 @@ "type": "github" } }, - "hpc-coveralls": { + "hls-2.8": { "flake": false, "locked": { - "lastModified": 1607498076, - "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", + "lastModified": 1715153580, + "narHash": "sha256-Vi/iUt2pWyUJlo9VrYgTcbRviWE0cFO6rmGi9rmALw0=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "dd1be1beb16700de59e0d6801957290bcf956a0a", "type": "github" }, "original": { - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "type": "github" - } - }, - "hydra": { - "inputs": { - "nix": "nix", - "nixpkgs": [ - "haskellNix", - "hydra", - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1671755331, - "narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=", - "owner": "NixOS", - "repo": "hydra", - "rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8", + "owner": "haskell", + "ref": "2.8.0.0", + "repo": "haskell-language-server", "type": "github" - }, - "original": { - "id": "hydra", - "type": "indirect" } }, - "iserv-proxy": { + "hls-2.9": { "flake": false, "locked": { - "lastModified": 1708894040, - "narHash": "sha256-Rv+PajrnuJ6AeyhtqzMN+bcR8z9+aEnrUass+N951CQ=", - "owner": "stable-haskell", - "repo": "iserv-proxy", - "rev": "2f2a318fd8837f8063a0d91f329aeae29055fba9", + "lastModified": 1719993701, + "narHash": "sha256-wy348++MiMm/xwtI9M3vVpqj2qfGgnDcZIGXw8sF1sA=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "90319a7e62ab93ab65a95f8f2bcf537e34dae76a", "type": "github" }, "original": { - "owner": "stable-haskell", - "ref": "iserv-syms", - "repo": "iserv-proxy", + "owner": "haskell", + "ref": "2.9.0.1", + "repo": "haskell-language-server", "type": "github" } }, - "lowdown-src": { + "hpc-coveralls": { "flake": false, "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs", - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1661606874, - "narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=", - "owner": "NixOS", - "repo": "nix", - "rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "2.11.0", - "repo": "nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1657693803, - "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2003": { - "locked": { - "lastModified": 1620055814, - "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-20.03-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2105": { - "locked": { - "lastModified": 1659914493, - "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", + "lastModified": 1607498076, + "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.05-darwin", - "repo": "nixpkgs", + "owner": "sevanspowell", + "repo": "hpc-coveralls", "type": "github" } }, - "nixpkgs-2111": { + "iserv-proxy": { + "flake": false, "locked": { - "lastModified": 1659446231, - "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", + "lastModified": 1755243078, + "narHash": "sha256-GLbl1YaohKdpzZVJFRdcI1O1oE3F3uBer4lFv3Yy0l8=", + "owner": "stable-haskell", + "repo": "iserv-proxy", + "rev": "150605195cb7183a6fb7bed82f23fedf37c6f52a", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.11-darwin", - "repo": "nixpkgs", + "owner": "stable-haskell", + "ref": "iserv-syms", + "repo": "iserv-proxy", "type": "github" } }, - "nixpkgs-2205": { + "nixpkgs-2305": { "locked": { - "lastModified": 1685573264, - "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "380be19fbd2d9079f677978361792cb25e8a3635", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-22.05-darwin", + "ref": "nixpkgs-23.05-darwin", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-2211": { + "nixpkgs-2311": { "locked": { - "lastModified": 1688392541, - "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "lastModified": 1719957072, + "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-22.11-darwin", + "ref": "nixpkgs-23.11-darwin", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-2305": { + "nixpkgs-2405": { "locked": { - "lastModified": 1701362232, - "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", + "lastModified": 1735564410, + "narHash": "sha256-HB/FA0+1gpSs8+/boEavrGJH+Eq08/R2wWNph1sM1Dg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", + "rev": "1e7a8f391f1a490460760065fa0630b5520f9cf8", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-23.05-darwin", + "ref": "nixpkgs-24.05-darwin", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-2311": { + "nixpkgs-2411": { "locked": { - "lastModified": 1701386440, - "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "lastModified": 1748037224, + "narHash": "sha256-92vihpZr6dwEMV6g98M5kHZIttrWahb9iRPBm1atcPk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "rev": "f09dede81861f3a83f7f06641ead34f02f37597f", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-23.11-darwin", + "ref": "nixpkgs-24.11-darwin", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-regression": { + "nixpkgs-2505": { "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "lastModified": 1754477006, + "narHash": "sha256-suIgZZHXdb4ca9nN4MIcmdjeN+ZWsTwCtYAG4HExqAo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "rev": "4896699973299bffae27d0d9828226983544d9e9", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-25.05-darwin", "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1694822471, - "narHash": "sha256-6fSDCj++lZVMZlyqOe9SIOL8tYSBz1bI8acwovRwoX8=", + "lastModified": 1754393734, + "narHash": "sha256-fbnmAwTQkuXHKBlcL5Nq1sMAzd3GFqCOQgEQw6Hy0Ak=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", + "rev": "a683adc19ff5228af548c6539dbc3440509bfed3", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" } }, @@ -696,11 +636,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1713658249, - "narHash": "sha256-+fjl407ii7vN2GazvewniOmriimgV4uRJussDJB7Ssg=", + "lastModified": 1760400715, + "narHash": "sha256-IrQRC0CiNrA71Rq40fWdTwBWGtXramBevsU/OEVcCtI=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "8387248af9b576dd2f4057690e79e533d42fa6ca", + "rev": "c9ed9ca5d8b9820d021c556481d2006319d143d4", "type": "github" }, "original": { From bf84516060ec828ff008acf244f54bcfd4c232cb Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Tue, 14 Oct 2025 18:07:36 +0200 Subject: [PATCH 12/40] chore: add .hspec-failures to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f45c27f..ae43ec4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ result-* /output/ .vscode/settings.json .envrc.local +.hspec-failures From 418e15c4c16aeb9da405466efe6c195a83643631 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 09:24:37 +0200 Subject: [PATCH 13/40] chore(nix): update flake inputs, bump PureScript to 0.15.16 Update haskell.nix (brings GHC 9.8.4 and a fresh Hackage index pin), nixpkgs, and easy-purescript-nix. Switch the dev shell to purs 0.15.16-0 (the upstream release attribute carries a -0 suffix). --- flake.lock | 107 +++++++++++++++++++++++++++++++---------------------- flake.nix | 2 +- 2 files changed, 63 insertions(+), 46 deletions(-) diff --git a/flake.lock b/flake.lock index 8ad284c..8e7fce8 100644 --- a/flake.lock +++ b/flake.lock @@ -16,23 +16,6 @@ "type": "github" } }, - "cabal-32": { - "flake": false, - "locked": { - "lastModified": 1603716527, - "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", - "owner": "haskell", - "repo": "cabal", - "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.2", - "repo": "cabal", - "type": "github" - } - }, "cabal-34": { "flake": false, "locked": { @@ -88,11 +71,11 @@ "flake-utils": "flake-utils" }, "locked": { - "lastModified": 1754252604, - "narHash": "sha256-Ta/HhK3BJ/yG7IYUWvqhOyQw5+R/a0fLAJeusFTNmKk=", + "lastModified": 1763814099, + "narHash": "sha256-YazeA9u0JdxykexV6HHG5DMtsnwqXoiAcWPjncO1XHM=", "owner": "justinwoo", "repo": "easy-purescript-nix", - "rev": "b5ded0a376d29605f5c7b27c6d55600028995bac", + "rev": "8fcd84f54d75d9007b2f1c7c9da5af843105a55f", "type": "github" }, "original": { @@ -157,11 +140,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1760401501, - "narHash": "sha256-9OHoxOoHLi/ucvi4k3M/li1HhBWY5Xn4VAi4+6cmskQ=", + "lastModified": 1781226159, + "narHash": "sha256-BD3MeXxK03Tnh1KxVKMYlU+H8hks+dVMOQLeriAkK8M=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "8a529b6761743b2d582d1ecaca0df1454a729168", + "rev": "cc1f434e3407d58970261cbff2e4a5dab00b803b", "type": "github" }, "original": { @@ -173,11 +156,11 @@ "hackage-for-stackage": { "flake": false, "locked": { - "lastModified": 1760401490, - "narHash": "sha256-23yoe4d68cmiLV+f+NeU2ZIdVRUEF/m4tfysliCp0Vc=", + "lastModified": 1781226148, + "narHash": "sha256-95My9dq0a6wCV1v/78OJ+NUKBdD1TwyZomuTc/AxJFg=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "19dfc080114658671e820e460da77a68e34662e5", + "rev": "6233e06fc1f6345f27324f55c485561848d784db", "type": "github" }, "original": { @@ -206,7 +189,6 @@ "haskellNix": { "inputs": { "HTTP": "HTTP", - "cabal-32": "cabal-32", "cabal-34": "cabal-34", "cabal-36": "cabal-36", "cardano-shell": "cardano-shell", @@ -219,6 +201,7 @@ "hls-2.0": "hls-2.0", "hls-2.10": "hls-2.10", "hls-2.11": "hls-2.11", + "hls-2.12": "hls-2.12", "hls-2.2": "hls-2.2", "hls-2.3": "hls-2.3", "hls-2.4": "hls-2.4", @@ -238,16 +221,17 @@ "nixpkgs-2405": "nixpkgs-2405", "nixpkgs-2411": "nixpkgs-2411", "nixpkgs-2505": "nixpkgs-2505", + "nixpkgs-2511": "nixpkgs-2511", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1760403127, - "narHash": "sha256-Nx7bintaRzBarcV3S92xw5P68CdE+9/KkwjWibThd/M=", + "lastModified": 1781228148, + "narHash": "sha256-Qu6Zml4PHTgV1vs5RuLZzHuNOZYbeOtjeQq8yLIUbTU=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "8244bb25bacd06f80fb7d79537eede0d6449faf6", + "rev": "fe9f2b0bfc6fc1bcc15eba41c729228135cda6ed", "type": "github" }, "original": { @@ -340,6 +324,23 @@ "type": "github" } }, + "hls-2.12": { + "flake": false, + "locked": { + "lastModified": 1758709460, + "narHash": "sha256-xkI8MIIVEVARskfWbGAgP5sHG/lyeKnkm0LIOJ19X5w=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "7d983de4fa7ff54369f6dd31444bdb9869aec83e", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.12.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, "hls-2.2": { "flake": false, "locked": { @@ -495,11 +496,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1755243078, - "narHash": "sha256-GLbl1YaohKdpzZVJFRdcI1O1oE3F3uBer4lFv3Yy0l8=", + "lastModified": 1778457436, + "narHash": "sha256-bzZAHGzwcQGzBTipJuUs9tvMGO28kp0373zqnpn0g5A=", "owner": "stable-haskell", "repo": "iserv-proxy", - "rev": "150605195cb7183a6fb7bed82f23fedf37c6f52a", + "rev": "8cdc446f8e2d91b120ecc075063e9475d387df52", "type": "github" }, "original": { @@ -559,11 +560,11 @@ }, "nixpkgs-2411": { "locked": { - "lastModified": 1748037224, - "narHash": "sha256-92vihpZr6dwEMV6g98M5kHZIttrWahb9iRPBm1atcPk=", + "lastModified": 1751290243, + "narHash": "sha256-kNf+obkpJZWar7HZymXZbW+Rlk3HTEIMlpc6FCNz0Ds=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f09dede81861f3a83f7f06641ead34f02f37597f", + "rev": "5ab036a8d97cb9476fbe81b09076e6e91d15e1b6", "type": "github" }, "original": { @@ -575,11 +576,11 @@ }, "nixpkgs-2505": { "locked": { - "lastModified": 1754477006, - "narHash": "sha256-suIgZZHXdb4ca9nN4MIcmdjeN+ZWsTwCtYAG4HExqAo=", + "lastModified": 1764560356, + "narHash": "sha256-M5aFEFPppI4UhdOxwdmceJ9bDJC4T6C6CzCK1E2FZyo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4896699973299bffae27d0d9828226983544d9e9", + "rev": "6c8f0cca84510cc79e09ea99a299c9bc17d03cb6", "type": "github" }, "original": { @@ -589,13 +590,29 @@ "type": "github" } }, + "nixpkgs-2511": { + "locked": { + "lastModified": 1775749320, + "narHash": "sha256-msT6frWJSQ2WR+0cpk+KPcZdLTLagUIsJwQwIX9JNSo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "74b87959b2d16f59f54d8559cf3cf26b9d907949", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { - "lastModified": 1754393734, - "narHash": "sha256-fbnmAwTQkuXHKBlcL5Nq1sMAzd3GFqCOQgEQw6Hy0Ak=", + "lastModified": 1775888245, + "narHash": "sha256-nwASzrRDD1JBEu/o8ekKYEXm/oJW6EMCzCRdrwcLe90=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a683adc19ff5228af548c6539dbc3440509bfed3", + "rev": "13043924aaa7375ce482ebe2494338e058282925", "type": "github" }, "original": { @@ -636,11 +653,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1760400715, - "narHash": "sha256-IrQRC0CiNrA71Rq40fWdTwBWGtXramBevsU/OEVcCtI=", + "lastModified": 1781225038, + "narHash": "sha256-eG1GGyHdEI8y2chHOmgx0rypbHyjIn9ViawYmN2CEd4=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "c9ed9ca5d8b9820d021c556481d2006319d143d4", + "rev": "e2af13c92a93da96529a874428acae18d085bafe", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 3ccb1da..d09efd3 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,7 @@ }; buildInputs = with pkgs; [ cachix - easy-ps.purs-0_15_15 + easy-ps.purs-0_15_16-0 easy-ps.spago lua51Packages.lua lua51Packages.luacheck From 7bb2f0be57426217911175496720f0f54056359b Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 09:24:46 +0200 Subject: [PATCH 14/40] chore(test): update PureScript package sets Bump upstream-ps to psc-0.15.15-20260605 and upstream-lua to psc-0.15.15-20260612. The 20260612 lua set restores the prelude v7.2.0 pin (unit = {} instead of nil) that was lost in the 20240829 release: nil values silently collapse Lua arrays, breaking Array Unit at runtime. corefn.json changes are the builtWith stamp 0.15.15 -> 0.15.16 after recompiling with the new purs. Golden files are unchanged: generated code is identical. --- test/ps/output/Golden.Annotations.M1/corefn.json | 2 +- test/ps/output/Golden.Annotations.M2/corefn.json | 2 +- test/ps/output/Golden.ArrayOfUnits.Test/corefn.json | 2 +- test/ps/output/Golden.Beta.Test/corefn.json | 2 +- test/ps/output/Golden.Bug1.Test/corefn.json | 2 +- test/ps/output/Golden.CaseStatements.Test/corefn.json | 2 +- test/ps/output/Golden.Currying.Test/corefn.json | 2 +- test/ps/output/Golden.DataDeclarations.Test1/corefn.json | 2 +- test/ps/output/Golden.DataDeclarations.Test2/corefn.json | 2 +- test/ps/output/Golden.Fibonacci.Test/corefn.json | 2 +- test/ps/output/Golden.Foreign.Lib/corefn.json | 2 +- test/ps/output/Golden.Foreign.Test/corefn.json | 2 +- test/ps/output/Golden.HelloPrelude.Test/corefn.json | 2 +- test/ps/output/Golden.Inline.Test/corefn.json | 2 +- test/ps/output/Golden.NameShadowing.Test/corefn.json | 2 +- test/ps/output/Golden.Nested.Test/corefn.json | 2 +- test/ps/output/Golden.Newtype.Test/corefn.json | 2 +- test/ps/output/Golden.PatternMatching.Test1/corefn.json | 2 +- test/ps/output/Golden.PatternMatching.Test2/corefn.json | 2 +- test/ps/output/Golden.RecDataDefs.Test/corefn.json | 2 +- test/ps/output/Golden.RecordsAccess.Test/corefn.json | 2 +- test/ps/output/Golden.RecordsUpdate.Test/corefn.json | 2 +- test/ps/output/Golden.RecursiveBindings.Test/corefn.json | 2 +- test/ps/output/Golden.Reexport.Exports/corefn.json | 2 +- test/ps/output/Golden.Reexport.ReExports/corefn.json | 2 +- test/ps/output/Golden.Reexport.Test/corefn.json | 2 +- test/ps/output/Golden.TestReturnTableField/corefn.json | 2 +- test/ps/output/Golden.Unbinding.Test/corefn.json | 2 +- test/ps/output/Golden.Values.Test/corefn.json | 2 +- test/ps/packages.dhall | 8 ++++---- 30 files changed, 33 insertions(+), 33 deletions(-) diff --git a/test/ps/output/Golden.Annotations.M1/corefn.json b/test/ps/output/Golden.Annotations.M1/corefn.json index 713c3d4..2cd1796 100644 --- a/test/ps/output/Golden.Annotations.M1/corefn.json +++ b/test/ps/output/Golden.Annotations.M1/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[{"LineComment":" @inline inlineMe always"},{"LineComment":" @inline inlineMeLambda always"}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"binderType":"VarBinder","identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,14]}},"type":"Var","value":{"identifier":"x","sourcePos":[7,10]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"inlineMe"}],"exports":["inlineMe","dontInlineClosure","inlineMeLambda"],"foreign":["dontInlineClosure","inlineMeLambda"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[3,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Annotations","M1"],"modulePath":"golden/Golden/Annotations/M1.purs","reExports":{},"sourceSpan":{"end":[10,44],"start":[3,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[{"LineComment":" @inline inlineMe always"},{"LineComment":" @inline inlineMeLambda always"}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"binderType":"VarBinder","identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,14]}},"type":"Var","value":{"identifier":"x","sourcePos":[7,10]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"inlineMe"}],"exports":["inlineMe","dontInlineClosure","inlineMeLambda"],"foreign":["dontInlineClosure","inlineMeLambda"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[3,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Annotations","M1"],"modulePath":"golden/Golden/Annotations/M1.purs","reExports":{},"sourceSpan":{"end":[10,44],"start":[3,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Annotations.M2/corefn.json b/test/ps/output/Golden.Annotations.M2/corefn.json index b5508d0..219420c 100644 --- a/test/ps/output/Golden.Annotations.M2/corefn.json +++ b/test/ps/output/Golden.Annotations.M2/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,21],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[9,69],"start":[9,17]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,32],"start":[11,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[12,35],"start":[12,21]}},"type":"Var","value":{"identifier":"inlineMeLambda","moduleName":["Golden","Annotations","M1"]}},"identifier":"inlineIntoMe3"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,34],"start":[9,17]}},"type":"Var","value":{"identifier":"dontInlineClosure","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,69],"start":[9,17]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,49],"start":[9,35]}},"type":"Var","value":{"identifier":"inlineMeLambda","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,68],"start":[9,35]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,64],"start":[9,51]}},"type":"Var","value":{"identifier":"inlineIntoMe3","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,67],"start":[9,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,67],"start":[9,65]}},"type":"Literal","value":{"literalType":"IntLiteral","value":17}},"type":"App"},"type":"App"},"type":"App"},"type":"Let"},"identifier":"inlineIntoMe2"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,27],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,27],"start":[5,1]}},"argument":"i","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,26],"start":[6,18]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,50],"start":[6,18]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,36],"start":[6,28]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,49],"start":[6,28]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,46],"start":[6,38]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,47]}},"type":"Var","value":{"identifier":"i","sourcePos":[6,1]}},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"identifier":"inlineIntoMe"}],"exports":["inlineIntoMe","inlineIntoMe2"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,35],"start":[1,1]}},"moduleName":["Golden","Annotations","M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,35],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Annotations","M2"],"modulePath":"golden/Golden/Annotations/M2.purs","reExports":{},"sourceSpan":{"end":[12,35],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,21],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[9,69],"start":[9,17]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,32],"start":[11,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[12,35],"start":[12,21]}},"type":"Var","value":{"identifier":"inlineMeLambda","moduleName":["Golden","Annotations","M1"]}},"identifier":"inlineIntoMe3"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,34],"start":[9,17]}},"type":"Var","value":{"identifier":"dontInlineClosure","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,69],"start":[9,17]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,49],"start":[9,35]}},"type":"Var","value":{"identifier":"inlineMeLambda","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,68],"start":[9,35]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,64],"start":[9,51]}},"type":"Var","value":{"identifier":"inlineIntoMe3","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,67],"start":[9,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,67],"start":[9,65]}},"type":"Literal","value":{"literalType":"IntLiteral","value":17}},"type":"App"},"type":"App"},"type":"App"},"type":"Let"},"identifier":"inlineIntoMe2"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,27],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,27],"start":[5,1]}},"argument":"i","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,26],"start":[6,18]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,50],"start":[6,18]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,36],"start":[6,28]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,49],"start":[6,28]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,46],"start":[6,38]}},"type":"Var","value":{"identifier":"inlineMe","moduleName":["Golden","Annotations","M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,47]}},"type":"Var","value":{"identifier":"i","sourcePos":[6,1]}},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"identifier":"inlineIntoMe"}],"exports":["inlineIntoMe","inlineIntoMe2"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,35],"start":[1,1]}},"moduleName":["Golden","Annotations","M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,35],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Annotations","M2"],"modulePath":"golden/Golden/Annotations/M2.purs","reExports":{},"sourceSpan":{"end":[12,35],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/corefn.json b/test/ps/output/Golden.ArrayOfUnits.Test/corefn.json index 570b7a6..2036fe9 100644 --- a/test/ps/output/Golden.ArrayOfUnits.Test/corefn.json +++ b/test/ps/output/Golden.ArrayOfUnits.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,19],"start":[16,13]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","Foldable"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"foldableArray","moduleName":["Data","Foldable"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"length"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,10],"start":[17,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,14],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,31],"start":[12,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,24],"start":[12,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,31],"start":[13,13]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,18],"start":[13,14]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,24],"start":[13,20]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,30],"start":[13,26]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}}]}},"identifier":"arr"}],"expression":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,12],"start":[14,3]}},"type":"Var","value":{"identifier":"traverse_","moduleName":["Data","Foldable"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"foldableArray","moduleName":["Data","Foldable"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,13]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showUnit","moduleName":["Data","Show"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,21]}},"type":"Var","value":{"identifier":"arr","sourcePos":[12,7]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[15,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,17],"start":[15,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"length","moduleName":["Golden","ArrayOfUnits","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[16,20]}},"type":"Var","value":{"identifier":"arr","sourcePos":[12,7]}},"type":"App"},"identifier":"len"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ArrayOfUnits","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[17,11]}},"type":"Var","value":{"identifier":"len","sourcePos":[15,7]}},"type":"App"},"type":"Let"},"type":"Abs"},"type":"App"},"type":"Let"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Foldable"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,36],"start":[7,1]}},"moduleName":["Data","Traversable"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Unit"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,37],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","ArrayOfUnits","Test"],"modulePath":"golden/Golden/ArrayOfUnits/Test.purs","reExports":{},"sourceSpan":{"end":[17,14],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,19],"start":[16,13]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","Foldable"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"foldableArray","moduleName":["Data","Foldable"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"length"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,10],"start":[17,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,14],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,31],"start":[12,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,24],"start":[12,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,31],"start":[13,13]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,18],"start":[13,14]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,24],"start":[13,20]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,30],"start":[13,26]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}}]}},"identifier":"arr"}],"expression":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,12],"start":[14,3]}},"type":"Var","value":{"identifier":"traverse_","moduleName":["Data","Foldable"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"foldableArray","moduleName":["Data","Foldable"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,20],"start":[14,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,13]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,20],"start":[14,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showUnit","moduleName":["Data","Show"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,21]}},"type":"Var","value":{"identifier":"arr","sourcePos":[12,7]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,24],"start":[14,3]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[15,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,17],"start":[15,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"length","moduleName":["Golden","ArrayOfUnits","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[16,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,23],"start":[16,20]}},"type":"Var","value":{"identifier":"arr","sourcePos":[12,7]}},"type":"App"},"identifier":"len"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ArrayOfUnits","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[17,11]}},"type":"Var","value":{"identifier":"len","sourcePos":[15,7]}},"type":"App"},"type":"Let"},"type":"Abs"},"type":"App"},"type":"Let"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Foldable"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,36],"start":[7,1]}},"moduleName":["Data","Traversable"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Data","Unit"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,37],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[17,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","ArrayOfUnits","Test"],"modulePath":"golden/Golden/ArrayOfUnits/Test.purs","reExports":{},"sourceSpan":{"end":[17,14],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Beta.Test/corefn.json b/test/ps/output/Golden.Beta.Test/corefn.json index a1ed5c4..2d5036a 100644 --- a/test/ps/output/Golden.Beta.Test/corefn.json +++ b/test/ps/output/Golden.Beta.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,5],"start":[4,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":42}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,4],"start":[5,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,8],"start":[5,7]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[8,8],"start":[8,7]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Beta","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,9]}},"type":"Var","value":{"identifier":"x","sourcePos":[8,1]}},"type":"App"},"type":"Abs"},"identifier":"g"}],"exports":["g"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[1,1]}},"moduleName":["Golden","Beta","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Beta","Test"],"modulePath":"golden/Golden/Beta/Test.purs","reExports":{},"sourceSpan":{"end":[8,10],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,5],"start":[4,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":42}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,4],"start":[5,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,8],"start":[5,7]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[8,8],"start":[8,7]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Beta","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,9]}},"type":"Var","value":{"identifier":"x","sourcePos":[8,1]}},"type":"App"},"type":"Abs"},"identifier":"g"}],"exports":["g"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[1,1]}},"moduleName":["Golden","Beta","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Beta","Test"],"modulePath":"golden/Golden/Beta/Test.purs","reExports":{},"sourceSpan":{"end":[8,10],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Bug1.Test/corefn.json b/test/ps/output/Golden.Bug1.Test/corefn.json index df381f9..36ab68c 100644 --- a/test/ps/output/Golden.Bug1.Test/corefn.json +++ b/test/ps/output/Golden.Bug1.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,12],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[5,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"argument":"r","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,14]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[5,28],"start":[5,22]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,22]}},"type":"Var","value":{"identifier":"r","sourcePos":[5,7]}},"fieldName":"elem","type":"Accessor"}]]}},"type":"Abs"},"identifier":"go"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"elem","type":"Accessor"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,14]}},"type":"Var","value":{"identifier":"go","sourcePos":[5,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,17]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[6,26],"start":[6,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"test"}],"exports":["test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Bug1","Test"],"modulePath":"golden/Golden/Bug1/Test.purs","reExports":{},"sourceSpan":{"end":[6,29],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,12],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[5,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,7]}},"argument":"r","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,30],"start":[5,14]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[5,28],"start":[5,22]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,22]}},"type":"Var","value":{"identifier":"r","sourcePos":[5,7]}},"fieldName":"elem","type":"Accessor"}]]}},"type":"Abs"},"identifier":"go"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,6]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"elem","type":"Accessor"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,14]}},"type":"Var","value":{"identifier":"go","sourcePos":[5,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,28],"start":[6,17]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["elem",{"annotation":{"meta":null,"sourceSpan":{"end":[6,26],"start":[6,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"test"}],"exports":["test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Bug1","Test"],"modulePath":"golden/Golden/Bug1/Test.purs","reExports":{},"sourceSpan":{"end":[6,29],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.CaseStatements.Test/corefn.json b/test/ps/output/Golden.CaseStatements.Test/corefn.json index 130ca43..c03ecb6 100644 --- a/test/ps/output/Golden.CaseStatements.Test/corefn.json +++ b/test/ps/output/Golden.CaseStatements.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"J","fieldNames":["value0"],"type":"Constructor","typeName":"M"},"identifier":"J"},{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"N","fieldNames":[],"type":"Constructor","typeName":"M"},"identifier":"N"},{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"caseAlternatives":[{"binders":[],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[59,14],"start":[59,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[59,10],"start":[59,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}},{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[60,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[60,9],"start":[60,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}}],"isGuarded":true}],"caseExpressions":[],"type":"Case"},"identifier":"multipleGuards"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,8],"start":[42,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"y"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,13],"start":[42,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,6],"start":[43,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[43,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,8],"start":[41,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"x"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,14],"start":[41,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"J","moduleName":["Golden","CaseStatements","Test"]},"typeName":{"identifier":"M","moduleName":["Golden","CaseStatements","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,22],"start":[41,21]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"N","moduleName":["Golden","CaseStatements","Test"]},"typeName":{"identifier":"M","moduleName":["Golden","CaseStatements","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,31]}},"type":"Var","value":{"identifier":"y","sourcePos":[41,13]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,27],"start":[41,26]}},"type":"Var","value":{"identifier":"n","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,19],"start":[41,18]}},"type":"Var","value":{"identifier":"m","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Let"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"d"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,9],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,8],"start":[9,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,8],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[15,9],"start":[15,8]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,21],"start":[15,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,13],"start":[15,12]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,14]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,12],"start":[16,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":3}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[16,15],"start":[16,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,26],"start":[16,25]}},"type":"Var","value":{"identifier":"y","sourcePos":[16,5]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,19],"start":[16,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,20]}},"type":"Var","value":{"identifier":"z","sourcePos":[16,8]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,12],"start":[17,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":4}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,26],"start":[17,25]}},"type":"Var","value":{"identifier":"z","sourcePos":[17,8]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,19],"start":[17,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,20]}},"type":"Var","value":{"identifier":"y","sourcePos":[17,5]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,5]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","CaseStatements","Test"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","CaseStatements","Test"]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[14,11],"start":[14,8]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"b"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,28],"start":[14,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,19]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,15],"start":[14,14]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,16]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","CaseStatements","Test"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","CaseStatements","Test"]}}],"type":"Case"},"type":"Let"},"identifier":"c"}],"exports":["a","b","c","J","N","d","multipleGuards"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","CaseStatements","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","Values","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","CaseStatements","Test"],"modulePath":"golden/Golden/CaseStatements/Test.purs","reExports":{},"sourceSpan":{"end":[60,13],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"J","fieldNames":["value0"],"type":"Constructor","typeName":"M"},"identifier":"J"},{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,1]}},"constructorName":"N","fieldNames":[],"type":"Constructor","typeName":"M"},"identifier":"N"},{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[57,21],"start":[57,1]}},"caseAlternatives":[{"binders":[],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[59,14],"start":[59,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[59,10],"start":[59,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}},{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[60,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"guard":{"annotation":{"meta":null,"sourceSpan":{"end":[60,9],"start":[60,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}}],"isGuarded":true}],"caseExpressions":[],"type":"Case"},"identifier":"multipleGuards"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,8],"start":[42,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"y"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,13],"start":[42,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,6],"start":[43,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[43,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,8],"start":[41,5]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"x"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,14],"start":[41,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"J","moduleName":["Golden","CaseStatements","Test"]},"typeName":{"identifier":"M","moduleName":["Golden","CaseStatements","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,22],"start":[41,21]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"N","moduleName":["Golden","CaseStatements","Test"]},"typeName":{"identifier":"M","moduleName":["Golden","CaseStatements","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,31]}},"type":"Var","value":{"identifier":"y","sourcePos":[41,13]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,27],"start":[41,26]}},"type":"Var","value":{"identifier":"n","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[41,19],"start":[41,18]}},"type":"Var","value":{"identifier":"m","sourcePos":[39,1]}}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,11],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,38],"start":[38,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,9],"start":[40,8]}},"type":"Var","value":{"identifier":"x","sourcePos":[39,1]}}],"type":"Case"},"type":"Let"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"d"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,9],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,8],"start":[9,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,8],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[15,9],"start":[15,8]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,21],"start":[15,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,13],"start":[15,12]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,15],"start":[15,14]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,12],"start":[16,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":3}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[16,15],"start":[16,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,26],"start":[16,25]}},"type":"Var","value":{"identifier":"y","sourcePos":[16,5]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,19],"start":[16,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,21],"start":[16,20]}},"type":"Var","value":{"identifier":"z","sourcePos":[16,8]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,12],"start":[17,5]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,8]}},"binder":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,10]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":4}},"binderType":"NamedBinder","identifier":"z"},"binderType":"NamedBinder","identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"binderType":"NullBinder"}],"expressions":[{"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,26],"start":[17,25]}},"type":"Var","value":{"identifier":"z","sourcePos":[17,8]}},"guard":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,19],"start":[17,18]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,20]}},"type":"Var","value":{"identifier":"y","sourcePos":[17,5]}},"type":"App"}}],"isGuarded":true},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,5]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","CaseStatements","Test"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","CaseStatements","Test"]}}],"type":"Case"},"type":"Abs"},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[14,11],"start":[14,8]}},"binderType":"LiteralBinder","literal":{"literalType":"CharLiteral","value":"b"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,28],"start":[14,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,19]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,15],"start":[14,14]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Values","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,16]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,8],"start":[11,1]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","CaseStatements","Test"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,11]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","CaseStatements","Test"]}}],"type":"Case"},"type":"Let"},"identifier":"c"}],"exports":["a","b","c","J","N","d","multipleGuards"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","CaseStatements","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Golden","Values","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[60,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","CaseStatements","Test"],"modulePath":"golden/Golden/CaseStatements/Test.purs","reExports":{},"sourceSpan":{"end":[60,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Currying.Test/corefn.json b/test/ps/output/Golden.Currying.Test/corefn.json index 535b661..f629a07 100644 --- a/test/ps/output/Golden.Currying.Test/corefn.json +++ b/test/ps/output/Golden.Currying.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"i","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"c","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"d","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[7,13]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ok"}},"type":"Abs"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"f1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,13]}},"type":"Var","value":{"identifier":"f1","sourcePos":[4,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"apply"}],"exports":["apply","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Currying","Test"],"modulePath":"golden/Golden/Currying/Test.purs","reExports":{},"sourceSpan":{"end":[7,17],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"i","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"c","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,48],"start":[6,1]}},"argument":"d","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[7,13]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ok"}},"type":"Abs"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"f1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,40],"start":[3,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,13]}},"type":"Var","value":{"identifier":"f1","sourcePos":[4,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"apply"}],"exports":["apply","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Currying","Test"],"modulePath":"golden/Golden/Currying/Test.purs","reExports":{},"sourceSpan":{"end":[7,17],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.DataDeclarations.Test1/corefn.json b/test/ps/output/Golden.DataDeclarations.Test1/corefn.json index f5bddf7..6bf1f53 100644 --- a/test/ps/output/Golden.DataDeclarations.Test1/corefn.json +++ b/test/ps/output/Golden.DataDeclarations.Test1/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"constructorName":"U","fieldNames":[],"type":"Constructor","typeName":"Unit"},"identifier":"U"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S0","fieldNames":[],"type":"Constructor","typeName":"TSum"},"identifier":"S0"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S1","fieldNames":["value0"],"type":"Constructor","typeName":"TSum"},"identifier":"S1"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S2","fieldNames":["value0","value1"],"type":"Constructor","typeName":"TSum"},"identifier":"S2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"constructorName":"PF","fieldNames":["value0"],"type":"Constructor","typeName":"TProductWithFields"},"identifier":"PF"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"constructorName":"P3","fieldNames":["value0","value1","value2"],"type":"Constructor","typeName":"TProduct"},"identifier":"P3"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"Nop","fieldNames":[],"type":"Constructor","typeName":"Rec"},"identifier":"Nop"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"More","fieldNames":["value0"],"type":"Constructor","typeName":"Rec"},"identifier":"More"}],"exports":["U","P3","PF","S0","S1","S2","Nop","More","CtorSameName"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","DataDeclarations","Test1"],"modulePath":"golden/Golden/DataDeclarations/Test1.purs","reExports":{},"sourceSpan":{"end":[9,31],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,14],"start":[4,1]}},"constructorName":"U","fieldNames":[],"type":"Constructor","typeName":"Unit"},"identifier":"U"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[9,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S0","fieldNames":[],"type":"Constructor","typeName":"TSum"},"identifier":"S0"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S1","fieldNames":["value0"],"type":"Constructor","typeName":"TSum"},"identifier":"S1"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,42],"start":[7,1]}},"constructorName":"S2","fieldNames":["value0","value1"],"type":"Constructor","typeName":"TSum"},"identifier":"S2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,72],"start":[6,1]}},"constructorName":"PF","fieldNames":["value0"],"type":"Constructor","typeName":"TProductWithFields"},"identifier":"PF"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[5,1]}},"constructorName":"P3","fieldNames":["value0","value1","value2"],"type":"Constructor","typeName":"TProduct"},"identifier":"P3"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"Nop","fieldNames":[],"type":"Constructor","typeName":"Rec"},"identifier":"Nop"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"constructorName":"More","fieldNames":["value0"],"type":"Constructor","typeName":"Rec"},"identifier":"More"}],"exports":["U","P3","PF","S0","S1","S2","Nop","More","CtorSameName"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,31],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","DataDeclarations","Test1"],"modulePath":"golden/Golden/DataDeclarations/Test1.purs","reExports":{},"sourceSpan":{"end":[9,31],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.DataDeclarations.Test2/corefn.json b/test/ps/output/Golden.DataDeclarations.Test2/corefn.json index d2e63cf..747af91 100644 --- a/test/ps/output/Golden.DataDeclarations.Test2/corefn.json +++ b/test/ps/output/Golden.DataDeclarations.Test2/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,23],"start":[8,6]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","DataDeclarations","Test1"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","DataDeclarations","Test1"]}},{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,36],"start":[8,24]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","DataDeclarations","Test2"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","DataDeclarations","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,39]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"test"}],"exports":["CtorSameName","test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","DataDeclarations","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","DataDeclarations","Test2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","DataDeclarations","Test2"],"modulePath":"golden/Golden/DataDeclarations/Test2.purs","reExports":{},"sourceSpan":{"end":[8,43],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[5,1]}},"constructorName":"CtorSameName","fieldNames":[],"type":"Constructor","typeName":"TySameName"},"identifier":"CtorSameName"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,49],"start":[7,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,23],"start":[8,6]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","DataDeclarations","Test1"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","DataDeclarations","Test1"]}},{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,36],"start":[8,24]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"CtorSameName","moduleName":["Golden","DataDeclarations","Test2"]},"typeName":{"identifier":"TySameName","moduleName":["Golden","DataDeclarations","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,39]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[8,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"test"}],"exports":["CtorSameName","test"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","DataDeclarations","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Golden","DataDeclarations","Test2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,43],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","DataDeclarations","Test2"],"modulePath":"golden/Golden/DataDeclarations/Test2.purs","reExports":{},"sourceSpan":{"end":[8,43],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Fibonacci.Test/corefn.json b/test/ps/output/Golden.Fibonacci.Test/corefn.json index 0017a21..3198473 100644 --- a/test/ps/output/Golden.Fibonacci.Test/corefn.json +++ b/test/ps/output/Golden.Fibonacci.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[10,22],"start":[10,21]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"add"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[10,17],"start":[10,16]}},"type":"Var","value":{"identifier":"sub","moduleName":["Data","Ring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"ringInt","moduleName":["Data","Ring"]}},"type":"App"},"identifier":"sub"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,6],"start":[8,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,6],"start":[9,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,6],"start":[10,5]}},"binderType":"VarBinder","identifier":"n"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,12],"start":[10,9]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"sub","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,15],"start":[10,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[10,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,26],"start":[10,23]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,23]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"sub","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,28]}},"type":"Var","value":{"identifier":"n","sourcePos":[10,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,32]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"fib"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,20],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,15],"start":[13,8]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[13,15],"start":[13,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,21],"start":[13,18]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,22]}},"type":"Literal","value":{"literalType":"IntLiteral","value":32}},"type":"App"},"type":"App"},"identifier":"main"}],"exports":["fib","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Ring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Golden","Fibonacci","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Fibonacci","Test"],"modulePath":"golden/Golden/Fibonacci/Test.purs","reExports":{},"sourceSpan":{"end":[13,24],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[10,22],"start":[10,21]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"add"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[10,17],"start":[10,16]}},"type":"Var","value":{"identifier":"sub","moduleName":["Data","Ring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"ringInt","moduleName":["Data","Ring"]}},"type":"App"},"identifier":"sub"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,18],"start":[7,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,6],"start":[8,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,6],"start":[9,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,6],"start":[10,5]}},"binderType":"VarBinder","identifier":"n"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,12],"start":[10,9]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"sub","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,15],"start":[10,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[10,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,19],"start":[10,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,9]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,26],"start":[10,23]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,34],"start":[10,23]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"sub","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,28]}},"type":"Var","value":{"identifier":"n","sourcePos":[10,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,33],"start":[10,32]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,10],"start":[8,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"fib"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,20],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,15],"start":[13,8]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[13,15],"start":[13,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,21],"start":[13,18]}},"type":"Var","value":{"identifier":"fib","moduleName":["Golden","Fibonacci","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,22]}},"type":"Literal","value":{"literalType":"IntLiteral","value":32}},"type":"App"},"type":"App"},"identifier":"main"}],"exports":["fib","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Ring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Golden","Fibonacci","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Fibonacci","Test"],"modulePath":"golden/Golden/Fibonacci/Test.purs","reExports":{},"sourceSpan":{"end":[13,24],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Foreign.Lib/corefn.json b/test/ps/output/Golden.Foreign.Lib/corefn.json index a84ab16..1f91420 100644 --- a/test/ps/output/Golden.Foreign.Lib/corefn.json +++ b/test/ps/output/Golden.Foreign.Lib/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[],"exports":["dead","alive"],"foreign":["dead","alive"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,28],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Foreign","Lib"],"modulePath":"golden/Golden/Foreign/Lib.purs","reExports":{},"sourceSpan":{"end":[4,28],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[],"exports":["dead","alive"],"foreign":["dead","alive"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,28],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Foreign","Lib"],"modulePath":"golden/Golden/Foreign/Lib.purs","reExports":{},"sourceSpan":{"end":[4,28],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Foreign.Test/corefn.json b/test/ps/output/Golden.Foreign.Test/corefn.json index d035d56..0c14a7d 100644 --- a/test/ps/output/Golden.Foreign.Test/corefn.json +++ b/test/ps/output/Golden.Foreign.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,17],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[9,7]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,12],"start":[9,9]}},"type":"Var","value":{"identifier":"boo","moduleName":["Golden","Foreign","Test"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,19],"start":[9,14]}},"type":"Var","value":{"identifier":"alive","moduleName":["Golden","Foreign","Lib"]}}]}},"identifier":"baz"}],"exports":["foo","baz"],"foreign":["foo","boo"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[1,1]}},"moduleName":["Golden","Foreign","Lib"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[1,1]}},"moduleName":["Golden","Foreign","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Foreign","Test"],"modulePath":"golden/Golden/Foreign/Test.purs","reExports":{},"sourceSpan":{"end":[9,21],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,17],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[9,7]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,12],"start":[9,9]}},"type":"Var","value":{"identifier":"boo","moduleName":["Golden","Foreign","Test"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,19],"start":[9,14]}},"type":"Var","value":{"identifier":"alive","moduleName":["Golden","Foreign","Lib"]}}]}},"identifier":"baz"}],"exports":["foo","baz"],"foreign":["foo","boo"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[1,1]}},"moduleName":["Golden","Foreign","Lib"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[1,1]}},"moduleName":["Golden","Foreign","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Foreign","Test"],"modulePath":"golden/Golden/Foreign/Test.purs","reExports":{},"sourceSpan":{"end":[9,21],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.HelloPrelude.Test/corefn.json b/test/ps/output/Golden.HelloPrelude.Test/corefn.json index 0b2a140..834e687 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/corefn.json +++ b/test/ps/output/Golden.HelloPrelude.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"type":"Var","value":{"identifier":"pass","moduleName":["Prelude"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","HelloPrelude","Test"],"modulePath":"golden/Golden/HelloPrelude/Test.purs","reExports":{},"sourceSpan":{"end":[7,12],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"type":"Var","value":{"identifier":"pass","moduleName":["Prelude"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,12],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","HelloPrelude","Test"],"modulePath":"golden/Golden/HelloPrelude/Test.purs","reExports":{},"sourceSpan":{"end":[7,12],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Inline.Test/corefn.json b/test/ps/output/Golden.Inline.Test/corefn.json index 3105748..6077f9c 100644 --- a/test/ps/output/Golden.Inline.Test/corefn.json +++ b/test/ps/output/Golden.Inline.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,32],"start":[16,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[16,32],"start":[16,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,32],"start":[16,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"MkMu"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,7]}},"binder":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[19,17],"start":[19,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,17],"start":[19,16]}},"binderType":"VarBinder","identifier":"f"}],"constructorName":{"identifier":"MkMu","moduleName":["Golden","Inline","Test"]},"typeName":{"identifier":"Mu","moduleName":["Golden","Inline","Test"]}},"binderType":"NamedBinder","identifier":"mu"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,22],"start":[19,21]}},"type":"Var","value":{"identifier":"f","sourcePos":[19,16]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,23]}},"type":"Var","value":{"identifier":"mu","sourcePos":[19,7]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"runMu"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,12],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[10,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,30],"start":[10,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,30],"start":[10,7]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,14],"start":[11,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"Abs"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[12,6]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,34],"start":[12,11]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,34],"start":[12,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,18],"start":[13,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"Abs"},"identifier":"y"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,11],"start":[14,10]}},"type":"Var","value":{"identifier":"x","sourcePos":[10,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[14,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[14,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[12,11]}},"type":"App"},"type":"Let"},"type":"Let"},"identifier":"main"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,14],"start":[21,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[22,11],"start":[22,7]}},"type":"Var","value":{"identifier":"MkMu","moduleName":["Golden","Inline","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,12]}},"type":"Var","value":{"identifier":"runMu","moduleName":["Golden","Inline","Test"]}},"type":"App"},"identifier":"iMu"}],"exports":["main","runMu","iMu"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[1,1]}},"moduleName":["Golden","Inline","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Inline","Test"],"modulePath":"golden/Golden/Inline/Test.purs","reExports":{},"sourceSpan":{"end":[22,17],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,32],"start":[16,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[16,32],"start":[16,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,32],"start":[16,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"MkMu"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[18,29],"start":[18,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,7]}},"binder":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[19,17],"start":[19,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,17],"start":[19,16]}},"binderType":"VarBinder","identifier":"f"}],"constructorName":{"identifier":"MkMu","moduleName":["Golden","Inline","Test"]},"typeName":{"identifier":"Mu","moduleName":["Golden","Inline","Test"]}},"binderType":"NamedBinder","identifier":"mu"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,22],"start":[19,21]}},"type":"Var","value":{"identifier":"f","sourcePos":[19,16]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,23]}},"type":"Var","value":{"identifier":"mu","sourcePos":[19,7]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,25],"start":[19,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"runMu"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,12],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[10,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,30],"start":[10,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,30],"start":[10,7]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,14],"start":[11,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"Abs"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[12,6]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,34],"start":[12,11]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,34],"start":[12,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,18],"start":[13,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"Abs"},"identifier":"y"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,11],"start":[14,10]}},"type":"Var","value":{"identifier":"x","sourcePos":[10,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[14,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,13],"start":[14,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[12,11]}},"type":"App"},"type":"Let"},"type":"Let"},"identifier":"main"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,14],"start":[21,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[22,11],"start":[22,7]}},"type":"Var","value":{"identifier":"MkMu","moduleName":["Golden","Inline","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,12]}},"type":"Var","value":{"identifier":"runMu","moduleName":["Golden","Inline","Test"]}},"type":"App"},"identifier":"iMu"}],"exports":["main","runMu","iMu"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[1,1]}},"moduleName":["Golden","Inline","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Inline","Test"],"modulePath":"golden/Golden/Inline/Test.purs","reExports":{},"sourceSpan":{"end":[22,17],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.NameShadowing.Test/corefn.json b/test/ps/output/Golden.NameShadowing.Test/corefn.json index a100b7a..fa7775b 100644 --- a/test/ps/output/Golden.NameShadowing.Test/corefn.json +++ b/test/ps/output/Golden.NameShadowing.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,6],"start":[13,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[14,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,4],"start":[15,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,5]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,12]}},"argument":"y","body":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,18]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,25],"start":[10,24]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,26]}},"type":"Var","value":{"identifier":"x1","sourcePos":[10,19]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[10,13]}},"type":"App"},"type":"Abs"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Var","value":{"identifier":"x","sourcePos":[10,6]}},"type":"App"},"type":"Abs"},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[4,7]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"Abs"},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,10]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,14],"start":[7,13]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[7,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,17]}},"type":"Var","value":{"identifier":"x1","sourcePos":[7,1]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,27],"start":[7,10]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[7,22]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"type":"App"},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"b"}],"exports":["b","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Golden","NameShadowing","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","NameShadowing","Test"],"modulePath":"golden/Golden/NameShadowing/Test.purs","reExports":{},"sourceSpan":{"end":[15,10],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,23],"start":[12,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,6],"start":[13,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,6],"start":[14,5]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[14,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,4],"start":[15,3]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,6],"start":[15,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,5]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,12]}},"argument":"y","body":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,18]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,25],"start":[10,24]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,27],"start":[10,26]}},"type":"Var","value":{"identifier":"x1","sourcePos":[10,19]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[10,13]}},"type":"App"},"type":"Abs"},"type":"Abs"},"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Var","value":{"identifier":"x","sourcePos":[10,6]}},"type":"App"},"type":"Abs"},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[4,7]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"type":"Var","value":{"identifier":"x","sourcePos":[4,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"Abs"},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,1]}},"argument":"x1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,10]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,14],"start":[7,13]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[7,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,19],"start":[7,17]}},"type":"Var","value":{"identifier":"x1","sourcePos":[7,1]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,27],"start":[7,10]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[7,22]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","NameShadowing","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,26],"start":[7,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"type":"App"},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"b"}],"exports":["b","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Golden","NameShadowing","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","NameShadowing","Test"],"modulePath":"golden/Golden/NameShadowing/Test.purs","reExports":{},"sourceSpan":{"end":[15,10],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Nested.Test/corefn.json b/test/ps/output/Golden.Nested.Test/corefn.json index a6b8d87..d9f4fa5 100644 --- a/test/ps/output/Golden.Nested.Test/corefn.json +++ b/test/ps/output/Golden.Nested.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,25],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,25],"start":[3,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,25],"start":[3,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,9],"start":[4,8]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,12]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,9],"start":[5,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,17],"start":[5,12]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"isZero"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[9,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[9,3]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,11]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,28]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ok"}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,11]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,38]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"fine"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,14]}},"type":"Var","value":{"identifier":"isZero","moduleName":["Golden","Nested","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,22],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,22],"start":[10,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[9,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,11]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,32],"start":[11,28]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ha"}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,11]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,38]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"cool"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,20],"start":[11,14]}},"type":"Var","value":{"identifier":"isZero","moduleName":["Golden","Nested","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,22],"start":[11,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,22],"start":[11,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"}],"type":"Case"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,6]}},"type":"Var","value":{"identifier":"isZero","moduleName":["Golden","Nested","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"identifier":"main"}],"exports":["isZero","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[1,1]}},"moduleName":["Golden","Nested","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Nested","Test"],"modulePath":"golden/Golden/Nested/Test.purs","reExports":{},"sourceSpan":{"end":[11,45],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,25],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,25],"start":[3,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,25],"start":[3,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,9],"start":[4,8]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,12]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,9],"start":[5,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,17],"start":[5,12]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"isZero"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[9,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[9,3]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,11]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,28]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ok"}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,11]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,44],"start":[10,38]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"fine"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,14]}},"type":"Var","value":{"identifier":"isZero","moduleName":["Golden","Nested","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,22],"start":[10,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,22],"start":[10,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[9,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,11]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,32],"start":[11,28]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"ha"}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,11]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,44],"start":[11,38]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"cool"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,20],"start":[11,14]}},"type":"Var","value":{"identifier":"isZero","moduleName":["Golden","Nested","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,22],"start":[11,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,22],"start":[11,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"}],"type":"Case"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,6]}},"type":"Var","value":{"identifier":"isZero","moduleName":["Golden","Nested","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}],"type":"Case"},"identifier":"main"}],"exports":["isZero","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[1,1]}},"moduleName":["Golden","Nested","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[11,45],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Nested","Test"],"modulePath":"golden/Golden/Nested/Test.purs","reExports":{},"sourceSpan":{"end":[11,45],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Newtype.Test/corefn.json b/test/ps/output/Golden.Newtype.Test/corefn.json index c616e48..e6ca98e 100644 --- a/test/ps/output/Golden.Newtype.Test/corefn.json +++ b/test/ps/output/Golden.Newtype.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[3,31],"start":[3,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"NT"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[9,7],"start":[9,5]}},"type":"Var","value":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[6,8],"start":[6,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"binderType":"VarBinder","identifier":"n"}],"constructorName":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]},"typeName":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,12]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"n","sourcePos":[6,7]}},"fieldName":"foo","type":"Accessor"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"f"}],"exports":["NT","f","g"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Golden","Newtype","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Newtype","Test"],"modulePath":"golden/Golden/Newtype/Test.purs","reExports":{},"sourceSpan":{"end":[9,7],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[3,31],"start":[3,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,31],"start":[3,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"NT"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[9,7],"start":[9,5]}},"type":"Var","value":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[6,8],"start":[6,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"binderType":"VarBinder","identifier":"n"}],"constructorName":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]},"typeName":{"identifier":"NT","moduleName":["Golden","Newtype","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,12]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"n","sourcePos":[6,7]}},"fieldName":"foo","type":"Accessor"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"f"}],"exports":["NT","f","g"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Golden","Newtype","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Newtype","Test"],"modulePath":"golden/Golden/Newtype/Test.purs","reExports":{},"sourceSpan":{"end":[9,7],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.PatternMatching.Test1/corefn.json b/test/ps/output/Golden.PatternMatching.Test1/corefn.json index 032ce53..130bcee 100644 --- a/test/ps/output/Golden.PatternMatching.Test1/corefn.json +++ b/test/ps/output/Golden.PatternMatching.Test1/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"constructorName":"T","fieldNames":["value0","value1"],"type":"Constructor","typeName":"Tuple"},"identifier":"T"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Num","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Num"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Not","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Not"},{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[21,11],"start":[21,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,9],"start":[21,8]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,11],"start":[21,10]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"T","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[21,10]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"snd"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[7,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,21],"start":[8,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,20],"start":[8,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,19],"start":[8,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,19],"start":[8,18]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,17],"start":[9,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,27],"start":[10,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,26],"start":[10,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,25],"start":[10,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,24],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,24],"start":[10,23]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,15],"start":[11,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,14],"start":[11,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,14],"start":[11,13]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,20],"start":[11,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,8],"start":[12,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,7]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,13],"start":[12,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[7,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,11],"start":[18,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"VarBinder","identifier":"x"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,11],"start":[18,10]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"T","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[18,8]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"fst"}],"exports":["Zero","Succ","Num","Not","pat","T","fst","snd"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","PatternMatching","Test1"],"modulePath":"golden/Golden/PatternMatching/Test1.purs","reExports":{},"sourceSpan":{"end":[21,16],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"constructorName":"T","fieldNames":["value0","value1"],"type":"Constructor","typeName":"Tuple"},"identifier":"T"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,23],"start":[3,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Num","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Num"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,23],"start":[4,1]}},"constructorName":"Not","fieldNames":["value0"],"type":"Constructor","typeName":"E"},"identifier":"Not"},{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[20,20],"start":[20,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[21,11],"start":[21,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,9],"start":[21,8]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,11],"start":[21,10]}},"binderType":"VarBinder","identifier":"y"}],"constructorName":{"identifier":"T","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[21,10]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[21,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"snd"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[7,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,21],"start":[8,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,20],"start":[8,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[8,19],"start":[8,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,19],"start":[8,18]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,25]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,17],"start":[9,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,22],"start":[9,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,27],"start":[10,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,26],"start":[10,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,25],"start":[10,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,24],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,24],"start":[10,23]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Not","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,32],"start":[10,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,15],"start":[11,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,14],"start":[11,8]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,14],"start":[11,13]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,20],"start":[11,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,8],"start":[12,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,7]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Num","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"E","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,13],"start":[12,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,4],"start":[13,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,15],"start":[7,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[7,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,11],"start":[18,6]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"VarBinder","identifier":"x"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,11],"start":[18,10]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"T","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"Tuple","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[18,8]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"fst"}],"exports":["Zero","Succ","Num","Not","pat","T","fst","snd"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","PatternMatching","Test1"],"modulePath":"golden/Golden/PatternMatching/Test1.purs","reExports":{},"sourceSpan":{"end":[21,16],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.PatternMatching.Test2/corefn.json b/test/ps/output/Golden.PatternMatching.Test2/corefn.json index b383924..d45c680 100644 --- a/test/ps/output/Golden.PatternMatching.Test2/corefn.json +++ b/test/ps/output/Golden.PatternMatching.Test2/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Add","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Add"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Mul","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Mul"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[8,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,16],"start":[9,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,28],"start":[9,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,16],"start":[10,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,14],"start":[10,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,16],"start":[10,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,28],"start":[10,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,19],"start":[11,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,9],"start":[11,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,18],"start":[11,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,16],"start":[11,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,25],"start":[11,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,19],"start":[12,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,9],"start":[12,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,18],"start":[12,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,18],"start":[12,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,25],"start":[12,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,10]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,20],"start":[13,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[14,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,15],"start":[8,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[8,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[17,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,9],"start":[18,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,11],"start":[19,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,10]}},"binderType":"VarBinder","identifier":"b"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,15]}},"type":"Var","value":{"identifier":"bat","moduleName":["Golden","PatternMatching","Test2"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,19]}},"type":"Var","value":{"identifier":"b","sourcePos":[19,10]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[17,1]}}],"type":"Case"},"type":"Abs"},"identifier":"bat"}]}],"exports":["Zero","Succ","Add","Mul","pat","bat"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","PatternMatching","Test2"],"modulePath":"golden/Golden/PatternMatching/Test2.purs","reExports":{},"sourceSpan":{"end":[19,20],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Zero","fieldNames":[],"type":"Constructor","typeName":"N"},"identifier":"Zero"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Succ","fieldNames":["value0"],"type":"Constructor","typeName":"N"},"identifier":"Succ"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Add","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Add"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,43],"start":[5,1]}},"constructorName":"Mul","fieldNames":["value0","value1"],"type":"Constructor","typeName":"N"},"identifier":"Mul"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,16],"start":[7,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[8,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,16],"start":[9,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,16],"start":[9,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,22],"start":[9,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,28],"start":[9,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,16],"start":[10,9]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,14],"start":[10,13]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,16],"start":[10,15]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,18]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,28],"start":[10,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,19],"start":[11,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,9],"start":[11,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,18],"start":[11,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,16],"start":[11,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Mul","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,25],"start":[11,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,19],"start":[12,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,9],"start":[12,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,18],"start":[12,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,18],"start":[12,17]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,25],"start":[12,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,4]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,14],"start":[13,10]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"constructorName":{"identifier":"Add","moduleName":["Golden","PatternMatching","Test2"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test2"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,20],"start":[13,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,9],"start":[14,8]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,15],"start":[8,14]}},"type":"Var","value":{"identifier":"e","sourcePos":[8,1]}}],"type":"Case"},"type":"Abs"},"identifier":"pat"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[17,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,9],"start":[18,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Zero","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,11],"start":[19,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,10]}},"binderType":"VarBinder","identifier":"b"}],"constructorName":{"identifier":"Succ","moduleName":["Golden","PatternMatching","Test1"]},"typeName":{"identifier":"N","moduleName":["Golden","PatternMatching","Test1"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,15]}},"type":"Var","value":{"identifier":"bat","moduleName":["Golden","PatternMatching","Test2"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,19]}},"type":"Var","value":{"identifier":"b","sourcePos":[19,10]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,15],"start":[17,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[17,1]}}],"type":"Case"},"type":"Abs"},"identifier":"bat"}]}],"exports":["Zero","Succ","Add","Mul","pat","bat"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Golden","PatternMatching","Test2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","PatternMatching","Test2"],"modulePath":"golden/Golden/PatternMatching/Test2.purs","reExports":{},"sourceSpan":{"end":[19,20],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.RecDataDefs.Test/corefn.json b/test/ps/output/Golden.RecDataDefs.Test/corefn.json index d0798c6..c0d0350 100644 --- a/test/ps/output/Golden.RecDataDefs.Test/corefn.json +++ b/test/ps/output/Golden.RecDataDefs.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"A","fieldNames":[],"type":"Constructor","typeName":"A"},"identifier":"A"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"AB","fieldNames":["value0"],"type":"Constructor","typeName":"A"},"identifier":"AB"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"B","fieldNames":[],"type":"Constructor","typeName":"B"},"identifier":"B"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"BA","fieldNames":["value0"],"type":"Constructor","typeName":"B"},"identifier":"BA"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,6],"start":[10,5]}},"type":"Var","value":{"identifier":"B","moduleName":["Golden","RecDataDefs","Test"]}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,8],"start":[13,6]}},"type":"Var","value":{"identifier":"AB","moduleName":["Golden","RecDataDefs","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","RecDataDefs","Test"]}},"type":"App"},"identifier":"ab"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,8],"start":[15,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[16,8],"start":[16,6]}},"type":"Var","value":{"identifier":"BA","moduleName":["Golden","RecDataDefs","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,9]}},"type":"Var","value":{"identifier":"ab","moduleName":["Golden","RecDataDefs","Test"]}},"type":"App"},"identifier":"ba"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[7,6],"start":[7,5]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","RecDataDefs","Test"]}},"identifier":"a"}],"exports":["A","AB","B","BA","a","b","ab","ba"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Golden","RecDataDefs","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecDataDefs","Test"],"modulePath":"golden/Golden/RecDataDefs/Test.purs","reExports":{},"sourceSpan":{"end":[16,11],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"A","fieldNames":[],"type":"Constructor","typeName":"A"},"identifier":"A"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"constructorName":"AB","fieldNames":["value0"],"type":"Constructor","typeName":"A"},"identifier":"AB"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"B","fieldNames":[],"type":"Constructor","typeName":"B"},"identifier":"B"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"constructorName":"BA","fieldNames":["value0"],"type":"Constructor","typeName":"B"},"identifier":"BA"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,7],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,6],"start":[10,5]}},"type":"Var","value":{"identifier":"B","moduleName":["Golden","RecDataDefs","Test"]}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,8],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,8],"start":[13,6]}},"type":"Var","value":{"identifier":"AB","moduleName":["Golden","RecDataDefs","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","RecDataDefs","Test"]}},"type":"App"},"identifier":"ab"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,8],"start":[15,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[16,8],"start":[16,6]}},"type":"Var","value":{"identifier":"BA","moduleName":["Golden","RecDataDefs","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,9]}},"type":"Var","value":{"identifier":"ab","moduleName":["Golden","RecDataDefs","Test"]}},"type":"App"},"identifier":"ba"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[7,6],"start":[7,5]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","RecDataDefs","Test"]}},"identifier":"a"}],"exports":["A","AB","B","BA","a","b","ab","ba"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Golden","RecDataDefs","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecDataDefs","Test"],"modulePath":"golden/Golden/RecDataDefs/Test.purs","reExports":{},"sourceSpan":{"end":[16,11],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.RecordsAccess.Test/corefn.json b/test/ps/output/Golden.RecordsAccess.Test/corefn.json index b065d43..e354825 100644 --- a/test/ps/output/Golden.RecordsAccess.Test/corefn.json +++ b/test/ps/output/Golden.RecordsAccess.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[18,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,8],"start":[19,3]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,5]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[19,12]}},"type":"Var","value":{"identifier":"x","sourcePos":[19,5]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,16]}},"type":"Var","value":{"identifier":"v","sourcePos":[18,1]}}],"type":"Case"},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,12],"start":[15,7]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[15,9]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"x","type":"Accessor"},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,7],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,22],"start":[6,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,13],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","RecordsAccess","Test"]}},"fieldName":"x","type":"Accessor"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Golden","RecordsAccess","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecordsAccess","Test"],"modulePath":"golden/Golden/RecordsAccess/Test.purs","reExports":{},"sourceSpan":{"end":[19,13],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[18,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,8],"start":[19,3]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,5]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[19,12]}},"type":"Var","value":{"identifier":"x","sourcePos":[19,5]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,16]}},"type":"Var","value":{"identifier":"v","sourcePos":[18,1]}}],"type":"Case"},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,12],"start":[15,7]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[15,10],"start":[15,9]}},"binderType":"VarBinder","identifier":"x"}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,15]}},"type":"Var","value":{"identifier":"x","sourcePos":[15,9]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,12],"start":[12,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"x","type":"Accessor"},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,7],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,22],"start":[6,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[6,20],"start":[6,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,13],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","RecordsAccess","Test"]}},"fieldName":"x","type":"Accessor"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Golden","RecordsAccess","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecordsAccess","Test"],"modulePath":"golden/Golden/RecordsAccess/Test.purs","reExports":{},"sourceSpan":{"end":[19,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.RecordsUpdate.Test/corefn.json b/test/ps/output/Golden.RecordsUpdate.Test/corefn.json index 41b38b2..5ce5d35 100644 --- a/test/ps/output/Golden.RecordsUpdate.Test/corefn.json +++ b/test/ps/output/Golden.RecordsUpdate.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,36],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"copy":null,"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[21,18],"start":[21,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["x","y"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"z","type":"Accessor"},"type":"ObjectUpdate","updates":[["p",{"annotation":{"meta":null,"sourceSpan":{"end":[16,24],"start":[16,21]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}}]]}]]},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"copy":["x","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["y",{"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[13,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}]]},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,47],"start":[7,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}],["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,45],"start":[7,25]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,30]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"foo"}}],["p",{"annotation":{"meta":null,"sourceSpan":{"end":[7,43],"start":[7,40]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"a"}}]]}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,10],"start":[10,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","RecordsUpdate","Test"]}},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"copy":["y","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[10,1]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[10,18],"start":[10,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}}]]},"type":"Let"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Golden","RecordsUpdate","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecordsUpdate","Test"],"modulePath":"golden/Golden/RecordsUpdate/Test.purs","reExports":{},"sourceSpan":{"end":[21,20],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,36],"start":[20,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,9]}},"copy":null,"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[21,18],"start":[21,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}]]},"type":"Abs"},"identifier":"test4"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["x","y"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"copy":["z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,9]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"z","type":"Accessor"},"type":"ObjectUpdate","updates":[["p",{"annotation":{"meta":null,"sourceSpan":{"end":[16,24],"start":[16,21]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"b"}}]]}]]},"type":"Abs"},"identifier":"test3"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,16],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,24],"start":[13,9]}},"copy":["x","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"ObjectUpdate","updates":[["y",{"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[13,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}}]]},"type":"Abs"},"identifier":"test2"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,7],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,47],"start":[7,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[7,11],"start":[7,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}}],["y",{"annotation":{"meta":null,"sourceSpan":{"end":[7,20],"start":[7,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}}],["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,45],"start":[7,25]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["z",{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,30]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"foo"}}],["p",{"annotation":{"meta":null,"sourceSpan":{"end":[7,43],"start":[7,40]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"a"}}]]}}]]}},"identifier":"r"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,10],"start":[10,9]}},"type":"Var","value":{"identifier":"r","moduleName":["Golden","RecordsUpdate","Test"]}},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,20],"start":[10,9]}},"copy":["y","z"],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[10,1]}},"type":"ObjectUpdate","updates":[["x",{"annotation":{"meta":null,"sourceSpan":{"end":[10,18],"start":[10,17]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}}]]},"type":"Let"},"identifier":"test1"}],"exports":["r","test1","test2","test3","test4"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Golden","RecordsUpdate","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecordsUpdate","Test"],"modulePath":"golden/Golden/RecordsUpdate/Test.purs","reExports":{},"sourceSpan":{"end":[21,20],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.RecursiveBindings.Test/corefn.json b/test/ps/output/Golden.RecursiveBindings.Test/corefn.json index 0a7a833..43354dc 100644 --- a/test/ps/output/Golden.RecursiveBindings.Test/corefn.json +++ b/test/ps/output/Golden.RecursiveBindings.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[19,20],"start":[19,12]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,28],"start":[26,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[28,9],"start":[28,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,15],"start":[28,13]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[29,10],"start":[29,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[29,16],"start":[29,14]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,27],"start":[21,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,9],"start":[23,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,16],"start":[23,13]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,10],"start":[24,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[24,17],"start":[24,14]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,14],"start":[19,12]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"whereRec"},{"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[33,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"z"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[42,12],"start":[42,11]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[41,12],"start":[41,11]}},"type":"Var","value":{"identifier":"b","sourcePos":[42,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"a"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"k","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[35,14],"start":[35,13]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,15]}},"type":"Var","value":{"identifier":"k","sourcePos":[35,5]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,13],"start":[38,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,10],"start":[38,9]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,15]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[37,13],"start":[37,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,10],"start":[37,9]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"identifier":"x"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,9],"start":[54,8]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,6],"start":[54,5]}},"type":"Var","value":{"identifier":"x","sourcePos":[37,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,16],"start":[54,15]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,13],"start":[54,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"letRecMixed"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[5,3]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,30],"start":[11,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,15]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,12],"start":[14,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,16]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,11],"start":[8,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[8,18],"start":[8,15]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,19],"start":[9,16]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,20]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[16,7],"start":[16,5]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,8]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"letRec"}],"exports":["letRec","whereRec","letRecMixed"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecursiveBindings","Test"],"modulePath":"golden/Golden/RecursiveBindings/Test.purs","reExports":{},"sourceSpan":{"end":[54,20],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[19,20],"start":[19,12]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,28],"start":[26,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[27,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[28,9],"start":[28,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,15],"start":[28,13]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,16]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[29,10],"start":[29,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[29,16],"start":[29,14]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,21],"start":[29,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,27],"start":[21,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[22,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,9],"start":[23,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,16],"start":[23,13]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,22],"start":[23,17]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,10],"start":[24,5]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[24,17],"start":[24,14]}},"type":"Var","value":{"identifier":"yes","sourcePos":[26,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,22],"start":[24,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,14],"start":[19,12]}},"type":"Var","value":{"identifier":"no","sourcePos":[21,3]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,15]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"whereRec"},{"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[33,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[34,10],"start":[34,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"z"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[42,12],"start":[42,11]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,14],"start":[42,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,5]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[41,12],"start":[41,11]}},"type":"Var","value":{"identifier":"b","sourcePos":[42,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,14],"start":[41,13]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"type":"Abs"},"identifier":"a"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,5]}},"argument":"k","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[35,14],"start":[35,13]}},"type":"Var","value":{"identifier":"a","sourcePos":[41,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[35,16],"start":[35,15]}},"type":"Var","value":{"identifier":"k","sourcePos":[35,5]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,13],"start":[38,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,10],"start":[38,9]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,16],"start":[38,15]}},"type":"Var","value":{"identifier":"z","sourcePos":[34,5]}},"type":"App"},"identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,5]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[37,13],"start":[37,12]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,10],"start":[37,9]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,16],"start":[37,15]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"identifier":"x"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,9],"start":[54,8]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,6],"start":[54,5]}},"type":"Var","value":{"identifier":"x","sourcePos":[37,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[54,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,16],"start":[54,15]}},"type":"Var","value":{"identifier":"f","sourcePos":[35,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,13],"start":[54,12]}},"type":"Var","value":{"identifier":"y","sourcePos":[38,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,19],"start":[54,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"type":"App"},"type":"Let"},"identifier":"letRecMixed"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,18],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[5,3]}},"binds":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,30],"start":[11,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[12,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,15]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,23],"start":[13,18]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,12],"start":[14,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,16]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,23],"start":[14,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"yes"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,29],"start":[6,5]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[7,10]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,11],"start":[8,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":true}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[8,18],"start":[8,15]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[8,24],"start":[8,19]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,12],"start":[9,7]}},"binderType":"LiteralBinder","literal":{"literalType":"BooleanLiteral","value":false}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,19],"start":[9,16]}},"type":"Var","value":{"identifier":"yes","sourcePos":[11,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,20]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"no"}]}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[16,7],"start":[16,5]}},"type":"Var","value":{"identifier":"no","sourcePos":[6,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,13],"start":[16,8]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":false}},"type":"App"},"type":"Let"},"identifier":"letRec"}],"exports":["letRec","whereRec","letRecMixed"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[54,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","RecursiveBindings","Test"],"modulePath":"golden/Golden/RecursiveBindings/Test.purs","reExports":{},"sourceSpan":{"end":[54,20],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Reexport.Exports/corefn.json b/test/ps/output/Golden.Reexport.Exports/corefn.json index 797d641..066c538 100644 --- a/test/ps/output/Golden.Reexport.Exports/corefn.json +++ b/test/ps/output/Golden.Reexport.Exports/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"binding1"}],"exports":["binding1"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Reexport","Exports"],"modulePath":"golden/Golden/Reexport/Exports.purs","reExports":{},"sourceSpan":{"end":[4,13],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,16],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"binding1"}],"exports":["binding1"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Reexport","Exports"],"modulePath":"golden/Golden/Reexport/Exports.purs","reExports":{},"sourceSpan":{"end":[4,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Reexport.ReExports/corefn.json b/test/ps/output/Golden.Reexport.ReExports/corefn.json index 97d7ef2..e2fc25e 100644 --- a/test/ps/output/Golden.Reexport.ReExports/corefn.json +++ b/test/ps/output/Golden.Reexport.ReExports/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,16],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"identifier":"binding2"}],"exports":["binding2"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,56],"start":[6,1]}},"moduleName":["Golden","Reexport","Exports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Reexport","ReExports"],"modulePath":"golden/Golden/Reexport/ReExports.purs","reExports":{"Golden.Reexport.Exports":["binding1"]},"sourceSpan":{"end":[9,13],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,16],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[9,12]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"identifier":"binding2"}],"exports":["binding2"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,56],"start":[6,1]}},"moduleName":["Golden","Reexport","Exports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Reexport","ReExports"],"modulePath":"golden/Golden/Reexport/ReExports.purs","reExports":{"Golden.Reexport.Exports":["binding1"]},"sourceSpan":{"end":[9,13],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Reexport.Test/corefn.json b/test/ps/output/Golden.Reexport.Test/corefn.json index c828c75..a48eb49 100644 --- a/test/ps/output/Golden.Reexport.Test/corefn.json +++ b/test/ps/output/Golden.Reexport.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,22],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[6,12]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,22],"start":[6,14]}},"type":"Var","value":{"identifier":"binding1","moduleName":["Golden","Reexport","Exports"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,33],"start":[6,25]}},"type":"Var","value":{"identifier":"binding2","moduleName":["Golden","Reexport","ReExports"]}}]}},"identifier":"binding3"}],"exports":["binding3"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","Exports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","ReExports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Reexport","Test"],"modulePath":"golden/Golden/Reexport/Test.purs","reExports":{},"sourceSpan":{"end":[6,35],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,22],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[6,12]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,22],"start":[6,14]}},"type":"Var","value":{"identifier":"binding1","moduleName":["Golden","Reexport","Exports"]}},{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,33],"start":[6,25]}},"type":"Var","value":{"identifier":"binding2","moduleName":["Golden","Reexport","ReExports"]}}]}},"identifier":"binding3"}],"exports":["binding3"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","Exports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Golden","Reexport","ReExports"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,35],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Reexport","Test"],"modulePath":"golden/Golden/Reexport/Test.purs","reExports":{},"sourceSpan":{"end":[6,35],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TestReturnTableField/corefn.json b/test/ps/output/Golden.TestReturnTableField/corefn.json index a38143d..a2fa667 100644 --- a/test/ps/output/Golden.TestReturnTableField/corefn.json +++ b/test/ps/output/Golden.TestReturnTableField/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[],"exports":["u"],"foreign":["u"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,22],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestReturnTableField"],"modulePath":"golden/Golden/ReturnTableField/Test.purs","reExports":{},"sourceSpan":{"end":[4,22],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[],"exports":["u"],"foreign":["u"],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,22],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TestReturnTableField"],"modulePath":"golden/Golden/ReturnTableField/Test.purs","reExports":{},"sourceSpan":{"end":[4,22],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Unbinding.Test/corefn.json b/test/ps/output/Golden.Unbinding.Test/corefn.json index a77b578..61ae9c7 100644 --- a/test/ps/output/Golden.Unbinding.Test/corefn.json +++ b/test/ps/output/Golden.Unbinding.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Unbinding","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Unbinding","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"type":"App"},"identifier":"c"}],"exports":["a","b","f","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Golden","Unbinding","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Unbinding","Test"],"modulePath":"golden/Golden/Unbinding/Test.purs","reExports":{},"sourceSpan":{"end":[6,16],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[5,10],"start":[5,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"Abs"},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,6],"start":[3,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,6],"start":[6,5]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Unbinding","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,8],"start":[6,7]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[6,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,10]}},"type":"Var","value":{"identifier":"f","moduleName":["Golden","Unbinding","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,12]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"type":"Var","value":{"identifier":"a","moduleName":["Golden","Unbinding","Test"]}},"type":"App"},"type":"App"},"identifier":"c"}],"exports":["a","b","f","c"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Golden","Unbinding","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,16],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Unbinding","Test"],"modulePath":"golden/Golden/Unbinding/Test.purs","reExports":{},"sourceSpan":{"end":[6,16],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.Values.Test/corefn.json b/test/ps/output/Golden.Values.Test/corefn.json index e88d16a..69b8831 100644 --- a/test/ps/output/Golden.Values.Test/corefn.json +++ b/test/ps/output/Golden.Values.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"i"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,7]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[10,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"c"}},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[7,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,43],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,16],"start":[16,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["i",{"annotation":{"meta":null,"sourceSpan":{"end":[16,8],"start":[16,7]}},"type":"Var","value":{"identifier":"i","moduleName":["Golden","Values","Test"]}}],["b",{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","Values","Test"]}}],["c",{"annotation":{"meta":null,"sourceSpan":{"end":[16,14],"start":[16,13]}},"type":"Var","value":{"identifier":"c","moduleName":["Golden","Values","Test"]}}]]}},"identifier":"o"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,15],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,16],"start":[13,5]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,8],"start":[13,7]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,14],"start":[13,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}}]}},"identifier":"a"}],"exports":["i","b","c","a","o","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Golden","Values","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Values","Test"],"modulePath":"golden/Golden/Values/Test.purs","reExports":{},"sourceSpan":{"end":[19,11],"start":[1,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,6],"start":[4,5]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"identifier":"i"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,20],"start":[18,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[19,7]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"type":"Abs"},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,10],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[10,5]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"c"}},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[7,5]}},"type":"Literal","value":{"literalType":"BooleanLiteral","value":true}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,43],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,16],"start":[16,5]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["i",{"annotation":{"meta":null,"sourceSpan":{"end":[16,8],"start":[16,7]}},"type":"Var","value":{"identifier":"i","moduleName":["Golden","Values","Test"]}}],["b",{"annotation":{"meta":null,"sourceSpan":{"end":[16,11],"start":[16,10]}},"type":"Var","value":{"identifier":"b","moduleName":["Golden","Values","Test"]}}],["c",{"annotation":{"meta":null,"sourceSpan":{"end":[16,14],"start":[16,13]}},"type":"Var","value":{"identifier":"c","moduleName":["Golden","Values","Test"]}}]]}},"identifier":"o"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,15],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,16],"start":[13,5]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,8],"start":[13,7]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,10]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,14],"start":[13,13]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}}]}},"identifier":"a"}],"exports":["i","b","c","a","o","f"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Golden","Values","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[19,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Values","Test"],"modulePath":"golden/Golden/Values/Test.purs","reExports":{},"sourceSpan":{"end":[19,11],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/packages.dhall b/test/ps/packages.dhall index 1a3ab9d..d74319c 100644 --- a/test/ps/packages.dhall +++ b/test/ps/packages.dhall @@ -1,9 +1,9 @@ let upstream-ps = - https://github.com/purescript/package-sets/releases/download/psc-0.15.15-20240419/packages.dhall - sha256:50c4ee579bf2c38671ac97df821c2cc4221fb3f6ad79c807bb6e4597ab6d1e95 + https://github.com/purescript/package-sets/releases/download/psc-0.15.15-20260605/packages.dhall + sha256:e48c9b283ca89ec994453459fb74c4b5b5a9432349f83a2e104f39dd869a0f6e let upstream-lua = - https://github.com/Unisay/purescript-lua-package-sets/releases/download/psc-0.15.15-20240425/packages.dhall - sha256:3721bc8a2f6681e16fb505b8b0256650d9fd47977755fde9947852343888f14b + https://github.com/Unisay/purescript-lua-package-sets/releases/download/psc-0.15.15-20260612/packages.dhall + sha256:e031a7820831578424a5270b778f9f31a5aadee7a719a9fa95f8d58f406b308d in upstream-ps // upstream-lua From 059e85d6ef7643238408a94a1482e715e6a7cc1e Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 09:24:54 +0200 Subject: [PATCH 15/40] docs: refresh toolchain versions and dependency-update guide Fix stale GHC version in README (9.4.8 -> 9.8.4). In CLAUDE.md: replace the hardcoded dist-newstyle path with cabal list-bin, document pinned toolchain versions, add a dependency-update procedure with known pitfalls (the unit = nil trap), extend module listings. --- CLAUDE.md | 48 +++++++++++++++++++++++++++++++++++++++++++++--- README.md | 2 +- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index fb7abaa..d48cef5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,6 +10,17 @@ This is `pslua` - a PureScript to Lua compiler backend. It takes PureScript Core The project uses **Nix with flakes** for reproducible builds and **Cabal** for Haskell development. +### Toolchain + +Versions are pinned by the flake (`compiler-nix-name` and `easy-ps.purs-*` +in `flake.nix`); update them there, not locally: + +- **GHC**: 9.8.x (haskell.nix `ghc98`) +- **PureScript**: `purs` 0.15.16 (from easy-purescript-nix; note that attr + names may carry an upstream release suffix, e.g. `purs-0_15_16-0`) +- **Spago**: 0.21.x — the *legacy* Haskell spago driven by `spago.dhall` / + `packages.dhall` (not the newer `spago.yaml`-based one) + ### Development Environment ```bash @@ -92,8 +103,8 @@ luacheck --quiet --std min test/ps/output/ # Build and run cabal run pslua -- --help -# Or after building -./dist-newstyle/build/x86_64-linux/ghc-9.8.1/pslua-0.1.0.0/x/pslua/build/pslua/pslua --help +# Or after building (resolves the dist-newstyle path for the current GHC) +$(cabal list-bin pslua) --help # Or via nix nix run . -- --help @@ -158,8 +169,9 @@ PureScript Source → CoreFn → IR → Lua → Optimized Lua **CoreFn Layer** (`Language.PureScript.CoreFn.*`): - `CoreFn.Reader`: Reads CoreFn JSON from disk - `CoreFn.FromJSON`: JSON deserialization -- `CoreFn.Expr`: CoreFn expression types +- `CoreFn.Expr`, `CoreFn.Module`, `CoreFn.Meta`: CoreFn data types - `CoreFn.Traversals`: Traversal utilities +- `CoreFn.Laziness`: Lazy binding analysis **IR Layer** (`Language.PureScript.Backend.IR.*`): - `IR.Types`: Core IR data types (`RawExp`, `Module`, `Binding`) @@ -168,6 +180,7 @@ PureScript Source → CoreFn → IR → Lua → Optimized Lua - `IR.Optimizer`: IR-level optimizations - `IR.DCE`: Dead code elimination - `IR.Inliner`: Inlining annotations and logic +- `IR.Query`: Queries over IR expressions **Lua Backend** (`Language.PureScript.Backend.Lua.*`): - `Lua.Types`: Lua AST types (`Chunk`, `Statement`, `Exp`) @@ -177,6 +190,7 @@ PureScript Source → CoreFn → IR → Lua → Optimized Lua - `Lua.DCE`: Lua-specific DCE - `Lua.Linker.Foreign`: FFI support for Lua foreign modules - `Lua.Fixture`: Runtime support code injected into output +- `Lua.Key`, `Lua.Traversal`: Table keys and AST traversal helpers **Main Entry** (`Language.PureScript.Backend`): - `compileModules`: Top-level compilation function orchestrating the pipeline @@ -275,6 +289,34 @@ The project uses Hedgehog for property-based testing: 5. If golden tests fail, inspect `actual.*` files in `test/ps/output/` 6. Update golden files if changes are correct +## Updating Dependencies + +1. `nix flake update` — refreshes haskell.nix (and with it the Hackage + index pin), nixpkgs, and easy-purescript-nix. To bump GHC or `purs`, + edit `compiler-nix-name` / `easy-ps.purs-*` in `flake.nix`. +2. PureScript package sets live in `test/ps/packages.dhall` as + `upstream-ps // upstream-lua`. The right operand wins: `upstream-lua` + (releases of `Unisay/purescript-lua-package-sets`) overrides core + packages with Lua forks that ship `.lua` FFI files. +3. After changing package sets or `purs`: `cd test/ps && spago build -u + '-g corefn'`, then `cabal test all`. Drop the `sha256:` annotations + when changing package set URLs — spago re-freezes them on first build. +4. Expected churn after updates: + - `test/ps/output/*/corefn.json` are committed; their `"builtWith"` + stamp changes with the `purs` version. + - `golden.ir` files embed `.spago///...` source paths, + so package version bumps legitimately change goldens. + +### Known Pitfalls + +- **`unit` must not be `nil`**: Lua tables cannot hold `nil` values, so + `Array Unit` silently collapses to an empty table if the prelude defines + `unit = nil`. Requires `Unisay/purescript-lua-prelude` ≥ v7.2.0, where + `unit = {}`. If eval goldens for unit arrays start printing `0`, a + package set downgraded the prelude — do not accept such goldens. +- A generated-Lua change that only passes `luacheck` is not verified: + eval goldens (`eval/golden.txt`) are the semantic check. + ## Debugging Tips - The IR and Lua types have `Show` instances - use `pShowOpt` for pretty debug output diff --git a/README.md b/README.md index 18eb788..e298c27 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ will make `pslua` executable available for use. ### Windows Nix build won't work on Windows so you'd first need to install -`cabal` and `ghc-9.4.8` (One way of installing those is [GHCUp](https://www.haskell.org/ghcup/)). +`cabal` and `ghc-9.8.4` (One way of installing those is [GHCUp](https://www.haskell.org/ghcup/)). Once the pre-requisites are available on your PATH you run From f525a92802a97317fc6a602d4200218cce2550b4 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 09:25:39 +0200 Subject: [PATCH 16/40] chore: add .local/ to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ae43ec4..3cc8bf0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ result-* .vscode/settings.json .envrc.local .hspec-failures +.local/ From 47b3316bf3e82a5758485d7953b0b304dbd56623 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 10:43:30 +0200 Subject: [PATCH 17/40] test: reproduce issue #37 (undefined variable in compiled code) Golden test from PR #38 with the explicit export list from PR #39: with 'module ... (baz) where' the non-exported bindings get inlined and the generated Lua references an undefined variable Bind11. The luacheck golden suite fails with W113 until the bug is fixed. --- test/ps/golden/Golden/Issue37/Test.purs | 20 +++++++++++++++++++ .../ps/output/Golden.Issue37.Test/corefn.json | 1 + 2 files changed, 21 insertions(+) create mode 100644 test/ps/golden/Golden/Issue37/Test.purs create mode 100644 test/ps/output/Golden.Issue37.Test/corefn.json diff --git a/test/ps/golden/Golden/Issue37/Test.purs b/test/ps/golden/Golden/Issue37/Test.purs new file mode 100644 index 0000000..4dd75da --- /dev/null +++ b/test/ps/golden/Golden/Issue37/Test.purs @@ -0,0 +1,20 @@ +module Golden.Issue37.Test (baz) where + +import Prelude +import Effect (Effect) + +baz :: Effect Unit +baz = bar (pure unit) + +bar :: forall f. Monad f => f Unit -> f Unit +bar f = do + f + _ <- pure [ foo f ] + pure unit + +foo :: forall f. Monad f => f Unit -> f Unit +foo fn1 = do + _ <- fn1 + fn1 + fn1 + fn1 diff --git a/test/ps/output/Golden.Issue37.Test/corefn.json b/test/ps/output/Golden.Issue37.Test/corefn.json new file mode 100644 index 0000000..7005a9c --- /dev/null +++ b/test/ps/output/Golden.Issue37.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[18,6],"start":[18,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[18,6],"start":[18,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,45],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,45],"start":[15,1]}},"argument":"dictMonad","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictMonad","sourcePos":[0,0]}},"fieldName":"Bind1","type":"Accessor"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,11],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"Bind1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,11],"start":[17,3]}},"type":"Var","value":{"identifier":"bind","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,11],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Bind1","sourcePos":[0,0]}},"type":"App"},"identifier":"bind"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","Issue37","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[18,6],"start":[18,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Bind1","sourcePos":[0,0]}},"type":"App"},"identifier":"discard1"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,45],"start":[15,1]}},"argument":"fn1","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bind","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,8]}},"type":"Var","value":{"identifier":"fn1","sourcePos":[16,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,11],"start":[17,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard1","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,3]}},"type":"Var","value":{"identifier":"fn1","sourcePos":[16,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard1","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,3]}},"type":"Var","value":{"identifier":"fn1","sourcePos":[16,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,6],"start":[19,3]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[20,6],"start":[20,3]}},"type":"Var","value":{"identifier":"fn1","sourcePos":[16,1]}},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"Let"},"type":"Abs"},"identifier":"foo"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,45],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,45],"start":[9,1]}},"argument":"dictMonad","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,4],"start":[11,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictMonad","sourcePos":[0,0]}},"fieldName":"Bind1","type":"Accessor"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[11,4],"start":[11,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"Bind1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","Issue37","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[11,4],"start":[11,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Bind1","sourcePos":[0,0]}},"type":"App"},"identifier":"discard1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[12,22],"start":[12,3]}},"type":"Var","value":{"identifier":"bind","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[12,22],"start":[12,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Bind1","sourcePos":[0,0]}},"type":"App"},"identifier":"bind"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[12,12],"start":[12,8]}},"type":"Var","value":{"identifier":"pure","moduleName":["Control","Applicative"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[12,22],"start":[12,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[12,22],"start":[12,8]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictMonad","sourcePos":[0,0]}},"fieldName":"Applicative0","type":"Accessor"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[12,22],"start":[12,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"type":"App"},"identifier":"pure"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[12,18],"start":[12,15]}},"type":"Var","value":{"identifier":"foo","moduleName":["Golden","Issue37","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[12,20],"start":[12,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictMonad","sourcePos":[0,0]}},"type":"App"},"identifier":"foo1"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,45],"start":[9,1]}},"argument":"f","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard1","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,4],"start":[11,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,4],"start":[11,3]}},"type":"Var","value":{"identifier":"f","sourcePos":[10,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[11,4],"start":[11,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,4],"start":[11,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bind","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,22],"start":[12,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"pure","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,22],"start":[12,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,22],"start":[12,13]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"foo1","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,20],"start":[12,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,20],"start":[12,19]}},"type":"Var","value":{"identifier":"f","sourcePos":[10,1]}},"type":"App"}]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[12,22],"start":[12,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,22],"start":[12,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"pure","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,12],"start":[13,3]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,12],"start":[13,8]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"Let"},"type":"Abs"},"identifier":"bar"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,19],"start":[6,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[7,7]}},"type":"Var","value":{"identifier":"bar","moduleName":["Golden","Issue37","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[7,22],"start":[7,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"monadEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,22],"start":[7,7]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[7,16],"start":[7,12]}},"type":"Var","value":{"identifier":"pure","moduleName":["Control","Applicative"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[7,21],"start":[7,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,21],"start":[7,12]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[7,21],"start":[7,17]}},"type":"Var","value":{"identifier":"unit","moduleName":["Data","Unit"]}},"type":"App"},"type":"App"},"identifier":"baz"}],"exports":["baz"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,6],"start":[1,1]}},"moduleName":["Control","Applicative"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,6],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,6],"start":[1,1]}},"moduleName":["Data","Unit"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,6],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,6],"start":[1,1]}},"moduleName":["Golden","Issue37","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,6],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","Issue37","Test"],"modulePath":"golden/Golden/Issue37/Test.purs","reExports":{},"sourceSpan":{"end":[20,6],"start":[1,1]}} \ No newline at end of file From 51d1b794dbcd71010c6829a86c163d83e394d112 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 10:51:59 +0200 Subject: [PATCH 18/40] test: pin sequential (let*) scoping convention for shift/substitute/countFreeRefs The IR's authoritative Let scoping convention (implemented by renameShadowedNames, DCE and Lua codegen) is sequential: in a standalone binding's RHS the earlier siblings of the same Let are in scope, while the binding's own name refers to an outer binder. shift, substitute and countFreeRefs in IR.Types implement the opposite convention, which makes inlining produce unbound references (issue #37). These tests are red until the convention is fixed. --- .../PureScript/Backend/IR/Optimizer/Spec.hs | 82 +++++++++++++++++++ .../PureScript/Backend/IR/Types/Spec.hs | 63 +++++++++++++- 2 files changed, 144 insertions(+), 1 deletion(-) diff --git a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs index 56d119c..ef0f1af 100644 --- a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs @@ -1,5 +1,6 @@ module Language.PureScript.Backend.IR.Optimizer.Spec where +import Control.Lens (universeOf) import Data.Map qualified as Map import Hedgehog (annotateShow, forAll, (===)) import Hedgehog.Gen qualified as Gen @@ -8,6 +9,8 @@ import Language.PureScript.Backend.IR.Linker (LinkMode (..)) import Language.PureScript.Backend.IR.Linker qualified as Linker import Language.PureScript.Backend.IR.Names ( Name (..) + , QName (..) + , Qualified (Local) , moduleNameFromString ) import Language.PureScript.Backend.IR.Optimizer @@ -31,8 +34,10 @@ import Language.PureScript.Backend.IR.Types , noAnn , paramNamed , paramUnused + , refImported , refLocal , refLocal0 + , subexpressions ) import Test.Hspec (Spec, describe) import Test.Hspec.Hedgehog.Extended (test) @@ -117,6 +122,83 @@ spec = describe "IR Optimizer" do annotateShow expected optimizedUberModule original === expected + describe "scoping invariants" do + -- Mimics issue #37: an inlined binding contains a let with a + -- reference bound by an earlier sibling; inlining it under a binder + -- with the same name must not leave the reference unbound. + test "inlining bindings does not unbind let-bound references" do + let mainModule = moduleNameFromString "Main" + dict = moduleNameFromString "Dict" + fooExp = + abstraction (paramNamed (Name "fn1")) $ + lets + ( Standalone + ( noAnn + , Name "Bind1" + , application + (refImported dict (Name "bind") 0) + (refLocal (Name "fn1") 0) + ) + :| [ Standalone + ( noAnn + , Name "discard1" + , application + (refImported dict (Name "discard") 0) + (refLocal (Name "Bind1") 0) + ) + ] + ) + ( application + (refLocal (Name "discard1") 0) + (refLocal (Name "discard1") 0) + ) + barExp = + abstraction (paramNamed (Name "f")) $ + lets + ( Standalone + ( noAnn + , Name "Bind1" + , application + (refImported dict (Name "bind") 0) + (refLocal (Name "f") 0) + ) + :| [] + ) + ( application + ( application + (refImported mainModule (Name "foo") 0) + (refLocal (Name "f") 0) + ) + ( application + (refLocal (Name "Bind1") 0) + (refLocal (Name "Bind1") 0) + ) + ) + original = + Linker.UberModule + { uberModuleForeigns = [] + , uberModuleBindings = + [ Standalone (QName mainModule (Name "foo"), fooExp) + , Standalone (QName mainModule (Name "bar"), barExp) + ] + , uberModuleExports = + [ ( Name "baz" + , application + (refImported mainModule (Name "bar") 0) + (literalInt 7) + ) + ] + } + optimized = optimizedUberModule original + unboundLocalRefs = + [ (name, index) + | (_exportedName, expr) ← Linker.uberModuleExports optimized + , Ref _ann (Local name) index ← universeOf subexpressions expr + , index /= 0 + ] + annotateShow optimized + unboundLocalRefs === [] + describe "renames shadowed names" do test "nested λ-abstractions" do name ← forAll Gen.name diff --git a/test/Language/PureScript/Backend/IR/Types/Spec.hs b/test/Language/PureScript/Backend/IR/Types/Spec.hs index 88d7393..bfa44ad 100644 --- a/test/Language/PureScript/Backend/IR/Types/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Types/Spec.hs @@ -5,13 +5,14 @@ import Hedgehog ((===)) import Language.PureScript.Backend.IR.Names ( ModuleName (..) , Name (..) - , Qualified (Imported) + , Qualified (Imported, Local) ) import Language.PureScript.Backend.IR.Types ( Exp , Grouping (..) , abstraction , application + , countFreeRef , countFreeRefs , lets , literalInt @@ -20,6 +21,8 @@ import Language.PureScript.Backend.IR.Types , paramUnused , refImported , refLocal + , shift + , substitute ) import Test.Hspec (Spec, describe) import Test.Hspec.Hedgehog.Extended (test) @@ -39,6 +42,64 @@ spec = describe "Types" do , (Imported (ModuleName "Partial.Unsafe") (Name "unsafePartial"), 1) ] + -- Convention: Let bindings have sequential (let*) scoping — in a + -- standalone binding's RHS the earlier siblings of the same Let are + -- in scope, while the binding's own name refers to an outer binder. + describe "Let sequential (let*) scoping" do + let x = Name "x" + y = Name "y" + + test "shift: ref bound by an earlier sibling is not shifted" do + let e = + lets + ( Standalone (noAnn, x, literalInt 1) + :| [Standalone (noAnn, y, refLocal x 0)] + ) + (literalInt 0) + shift 1 x 0 e === e + + test "shift: ref to an outer name in own RHS is shifted" do + let original = + lets (Standalone (noAnn, x, refLocal x 0) :| []) (literalInt 0) + shifted = + lets (Standalone (noAnn, x, refLocal x 1) :| []) (literalInt 0) + shift 1 x 0 original === shifted + + test "shift: ref in the body bound by the let is not shifted" do + let e = + lets (Standalone (noAnn, x, literalInt 1) :| []) (refLocal x 0) + shift 1 x 0 e === e + + test "countFreeRefs: ref bound by an earlier sibling is not free" do + let e = + lets + ( Standalone (noAnn, x, literalInt 1) + :| [Standalone (noAnn, y, refLocal x 0)] + ) + (literalInt 0) + countFreeRef (Local x) e === 0 + + test "countFreeRefs: ref to an outer name in own RHS is free" do + let e = + lets (Standalone (noAnn, x, refLocal x 0) :| []) (literalInt 0) + countFreeRef (Local x) e === 1 + + test "substitute: ref bound by an earlier sibling is not substituted" do + let e = + lets + ( Standalone (noAnn, x, literalInt 1) + :| [Standalone (noAnn, y, refLocal x 0)] + ) + (literalInt 0) + substitute (Local x) 0 (literalInt 42) e === e + + test "substitute: ref to an outer name in own RHS is substituted" do + let original = + lets (Standalone (noAnn, x, refLocal x 0) :| []) (literalInt 0) + expected = + lets (Standalone (noAnn, x, literalInt 42) :| []) (literalInt 0) + substitute (Local x) 0 (literalInt 42) original === expected + expr ∷ Exp expr = abstraction From 3c64f5ae4fed3a6d1629d0c6f8f46dd2ab6b5411 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 11:01:17 +0200 Subject: [PATCH 19/40] fix: align shift/substitute/countFreeRefs with sequential Let scoping (#37) The IR's Let scoping convention is sequential (let*): in a standalone binding's RHS the earlier siblings of the same Let are in scope, while the binding's own name refers to an outer binder. renameShadowedNames, DCE and the Lua codegen all follow this convention, but shift, substitute and countFreeRefs implemented the opposite one: they bumped the index for the binding's own name and ignored earlier siblings. As a result, inlining a non-exported binding whose body contained a let with a sibling-bound reference under a binder with the same name shifted that reference past its binder. DCE then deleted the "unused" binder and the Lua codegen rendered the dangling Ref (Local Bind1) 1 as an undefined variable Bind11. Also harden the codegen: a local reference with a non-zero index after renameShadowedNames is now a compile-time error (UnexpectedRefBound) instead of being silently rendered as an undefined Lua variable. --- lib/Language/PureScript/Backend/IR/Types.hs | 161 ++++---- lib/Language/PureScript/Backend/Lua.hs | 27 +- .../PureScript/Backend/IR/Optimizer/Spec.hs | 15 +- test/ps/output/Golden.Issue37.Test/golden.ir | 378 ++++++++++++++++++ test/ps/output/Golden.Issue37.Test/golden.lua | 98 +++++ 5 files changed, 585 insertions(+), 94 deletions(-) create mode 100644 test/ps/output/Golden.Issue37.Test/golden.ir create mode 100644 test/ps/output/Golden.Issue37.Test/golden.lua diff --git a/lib/Language/PureScript/Backend/IR/Types.hs b/lib/Language/PureScript/Backend/IR/Types.hs index 7783e7c..e64e829 100644 --- a/lib/Language/PureScript/Backend/IR/Types.hs +++ b/lib/Language/PureScript/Backend/IR/Types.hs @@ -507,28 +507,41 @@ countFreeRefs = fmap getSum . MMap.toMap . countFreeRefs' mempty where minIndexes' = Map.insertWith (+) (Local name) 1 minIndexes ParamUnused _paramAnn → countFreeRefs' minIndexes body + -- Let bindings have sequential (let*) scoping: in a standalone + -- binding's RHS the earlier siblings of the same Let are in scope, + -- while the binding's own name refers to an outer binder. Members + -- of a recursive group additionally see the whole group. Let _ann binds body → fold (countsInBody : countsInBinds) where - countsInBody = countFreeRefs' minIndexes' body - where - minIndexes' = - foldr (\name → Map.insertWith (+) name 1) minIndexes $ - toList binds >>= fmap Local . bindingNames - countsInBinds = - toList binds >>= \case - Standalone (_nameAnn, boundName, expr) → - [countFreeRefs' minIndexes' expr] - where - minIndexes' = Map.insertWith (+) (Local boundName) 1 minIndexes - RecursiveGroup recBinds → - toList recBinds <&> \(_nameAnn, _boundName, expr) → - countFreeRefs' minIndexes' expr - where - minIndexes' = - foldr - (\(_nameAnn, qName, _expr) → Map.insertWith (+) (Local qName) 1) - minIndexes - recBinds + countsInBody = countFreeRefs' minIndexesAfterBinds body + (minIndexesAfterBinds, countsInBinds) = + foldl' withGrouping (minIndexes, []) (toList binds) + withGrouping + ∷ ( Map (Qualified Name) Index + , [MonoidMap (Qualified Name) (Sum Natural)] + ) + → Grouping (ann, Name, RawExp ann) + → ( Map (Qualified Name) Index + , [MonoidMap (Qualified Name) (Sum Natural)] + ) + withGrouping (mins, counts) = \case + Standalone (_nameAnn, boundName, expr) → + ( Map.insertWith (+) (Local boundName) 1 mins + , countFreeRefs' mins expr : counts + ) + RecursiveGroup recBinds → + ( minsAfterGroup + , ( toList recBinds <&> \(_nameAnn, _boundName, expr) → + countFreeRefs' minsAfterGroup expr + ) + <> counts + ) + where + minsAfterGroup = + foldr + (\(_nameAnn, qName, _expr) → Map.insertWith (+) (Local qName) 1) + mins + recBinds App _ann argument function → go argument <> go function LiteralArray _ann as → @@ -604,39 +617,39 @@ substitute name idx replacement = substitute' idx where index' = if name == Local pName then index + 1 else index replacement' = shift 1 pName 0 replacement + -- Sequential (let*) scoping: a standalone binding's RHS sees the + -- earlier siblings of the same Let (its own name refers to an + -- outer binder), recursive group members see the whole group, + -- and the body sees all the bindings. Let ann binds body → Let ann binds' body' where - binds' = - binds <&> \grouping → - case grouping of - Standalone (nameAnn, boundName, expr) → - Standalone - ( nameAnn - , boundName - , substitute name index' replacement' expr - ) - where - index' - | name == Local boundName = index + 1 - | otherwise = index - replacement' = shift 1 boundName 0 replacement - RecursiveGroup recBinds → - RecursiveGroup $ - substitute name index' replacement' <<$>> recBinds - where - index' - | name `elem` fmap Local boundNames = index + 1 - | otherwise = index - replacement' = - foldr (\n r → shift 1 n 0 r) replacement boundNames - boundNames = bindingNames grouping - body' = substitute name index' replacement' body - where - boundNames = toList binds >>= bindingNames - index' = - index - & if name `elem` (Local <$> boundNames) then (+ 1) else id - replacement' = foldr (\n r → shift 1 n 0 r) replacement boundNames + ((bodyIndex, bodyReplacement), binds') = + mapAccumL withGrouping (index, replacement) binds + body' = substitute name bodyIndex bodyReplacement body + withGrouping + ∷ (Index, RawExp ann) + → Grouping (ann, Name, RawExp ann) + → ((Index, RawExp ann), Grouping (ann, Name, RawExp ann)) + withGrouping (i, repl) grouping = + case grouping of + Standalone (nameAnn, boundName, expr) → + ( + ( if name == Local boundName then i + 1 else i + , shift 1 boundName 0 repl + ) + , Standalone (nameAnn, boundName, substitute name i repl expr) + ) + RecursiveGroup recBinds → + ( (i', repl') + , RecursiveGroup $ substitute name i' repl' <<$>> recBinds + ) + where + boundNames = bindingNames grouping + i' = + i + + fromIntegral + (length (filter ((name ==) . Local) boundNames)) + repl' = foldr (\n r → shift 1 n 0 r) repl boundNames App ann argument function → App ann (go argument) (go function) LiteralArray ann as → @@ -696,36 +709,36 @@ shift offset namespace minIndex expression = minIndex' | paramName argument == Just namespace = minIndex + 1 | otherwise = minIndex + -- Sequential (let*) scoping: a standalone binding's RHS sees the + -- earlier siblings of the same Let (its own name refers to an + -- outer binder), recursive group members see the whole group, + -- and the body sees all the bindings. Let ann binds body → Let ann binds' body' where - binds' = - binds <&> \grouping → - case grouping of - Standalone (annotation, boundName, expr) → - Standalone + (bodyMinIndex, binds') = mapAccumL withGrouping minIndex binds + body' = shift offset namespace bodyMinIndex body + withGrouping minIdx grouping = + case grouping of + Standalone (annotation, boundName, expr) → + ( if boundName == namespace then minIdx + 1 else minIdx + , Standalone ( annotation , boundName - , shift offset namespace minIndex' expr + , shift offset namespace minIdx expr ) - where - minIndex' - | namespace == boundName = minIndex + 1 - | otherwise = minIndex - RecursiveGroup recBinds → - RecursiveGroup $ + ) + RecursiveGroup recBinds → + ( minIdx' + , RecursiveGroup $ recBinds <&> \(nameAnn, boundName, expr) → - (nameAnn, boundName, shift offset namespace minIndex' expr) - where - minIndex' - | namespace `elem` bindingNames grouping = minIndex + 1 - | otherwise = minIndex - body' = shift offset namespace minIndex' body - where - boundNames' = toList binds >>= bindingNames - minIndex' - | namespace `elem` boundNames' = minIndex + 1 - | otherwise = minIndex + (nameAnn, boundName, shift offset namespace minIdx' expr) + ) + where + minIdx' = + minIdx + + fromIntegral + (length (filter (== namespace) (bindingNames grouping))) App ann argument function → App ann (go argument) (go function) LiteralArray ann as → diff --git a/lib/Language/PureScript/Backend/Lua.hs b/lib/Language/PureScript/Backend/Lua.hs index fff3710..dcbe233 100644 --- a/lib/Language/PureScript/Backend/Lua.hs +++ b/lib/Language/PureScript/Backend/Lua.hs @@ -127,12 +127,6 @@ asExpression = \case fromName ∷ HasCallStack ⇒ IR.Name → Lua.Name fromName = Name.makeSafe . IR.nameToText -fromNameWithIndex ∷ HasCallStack ⇒ IR.Name → IR.Index → Lua.Name -fromNameWithIndex name (IR.unIndex → index) = - if index == 0 - then fromName name - else Name.makeSafe $ IR.nameToText name <> show index - fromModuleName ∷ ModuleName → Lua.Name fromModuleName = Name.makeSafe . runModuleName @@ -207,17 +201,24 @@ fromIR foreigns topLevelNames modname ir = case ir of pure [] _ → goExp arg <&> \a → [a] IR.Ref _ann qualifiedName index → - pure . Right $ case qualifiedName of + case qualifiedName of IR.Local name | topLevelName ← qualifyName modname (fromName name) , Set.member topLevelName topLevelNames → - Lua.varField (Lua.varName Fixture.moduleName) topLevelName - IR.Local name → - Lua.varName (fromNameWithIndex name index) + pure . Right $ + Lua.varField (Lua.varName Fixture.moduleName) topLevelName + IR.Local name + -- After the optimizer's renameShadowedNames pass every local + -- reference must resolve to its binder by name alone: a + -- non-zero index means the reference is unbound and would be + -- rendered as an undefined Lua variable (issue #37). + | index == 0 → pure . Right $ Lua.varName (fromName name) + | otherwise → Oops.throw $ UnexpectedRefBound modname ir IR.Imported modname' name → - Lua.varField - (Lua.varName Fixture.moduleName) - (qualifyName modname' (fromName name)) + pure . Right $ + Lua.varField + (Lua.varName Fixture.moduleName) + (qualifyName modname' (fromName name)) IR.Let _ann bindings bodyExp → do body ← go bodyExp recs ← diff --git a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs index ef0f1af..4c01c4b 100644 --- a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs @@ -140,12 +140,12 @@ spec = describe "IR Optimizer" do (refLocal (Name "fn1") 0) ) :| [ Standalone - ( noAnn - , Name "discard1" - , application - (refImported dict (Name "discard") 0) - (refLocal (Name "Bind1") 0) - ) + ( noAnn + , Name "discard1" + , application + (refImported dict (Name "discard") 0) + (refLocal (Name "Bind1") 0) + ) ] ) ( application @@ -182,7 +182,8 @@ spec = describe "IR Optimizer" do , Standalone (QName mainModule (Name "bar"), barExp) ] , uberModuleExports = - [ ( Name "baz" + [ + ( Name "baz" , application (refImported mainModule (Name "bar") 0) (literalInt 7) diff --git a/test/ps/output/Golden.Issue37.Test/golden.ir b/test/ps/output/Golden.Issue37.Test/golden.ir new file mode 100644 index 0000000..1019739 --- /dev/null +++ b/test/ps/output/Golden.Issue37.Test/golden.ir @@ -0,0 +1,378 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Unit", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs" + [ ( Just Always, Name "unit" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.Issue37.Test", qnameName = Name "discard" + }, ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ] + ) + ( PropName "discard" ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "baz", App Nothing + ( Let Nothing + ( Standalone + ( Nothing, Name "Bind1", App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) :| + [ Standalone + ( Nothing, Name "pure", App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) + ] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.Issue37.Test" ) ( Name "discard" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "Bind1" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "Bind1" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "pure" ) ) 0 ) + ( LiteralArray Nothing + [ App Nothing + ( Let Nothing + ( Standalone + ( Nothing, Name "Bind11", App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) :| + [ Standalone + ( Nothing, Name "discard1", App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.Issue37.Test" ) + ( Name "discard" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "Bind11" ) ) 0 ) + ) + ] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "fn1" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( Ref Nothing ( Local ( Name "fn1" ) ) 0 ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "discard1" ) ) 0 ) + ( Ref Nothing ( Local ( Name "fn1" ) ) 0 ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "discard1" ) ) 0 ) + ( Ref Nothing ( Local ( Name "fn1" ) ) 0 ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Local ( Name "fn1" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ] + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing ( Local ( Name "pure" ) ) 0 ) + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Unit" ) ( Name "foreign" ) ) 0 + ) + ( PropName "unit" ) + ) + ) + ) + ) + ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ) + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Unit" ) ( Name "foreign" ) ) 0 ) + ( PropName "unit" ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.Issue37.Test/golden.lua b/test/ps/output/Golden.Issue37.Test/golden.lua new file mode 100644 index 0000000..fe39af7 --- /dev/null +++ b/test/ps/output/Golden.Issue37.Test/golden.lua @@ -0,0 +1,98 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_Unit_foreign = { unit = {} } +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f)) + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_Issue37_Test_discard = M.Control_Bind_bind +return { + baz = (function() + return function(f) + local Bind1 = M.Effect_monadEffect.Bind1() + local pure = M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0()) + return M.Golden_Issue37_Test_discard(Bind1)(f)(function() + return M.Control_Bind_bind(Bind1)(pure({ + [1] = (function() + return function(fn1) + local Bind11 = M.Effect_monadEffect.Bind1() + local discard1 = M.Golden_Issue37_Test_discard(Bind11) + return M.Control_Bind_bind(M.Effect_monadEffect.Bind1())(fn1)(function( ) + return discard1(fn1)(function() + return discard1(fn1)(function() return fn1 end) + end) + end) + end + end)()(f) + }))(function() return pure(M.Data_Unit_foreign.unit) end) + end) + end + end)()(M.Control_Applicative_pure(M.Effect_applicativeEffect)(M.Data_Unit_foreign.unit)) +} From 55a75747b984a3504f80b135ea06527b1061eed5 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 11:03:26 +0200 Subject: [PATCH 20/40] chore(test): fix typo in golden spec progress message --- test/Language/PureScript/Backend/Lua/Golden/Spec.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Language/PureScript/Backend/Lua/Golden/Spec.hs b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs index e712f35..50ba4a7 100644 --- a/test/Language/PureScript/Backend/Lua/Golden/Spec.hs +++ b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs @@ -75,7 +75,7 @@ spec ∷ Spec spec = do describe "Goldens: *.purs -> *.lua" do let compilePs = do - putText "Comipling PureScript sources" + putText "Compiling PureScript sources" exitCode ← runProcess . setWorkingDir "test/ps" . shell $ String.unwords ["spago", "build", "-u", "'-g corefn'"] From 69bd23c11c074f28fa3ae78e439d3dc6716b1b36 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 11:41:33 +0200 Subject: [PATCH 21/40] docs: add Note [Sequential scoping of Let bindings]; fix same defect in Linker Consolidate the let*-scoping convention, previously copy-pasted at three Let cases in IR.Types and paraphrased across Lua codegen, DCE and two test specs, into a single GHC-style Note in IR.Types referenced from every site that implements or depends on it. Add a companion Note [Locals are uniquely named after renameShadowedNames] in IR.Optimizer documenting why renameShadowedNames must run last and why the Lua backend rejects non-zero local indices. While auditing for the convention, qualifyTopRefs in IR.Linker turned out to have the same defect issue #37 had: it qualified Let groupings independently instead of threading the per-name scope left to right, so a reference bound by an earlier sibling could be mis-qualified to a top-level binding. Fixed with mapAccumL threading mirroring the IR.Types functions, plus IR.Linker.Spec unit tests (red before the fix, green after). --- lib/Language/PureScript/Backend/IR/DCE.hs | 1 + lib/Language/PureScript/Backend/IR/Linker.hs | 34 +++++---- .../PureScript/Backend/IR/Optimizer.hs | 30 +++++++- lib/Language/PureScript/Backend/IR/Types.hs | 73 ++++++++++++++++--- lib/Language/PureScript/Backend/Lua.hs | 7 +- pslua.cabal | 1 + .../PureScript/Backend/IR/Linker/Spec.hs | 60 +++++++++++++++ .../PureScript/Backend/IR/Optimizer/Spec.hs | 1 + .../PureScript/Backend/IR/Types/Spec.hs | 4 +- test/Main.hs | 2 + 10 files changed, 178 insertions(+), 35 deletions(-) create mode 100644 test/Language/PureScript/Backend/IR/Linker/Spec.hs diff --git a/lib/Language/PureScript/Backend/IR/DCE.hs b/lib/Language/PureScript/Backend/IR/DCE.hs index 6bca7a8..7f95c96 100644 --- a/lib/Language/PureScript/Backend/IR/DCE.hs +++ b/lib/Language/PureScript/Backend/IR/DCE.hs @@ -309,6 +309,7 @@ eliminateDeadCode uber@UberModule {..} = addToScope ((nameId, _ann), name, _expr) = addLocalToScope nameId name 0 where + -- See Note [Sequential scoping of Let bindings] adjacencyListForGrouping ∷ (Scope, DList Node) → Grouping ((Id, Ann), Name, AExp) diff --git a/lib/Language/PureScript/Backend/IR/Linker.hs b/lib/Language/PureScript/Backend/IR/Linker.hs index c4d5210..ee8b825 100644 --- a/lib/Language/PureScript/Backend/IR/Linker.hs +++ b/lib/Language/PureScript/Backend/IR/Linker.hs @@ -106,23 +106,27 @@ qualifyTopRefs moduleName = go case parameter of ParamNamed _ann argName → Map.adjust (+ 1) argName topNames ParamUnused _ann → topNames + -- See Note [Sequential scoping of Let bindings] Let ann groupings body → - Let ann (qualifyGroupings groupings) (qualifyBody body) + Let ann groupings' (go topNamesAfterBinds body) where - qualifyGroupings ∷ NonEmpty Binding → NonEmpty Binding - qualifyGroupings = fmap \case - Standalone (a, name, expr) → - Standalone (a, name, go (Map.adjust (+ 1) name topNames) expr) - RecursiveGroup recBinds → - RecursiveGroup do - (a, name, expr) ← recBinds - pure (a, name, go indexedNames expr) - where - boundNames = toList recBinds <&> \(_, n, _) → n - indexedNames = foldr (Map.adjust (+ 1)) topNames boundNames - qualifyBody = - let boundNames = toList groupings >>= bindingNames - in go (foldr (Map.adjust (+ 1)) topNames boundNames) + (topNamesAfterBinds, groupings') = + mapAccumL qualifyGrouping topNames groupings + qualifyGrouping ∷ Map Name Index → Binding → (Map Name Index, Binding) + qualifyGrouping names grouping = + case grouping of + Standalone (a, name, expr) → + ( Map.adjust (+ 1) name names + , Standalone (a, name, go names expr) + ) + RecursiveGroup recBinds → + ( names' + , RecursiveGroup $ + recBinds <&> \(a, name, expr) → (a, name, go names' expr) + ) + where + names' = + foldr (Map.adjust (+ 1)) names (bindingNames grouping) App ann argument function → App ann (go' argument) (go' function) LiteralArray ann as → diff --git a/lib/Language/PureScript/Backend/IR/Optimizer.hs b/lib/Language/PureScript/Backend/IR/Optimizer.hs index bf56d22..905ad74 100644 --- a/lib/Language/PureScript/Backend/IR/Optimizer.hs +++ b/lib/Language/PureScript/Backend/IR/Optimizer.hs @@ -41,6 +41,8 @@ optimizedUberModule = -- unblock even more optimizations, e.g. inline foreign bindings. >>> mergeForeignsIntoBindings >>> idempotently (eliminateDeadCode . optimizeModule) + -- Must run last: + -- see Note [Locals are uniquely named after renameShadowedNames] >>> renameShadowedNames mergeForeignsIntoBindings ∷ UberModule → UberModule @@ -51,6 +53,30 @@ mergeForeignsIntoBindings uberModule@UberModule {..} = map Standalone uberModuleForeigns <> uberModuleBindings } +{- Note [Locals are uniquely named after renameShadowedNames] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'renameShadowedNames' gives every shadowing local binder a fresh name +and rewrites all references to it with index 0, so afterwards a local +reference resolves to its binder by name alone. The Lua code generator +relies on this: Lua has no notion of "the second enclosing local named +x", so the Ref case of 'fromIR' emits a plain variable name and throws +'UnexpectedRefBound' if it ever meets a local reference with a non-zero +index. Such a reference is unbound: rendering it by name would silently +capture a different binder, and inventing a name produces an undefined +Lua variable (issue #37). + +Two consequences: + + * this pass must run LAST in 'optimizedUberModule' — passes like + inlining and DCE may introduce or remove shadowing and rely on + indices being meaningful, so running anything after the renaming + would invalidate it; + + * (name, index) references must be resolved according to + Note [Sequential scoping of Let bindings], which this pass and the + rest of the pipeline implement. +-} + renameShadowedNames ∷ UberModule → UberModule renameShadowedNames uberModule = uberModule @@ -60,6 +86,7 @@ renameShadowedNames uberModule = type RenamesInScope = Map Name [Name] +-- | See Note [Sequential scoping of Let bindings] renameShadowedNamesInExpr ∷ RenamesInScope → Exp → Exp renameShadowedNamesInExpr scope = go where @@ -284,7 +311,8 @@ etaReduce = _ → NoChange betaReduceUnusedParams ∷ RewriteRule Ann -betaReduceUnusedParams = pure . \case +betaReduceUnusedParams = + pure . \case App _ (Abs _ (ParamUnused _) body) _arg → Rewritten Recurse body _ → NoChange diff --git a/lib/Language/PureScript/Backend/IR/Types.hs b/lib/Language/PureScript/Backend/IR/Types.hs index e64e829..c1c2b8c 100644 --- a/lib/Language/PureScript/Backend/IR/Types.hs +++ b/lib/Language/PureScript/Backend/IR/Types.hs @@ -98,6 +98,64 @@ data RawExp ann | Exception ann Text | ForeignImport ann ModuleName FilePath [(ann, Name)] +{- Note [Sequential scoping of Let bindings] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +A local variable is referenced by name plus a De Bruijn-style index +('Ref _ (Local name) index'): the index selects among the binders of +that same name that are in scope, counting from the innermost binder +outwards, starting at 0. The index is per-name, so introducing a binder +for one name does not disturb references to other names. + +Which binders of a 'Let' are in scope where? The convention is +sequential, like Scheme's let*: + + * the RHS of a Standalone binding sees the *earlier* siblings of the + same Let; the binding's own name is NOT in scope there, so a + reference to it from its own RHS points at an outer binder + (Standalone bindings are non-recursive); + + * the RHS of a RecursiveGroup member sees the earlier groupings of + the same Let and every member of its own group, itself included; + + * the body sees all the bindings. + +For example (indices in brackets): + + let a = ... -- sees only the enclosing scope + b = f a[0] -- a[0] is the sibling directly above + a = g a[0] b[0] -- a[0] is the FIRST binding, not itself + in h a[0] a[1] b[0] -- a[0] is the second binding, a[1] the first + +Every traversal that walks under Let binders must implement this +convention, and they must all agree: + + * 'countFreeRefs', 'substitute' and 'shift' thread the scope through + the groupings left to right; + + * 'qualifyTopRefs' decides whether a local reference escapes to a + top-level binding by threading per-name depths the same way; + + * 'renameShadowedNamesInExpr' resolves (name, index) pairs to fresh + unique names the same way (see also + Note [Locals are uniquely named after renameShadowedNames]); + + * dead code elimination resolves references against the same + sequential scope ('adjacencyListForGrouping'); + + * the Lua code generator emits Standalone bindings of a Let as a + sequence of 'local' statements, which is exactly let* scoping on + the Lua side (the Let case of 'fromIR'). + +Getting one of the walkers wrong miscompiles. Issue #37 was caused by +shift/substitute/countFreeRefs implementing the opposite convention +(own name bound in its own RHS, siblings ignored): inlining shifted a +sibling-bound reference past its binder, DCE deleted the "unused" +binder, and codegen rendered the dangling 'Ref (Local Bind1) 1' as an +undefined Lua variable 'Bind11'. The golden test +test/ps/golden/Golden/Issue37/Test.purs and the "Let sequential (let*) +scoping" tests pin the convention. +-} + deriving stock instance Show ann ⇒ Show (RawExp ann) deriving stock instance Eq ann ⇒ Eq (RawExp ann) deriving stock instance Ord ann ⇒ Ord (RawExp ann) @@ -507,10 +565,7 @@ countFreeRefs = fmap getSum . MMap.toMap . countFreeRefs' mempty where minIndexes' = Map.insertWith (+) (Local name) 1 minIndexes ParamUnused _paramAnn → countFreeRefs' minIndexes body - -- Let bindings have sequential (let*) scoping: in a standalone - -- binding's RHS the earlier siblings of the same Let are in scope, - -- while the binding's own name refers to an outer binder. Members - -- of a recursive group additionally see the whole group. + -- See Note [Sequential scoping of Let bindings] Let _ann binds body → fold (countsInBody : countsInBinds) where countsInBody = countFreeRefs' minIndexesAfterBinds body @@ -617,10 +672,7 @@ substitute name idx replacement = substitute' idx where index' = if name == Local pName then index + 1 else index replacement' = shift 1 pName 0 replacement - -- Sequential (let*) scoping: a standalone binding's RHS sees the - -- earlier siblings of the same Let (its own name refers to an - -- outer binder), recursive group members see the whole group, - -- and the body sees all the bindings. + -- See Note [Sequential scoping of Let bindings] Let ann binds body → Let ann binds' body' where ((bodyIndex, bodyReplacement), binds') = @@ -709,10 +761,7 @@ shift offset namespace minIndex expression = minIndex' | paramName argument == Just namespace = minIndex + 1 | otherwise = minIndex - -- Sequential (let*) scoping: a standalone binding's RHS sees the - -- earlier siblings of the same Let (its own name refers to an - -- outer binder), recursive group members see the whole group, - -- and the body sees all the bindings. + -- See Note [Sequential scoping of Let bindings] Let ann binds body → Let ann binds' body' where diff --git a/lib/Language/PureScript/Backend/Lua.hs b/lib/Language/PureScript/Backend/Lua.hs index dcbe233..eaf7d24 100644 --- a/lib/Language/PureScript/Backend/Lua.hs +++ b/lib/Language/PureScript/Backend/Lua.hs @@ -208,10 +208,7 @@ fromIR foreigns topLevelNames modname ir = case ir of pure . Right $ Lua.varField (Lua.varName Fixture.moduleName) topLevelName IR.Local name - -- After the optimizer's renameShadowedNames pass every local - -- reference must resolve to its binder by name alone: a - -- non-zero index means the reference is unbound and would be - -- rendered as an undefined Lua variable (issue #37). + -- See Note [Locals are uniquely named after renameShadowedNames] | index == 0 → pure . Right $ Lua.varName (fromName name) | otherwise → Oops.throw $ UnexpectedRefBound modname ir IR.Imported modname' name → @@ -219,6 +216,8 @@ fromIR foreigns topLevelNames modname ir = case ir of Lua.varField (Lua.varName Fixture.moduleName) (qualifyName modname' (fromName name)) + -- Standalone bindings become a sequence of 'local' statements, which + -- matches Note [Sequential scoping of Let bindings] IR.Let _ann bindings bodyExp → do body ← go bodyExp recs ← diff --git a/pslua.cabal b/pslua.cabal index 70f957e..d8dad70 100644 --- a/pslua.cabal +++ b/pslua.cabal @@ -162,6 +162,7 @@ test-suite spec Language.PureScript.Backend.IR.DCE.Spec Language.PureScript.Backend.IR.Gen Language.PureScript.Backend.IR.Inliner.Spec + Language.PureScript.Backend.IR.Linker.Spec Language.PureScript.Backend.IR.Optimizer.Spec Language.PureScript.Backend.IR.Spec Language.PureScript.Backend.IR.Types.Spec diff --git a/test/Language/PureScript/Backend/IR/Linker/Spec.hs b/test/Language/PureScript/Backend/IR/Linker/Spec.hs new file mode 100644 index 0000000..fffd513 --- /dev/null +++ b/test/Language/PureScript/Backend/IR/Linker/Spec.hs @@ -0,0 +1,60 @@ +module Language.PureScript.Backend.IR.Linker.Spec where + +import Data.Map qualified as Map +import Hedgehog ((===)) +import Language.PureScript.Backend.IR.Linker (qualifyTopRefs) +import Language.PureScript.Backend.IR.Names + ( ModuleName (..) + , Name (..) + ) +import Language.PureScript.Backend.IR.Types + ( Grouping (..) + , lets + , literalInt + , noAnn + , refImported + , refLocal + ) +import Test.Hspec (Spec, describe) +import Test.Hspec.Hedgehog.Extended (test) + +spec ∷ Spec +spec = describe "IR Linker" do + -- See Note [Sequential scoping of Let bindings] + describe "qualifyTopRefs" do + let modname = ModuleName "Main" + x = Name "x" + y = Name "y" + topX = Map.fromList [(x, 0)] + qualify = qualifyTopRefs modname topX + + test "ref bound by an earlier sibling is not qualified" do + let e = + lets + ( Standalone (noAnn, x, literalInt 1) + :| [Standalone (noAnn, y, refLocal x 0)] + ) + (literalInt 0) + qualify e === e + + test "ref to a top-level name in own RHS is qualified" do + let original = + lets (Standalone (noAnn, x, refLocal x 0) :| []) (literalInt 0) + expected = + lets + (Standalone (noAnn, x, refImported modname x 0) :| []) + (literalInt 0) + qualify original === expected + + test "ref in the body pointing past the binder is qualified" do + let original = + lets (Standalone (noAnn, x, literalInt 1) :| []) (refLocal x 1) + expected = + lets + (Standalone (noAnn, x, literalInt 1) :| []) + (refImported modname x 1) + qualify original === expected + + test "ref in the body bound by the let is not qualified" do + let e = lets (Standalone (noAnn, x, literalInt 1) :| []) (refLocal x 0) + qualify e === e diff --git a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs index 4c01c4b..3f6a47a 100644 --- a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs @@ -126,6 +126,7 @@ spec = describe "IR Optimizer" do -- Mimics issue #37: an inlined binding contains a let with a -- reference bound by an earlier sibling; inlining it under a binder -- with the same name must not leave the reference unbound. + -- See Note [Sequential scoping of Let bindings] test "inlining bindings does not unbind let-bound references" do let mainModule = moduleNameFromString "Main" dict = moduleNameFromString "Dict" diff --git a/test/Language/PureScript/Backend/IR/Types/Spec.hs b/test/Language/PureScript/Backend/IR/Types/Spec.hs index bfa44ad..01d0f70 100644 --- a/test/Language/PureScript/Backend/IR/Types/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Types/Spec.hs @@ -42,9 +42,7 @@ spec = describe "Types" do , (Imported (ModuleName "Partial.Unsafe") (Name "unsafePartial"), 1) ] - -- Convention: Let bindings have sequential (let*) scoping — in a - -- standalone binding's RHS the earlier siblings of the same Let are - -- in scope, while the binding's own name refers to an outer binder. + -- See Note [Sequential scoping of Let bindings] describe "Let sequential (let*) scoping" do let x = Name "x" y = Name "y" diff --git a/test/Main.hs b/test/Main.hs index 75c4202..6d27b1d 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -2,6 +2,7 @@ module Main where import Language.PureScript.Backend.IR.DCE.Spec qualified as IrDce import Language.PureScript.Backend.IR.Inliner.Spec qualified as Inliner +import Language.PureScript.Backend.IR.Linker.Spec qualified as IRLinker import Language.PureScript.Backend.IR.Optimizer.Spec qualified as IROptimizer import Language.PureScript.Backend.IR.Spec qualified as IR import Language.PureScript.Backend.IR.Types.Spec qualified as Types @@ -20,6 +21,7 @@ main = hspec do IrDce.spec LuaDce.spec Types.spec + IRLinker.spec IROptimizer.spec LuaOptimizer.spec Printer.spec From e7a6769df0b96d176acc9408067385840d86958a Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 14:44:56 +0200 Subject: [PATCH 22/40] test: add runtime eval repros for issue #32 Three eval-golden modules exercising the symptoms reported in #32: - BugListGenericEq: the original repro from PR #33, extended with a main function so the generated Lua is actually executed (the PR only checked compilation and luacheck, which is why the runtime stack overflow went unnoticed). - DerivedFunctor: derived Functor instances mapped over an Either-like and a recursive Tree type. - GenericEqTwoTypes: two generic-derived Eq instances in one module. The duplication keeps the generic machinery multiply-used, so the inliner does not mask the eager self-reference in the instance dictionary: evaluation overflows the Lua stack until the optimizer stops eta-reducing user code. golden.ir/golden.lua files are intentionally not included: they are generated on first test run, and the fix in the next commit changes their shape anyway. --- .../golden/Golden/BugListGenericEq/Test.purs | 23 +++++++++++++ .../ps/golden/Golden/DerivedFunctor/Test.purs | 30 ++++++++++++++++ .../golden/Golden/GenericEqTwoTypes/Test.purs | 34 +++++++++++++++++++ .../Golden.BugListGenericEq.Test/corefn.json | 1 + .../eval/.gitignore | 1 + .../eval/golden.txt | 3 ++ .../Golden.DerivedFunctor.Test/corefn.json | 1 + .../eval/.gitignore | 1 + .../eval/golden.txt | 3 ++ .../Golden.GenericEqTwoTypes.Test/corefn.json | 1 + .../eval/.gitignore | 1 + .../eval/golden.txt | 4 +++ 12 files changed, 103 insertions(+) create mode 100644 test/ps/golden/Golden/BugListGenericEq/Test.purs create mode 100644 test/ps/golden/Golden/DerivedFunctor/Test.purs create mode 100644 test/ps/golden/Golden/GenericEqTwoTypes/Test.purs create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/corefn.json create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.DerivedFunctor.Test/corefn.json create mode 100644 test/ps/output/Golden.DerivedFunctor.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.DerivedFunctor.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.GenericEqTwoTypes.Test/corefn.json create mode 100644 test/ps/output/Golden.GenericEqTwoTypes.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.GenericEqTwoTypes.Test/eval/golden.txt diff --git a/test/ps/golden/Golden/BugListGenericEq/Test.purs b/test/ps/golden/Golden/BugListGenericEq/Test.purs new file mode 100644 index 0000000..ea3e63e --- /dev/null +++ b/test/ps/golden/Golden/BugListGenericEq/Test.purs @@ -0,0 +1,23 @@ +module Golden.BugListGenericEq.Test where + +import Prelude +import Data.Eq.Generic as GEq +import Data.Generic.Rep as G +import Effect (Effect) +import Effect.Console (logShow) + +data List a = Nil | Cons { head :: a, tail :: List a } + +cons :: forall a. a -> List a -> List a +cons head tail = Cons { head, tail } + +derive instance genericList :: G.Generic (List a) _ + +instance eqList :: Eq a => Eq (List a) where + eq x y = GEq.genericEq x y + +main :: Effect Unit +main = do + logShow $ (Nil :: List Int) == Nil + logShow $ cons 1 (cons 2 Nil) == cons 1 (cons 2 Nil) + logShow $ cons 1 Nil == cons 2 Nil diff --git a/test/ps/golden/Golden/DerivedFunctor/Test.purs b/test/ps/golden/Golden/DerivedFunctor/Test.purs new file mode 100644 index 0000000..60a74ba --- /dev/null +++ b/test/ps/golden/Golden/DerivedFunctor/Test.purs @@ -0,0 +1,30 @@ +module Golden.DerivedFunctor.Test where + +import Prelude +import Effect (Effect) +import Effect.Console (logShow) + +data Either a b = Left a | Right b + +derive instance functorEither :: Functor (Either a) + +data Tree a = Leaf | Node (Tree a) a (Tree a) + +derive instance functorTree :: Functor Tree + +fromRight :: forall a. Int -> Either a Int -> Int +fromRight fallback = case _ of + Left _ -> fallback + Right n -> n + +sumTree :: Tree Int -> Int +sumTree = case _ of + Leaf -> 0 + Node l x r -> sumTree l + x + sumTree r + +main :: Effect Unit +main = do + logShow $ fromRight 0 $ map (_ + 1) (Right 41 :: Either String Int) + logShow $ fromRight 7 $ map (_ + 1) (Left "no" :: Either String Int) + logShow $ sumTree $ map (_ * 2) + $ Node (Node Leaf 1 Leaf) 2 (Node Leaf 3 Leaf) diff --git a/test/ps/golden/Golden/GenericEqTwoTypes/Test.purs b/test/ps/golden/Golden/GenericEqTwoTypes/Test.purs new file mode 100644 index 0000000..c0b0b65 --- /dev/null +++ b/test/ps/golden/Golden/GenericEqTwoTypes/Test.purs @@ -0,0 +1,34 @@ +module Golden.GenericEqTwoTypes.Test where + +import Prelude +import Data.Eq.Generic as GEq +import Data.Generic.Rep as G +import Effect (Effect) +import Effect.Console (logShow) + +data List a = Nil | Cons { head :: a, tail :: List a } + +cons :: forall a. a -> List a -> List a +cons head tail = Cons { head, tail } + +derive instance genericList :: G.Generic (List a) _ + +instance eqList :: Eq a => Eq (List a) where + eq x y = GEq.genericEq x y + +data Tree a = Leaf | Node { left :: Tree a, value :: a, right :: Tree a } + +node :: forall a. Tree a -> a -> Tree a -> Tree a +node left value right = Node { left, value, right } + +derive instance genericTree :: G.Generic (Tree a) _ + +instance eqTree :: Eq a => Eq (Tree a) where + eq x y = GEq.genericEq x y + +main :: Effect Unit +main = do + logShow $ cons 1 (cons 2 Nil) == cons 1 (cons 2 Nil) + logShow $ cons 1 Nil == cons 2 Nil + logShow $ node Leaf 1 (node Leaf 2 Leaf) == node Leaf 1 (node Leaf 2 Leaf) + logShow $ node Leaf 1 Leaf == node Leaf 2 Leaf diff --git a/test/ps/output/Golden.BugListGenericEq.Test/corefn.json b/test/ps/output/Golden.BugListGenericEq.Test/corefn.json new file mode 100644 index 0000000..3993cc7 --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqSum","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqConstructor","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqNoArguments","moduleName":["Data","Eq","Generic"]}},"type":"App"},"type":"App"},"identifier":"genericEqSum"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRec","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"eqRec"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowNil","moduleName":["Data","Eq"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"tail"}},"type":"Abs"}]]}},"type":"App"},"type":"App"},"identifier":"eqRowCons"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"head"}},"type":"Abs"}]]}},"type":"App"},"identifier":"headIsSymbol"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[21,37],"start":[21,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[21,10],"start":[21,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[21,10],"start":[21,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showBoolean","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"constructorName":"Nil","fieldNames":[],"type":"Constructor","typeName":"List"},"identifier":"Nil"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"constructorName":"Cons","fieldNames":["value0"],"type":"Constructor","typeName":"List"},"identifier":"Cons"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Generic$Dict","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["to",{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[14,1]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}],["from",{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]},"typeName":{"identifier":"List","moduleName":["Golden","BugListGenericEq","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"NoArguments","moduleName":["Data","Generic","Rep"]}},"type":"App"},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Cons","moduleName":["Golden","BugListGenericEq","Test"]},"typeName":{"identifier":"List","moduleName":["Golden","BugListGenericEq","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[14,1]}},"type":"App"},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}]]}},"type":"App"},"identifier":"genericList"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,25],"start":[17,12]}},"type":"Var","value":{"identifier":"genericEq","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericList","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"identifier":"genericEq"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":"dictEq","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[17,29],"start":[16,1]}},"type":"Var","value":{"identifier":"Eq$Dict","moduleName":["Data","Eq"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["eq",{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEq","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqSum","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqConstructor","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqArgument","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRec","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqList","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"headIsSymbol","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,26]}},"type":"Var","value":{"identifier":"x","sourcePos":[17,3]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[17,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[17,3]}},"type":"App"},"type":"Abs"},"type":"Abs"}]]}},"type":"App"},"type":"Abs"},"identifier":"eqList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[21,33],"start":[21,31]}},"type":"Var","value":{"identifier":"eq","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqList","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqInt","moduleName":["Data","Eq"]}},"type":"App"},"type":"App"},"identifier":"eq"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,40],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,40],"start":[11,1]}},"argument":"head","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,40],"start":[11,1]}},"argument":"tail","body":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,22],"start":[12,18]}},"type":"Var","value":{"identifier":"Cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,37],"start":[12,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,37],"start":[12,23]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["head",{"annotation":{"meta":null,"sourceSpan":{"end":[12,29],"start":[12,25]}},"type":"Var","value":{"identifier":"head","sourcePos":[12,1]}}],["tail",{"annotation":{"meta":null,"sourceSpan":{"end":[12,35],"start":[12,31]}},"type":"Var","value":{"identifier":"tail","sourcePos":[12,1]}}]]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"cons"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,20],"start":[19,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[21,17],"start":[21,14]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[21,37],"start":[21,34]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[21,37],"start":[21,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,55],"start":[22,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,55],"start":[22,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,55],"start":[22,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,13]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,19],"start":[22,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,19],"start":[22,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[22,32],"start":[22,13]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[22,25],"start":[22,21]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,27],"start":[22,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,27],"start":[22,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[22,31],"start":[22,21]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[22,31],"start":[22,28]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[22,55],"start":[22,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[22,40],"start":[22,36]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,42],"start":[22,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,42],"start":[22,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[22,55],"start":[22,36]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[22,48],"start":[22,44]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,50],"start":[22,44]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,50],"start":[22,49]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[22,54],"start":[22,44]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[22,54],"start":[22,51]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[22,55],"start":[22,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,55],"start":[22,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[23,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[23,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,17],"start":[23,13]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,19],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,19],"start":[23,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,23],"start":[23,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[23,23],"start":[23,20]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[23,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,31],"start":[23,27]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,33],"start":[23,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,33],"start":[23,32]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[23,27]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[23,37],"start":[23,34]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["Nil","Cons","cons","main","genericList","eqList"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Data","Eq"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Data","Eq","Generic"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Data","Generic","Rep"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Data","Symbol"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Golden","BugListGenericEq","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[23,37],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","BugListGenericEq","Test"],"modulePath":"golden/Golden/BugListGenericEq/Test.purs","reExports":{},"sourceSpan":{"end":[23,37],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.BugListGenericEq.Test/eval/.gitignore b/test/ps/output/Golden.BugListGenericEq.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.BugListGenericEq.Test/eval/golden.txt b/test/ps/output/Golden.BugListGenericEq.Test/eval/golden.txt new file mode 100644 index 0000000..9e8a46a --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/eval/golden.txt @@ -0,0 +1,3 @@ +true +true +false diff --git a/test/ps/output/Golden.DerivedFunctor.Test/corefn.json b/test/ps/output/Golden.DerivedFunctor.Test/corefn.json new file mode 100644 index 0000000..6541159 --- /dev/null +++ b/test/ps/output/Golden.DerivedFunctor.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,32],"start":[23,31]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,42],"start":[23,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"add"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[27,70],"start":[27,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,70],"start":[27,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,70],"start":[27,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[27,10],"start":[27,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,10],"start":[27,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[29,31],"start":[29,30]}},"type":"Var","value":{"identifier":"mul","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[29,34],"start":[29,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"mul"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,46],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,46],"start":[11,1]}},"constructorName":"Leaf","fieldNames":[],"type":"Constructor","typeName":"Tree"},"identifier":"Leaf"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,46],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,46],"start":[11,1]}},"constructorName":"Node","fieldNames":["value0","value1","value2"],"type":"Constructor","typeName":"Tree"},"identifier":"Node"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,1]}},"constructorName":"Left","fieldNames":["value0"],"type":"Constructor","typeName":"Either"},"identifier":"Left"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,35],"start":[7,1]}},"constructorName":"Right","fieldNames":["value0"],"type":"Constructor","typeName":"Either"},"identifier":"Right"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[20,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[21,11]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[21,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[22,7],"start":[22,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Leaf","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Tree","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[22,12],"start":[22,11]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1","value2"],"metaType":"IsConstructor"},"sourceSpan":{"end":[23,13],"start":[23,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,9],"start":[23,8]}},"binderType":"VarBinder","identifier":"l"},{"annotation":{"meta":null,"sourceSpan":{"end":[23,11],"start":[23,10]}},"binderType":"VarBinder","identifier":"x"},{"annotation":{"meta":null,"sourceSpan":{"end":[23,13],"start":[23,12]}},"binderType":"VarBinder","identifier":"r"}],"constructorName":{"identifier":"Node","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Tree","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[23,17]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[23,17]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,24],"start":[23,17]}},"type":"Var","value":{"identifier":"sumTree","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,26],"start":[23,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,26],"start":[23,25]}},"type":"Var","value":{"identifier":"l","sourcePos":[23,8]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[23,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,30],"start":[23,29]}},"type":"Var","value":{"identifier":"x","sourcePos":[23,10]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[23,17]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,40],"start":[23,33]}},"type":"Var","value":{"identifier":"sumTree","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[23,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,42],"start":[23,41]}},"type":"Var","value":{"identifier":"r","sourcePos":[23,12]}},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"sumTree"}]},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,44],"start":[13,1]}},"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Functor$Dict","moduleName":["Data","Functor"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,44],"start":[13,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["map",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Leaf","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Tree","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","DerivedFunctor","Test"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1","value2"],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"VarBinder","identifier":"v"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"VarBinder","identifier":"v1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"VarBinder","identifier":"v2"}],"constructorName":{"identifier":"Node","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Tree","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1","value2"],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Node","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorTree","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"f","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"f","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorTree","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"f","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v2","sourcePos":[0,0]}},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"m","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"}]]}},"type":"App"},"identifier":"functorTree"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[29,26],"start":[29,23]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[29,34],"start":[29,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorTree","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"identifier":"map"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,52],"start":[9,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Functor$Dict","moduleName":["Data","Functor"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,52],"start":[9,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["map",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"VarBinder","identifier":"v"}],"constructorName":{"identifier":"Left","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Either","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Left","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"VarBinder","identifier":"v"}],"constructorName":{"identifier":"Right","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Either","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"Right","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"f","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"m","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"}]]}},"type":"App"},"identifier":"functorEither"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[27,30],"start":[27,27]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,38],"start":[27,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorEither","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"identifier":"map1"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,50],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,50],"start":[15,1]}},"argument":"fallback","body":{"annotation":{"meta":null,"sourceSpan":{"end":[18,15],"start":[16,22]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[18,15],"start":[16,22]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[17,9],"start":[17,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,9],"start":[17,8]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Left","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Either","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,21],"start":[17,13]}},"type":"Var","value":{"identifier":"fallback","sourcePos":[16,1]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,10],"start":[18,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,10],"start":[18,9]}},"binderType":"VarBinder","identifier":"n"}],"constructorName":{"identifier":"Right","moduleName":["Golden","DerivedFunctor","Test"]},"typeName":{"identifier":"Either","moduleName":["Golden","DerivedFunctor","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,15],"start":[18,14]}},"type":"Var","value":{"identifier":"n","sourcePos":[18,9]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"fromRight"},{"annotation":{"meta":null,"sourceSpan":{"end":[25,20],"start":[25,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,70],"start":[27,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,70],"start":[27,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[27,22],"start":[27,13]}},"type":"Var","value":{"identifier":"fromRight","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,24],"start":[27,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,24],"start":[27,23]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,70],"start":[27,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map1","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,38],"start":[27,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,38],"start":[27,31]}},"argument":"v","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,38],"start":[27,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,38],"start":[27,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,37],"start":[27,36]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,70],"start":[27,27]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[27,45],"start":[27,40]}},"type":"Var","value":{"identifier":"Right","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,48],"start":[27,40]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,48],"start":[27,46]}},"type":"Literal","value":{"literalType":"IntLiteral","value":41}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,70],"start":[27,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,70],"start":[27,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,71],"start":[28,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,71],"start":[28,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,13]}},"type":"Var","value":{"identifier":"fromRight","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,24],"start":[28,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,24],"start":[28,23]}},"type":"Literal","value":{"literalType":"IntLiteral","value":7}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,71],"start":[28,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map1","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,38],"start":[28,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,38],"start":[28,31]}},"argument":"v","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,38],"start":[28,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,38],"start":[28,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,37],"start":[28,36]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,71],"start":[28,27]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[28,44],"start":[28,40]}},"type":"Var","value":{"identifier":"Left","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,49],"start":[28,40]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,49],"start":[28,45]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"no"}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,71],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,71],"start":[28,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[29,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[29,20],"start":[29,13]}},"type":"Var","value":{"identifier":"sumTree","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[29,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,34],"start":[29,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,34],"start":[29,27]}},"argument":"v","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"mul","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,34],"start":[29,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[29,34],"start":[29,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,33],"start":[29,32]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[29,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1","value2"],"metaType":"IsConstructor"},"sourceSpan":{"end":[30,11],"start":[30,7]}},"type":"Var","value":{"identifier":"Node","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,30],"start":[30,7]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1","value2"],"metaType":"IsConstructor"},"sourceSpan":{"end":[30,17],"start":[30,13]}},"type":"Var","value":{"identifier":"Node","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,22],"start":[30,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[30,22],"start":[30,18]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,24],"start":[30,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,24],"start":[30,23]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,29],"start":[30,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[30,29],"start":[30,25]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,32],"start":[30,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,32],"start":[30,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[30,7]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1","value2"],"metaType":"IsConstructor"},"sourceSpan":{"end":[30,38],"start":[30,34]}},"type":"Var","value":{"identifier":"Node","moduleName":["Golden","DerivedFunctor","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,43],"start":[30,34]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[30,43],"start":[30,39]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,45],"start":[30,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,45],"start":[30,44]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,50],"start":[30,34]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[30,50],"start":[30,46]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","DerivedFunctor","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["Left","Right","Leaf","Node","fromRight","sumTree","main","functorEither","functorTree"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Data","Functor"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Golden","DerivedFunctor","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[30,51],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","DerivedFunctor","Test"],"modulePath":"golden/Golden/DerivedFunctor/Test.purs","reExports":{},"sourceSpan":{"end":[30,51],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.DerivedFunctor.Test/eval/.gitignore b/test/ps/output/Golden.DerivedFunctor.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.DerivedFunctor.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.DerivedFunctor.Test/eval/golden.txt b/test/ps/output/Golden.DerivedFunctor.Test/eval/golden.txt new file mode 100644 index 0000000..c23e48a --- /dev/null +++ b/test/ps/output/Golden.DerivedFunctor.Test/eval/golden.txt @@ -0,0 +1,3 @@ +42 +7 +12 diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/corefn.json b/test/ps/output/Golden.GenericEqTwoTypes.Test/corefn.json new file mode 100644 index 0000000..05a7272 --- /dev/null +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqSum","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqConstructor","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqNoArguments","moduleName":["Data","Eq","Generic"]}},"type":"App"},"type":"App"},"identifier":"genericEqSum"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRec","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,27],"start":[27,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"eqRec"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowNil","moduleName":["Data","Eq"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,27],"start":[27,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"eqRowCons"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"value"}},"type":"Abs"}]]}},"type":"App"},"type":"App"},"identifier":"eqRowCons1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"right"}},"type":"Abs"}]]}},"type":"App"},"identifier":"rightIsSymbol"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"left"}},"type":"Abs"}]]}},"type":"App"},"identifier":"leftIsSymbol"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"tail"}},"type":"Abs"}]]}},"type":"App"},"type":"App"},"identifier":"eqRowCons2"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"head"}},"type":"Abs"}]]}},"type":"App"},"identifier":"headIsSymbol"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[31,55],"start":[31,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[31,10],"start":[31,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[31,10],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showBoolean","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,74],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,74],"start":[19,1]}},"constructorName":"Leaf","fieldNames":[],"type":"Constructor","typeName":"Tree"},"identifier":"Leaf"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,74],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,74],"start":[19,1]}},"constructorName":"Node","fieldNames":["value0"],"type":"Constructor","typeName":"Tree"},"identifier":"Node"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"constructorName":"Nil","fieldNames":[],"type":"Constructor","typeName":"List"},"identifier":"Nil"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,55],"start":[9,1]}},"constructorName":"Cons","fieldNames":["value0"],"type":"Constructor","typeName":"List"},"identifier":"Cons"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,50],"start":[21,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[21,50],"start":[21,1]}},"argument":"left","body":{"annotation":{"meta":null,"sourceSpan":{"end":[21,50],"start":[21,1]}},"argument":"value","body":{"annotation":{"meta":null,"sourceSpan":{"end":[21,50],"start":[21,1]}},"argument":"right","body":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[22,29],"start":[22,25]}},"type":"Var","value":{"identifier":"Node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,52],"start":[22,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,52],"start":[22,30]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["left",{"annotation":{"meta":null,"sourceSpan":{"end":[22,36],"start":[22,32]}},"type":"Var","value":{"identifier":"left","sourcePos":[22,1]}}],["value",{"annotation":{"meta":null,"sourceSpan":{"end":[22,43],"start":[22,38]}},"type":"Var","value":{"identifier":"value","sourcePos":[22,1]}}],["right",{"annotation":{"meta":null,"sourceSpan":{"end":[22,50],"start":[22,45]}},"type":"Var","value":{"identifier":"right","sourcePos":[22,1]}}]]}},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"identifier":"node"},{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Generic$Dict","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["to",{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[24,1]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}],["from",{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]},"typeName":{"identifier":"Tree","moduleName":["Golden","GenericEqTwoTypes","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"NoArguments","moduleName":["Data","Generic","Rep"]}},"type":"App"},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Node","moduleName":["Golden","GenericEqTwoTypes","Test"]},"typeName":{"identifier":"Tree","moduleName":["Golden","GenericEqTwoTypes","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,52],"start":[24,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[24,1]}},"type":"App"},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}]]}},"type":"App"},"identifier":"genericTree"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[27,25],"start":[27,12]}},"type":"Var","value":{"identifier":"genericEq","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericTree","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"identifier":"genericEq"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Generic$Dict","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["to",{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[14,1]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}],["from",{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Golden","GenericEqTwoTypes","Test"]},"typeName":{"identifier":"List","moduleName":["Golden","GenericEqTwoTypes","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"NoArguments","moduleName":["Data","Generic","Rep"]}},"type":"App"},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Cons","moduleName":["Golden","GenericEqTwoTypes","Test"]},"typeName":{"identifier":"List","moduleName":["Golden","GenericEqTwoTypes","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,52],"start":[14,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[14,1]}},"type":"App"},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}]]}},"type":"App"},"identifier":"genericList"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,25],"start":[17,12]}},"type":"Var","value":{"identifier":"genericEq","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericList","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"identifier":"genericEq1"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[26,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[26,1]}},"argument":"dictEq","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons1","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,27],"start":[27,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"rightIsSymbol","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"identifier":"eqRowCons3"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[27,29],"start":[26,1]}},"type":"Var","value":{"identifier":"Eq$Dict","moduleName":["Data","Eq"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[26,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[26,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["eq",{"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[26,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[26,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEq","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqSum","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqConstructor","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqArgument","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRec","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons3","sourcePos":[0,0]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqTree","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,27],"start":[27,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"leftIsSymbol","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqTree","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,27],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,27],"start":[27,26]}},"type":"Var","value":{"identifier":"x","sourcePos":[27,3]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[27,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,29],"start":[27,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[27,3]}},"type":"App"},"type":"Abs"},"type":"Abs"}]]}},"type":"App"},"type":"Let"},"type":"Abs"},"identifier":"eqTree"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[33,46],"start":[33,44]}},"type":"Var","value":{"identifier":"eq","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqTree","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqInt","moduleName":["Data","Eq"]}},"type":"App"},"type":"App"},"identifier":"eq"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":"dictEq","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[17,29],"start":[16,1]}},"type":"Var","value":{"identifier":"Eq$Dict","moduleName":["Data","Eq"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["eq",{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[16,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEq1","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqSum","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqConstructor","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqArgument","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRec","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons2","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqList","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"headIsSymbol","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,27],"start":[17,26]}},"type":"Var","value":{"identifier":"x","sourcePos":[17,3]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[17,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,29],"start":[17,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[17,3]}},"type":"App"},"type":"Abs"},"type":"Abs"}]]}},"type":"App"},"type":"Abs"},"identifier":"eqList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[31,35],"start":[31,33]}},"type":"Var","value":{"identifier":"eq","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqList","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqInt","moduleName":["Data","Eq"]}},"type":"App"},"type":"App"},"identifier":"eq1"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,40],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,40],"start":[11,1]}},"argument":"head","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,40],"start":[11,1]}},"argument":"tail","body":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,22],"start":[12,18]}},"type":"Var","value":{"identifier":"Cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,37],"start":[12,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,37],"start":[12,23]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["head",{"annotation":{"meta":null,"sourceSpan":{"end":[12,29],"start":[12,25]}},"type":"Var","value":{"identifier":"head","sourcePos":[12,1]}}],["tail",{"annotation":{"meta":null,"sourceSpan":{"end":[12,35],"start":[12,31]}},"type":"Var","value":{"identifier":"tail","sourcePos":[12,1]}}]]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"cons"},{"annotation":{"meta":null,"sourceSpan":{"end":[29,20],"start":[29,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq1","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[31,17],"start":[31,13]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,32],"start":[31,13]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[31,25],"start":[31,21]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,31],"start":[31,21]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[31,31],"start":[31,28]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[31,40],"start":[31,36]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,42],"start":[31,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,42],"start":[31,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,55],"start":[31,36]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[31,48],"start":[31,44]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,50],"start":[31,44]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,50],"start":[31,49]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,54],"start":[31,44]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[31,54],"start":[31,51]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,55],"start":[31,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[32,37],"start":[32,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[32,37],"start":[32,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq1","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[32,37],"start":[32,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[32,17],"start":[32,13]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[32,19],"start":[32,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[32,19],"start":[32,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[32,23],"start":[32,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[32,23],"start":[32,20]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[32,37],"start":[32,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[32,31],"start":[32,27]}},"type":"Var","value":{"identifier":"cons","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[32,33],"start":[32,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[32,33],"start":[32,32]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[32,37],"start":[32,27]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[32,37],"start":[32,34]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[32,37],"start":[32,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[32,37],"start":[32,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,17],"start":[33,13]}},"type":"Var","value":{"identifier":"node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,22],"start":[33,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[33,22],"start":[33,18]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,24],"start":[33,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,24],"start":[33,23]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,43],"start":[33,13]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,30],"start":[33,26]}},"type":"Var","value":{"identifier":"node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,26]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[33,35],"start":[33,31]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,37],"start":[33,26]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,37],"start":[33,36]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,42],"start":[33,26]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[33,42],"start":[33,38]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,51],"start":[33,47]}},"type":"Var","value":{"identifier":"node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,56],"start":[33,47]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[33,56],"start":[33,52]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,58],"start":[33,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,58],"start":[33,57]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,77],"start":[33,47]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,64],"start":[33,60]}},"type":"Var","value":{"identifier":"node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,69],"start":[33,60]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[33,69],"start":[33,65]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,71],"start":[33,60]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,71],"start":[33,70]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,76],"start":[33,60]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[33,76],"start":[33,72]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,77],"start":[33,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[34,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[34,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[34,17],"start":[34,13]}},"type":"Var","value":{"identifier":"node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,22],"start":[34,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[34,22],"start":[34,18]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,24],"start":[34,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,24],"start":[34,23]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[34,29],"start":[34,25]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[34,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[34,37],"start":[34,33]}},"type":"Var","value":{"identifier":"node","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,42],"start":[34,33]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[34,42],"start":[34,38]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,44],"start":[34,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,44],"start":[34,43]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[34,33]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[34,49],"start":[34,45]}},"type":"Var","value":{"identifier":"Leaf","moduleName":["Golden","GenericEqTwoTypes","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["Nil","Cons","cons","Leaf","Node","node","main","genericList","eqList","genericTree","eqTree"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Data","Eq"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Data","Eq","Generic"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Data","Generic","Rep"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Data","Symbol"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Golden","GenericEqTwoTypes","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[34,49],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","GenericEqTwoTypes","Test"],"modulePath":"golden/Golden/GenericEqTwoTypes/Test.purs","reExports":{},"sourceSpan":{"end":[34,49],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/eval/.gitignore b/test/ps/output/Golden.GenericEqTwoTypes.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/eval/golden.txt b/test/ps/output/Golden.GenericEqTwoTypes.Test/eval/golden.txt new file mode 100644 index 0000000..2cdda45 --- /dev/null +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/eval/golden.txt @@ -0,0 +1,4 @@ +true +false +true +false From 718cef8753ec91a0b6aaf1cb3f6582827527e7d6 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 14:45:14 +0200 Subject: [PATCH 23/40] fix: remove unsound eta reduction (closes #32) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a strict language, rewriting (λx. M x) to M moves the evaluation of M from every call of the lambda to the point where the lambda was constructed. When M transitively references the binding being defined, as it does in instance dictionaries deriving Eq via Generic for recursive data types, the eagerly evaluated self-reference recurses without a base case and overflows the Lua stack at dictionary construction time. Eta-expanding the method by hand is the documented PureScript idiom for breaking exactly this cycle, and the upstream JS backend preserves it; pslua's optimizer destroyed it. The rule is removed rather than restricted: every shape of M worth reducing is unsafe in its own way. Details are in the new Note [Eta reduction is unsound]. Removing eta reduction surfaced a latent gap in renameShadowedNames: it only processed uberModuleExports, leaving shadowed locals in uberModuleBindings unrenamed. Previously eta reduction happened to collapse the offending nested lambdas; without it, luacheck flags the shadowing, and a shadowed reference with a non-zero index inside a binding would crash the Lua code generator with UnexpectedRefBound. The renaming pass now covers bindings as well. Golden files change shape only: lambdas that used to be eta-reduced are now preserved. All eval goldens, including the new repros, pass. --- .../PureScript/Backend/IR/Optimizer.hs | 57 +- .../PureScript/Backend/IR/Optimizer/Spec.hs | 11 + .../output/Golden.ArrayOfUnits.Test/golden.ir | 192 ++- .../Golden.ArrayOfUnits.Test/golden.lua | 20 +- test/ps/output/Golden.Beta.Test/golden.ir | 4 +- test/ps/output/Golden.Beta.Test/golden.lua | 2 +- .../Golden.BugListGenericEq.Test/golden.ir | 1067 ++++++++++++ .../Golden.BugListGenericEq.Test/golden.lua | 255 +++ test/ps/output/Golden.Currying.Test/golden.ir | 8 +- .../ps/output/Golden.Currying.Test/golden.lua | 2 +- .../Golden.DerivedFunctor.Test/golden.ir | 783 +++++++++ .../Golden.DerivedFunctor.Test/golden.lua | 186 ++ .../Golden.GenericEqTwoTypes.Test/golden.ir | 1531 +++++++++++++++++ .../Golden.GenericEqTwoTypes.Test/golden.lua | 326 ++++ .../output/Golden.HelloPrelude.Test/golden.ir | 45 +- .../Golden.HelloPrelude.Test/golden.lua | 4 +- test/ps/output/Golden.Issue37.Test/golden.ir | 53 +- test/ps/output/Golden.Issue37.Test/golden.lua | 8 +- .../Golden.NameShadowing.Test/golden.ir | 4 +- .../Golden.NameShadowing.Test/golden.lua | 4 +- .../Golden.RecursiveBindings.Test/golden.ir | 8 +- .../Golden.RecursiveBindings.Test/golden.lua | 2 +- 22 files changed, 4426 insertions(+), 146 deletions(-) create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/golden.ir create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/golden.lua create mode 100644 test/ps/output/Golden.DerivedFunctor.Test/golden.ir create mode 100644 test/ps/output/Golden.DerivedFunctor.Test/golden.lua create mode 100644 test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir create mode 100644 test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua diff --git a/lib/Language/PureScript/Backend/IR/Optimizer.hs b/lib/Language/PureScript/Backend/IR/Optimizer.hs index 905ad74..cce95af 100644 --- a/lib/Language/PureScript/Backend/IR/Optimizer.hs +++ b/lib/Language/PureScript/Backend/IR/Optimizer.hs @@ -80,7 +80,10 @@ Two consequences: renameShadowedNames ∷ UberModule → UberModule renameShadowedNames uberModule = uberModule - { uberModuleExports = + { uberModuleBindings = + fmap (renameShadowedNamesInExpr mempty) + <<$>> uberModuleBindings uberModule + , uberModuleExports = renameShadowedNamesInExpr mempty <<$>> uberModuleExports uberModule } @@ -265,10 +268,10 @@ substituteInExports qname inlinee = map \case optimizedExpression ∷ Exp → Exp optimizedExpression = + -- See Note [Eta reduction is unsound] rewriteExpTopDown $ constantFolding `thenRewrite` betaReduce - `thenRewrite` etaReduce `thenRewrite` betaReduceUnusedParams `thenRewrite` removeUnreachableThenBranch `thenRewrite` removeUnreachableElseBranch @@ -301,14 +304,48 @@ betaReduce = Rewritten Recurse $ substitute (Local param) 0 r body _ → NoChange --- (λx. M x) where x not free in M ===> M -etaReduce ∷ RewriteRule Ann -etaReduce = - pure . \case - Abs _ (ParamNamed _ param) (App _ m (Ref _ (Local param') 0)) - | param == param' && countFreeRef (Local param) m == 0 → - Rewritten Recurse m - _ → NoChange +{- Note [Eta reduction is unsound] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The optimizer used to rewrite (λx. M x) to M whenever x was not free +in M. In a strict language this is not semantics-preserving: it moves +the evaluation of M from every call of the lambda to the point where +the lambda itself was constructed. + +That breaks self-referential instance dictionaries (issue #32). For + + data Tree a = Leaf | Node { left ∷ Tree a, value ∷ a, right ∷ Tree a } + derive instance genericTree ∷ Generic (Tree a) _ + instance eqTree ∷ Eq a ⇒ Eq (Tree a) where + eq x y = genericEq x y + +the method is deliberately eta-expanded by the user: the dictionary +chain built by genericEq contains `eqTree dictEq` — a self-reference — +and hiding it under λx λy is the documented PureScript way to break +the cycle (upstream purs relies on it too: its JS output keeps the +chain under the lambdas). Eta reduction rewrote the method to a bare +application chain + + eqTree = \dictEq → { eq = genericEq genericTree (… eqTree dictEq …) } + +which recurses at dictionary-construction time: calling `eqTree d` +evaluates `eqTree d` eagerly and overflows the stack before any +comparison happens. Golden/GenericEqTwoTypes is the regression test +(two generic types, so the chain is multiply-used and the inliner +cannot mask the problem by inlining it under another lambda). + +Reducing only special cases of M does not help either: + + * M is an application — may diverge (the case above); + * M is a reference — a recursive-group member `f = λx. g x` + becomes the value binding `f = g`, but the laziness analysis + (CoreFn.Laziness.applyLazinessTransform) already ran on CoreFn + and never saw it, so nothing wraps it in runtime-lazy and `g` + may still be uninitialized when `f` is assigned; + * M is an abstraction — the redex (λy. K) x is already handled by + betaReduce, so nothing is left to gain. + +Hence no eta reduction is performed at all. +-} betaReduceUnusedParams ∷ RewriteRule Ann betaReduceUnusedParams = diff --git a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs index 3f6a47a..bb98952 100644 --- a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs @@ -65,6 +65,17 @@ spec = describe "IR Optimizer" do let f = abstraction paramUnused body body === optimizedExpression (application f arg) + -- See Note [Eta reduction is unsound] + test "does not eta-reduce λx. M x to M" do + param ← forAll Gen.name + let dict = moduleNameFromString "Dict" + m = + application + (refImported dict (Name "eqList") 0) + (refImported dict (Name "eqInt") 0) + original = abstraction (paramNamed param) (application m (refLocal0 param)) + optimizedExpression original === original + describe "inlines expressions" do test "inlines literals" do name ← forAll Gen.name diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir index 52e2626..7d484a1 100644 --- a/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir +++ b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir @@ -113,22 +113,28 @@ UberModule ) ( Abs Nothing ( ParamNamed Nothing ( Name "x" ) ) - ( App Nothing - ( ObjectProp Nothing + ( Abs Nothing + ( ParamNamed Nothing ( Name "acc" ) ) + ( App Nothing ( App Nothing ( ObjectProp Nothing - ( Ref Nothing ( Local ( Name "dictMonoid" ) ) 0 ) - ( PropName "Semigroup0" ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictMonoid" ) ) 0 ) + ( PropName "Semigroup0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "append" ) ) - ( Ref Nothing - ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) ) - ( PropName "append" ) - ) - ( App Nothing - ( Ref Nothing ( Local ( Name "f" ) ) 0 ) - ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( Ref Nothing ( Local ( Name "acc" ) ) 0 ) ) ) ) @@ -205,31 +211,42 @@ UberModule [ ( PropName "map", Abs Nothing ( ParamNamed Nothing ( Name "f" ) ) - ( App Nothing + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) ( App Nothing - ( Ref Nothing - ( Imported ( ModuleName "Control.Apply" ) ( Name "apply" ) ) 0 - ) ( App Nothing - ( ObjectProp Nothing + ( App Nothing ( Ref Nothing - ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ( Imported ( ModuleName "Control.Apply" ) ( Name "apply" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) ) - ( PropName "Apply0" ) - ) - ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) - ) - ) - ( App Nothing - ( App Nothing - ( Ref Nothing - ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 ) - ( Ref Nothing - ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) ) ) - ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) ) ) ) @@ -375,8 +392,14 @@ UberModule ( ObjectProp Nothing ( LiteralObject Nothing [ - ( PropName "discard", Ref Nothing - ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) ) ] ) @@ -406,76 +429,85 @@ UberModule ) ( Abs Nothing ( ParamNamed Nothing ( Name "a" ) ) - ( App Nothing + ( Abs Nothing + ( ParamNamed Nothing ( Name "b" ) ) ( App Nothing - ( Ref Nothing - ( Imported ( ModuleName "Control.Apply" ) ( Name "apply" ) ) 0 - ) ( App Nothing - ( ObjectProp Nothing + ( App Nothing ( Ref Nothing - ( Imported - ( ModuleName "Effect" ) - ( Name "applicativeEffect" ) - ) 0 + ( Imported ( ModuleName "Control.Apply" ) ( Name "apply" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) ) - ( PropName "Apply0" ) - ) - ( Ref Nothing - ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) - ) - ) - ( App Nothing - ( App Nothing - ( ObjectProp Nothing + ( App Nothing ( App Nothing ( ObjectProp Nothing ( App Nothing ( ObjectProp Nothing - ( Ref Nothing - ( Imported - ( ModuleName "Effect" ) - ( Name "applicativeEffect" ) - ) 0 + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Prim" ) + ( Name "undefined" ) + ) 0 + ) ) - ( PropName "Apply0" ) + ( PropName "Functor0" ) ) ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) ) - ( PropName "Functor0" ) + ( PropName "map" ) ) - ( Ref Nothing - ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 - ) - ) - ( PropName "map" ) - ) - ( Abs Nothing ( ParamUnused Nothing ) - ( ObjectProp Nothing - ( LiteralObject Nothing - [ - ( PropName "identity", Abs Nothing - ( ParamNamed Nothing ( Name "x" ) ) - ( Ref Nothing ( Local ( Name "x" ) ) 0 ) - ), - ( PropName "Semigroupoid0", Abs Nothing ( ParamUnused Nothing ) - ( Ref Nothing - ( Imported - ( ModuleName "Control.Semigroupoid" ) - ( Name "semigroupoidFn" ) - ) 0 - ) + ( Abs Nothing ( ParamUnused Nothing ) + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "identity", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ), + ( PropName "Semigroupoid0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported + ( ModuleName "Control.Semigroupoid" ) + ( Name "semigroupoidFn" ) + ) 0 + ) + ) + ] ) - ] + ( PropName "identity" ) + ) ) - ( PropName "identity" ) ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) ) ) - ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ( Ref Nothing ( Local ( Name "b" ) ) 0 ) ) ) ) diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua b/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua index b02e938..8bf2834 100644 --- a/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua +++ b/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua @@ -81,7 +81,9 @@ M.Data_Foldable_foldableArray = { foldMap = function(dictMonoid) return function(f) return M.Data_Foldable_foldr(M.Data_Foldable_foldableArray)(function(x) - return (dictMonoid.Semigroup0()).append(f(x)) + return function(acc) + return (dictMonoid.Semigroup0()).append(f(x))(acc) + end end)(dictMonoid.mempty) end end @@ -101,7 +103,9 @@ M.Effect_applicativeEffect = { M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() return { map = function(f) - return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f)) + return function(a) + return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end end } end) @@ -133,10 +137,14 @@ return (function() [2] = M.Data_Unit_foreign.unit, [3] = M.Data_Unit_foreign.unit } - return M.Control_Bind_bind(M.Effect_bindEffect)(M.Data_Foldable_foldr(M.Data_Foldable_foldableArray)(M.Control_Semigroupoid_semigroupoidFn.compose(function( a ) - return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(((M.Effect_applicativeEffect.Apply0()).Functor0()).map(function( ) - return function(x) return x end - end)(a)) + return (function(dictBind) + return M.Control_Bind_bind(dictBind) + end)(M.Effect_bindEffect)(M.Data_Foldable_foldr(M.Data_Foldable_foldableArray)(M.Control_Semigroupoid_semigroupoidFn.compose(function( a ) + return function(b) + return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(((M.Effect_applicativeEffect.Apply0()).Functor0()).map(function( ) + return function(x) return x end + end)(a))(b) + end end)(M.Effect_Console_logShow({ show = function() return "unit" end })))(M.Control_Applicative_pure(M.Effect_applicativeEffect)(M.Data_Unit_foreign.unit))(arr))(function( ) diff --git a/test/ps/output/Golden.Beta.Test/golden.ir b/test/ps/output/Golden.Beta.Test/golden.ir index 3291dea..52d7dc0 100644 --- a/test/ps/output/Golden.Beta.Test/golden.ir +++ b/test/ps/output/Golden.Beta.Test/golden.ir @@ -2,9 +2,9 @@ UberModule { uberModuleBindings = [], uberModuleForeigns = [], uberModuleExports = [ ( Name "g", Abs Nothing - ( ParamNamed Nothing ( Name "v" ) ) + ( ParamNamed Nothing ( Name "x" ) ) ( IfThenElse Nothing - ( Eq Nothing ( LiteralInt Nothing 42 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( Eq Nothing ( LiteralInt Nothing 42 ) ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) ( LiteralInt Nothing 42 ) ( LiteralInt Nothing 1 ) ) diff --git a/test/ps/output/Golden.Beta.Test/golden.lua b/test/ps/output/Golden.Beta.Test/golden.lua index facc122..b7811db 100644 --- a/test/ps/output/Golden.Beta.Test/golden.lua +++ b/test/ps/output/Golden.Beta.Test/golden.lua @@ -1 +1 @@ -return { g = function(v) if 42 == v then return 42 else return 1 end end } +return { g = function(x) if 42 == x then return 42 else return 1 end end } diff --git a/test/ps/output/Golden.BugListGenericEq.Test/golden.ir b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir new file mode 100644 index 0000000..672bd68 --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir @@ -0,0 +1,1067 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.0/src/Data/HeytingAlgebra.purs" + [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Type.Proxy", qnameName = Name "Proxy" + }, Ctor Nothing ProductType + ( ModuleName "Type.Proxy" ) + ( TyName "Proxy" ) + ( CtorName "Proxy" ) [] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "heytingAlgebraBoolean" + }, LiteralObject Nothing + [ + ( PropName "ff", LiteralBool Nothing False ), + ( PropName "tt", LiteralBool Nothing True ), + ( PropName "implies", Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "b" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "disj" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "not" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "b" ) ) 0 ) + ) + ) + ), + ( PropName "conj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolConj" ) + ), + ( PropName "disj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolDisj" ) + ), + ( PropName "not", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolNot" ) + ) + ] + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqRecord" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "eqRecord" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eq" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "eq" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqRowCons" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEqRecord" ) ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictIsSymbol" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "eqRecord", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "ra" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "rb" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "key", App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictIsSymbol" ) ) 0 ) + ( PropName "reflectSymbol" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Type.Proxy" ) ( Name "Proxy" ) ) 0 + ) + ) :| + [ Standalone + ( Nothing, Name "get", App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.0/src/Record/Unsafe.purs" + [ ( Nothing, Name "unsafeGet" ) ] + ) + ( PropName "unsafeGet" ) + ) + ( Ref Nothing ( Local ( Name "key" ) ) 0 ) + ) + ] + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "conj" ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "get" ) ) 0 ) + ( Ref Nothing ( Local ( Name "ra" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "get" ) ) 0 ) + ( Ref Nothing ( Local ( Name "rb" ) ) 0 ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq" ) ( Name "eqRecord" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEqRecord" ) ) 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Type.Proxy" ) ( Name "Proxy" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "ra" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "rb" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ] + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEq'" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "genericEq'" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEqConstructor" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictGenericEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq'" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictGenericEq" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ) + ] + ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "discard" + }, App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "logShow" + }, Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( LiteralString Nothing "true" ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralBool Nothing False ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralString Nothing "false" ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "Nil" + }, Ctor Nothing SumType + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( TyName "List" ) + ( CtorName "Nil" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "Cons" + }, Ctor Nothing SumType + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( TyName "List" ) + ( CtorName "Cons" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "genericList" + }, LiteralObject Nothing + [ + ( PropName "to", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Cons" ) ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ), + ( PropName "from", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.BugListGenericEq.Test∷List.Nil" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ctor Nothing SumType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "Sum" ) + ( CtorName "Inl" ) + [ FieldName "value0" ] + ) + ( Ctor Nothing ProductType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "NoArguments" ) + ( CtorName "NoArguments" ) [] + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.BugListGenericEq.Test∷List.Cons" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ctor Nothing SumType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "Sum" ) + ( CtorName "Inr" ) + [ FieldName "value0" ] + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "eqList" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "eq", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Let Nothing + ( Standalone + ( Nothing, Name "from", ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "genericList" ) + ) 0 + ) + ( PropName "from" ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictGenericEq" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y1" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEq'" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "dictGenericEq" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "from" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x1" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "from" ) ) 0 ) + ( Ref Nothing ( Local ( Name "y1" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEq'" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqConstructor" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) ( LiteralBool Nothing True ) ) + ) + ] + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) ( LiteralBool Nothing False ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEq'" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqConstructor" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing + ( ParamNamed Nothing ( Name "v2" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v11" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eq" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "eq", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRecord" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "eqRecord", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) ( LiteralBool Nothing True ) ) + ) + ) + ] + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Prim" ) + ( Name "undefined" ) + ) 0 + ) + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "tail" ) + ) + ] + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "eqList" ) + ) 0 + ) + ( Ref Nothing + ( Local + ( Name "dictEq" ) + ) 0 + ) + ) + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Prim" ) + ( Name "undefined" ) + ) 0 + ) + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "head" ) + ) + ] + ) + ) + ( Ref Nothing + ( Local + ( Name "dictEq" ) + ) 0 + ) + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Type.Proxy" ) + ( Name "Proxy" ) + ) 0 + ) + ) + ] + ) + ) + ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v11" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) ( LiteralBool Nothing False ) + ) ( LiteralBool Nothing False ) + ) + ) + ) + ) + ] + ) + ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) + ) + ] + ) + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "eq" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "eqList" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "eq", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.0/src/Data/Eq.purs" + [ ( Nothing, Name "eqIntImpl" ) ] + ) + ( PropName "eqIntImpl" ) + ) + ] + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "cons" + }, Abs Nothing + ( ParamNamed Nothing ( Name "head" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "tail" ) ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Cons" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "head", Ref Nothing ( Local ( Name "head" ) ) 0 ), + ( PropName "tail", Ref Nothing ( Local ( Name "tail" ) ) 0 ) + ] + ) + ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "Nil", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ), + ( Name "Cons", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Cons" ) ) 0 + ), + ( Name "cons", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "cons" ) ) 0 + ), + ( Name "main", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "eq" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "eq" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "cons" ) + ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "cons" ) + ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "Nil" ) + ) 0 + ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "cons" ) ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "cons" ) + ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "eq" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "cons" ) + ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "cons" ) ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ) + ) + ) + ) + ), + ( Name "genericList", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "genericList" ) ) 0 + ), + ( Name "eqList", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "eqList" ) ) 0 + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.BugListGenericEq.Test/golden.lua b/test/ps/output/Golden.BugListGenericEq.Test/golden.lua new file mode 100644 index 0000000..f5acb82 --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/golden.lua @@ -0,0 +1,255 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_HeytingAlgebra_foreign = { + boolConj = function(b1) return function(b2) return b1 and b2 end end, + boolDisj = function(b1) return function(b2) return b1 or b2 end end, + boolNot = function(b) return not b end +} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Type_Proxy_Proxy = { ["$ctor"] = "Type.Proxy∷Proxy.Proxy" } +M.Data_HeytingAlgebra_heytingAlgebraBoolean = { + ff = false, + tt = true, + implies = function(a) + return function(b) + return M.Data_HeytingAlgebra_heytingAlgebraBoolean.disj(M.Data_HeytingAlgebra_heytingAlgebraBoolean._not_(a))(b) + end + end, + conj = M.Data_HeytingAlgebra_foreign.boolConj, + disj = M.Data_HeytingAlgebra_foreign.boolDisj, + _not_ = M.Data_HeytingAlgebra_foreign.boolNot +} +M.Data_Eq_eqRecord = function(dict) return dict.eqRecord end +M.Data_Eq_eq = function(dict) return dict.eq end +M.Data_Eq_eqRowCons = function(dictEqRecord) + return function() + return function(dictIsSymbol) + return function(dictEq) + return { + eqRecord = function() + return function(ra) + return function(rb) + local key = dictIsSymbol.reflectSymbol(M.Type_Proxy_Proxy) + local get = (function(l) return function(r) return r[l] end end)(key) + return M.Data_HeytingAlgebra_heytingAlgebraBoolean.conj(M.Data_Eq_eq(dictEq)(get(ra))(get(rb)))(M.Data_Eq_eqRecord(dictEqRecord)(M.Type_Proxy_Proxy)(ra)(rb)) + end + end + end + } + end + end + end +end +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Data_Eq_Generic_genericEqPrime = function(dict) return dict.genericEqPrime end +M.Data_Eq_Generic_genericEqConstructor = function(dictGenericEq) + return { + genericEqPrime = function(v) + return function(v1) + return M.Data_Eq_Generic_genericEqPrime(dictGenericEq)(v)(v1) + end + end + } +end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_BugListGenericEq_Test_discard = (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect) +M.Golden_BugListGenericEq_Test_logShow = function(a) + return (function(s) return function() print(s) end end)((function(v) + if v then + return "true" + else + if false == v then + return "false" + else + return error("No patterns matched") + end + end + end)(a)) +end +M.Golden_BugListGenericEq_Test_Nil = { + ["$ctor"] = "Golden.BugListGenericEq.Test∷List.Nil" +} +M.Golden_BugListGenericEq_Test_Cons = function(value0) + return { + ["$ctor"] = "Golden.BugListGenericEq.Test∷List.Cons", + value0 = value0 + } +end +M.Golden_BugListGenericEq_Test_genericList = { + to = function(x) + if "Data.Generic.Rep∷Sum.Inl" == x["$ctor"] then + return M.Golden_BugListGenericEq_Test_Nil + else + if "Data.Generic.Rep∷Sum.Inr" == x["$ctor"] then + return M.Golden_BugListGenericEq_Test_Cons(x.value0) + else + return error("No patterns matched") + end + end + end, + from = function(x) + if "Golden.BugListGenericEq.Test∷List.Nil" == x["$ctor"] then + return (function(value0) + return { ["$ctor"] = "Data.Generic.Rep∷Sum.Inl", value0 = value0 } + end)({ ["$ctor"] = "Data.Generic.Rep∷NoArguments.NoArguments" }) + else + if "Golden.BugListGenericEq.Test∷List.Cons" == x["$ctor"] then + return (function(value0) + return { ["$ctor"] = "Data.Generic.Rep∷Sum.Inr", value0 = value0 } + end)(x.value0) + else + return error("No patterns matched") + end + end + end +} +M.Golden_BugListGenericEq_Test_eqList = function(dictEq) + return { + eq = function(x) + return function(y) + return (function() + return function(dictGenericEq) + local from = M.Golden_BugListGenericEq_Test_genericList.from + return function(x1) + return function(y1) + return M.Data_Eq_Generic_genericEqPrime(dictGenericEq)(from(x1))(from(y1)) + end + end + end + end)()({ + genericEqPrime = function(v) + return function(v1) + if "Data.Generic.Rep∷Sum.Inl" == v["$ctor"] then + if "Data.Generic.Rep∷Sum.Inl" == v1["$ctor"] then + return M.Data_Eq_Generic_genericEqPrime(M.Data_Eq_Generic_genericEqConstructor({ + genericEqPrime = function() + return function() return true end + end + }))(v.value0)(v1.value0) + else + return false + end + else + if "Data.Generic.Rep∷Sum.Inr" == v["$ctor"] then + if "Data.Generic.Rep∷Sum.Inr" == v1["$ctor"] then + return M.Data_Eq_Generic_genericEqPrime(M.Data_Eq_Generic_genericEqConstructor({ + genericEqPrime = function(v2) + return function(v11) + return M.Data_Eq_eq({ + eq = M.Data_Eq_eqRecord(M.Data_Eq_eqRowCons(M.Data_Eq_eqRowCons({ + eqRecord = function() + return function() + return function() return true end + end + end + })()({ + reflectSymbol = function() return "tail" end + })(M.Golden_BugListGenericEq_Test_eqList(dictEq)))()({ + reflectSymbol = function() return "head" end + })(dictEq))(M.Type_Proxy_Proxy) + })(v2)(v11) + end + end + }))(v.value0)(v1.value0) + else + return false + end + else + return false + end + end + end + end + })(x)(y) + end + end + } +end +M.Golden_BugListGenericEq_Test_eq = M.Data_Eq_eq(M.Golden_BugListGenericEq_Test_eqList({ + eq = ((function() + local refEq = function(r1) return function(r2) return r1 == r2 end end + return { eqIntImpl = refEq } + end)()).eqIntImpl +})) +M.Golden_BugListGenericEq_Test_cons = function(head) + return function(tail) + return M.Golden_BugListGenericEq_Test_Cons({ head = head, tail = tail }) + end +end +return M.Golden_BugListGenericEq_Test_discard(M.Golden_BugListGenericEq_Test_logShow(M.Golden_BugListGenericEq_Test_eq(M.Golden_BugListGenericEq_Test_Nil)(M.Golden_BugListGenericEq_Test_Nil)))(function( ) + return M.Golden_BugListGenericEq_Test_discard(M.Golden_BugListGenericEq_Test_logShow(M.Golden_BugListGenericEq_Test_eq(M.Golden_BugListGenericEq_Test_cons(1)(M.Golden_BugListGenericEq_Test_cons(2)(M.Golden_BugListGenericEq_Test_Nil)))(M.Golden_BugListGenericEq_Test_cons(1)(M.Golden_BugListGenericEq_Test_cons(2)(M.Golden_BugListGenericEq_Test_Nil)))))(function( ) + return M.Golden_BugListGenericEq_Test_logShow(M.Golden_BugListGenericEq_Test_eq(M.Golden_BugListGenericEq_Test_cons(1)(M.Golden_BugListGenericEq_Test_Nil))(M.Golden_BugListGenericEq_Test_cons(2)(M.Golden_BugListGenericEq_Test_Nil))) + end) +end)() diff --git a/test/ps/output/Golden.Currying.Test/golden.ir b/test/ps/output/Golden.Currying.Test/golden.ir index 5839809..abd1f9a 100644 --- a/test/ps/output/Golden.Currying.Test/golden.ir +++ b/test/ps/output/Golden.Currying.Test/golden.ir @@ -3,7 +3,13 @@ UberModule [ ( Name "apply", Abs Nothing ( ParamNamed Nothing ( Name "f1" ) ) - ( Ref Nothing ( Local ( Name "f1" ) ) 0 ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f1" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) ), ( Name "f", Abs Nothing ( ParamUnused Nothing ) ( Abs Nothing ( ParamUnused Nothing ) diff --git a/test/ps/output/Golden.Currying.Test/golden.lua b/test/ps/output/Golden.Currying.Test/golden.lua index 0bf7a3c..93f2467 100644 --- a/test/ps/output/Golden.Currying.Test/golden.lua +++ b/test/ps/output/Golden.Currying.Test/golden.lua @@ -1,5 +1,5 @@ return { - apply = function(f1) return f1 end, + apply = function(f1) return function(x) return f1(x) end end, f = function() return function() return function() return function() return "ok" end end diff --git a/test/ps/output/Golden.DerivedFunctor.Test/golden.ir b/test/ps/output/Golden.DerivedFunctor.Test/golden.ir new file mode 100644 index 0000000..021f2f6 --- /dev/null +++ b/test/ps/output/Golden.DerivedFunctor.Test/golden.ir @@ -0,0 +1,783 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "semiringInt" + }, LiteralObject Nothing + [ + ( PropName "add", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intAdd" ) + ), + ( PropName "zero", LiteralInt Nothing 0 ), + ( PropName "mul", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMul" ) + ), + ( PropName "one", LiteralInt Nothing 1 ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Functor", qnameName = Name "map" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "map" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "add" + }, ObjectProp Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 ) + ( PropName "add" ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "discard" + }, App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "logShow" + }, Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ) + ( PropName "showIntImpl" ) + ) + ] + ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "Leaf" + }, Ctor Nothing SumType + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( TyName "Tree" ) + ( CtorName "Leaf" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "Node" + }, Ctor Nothing SumType + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( TyName "Tree" ) + ( CtorName "Node" ) + [ FieldName "value0", FieldName "value1", FieldName "value2" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "Left" + }, Ctor Nothing SumType + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( TyName "Either" ) + ( CtorName "Left" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "Right" + }, Ctor Nothing SumType + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( TyName "Either" ) + ( CtorName "Right" ) + [ FieldName "value0" ] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "sumTree" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Tree.Leaf" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( LiteralInt Nothing 0 ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Tree.Node" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "add" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "add" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "sumTree" ) + ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value1" ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "sumTree" ) ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value2" ) + ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) :| [] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "functorTree" + }, LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "m" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Tree.Leaf" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "m" ) ) 0 ) ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Leaf" ) ) 0 + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Tree.Node" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "m" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "Node" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Functor" ) ( Name "map" ) ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "functorTree" ) + ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "m" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "m" ) ) 0 ) + ( PropName "value1" ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Functor" ) ( Name "map" ) ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "functorTree" ) + ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "m" ) ) 0 ) + ( PropName "value2" ) + ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ] + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "functorEither" + }, LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "m" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Either.Left" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "m" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Left" ) ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "m" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Either.Right" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "m" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Right" ) ) 0 + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "m" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "map1" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Functor" ) ( Name "map" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "functorEither" ) ) 0 + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.DerivedFunctor.Test", qnameName = Name "fromRight" + }, Abs Nothing + ( ParamNamed Nothing ( Name "fallback" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Either.Left" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( Ref Nothing ( Local ( Name "fallback" ) ) 0 ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.DerivedFunctor.Test∷Either.Right" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ( PropName "value0" ) ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "Left", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Left" ) ) 0 + ), + ( Name "Right", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Right" ) ) 0 + ), + ( Name "Leaf", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Leaf" ) ) 0 + ), + ( Name "Node", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Node" ) ) 0 + ), + ( Name "fromRight", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "fromRight" ) ) 0 + ), + ( Name "sumTree", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "sumTree" ) ) 0 + ), + ( Name "main", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "fromRight" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "map1" ) ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "add" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Right" ) ) 0 + ) + ( LiteralInt Nothing 41 ) + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "fromRight" ) + ) 0 + ) + ( LiteralInt Nothing 7 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "map1" ) ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "add" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Left" ) ) 0 + ) + ( LiteralString Nothing "no" ) + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "sumTree" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Functor" ) ( Name "map" ) ) 0 ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "functorTree" ) + ) 0 + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "mul" ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 2 ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "Node" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "Node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 1 ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ) + ( LiteralInt Nothing 2 ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "Node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.DerivedFunctor.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 3 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "Leaf" ) ) 0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( Name "functorEither", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "functorEither" ) ) 0 + ), + ( Name "functorTree", Ref Nothing + ( Imported ( ModuleName "Golden.DerivedFunctor.Test" ) ( Name "functorTree" ) ) 0 + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.DerivedFunctor.Test/golden.lua b/test/ps/output/Golden.DerivedFunctor.Test/golden.lua new file mode 100644 index 0000000..98a7157 --- /dev/null +++ b/test/ps/output/Golden.DerivedFunctor.Test/golden.lua @@ -0,0 +1,186 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_Semiring_foreign = { + intAdd = function(x) return function(y) return x + y end end, + intMul = function(x) return function(y) return x * y end end +} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Data_Semiring_semiringInt = { + add = M.Data_Semiring_foreign.intAdd, + zero = 0, + mul = M.Data_Semiring_foreign.intMul, + one = 1 +} +M.Data_Functor_map = function(dict) return dict.map end +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_DerivedFunctor_Test_add = M.Data_Semiring_semiringInt.add +M.Golden_DerivedFunctor_Test_discard = (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect) +M.Golden_DerivedFunctor_Test_logShow = function(a) + return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(a)) +end +M.Golden_DerivedFunctor_Test_Leaf = { + ["$ctor"] = "Golden.DerivedFunctor.Test∷Tree.Leaf" +} +M.Golden_DerivedFunctor_Test_Node = function(value0) + return function(value1) + return function(value2) + return { + ["$ctor"] = "Golden.DerivedFunctor.Test∷Tree.Node", + value0 = value0, + value1 = value1, + value2 = value2 + } + end + end +end +M.Golden_DerivedFunctor_Test_Left = function(value0) + return { + ["$ctor"] = "Golden.DerivedFunctor.Test∷Either.Left", + value0 = value0 + } +end +M.Golden_DerivedFunctor_Test_Right = function(value0) + return { + ["$ctor"] = "Golden.DerivedFunctor.Test∷Either.Right", + value0 = value0 + } +end +M.Golden_DerivedFunctor_Test_sumTree = function(v) + if "Golden.DerivedFunctor.Test∷Tree.Leaf" == v["$ctor"] then + return 0 + else + if "Golden.DerivedFunctor.Test∷Tree.Node" == v["$ctor"] then + return M.Golden_DerivedFunctor_Test_add(M.Golden_DerivedFunctor_Test_add(M.Golden_DerivedFunctor_Test_sumTree(v.value0))(v.value1))(M.Golden_DerivedFunctor_Test_sumTree(v.value2)) + else + return error("No patterns matched") + end + end +end +M.Golden_DerivedFunctor_Test_functorTree = { + map = function(f) + return function(m) + if "Golden.DerivedFunctor.Test∷Tree.Leaf" == m["$ctor"] then + return M.Golden_DerivedFunctor_Test_Leaf + else + if "Golden.DerivedFunctor.Test∷Tree.Node" == m["$ctor"] then + return M.Golden_DerivedFunctor_Test_Node(M.Data_Functor_map(M.Golden_DerivedFunctor_Test_functorTree)(f)(m.value0))(f(m.value1))(M.Data_Functor_map(M.Golden_DerivedFunctor_Test_functorTree)(f)(m.value2)) + else + return error("No patterns matched") + end + end + end + end +} +M.Golden_DerivedFunctor_Test_functorEither = { + map = function(f) + return function(m) + if "Golden.DerivedFunctor.Test∷Either.Left" == m["$ctor"] then + return M.Golden_DerivedFunctor_Test_Left(m.value0) + else + if "Golden.DerivedFunctor.Test∷Either.Right" == m["$ctor"] then + return M.Golden_DerivedFunctor_Test_Right(f(m.value0)) + else + return error("No patterns matched") + end + end + end + end +} +M.Golden_DerivedFunctor_Test_map1 = M.Data_Functor_map(M.Golden_DerivedFunctor_Test_functorEither) +M.Golden_DerivedFunctor_Test_fromRight = function(fallback) + return function(v) + if "Golden.DerivedFunctor.Test∷Either.Left" == v["$ctor"] then + return fallback + else + if "Golden.DerivedFunctor.Test∷Either.Right" == v["$ctor"] then + return v.value0 + else + return error("No patterns matched") + end + end + end +end +return M.Golden_DerivedFunctor_Test_discard(M.Golden_DerivedFunctor_Test_logShow(M.Golden_DerivedFunctor_Test_fromRight(0)(M.Golden_DerivedFunctor_Test_map1(function( v ) + return M.Golden_DerivedFunctor_Test_add(v)(1) +end)(M.Golden_DerivedFunctor_Test_Right(41)))))(function() + return M.Golden_DerivedFunctor_Test_discard(M.Golden_DerivedFunctor_Test_logShow(M.Golden_DerivedFunctor_Test_fromRight(7)(M.Golden_DerivedFunctor_Test_map1(function( v ) + return M.Golden_DerivedFunctor_Test_add(v)(1) + end)(M.Golden_DerivedFunctor_Test_Left("no")))))(function() + return M.Golden_DerivedFunctor_Test_logShow(M.Golden_DerivedFunctor_Test_sumTree(M.Data_Functor_map(M.Golden_DerivedFunctor_Test_functorTree)(function( v ) + return M.Data_Semiring_semiringInt.mul(v)(2) + end)(M.Golden_DerivedFunctor_Test_Node(M.Golden_DerivedFunctor_Test_Node(M.Golden_DerivedFunctor_Test_Leaf)(1)(M.Golden_DerivedFunctor_Test_Leaf))(2)(M.Golden_DerivedFunctor_Test_Node(M.Golden_DerivedFunctor_Test_Leaf)(3)(M.Golden_DerivedFunctor_Test_Leaf))))) + end) +end)() diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir new file mode 100644 index 0000000..35a5c01 --- /dev/null +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir @@ -0,0 +1,1531 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.0/src/Data/HeytingAlgebra.purs" + [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Type.Proxy", qnameName = Name "Proxy" + }, Ctor Nothing ProductType + ( ModuleName "Type.Proxy" ) + ( TyName "Proxy" ) + ( CtorName "Proxy" ) [] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "heytingAlgebraBoolean" + }, LiteralObject Nothing + [ + ( PropName "ff", LiteralBool Nothing False ), + ( PropName "tt", LiteralBool Nothing True ), + ( PropName "implies", Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "b" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "disj" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "not" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "b" ) ) 0 ) + ) + ) + ), + ( PropName "conj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolConj" ) + ), + ( PropName "disj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolDisj" ) + ), + ( PropName "not", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolNot" ) + ) + ] + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqRecord" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "eqRecord" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqInt" }, LiteralObject Nothing + [ + ( PropName "eq", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.0/src/Data/Eq.purs" + [ ( Nothing, Name "eqIntImpl" ) ] + ) + ( PropName "eqIntImpl" ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eq" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "eq" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqRowCons" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEqRecord" ) ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictIsSymbol" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "eqRecord", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "ra" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "rb" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "key", App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictIsSymbol" ) ) 0 ) + ( PropName "reflectSymbol" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Type.Proxy" ) ( Name "Proxy" ) ) 0 + ) + ) :| + [ Standalone + ( Nothing, Name "get", App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.0/src/Record/Unsafe.purs" + [ ( Nothing, Name "unsafeGet" ) ] + ) + ( PropName "unsafeGet" ) + ) + ( Ref Nothing ( Local ( Name "key" ) ) 0 ) + ) + ] + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "conj" ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "get" ) ) 0 ) + ( Ref Nothing ( Local ( Name "ra" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "get" ) ) 0 ) + ( Ref Nothing ( Local ( Name "rb" ) ) 0 ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq" ) ( Name "eqRecord" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEqRecord" ) ) 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Type.Proxy" ) ( Name "Proxy" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "ra" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "rb" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ] + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Generic.Rep", qnameName = Name "Inl" + }, Ctor Nothing SumType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "Sum" ) + ( CtorName "Inl" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Generic.Rep", qnameName = Name "Inr" + }, Ctor Nothing SumType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "Sum" ) + ( CtorName "Inr" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Generic.Rep", qnameName = Name "NoArguments" + }, Ctor Nothing ProductType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "NoArguments" ) + ( CtorName "NoArguments" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEqArgument" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ) + ] + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEq'" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "genericEq'" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEqConstructor" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictGenericEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq'" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictGenericEq" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ) + ] + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEq" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictGeneric" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "from", ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictGeneric" ) ) 0 ) + ( PropName "from" ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictGenericEq" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq'" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictGenericEq" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "from" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "from" ) ) 0 ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "genericEqSum" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictGenericEq1" ) ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq'" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqConstructor" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) ( LiteralBool Nothing True ) ) + ) + ] + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) ( LiteralBool Nothing False ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq'" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictGenericEq1" ) ) 0 ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) ( LiteralBool Nothing False ) + ) ( LiteralBool Nothing False ) + ) + ) + ) + ) + ] + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "eqRec" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEqRecord" ) ) + ( LiteralObject Nothing + [ + ( PropName "eq", App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eqRecord" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictEqRecord" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Type.Proxy" ) ( Name "Proxy" ) ) 0 ) + ) + ] + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "eqRowCons" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eqRowCons" ) ) 0 ) + ( LiteralObject Nothing + [ + ( PropName "eqRecord", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) ( LiteralBool Nothing True ) ) + ) + ) + ] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "discard" + }, App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "logShow" + }, Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( LiteralString Nothing "true" ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralBool Nothing False ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralString Nothing "false" ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "Leaf" + }, Ctor Nothing SumType + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( TyName "Tree" ) + ( CtorName "Leaf" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "Node" + }, Ctor Nothing SumType + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( TyName "Tree" ) + ( CtorName "Node" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "Nil" + }, Ctor Nothing SumType + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( TyName "List" ) + ( CtorName "Nil" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "Cons" + }, Ctor Nothing SumType + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( TyName "List" ) + ( CtorName "Cons" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "node" + }, Abs Nothing + ( ParamNamed Nothing ( Name "left" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "value" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "right" ) ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Node" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "left", Ref Nothing ( Local ( Name "left" ) ) 0 ), + ( PropName "value", Ref Nothing ( Local ( Name "value" ) ) 0 ), + ( PropName "right", Ref Nothing ( Local ( Name "right" ) ) 0 ) + ] + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "genericTree" + }, LiteralObject Nothing + [ + ( PropName "to", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Leaf" ) ) 0 + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Node" ) ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ), + ( PropName "from", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.GenericEqTwoTypes.Test∷Tree.Leaf" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Generic.Rep" ) ( Name "Inl" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Generic.Rep" ) ( Name "NoArguments" ) ) 0 + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.GenericEqTwoTypes.Test∷Tree.Node" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Generic.Rep" ) ( Name "Inr" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "genericList" + }, LiteralObject Nothing + [ + ( PropName "to", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Nil" ) ) 0 + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Cons" ) ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ), + ( PropName "from", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.GenericEqTwoTypes.Test∷List.Nil" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Generic.Rep" ) ( Name "Inl" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Generic.Rep" ) ( Name "NoArguments" ) ) 0 + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.GenericEqTwoTypes.Test∷List.Cons" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Generic.Rep" ) ( Name "Inr" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "eqTree" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "eq", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq" ) ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "genericTree" ) + ) 0 + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "genericEqSum" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqConstructor" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqArgument" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eqRec" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "value" ) + ) + ] + ) + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Prim" ) + ( Name "undefined" ) + ) 0 + ) + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "right" ) + ) + ] + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eqTree" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "left" ) + ) + ] + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eqTree" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) + ) + ] + ) + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "eq" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "eqTree" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eqInt" ) ) 0 ) + ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "eqList" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "eq", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq" ) ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "genericList" ) + ) 0 + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "genericEqSum" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqConstructor" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqArgument" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eqRec" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "tail" ) + ) + ] + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eqList" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "head" ) + ) + ] + ) + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) + ) + ] + ) + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "eq1" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "eqList" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eqInt" ) ) 0 ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.GenericEqTwoTypes.Test", qnameName = Name "cons" + }, Abs Nothing + ( ParamNamed Nothing ( Name "head" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "tail" ) ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Cons" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "head", Ref Nothing ( Local ( Name "head" ) ) 0 ), + ( PropName "tail", Ref Nothing ( Local ( Name "tail" ) ) 0 ) + ] + ) + ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "Nil", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Nil" ) ) 0 + ), + ( Name "Cons", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Cons" ) ) 0 + ), + ( Name "cons", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "cons" ) ) 0 + ), + ( Name "Leaf", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Leaf" ) ) 0 + ), + ( Name "Node", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Node" ) ) 0 + ), + ( Name "node", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "node" ) ) 0 + ), + ( Name "main", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "eq1" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "cons" ) ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "cons" ) + ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "cons" ) ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "cons" ) ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "eq1" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "cons" ) + ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "cons" ) + ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "Nil" ) ) 0 + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eq" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 1 ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 1 ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "eq" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 1 ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "node" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ( LiteralInt Nothing 2 ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.GenericEqTwoTypes.Test" ) + ( Name "Leaf" ) + ) 0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( Name "genericList", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "genericList" ) ) 0 + ), + ( Name "eqList", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "eqList" ) ) 0 + ), + ( Name "genericTree", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "genericTree" ) ) 0 + ), + ( Name "eqTree", Ref Nothing + ( Imported ( ModuleName "Golden.GenericEqTwoTypes.Test" ) ( Name "eqTree" ) ) 0 + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua new file mode 100644 index 0000000..5f1c3f7 --- /dev/null +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua @@ -0,0 +1,326 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_HeytingAlgebra_foreign = { + boolConj = function(b1) return function(b2) return b1 and b2 end end, + boolDisj = function(b1) return function(b2) return b1 or b2 end end, + boolNot = function(b) return not b end +} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Type_Proxy_Proxy = { ["$ctor"] = "Type.Proxy∷Proxy.Proxy" } +M.Data_HeytingAlgebra_heytingAlgebraBoolean = { + ff = false, + tt = true, + implies = function(a) + return function(b) + return M.Data_HeytingAlgebra_heytingAlgebraBoolean.disj(M.Data_HeytingAlgebra_heytingAlgebraBoolean._not_(a))(b) + end + end, + conj = M.Data_HeytingAlgebra_foreign.boolConj, + disj = M.Data_HeytingAlgebra_foreign.boolDisj, + _not_ = M.Data_HeytingAlgebra_foreign.boolNot +} +M.Data_Eq_eqRecord = function(dict) return dict.eqRecord end +M.Data_Eq_eqInt = { + eq = ((function() + local refEq = function(r1) return function(r2) return r1 == r2 end end + return { eqIntImpl = refEq } + end)()).eqIntImpl +} +M.Data_Eq_eq = function(dict) return dict.eq end +M.Data_Eq_eqRowCons = function(dictEqRecord) + return function() + return function(dictIsSymbol) + return function(dictEq) + return { + eqRecord = function() + return function(ra) + return function(rb) + local key = dictIsSymbol.reflectSymbol(M.Type_Proxy_Proxy) + local get = (function(l) return function(r) return r[l] end end)(key) + return M.Data_HeytingAlgebra_heytingAlgebraBoolean.conj(M.Data_Eq_eq(dictEq)(get(ra))(get(rb)))(M.Data_Eq_eqRecord(dictEqRecord)(M.Type_Proxy_Proxy)(ra)(rb)) + end + end + end + } + end + end + end +end +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Data_Generic_Rep_Inl = function(value0) + return { ["$ctor"] = "Data.Generic.Rep∷Sum.Inl", value0 = value0 } +end +M.Data_Generic_Rep_Inr = function(value0) + return { ["$ctor"] = "Data.Generic.Rep∷Sum.Inr", value0 = value0 } +end +M.Data_Generic_Rep_NoArguments = { + ["$ctor"] = "Data.Generic.Rep∷NoArguments.NoArguments" +} +M.Data_Eq_Generic_genericEqArgument = function(dictEq) + return { + genericEqPrime = function(v) + return function(v1) return M.Data_Eq_eq(dictEq)(v)(v1) end + end + } +end +M.Data_Eq_Generic_genericEqPrime = function(dict) return dict.genericEqPrime end +M.Data_Eq_Generic_genericEqConstructor = function(dictGenericEq) + return { + genericEqPrime = function(v) + return function(v1) + return M.Data_Eq_Generic_genericEqPrime(dictGenericEq)(v)(v1) + end + end + } +end +M.Data_Eq_Generic_genericEq = function(dictGeneric) + return function(dictGenericEq) + local from = dictGeneric.from + return function(x) + return function(y) + return M.Data_Eq_Generic_genericEqPrime(dictGenericEq)(from(x))(from(y)) + end + end + end +end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_GenericEqTwoTypes_Test_genericEqSum = function(dictGenericEq1) + return { + genericEqPrime = function(v) + return function(v1) + if "Data.Generic.Rep∷Sum.Inl" == v["$ctor"] then + if "Data.Generic.Rep∷Sum.Inl" == v1["$ctor"] then + return M.Data_Eq_Generic_genericEqPrime(M.Data_Eq_Generic_genericEqConstructor({ + genericEqPrime = function() return function() return true end end + }))(v.value0)(v1.value0) + else + return false + end + else + if "Data.Generic.Rep∷Sum.Inr" == v["$ctor"] then + if "Data.Generic.Rep∷Sum.Inr" == v1["$ctor"] then + return M.Data_Eq_Generic_genericEqPrime(dictGenericEq1)(v.value0)(v1.value0) + else + return false + end + else + return false + end + end + end + end + } +end +M.Golden_GenericEqTwoTypes_Test_eqRec = function(dictEqRecord) + return { eq = M.Data_Eq_eqRecord(dictEqRecord)(M.Type_Proxy_Proxy) } +end +M.Golden_GenericEqTwoTypes_Test_eqRowCons = M.Data_Eq_eqRowCons({ + eqRecord = function() + return function() return function() return true end end + end +})() +M.Golden_GenericEqTwoTypes_Test_discard = (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect) +M.Golden_GenericEqTwoTypes_Test_logShow = function(a) + return (function(s) return function() print(s) end end)((function(v) + if v then + return "true" + else + if false == v then + return "false" + else + return error("No patterns matched") + end + end + end)(a)) +end +M.Golden_GenericEqTwoTypes_Test_Leaf = { + ["$ctor"] = "Golden.GenericEqTwoTypes.Test∷Tree.Leaf" +} +M.Golden_GenericEqTwoTypes_Test_Node = function(value0) + return { + ["$ctor"] = "Golden.GenericEqTwoTypes.Test∷Tree.Node", + value0 = value0 + } +end +M.Golden_GenericEqTwoTypes_Test_Nil = { + ["$ctor"] = "Golden.GenericEqTwoTypes.Test∷List.Nil" +} +M.Golden_GenericEqTwoTypes_Test_Cons = function(value0) + return { + ["$ctor"] = "Golden.GenericEqTwoTypes.Test∷List.Cons", + value0 = value0 + } +end +M.Golden_GenericEqTwoTypes_Test_node = function(left) + return function(value) + return function(right) + return M.Golden_GenericEqTwoTypes_Test_Node({ + left = left, + value = value, + right = right + }) + end + end +end +M.Golden_GenericEqTwoTypes_Test_genericTree = { + to = function(x) + if "Data.Generic.Rep∷Sum.Inl" == x["$ctor"] then + return M.Golden_GenericEqTwoTypes_Test_Leaf + else + if "Data.Generic.Rep∷Sum.Inr" == x["$ctor"] then + return M.Golden_GenericEqTwoTypes_Test_Node(x.value0) + else + return error("No patterns matched") + end + end + end, + from = function(x) + if "Golden.GenericEqTwoTypes.Test∷Tree.Leaf" == x["$ctor"] then + return M.Data_Generic_Rep_Inl(M.Data_Generic_Rep_NoArguments) + else + if "Golden.GenericEqTwoTypes.Test∷Tree.Node" == x["$ctor"] then + return M.Data_Generic_Rep_Inr(x.value0) + else + return error("No patterns matched") + end + end + end +} +M.Golden_GenericEqTwoTypes_Test_genericList = { + to = function(x) + if "Data.Generic.Rep∷Sum.Inl" == x["$ctor"] then + return M.Golden_GenericEqTwoTypes_Test_Nil + else + if "Data.Generic.Rep∷Sum.Inr" == x["$ctor"] then + return M.Golden_GenericEqTwoTypes_Test_Cons(x.value0) + else + return error("No patterns matched") + end + end + end, + from = function(x) + if "Golden.GenericEqTwoTypes.Test∷List.Nil" == x["$ctor"] then + return M.Data_Generic_Rep_Inl(M.Data_Generic_Rep_NoArguments) + else + if "Golden.GenericEqTwoTypes.Test∷List.Cons" == x["$ctor"] then + return M.Data_Generic_Rep_Inr(x.value0) + else + return error("No patterns matched") + end + end + end +} +M.Golden_GenericEqTwoTypes_Test_eqTree = function(dictEq) + return { + eq = function(x) + return function(y) + return M.Data_Eq_Generic_genericEq(M.Golden_GenericEqTwoTypes_Test_genericTree)(M.Golden_GenericEqTwoTypes_Test_genericEqSum(M.Data_Eq_Generic_genericEqConstructor(M.Data_Eq_Generic_genericEqArgument(M.Golden_GenericEqTwoTypes_Test_eqRec(M.Data_Eq_eqRowCons(M.Data_Eq_eqRowCons(M.Golden_GenericEqTwoTypes_Test_eqRowCons({ + reflectSymbol = function() return "value" end + })(dictEq))()({ + reflectSymbol = function() return "right" end + })(M.Golden_GenericEqTwoTypes_Test_eqTree(dictEq)))()({ + reflectSymbol = function() return "left" end + })(M.Golden_GenericEqTwoTypes_Test_eqTree(dictEq)))))))(x)(y) + end + end + } +end +M.Golden_GenericEqTwoTypes_Test_eq = M.Data_Eq_eq(M.Golden_GenericEqTwoTypes_Test_eqTree(M.Data_Eq_eqInt)) +M.Golden_GenericEqTwoTypes_Test_eqList = function(dictEq) + return { + eq = function(x) + return function(y) + return M.Data_Eq_Generic_genericEq(M.Golden_GenericEqTwoTypes_Test_genericList)(M.Golden_GenericEqTwoTypes_Test_genericEqSum(M.Data_Eq_Generic_genericEqConstructor(M.Data_Eq_Generic_genericEqArgument(M.Golden_GenericEqTwoTypes_Test_eqRec(M.Data_Eq_eqRowCons(M.Golden_GenericEqTwoTypes_Test_eqRowCons({ + reflectSymbol = function() return "tail" end + })(M.Golden_GenericEqTwoTypes_Test_eqList(dictEq)))()({ + reflectSymbol = function() return "head" end + })(dictEq))))))(x)(y) + end + end + } +end +M.Golden_GenericEqTwoTypes_Test_eq1 = M.Data_Eq_eq(M.Golden_GenericEqTwoTypes_Test_eqList(M.Data_Eq_eqInt)) +M.Golden_GenericEqTwoTypes_Test_cons = function(head) + return function(tail) + return M.Golden_GenericEqTwoTypes_Test_Cons({ head = head, tail = tail }) + end +end +return M.Golden_GenericEqTwoTypes_Test_discard(M.Golden_GenericEqTwoTypes_Test_logShow(M.Golden_GenericEqTwoTypes_Test_eq1(M.Golden_GenericEqTwoTypes_Test_cons(1)(M.Golden_GenericEqTwoTypes_Test_cons(2)(M.Golden_GenericEqTwoTypes_Test_Nil)))(M.Golden_GenericEqTwoTypes_Test_cons(1)(M.Golden_GenericEqTwoTypes_Test_cons(2)(M.Golden_GenericEqTwoTypes_Test_Nil)))))(function( ) + return M.Golden_GenericEqTwoTypes_Test_discard(M.Golden_GenericEqTwoTypes_Test_logShow(M.Golden_GenericEqTwoTypes_Test_eq1(M.Golden_GenericEqTwoTypes_Test_cons(1)(M.Golden_GenericEqTwoTypes_Test_Nil))(M.Golden_GenericEqTwoTypes_Test_cons(2)(M.Golden_GenericEqTwoTypes_Test_Nil))))(function( ) + return M.Golden_GenericEqTwoTypes_Test_discard(M.Golden_GenericEqTwoTypes_Test_logShow(M.Golden_GenericEqTwoTypes_Test_eq(M.Golden_GenericEqTwoTypes_Test_node(M.Golden_GenericEqTwoTypes_Test_Leaf)(1)(M.Golden_GenericEqTwoTypes_Test_node(M.Golden_GenericEqTwoTypes_Test_Leaf)(2)(M.Golden_GenericEqTwoTypes_Test_Leaf)))(M.Golden_GenericEqTwoTypes_Test_node(M.Golden_GenericEqTwoTypes_Test_Leaf)(1)(M.Golden_GenericEqTwoTypes_Test_node(M.Golden_GenericEqTwoTypes_Test_Leaf)(2)(M.Golden_GenericEqTwoTypes_Test_Leaf)))))(function( ) + return M.Golden_GenericEqTwoTypes_Test_logShow(M.Golden_GenericEqTwoTypes_Test_eq(M.Golden_GenericEqTwoTypes_Test_node(M.Golden_GenericEqTwoTypes_Test_Leaf)(1)(M.Golden_GenericEqTwoTypes_Test_Leaf))(M.Golden_GenericEqTwoTypes_Test_node(M.Golden_GenericEqTwoTypes_Test_Leaf)(2)(M.Golden_GenericEqTwoTypes_Test_Leaf))) + end) + end) +end)() diff --git a/test/ps/output/Golden.HelloPrelude.Test/golden.ir b/test/ps/output/Golden.HelloPrelude.Test/golden.ir index e7afbf6..b7675b7 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/golden.ir +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.ir @@ -75,29 +75,40 @@ UberModule [ ( PropName "map", Abs Nothing ( ParamNamed Nothing ( Name "f" ) ) - ( App Nothing - ( ObjectProp Nothing + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing ( App Nothing ( ObjectProp Nothing - ( Ref Nothing - ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) ) - ( PropName "Apply0" ) - ) - ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) - ) - ( PropName "apply" ) - ) - ( App Nothing - ( App Nothing - ( Ref Nothing - ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ( PropName "apply" ) ) - ( Ref Nothing - ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) ) ) - ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) ) ) ) diff --git a/test/ps/output/Golden.HelloPrelude.Test/golden.lua b/test/ps/output/Golden.HelloPrelude.Test/golden.lua index 16977dd..8b4fad2 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/golden.lua +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.lua @@ -49,7 +49,9 @@ M.Effect_applicativeEffect = { M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() return { map = function(f) - return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f)) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end end } end) diff --git a/test/ps/output/Golden.Issue37.Test/golden.ir b/test/ps/output/Golden.Issue37.Test/golden.ir index 1019739..346ed34 100644 --- a/test/ps/output/Golden.Issue37.Test/golden.ir +++ b/test/ps/output/Golden.Issue37.Test/golden.ir @@ -86,29 +86,40 @@ UberModule [ ( PropName "map", Abs Nothing ( ParamNamed Nothing ( Name "f" ) ) - ( App Nothing - ( ObjectProp Nothing + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing ( App Nothing ( ObjectProp Nothing - ( Ref Nothing - ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) ) - ( PropName "Apply0" ) + ( PropName "apply" ) ) - ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) - ) - ( PropName "apply" ) - ) - ( App Nothing - ( App Nothing - ( Ref Nothing - ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 - ) - ( Ref Nothing - ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) ) ) - ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) ) ) ) @@ -215,8 +226,12 @@ UberModule }, ObjectProp Nothing ( LiteralObject Nothing [ - ( PropName "discard", Ref Nothing - ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) ) ] ) diff --git a/test/ps/output/Golden.Issue37.Test/golden.lua b/test/ps/output/Golden.Issue37.Test/golden.lua index fe39af7..cf75054 100644 --- a/test/ps/output/Golden.Issue37.Test/golden.lua +++ b/test/ps/output/Golden.Issue37.Test/golden.lua @@ -51,7 +51,9 @@ M.Effect_applicativeEffect = { M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() return { map = function(f) - return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f)) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end end } end) @@ -72,7 +74,9 @@ M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() Functor0 = function() return M.Effect_Lazy_functorEffect(0) end } end) -M.Golden_Issue37_Test_discard = M.Control_Bind_bind +M.Golden_Issue37_Test_discard = function(dictBind) + return M.Control_Bind_bind(dictBind) +end return { baz = (function() return function(f) diff --git a/test/ps/output/Golden.NameShadowing.Test/golden.ir b/test/ps/output/Golden.NameShadowing.Test/golden.ir index a0cce51..8014d23 100644 --- a/test/ps/output/Golden.NameShadowing.Test/golden.ir +++ b/test/ps/output/Golden.NameShadowing.Test/golden.ir @@ -52,7 +52,7 @@ UberModule ) ), ( Name "c", Abs Nothing - ( ParamNamed Nothing ( Name "y" ) ) + ( ParamNamed Nothing ( Name "x" ) ) ( Abs Nothing ( ParamNamed Nothing ( Name "x1" ) ) ( App Nothing @@ -62,7 +62,7 @@ UberModule ) ( Ref Nothing ( Local ( Name "x1" ) ) 0 ) ) - ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) ) ) diff --git a/test/ps/output/Golden.NameShadowing.Test/golden.lua b/test/ps/output/Golden.NameShadowing.Test/golden.lua index 272f73a..fb96f85 100644 --- a/test/ps/output/Golden.NameShadowing.Test/golden.lua +++ b/test/ps/output/Golden.NameShadowing.Test/golden.lua @@ -10,7 +10,7 @@ return { return M.Golden_NameShadowing_Test_f(M.Golden_NameShadowing_Test_f(x)(x1))(M.Golden_NameShadowing_Test_f(42)(1)) end end, - c = function(y) - return function(x1) return M.Golden_NameShadowing_Test_f(x1)(y) end + c = function(x) + return function(x1) return M.Golden_NameShadowing_Test_f(x1)(x) end end } diff --git a/test/ps/output/Golden.RecursiveBindings.Test/golden.ir b/test/ps/output/Golden.RecursiveBindings.Test/golden.ir index a08c841..155d0a7 100644 --- a/test/ps/output/Golden.RecursiveBindings.Test/golden.ir +++ b/test/ps/output/Golden.RecursiveBindings.Test/golden.ir @@ -112,7 +112,13 @@ UberModule ] ), Standalone ( Nothing, Name "f", Abs Nothing ( ParamUnused Nothing ) - ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "k" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ( Ref Nothing ( Local ( Name "k" ) ) 0 ) + ) + ) ), Standalone ( Nothing, Name "y", App Nothing ( App Nothing diff --git a/test/ps/output/Golden.RecursiveBindings.Test/golden.lua b/test/ps/output/Golden.RecursiveBindings.Test/golden.lua index e6c3208..13547c0 100644 --- a/test/ps/output/Golden.RecursiveBindings.Test/golden.lua +++ b/test/ps/output/Golden.RecursiveBindings.Test/golden.lua @@ -59,7 +59,7 @@ return { local b a = function() return b(z) end b = function() return a(z) end - local f = function() return a end + local f = function() return function(k) return a(k) end end local y = f(z)(z) return f(f(y)(y))(f(y)(0)) end)() From c251beb40a0b6faddb82e9afc57c7e33ae1d8f1b Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 16:52:33 +0200 Subject: [PATCH 24/40] test: lock regression for #28 (profunctor dict lens) Reproduces the Data.Lens._Newtype miscompilation from issue #28 without profunctor-lenses: a binding abstracted over a Profunctor dictionary, used more than once so the used-once inliner cannot mask a lost dictionary lambda. The bug was fixed by the eta reduction guard in 833cec8 and the subsequent removal of eta reduction entirely (#45); this eval golden locks it in. --- .../Golden/ProfunctorDictLens/Test.purs | 26 + .../corefn.json | 1 + .../eval/.gitignore | 1 + .../eval/golden.txt | 3 + .../Golden.ProfunctorDictLens.Test/golden.ir | 598 ++++++++++++++++++ .../Golden.ProfunctorDictLens.Test/golden.lua | 129 ++++ test/ps/spago.dhall | 10 +- 7 files changed, 767 insertions(+), 1 deletion(-) create mode 100644 test/ps/golden/Golden/ProfunctorDictLens/Test.purs create mode 100644 test/ps/output/Golden.ProfunctorDictLens.Test/corefn.json create mode 100644 test/ps/output/Golden.ProfunctorDictLens.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.ProfunctorDictLens.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir create mode 100644 test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua diff --git a/test/ps/golden/Golden/ProfunctorDictLens/Test.purs b/test/ps/golden/Golden/ProfunctorDictLens/Test.purs new file mode 100644 index 0000000..e346d78 --- /dev/null +++ b/test/ps/golden/Golden/ProfunctorDictLens/Test.purs @@ -0,0 +1,26 @@ +module Golden.ProfunctorDictLens.Test where + +import Prelude + +import Data.Newtype (class Newtype, unwrap) +import Data.Profunctor (class Profunctor, dimap) +import Data.Profunctor (wrapIso) as Profunctor +import Effect (Effect) +import Effect.Console (logShow) + +newtype Wrapped = Wrapped Int + +derive instance newtypeWrapped :: Newtype Wrapped _ + +-- Same shape as Data.Lens._Newtype from issue #28: a binding whose body +-- is an application of a dict-consuming function, abstracted over the +-- Profunctor dictionary. Used twice in main so that the used-once +-- inliner cannot mask a lost dictionary lambda. +_Wrapped :: forall p. Profunctor p => p Int Int -> p Wrapped Wrapped +_Wrapped = dimap unwrap Wrapped + +main :: Effect Unit +main = do + logShow $ unwrap (_Wrapped (_ + 1) (Wrapped 10)) + logShow $ unwrap (_Wrapped (_ * 2) (Wrapped 10)) + logShow $ unwrap (Profunctor.wrapIso Wrapped (_ - 5) (Wrapped 10)) diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/corefn.json b/test/ps/output/Golden.ProfunctorDictLens.Test/corefn.json new file mode 100644 index 0000000..39ec527 --- /dev/null +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[20,24],"start":[20,18]}},"type":"Var","value":{"identifier":"unwrap","moduleName":["Data","Newtype"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[20,24],"start":[20,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,24],"start":[20,18]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"unwrap"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[24,51],"start":[24,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[24,51],"start":[24,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[24,51],"start":[24,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[24,10],"start":[24,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[24,10],"start":[24,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[24,34],"start":[24,33]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[24,37],"start":[24,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"add"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[25,34],"start":[25,33]}},"type":"Var","value":{"identifier":"mul","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[25,37],"start":[25,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"mul"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[26,39],"start":[26,21]}},"type":"Var","value":{"identifier":"wrapIso","moduleName":["Data","Profunctor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[26,47],"start":[26,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"profunctorFn","moduleName":["Data","Profunctor"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[26,47],"start":[26,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,47],"start":[26,21]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"wrapIso"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[26,52],"start":[26,51]}},"type":"Var","value":{"identifier":"sub","moduleName":["Data","Ring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[26,55],"start":[26,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"ringInt","moduleName":["Data","Ring"]}},"type":"App"},"identifier":"sub"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,30],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[11,30],"start":[11,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,30],"start":[11,1]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}},"type":"Abs"},"identifier":"Wrapped"},{"annotation":{"meta":null,"sourceSpan":{"end":[13,52],"start":[13,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[13,52],"start":[13,1]}},"type":"Var","value":{"identifier":"Newtype$Dict","moduleName":["Data","Newtype"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,52],"start":[13,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,52],"start":[13,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["Coercible0",{"annotation":{"meta":null,"sourceSpan":{"end":[13,52],"start":[13,1]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[13,52],"start":[13,1]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"Abs"}]]}},"type":"App"},"identifier":"newtypeWrapped"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,69],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,69],"start":[19,1]}},"argument":"dictProfunctor","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[20,17],"start":[20,12]}},"type":"Var","value":{"identifier":"dimap","moduleName":["Data","Profunctor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[20,24],"start":[20,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictProfunctor","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,24],"start":[20,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"unwrap","moduleName":["Golden","ProfunctorDictLens","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,32],"start":[20,12]}},"argument":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[20,32],"start":[20,25]}},"type":"Var","value":{"identifier":"Wrapped","moduleName":["Golden","ProfunctorDictLens","Test"]}},"type":"App"},"type":"Abs"},"identifier":"_Wrapped"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[24,29],"start":[24,21]}},"type":"Var","value":{"identifier":"_Wrapped","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[24,37],"start":[24,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"profunctorFn","moduleName":["Data","Profunctor"]}},"type":"App"},"identifier":"_Wrapped1"},{"annotation":{"meta":null,"sourceSpan":{"end":[22,20],"start":[22,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,51],"start":[24,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,51],"start":[24,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"unwrap","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,51],"start":[24,13]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"_Wrapped1","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,37],"start":[24,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,37],"start":[24,30]}},"argument":"v","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,37],"start":[24,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,37],"start":[24,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,36],"start":[24,35]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,50],"start":[24,21]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[24,46],"start":[24,39]}},"type":"Var","value":{"identifier":"Wrapped","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,49],"start":[24,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,49],"start":[24,47]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,51],"start":[24,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,51],"start":[24,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,51],"start":[25,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,51],"start":[25,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"unwrap","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,51],"start":[25,13]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"_Wrapped1","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,37],"start":[25,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,37],"start":[25,30]}},"argument":"v","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"mul","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,37],"start":[25,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,37],"start":[25,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,36],"start":[25,35]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,50],"start":[25,21]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[25,46],"start":[25,39]}},"type":"Var","value":{"identifier":"Wrapped","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,49],"start":[25,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,49],"start":[25,47]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,51],"start":[25,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,51],"start":[25,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[26,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"unwrap","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[26,13]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"wrapIso","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,47],"start":[26,21]}},"argument":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[26,47],"start":[26,40]}},"type":"Var","value":{"identifier":"Wrapped","moduleName":["Golden","ProfunctorDictLens","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[26,55],"start":[26,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,55],"start":[26,48]}},"argument":"v","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"sub","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,55],"start":[26,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[26,55],"start":[26,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,54],"start":[26,53]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[26,68],"start":[26,21]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[26,64],"start":[26,57]}},"type":"Var","value":{"identifier":"Wrapped","moduleName":["Golden","ProfunctorDictLens","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,67],"start":[26,57]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,67],"start":[26,65]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["Wrapped","_Wrapped","main","newtypeWrapped"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Data","Newtype"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Data","Profunctor"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Data","Ring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Golden","ProfunctorDictLens","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,69],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","ProfunctorDictLens","Test"],"modulePath":"golden/Golden/ProfunctorDictLens/Test.purs","reExports":{},"sourceSpan":{"end":[26,69],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/eval/.gitignore b/test/ps/output/Golden.ProfunctorDictLens.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/eval/golden.txt b/test/ps/output/Golden.ProfunctorDictLens.Test/eval/golden.txt new file mode 100644 index 0000000..f6c8ee5 --- /dev/null +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/eval/golden.txt @@ -0,0 +1,3 @@ +11 +20 +5 diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir new file mode 100644 index 0000000..ca8f9e1 --- /dev/null +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir @@ -0,0 +1,598 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Unsafe.Coerce", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Unsafe.Coerce" ) ".spago/unsafe-coerce/v6.1.0/src/Unsafe/Coerce.purs" + [ ( Nothing, Name "unsafeCoerce" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "semiringInt" + }, LiteralObject Nothing + [ + ( PropName "add", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intAdd" ) + ), + ( PropName "zero", LiteralInt Nothing 0 ), + ( PropName "mul", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMul" ) + ), + ( PropName "one", LiteralInt Nothing 1 ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Newtype", qnameName = Name "unwrap" + }, Abs Nothing ( ParamUnused Nothing ) + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Unsafe.Coerce" ) ( Name "foreign" ) ) 0 ) + ( PropName "unsafeCoerce" ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Profunctor", qnameName = Name "composeFlipped" + }, Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "g" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "compose", Abs Nothing + ( ParamNamed Nothing ( Name "f1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "g1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f1" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "g1" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ) + ) + ) + ] + ) + ( PropName "compose" ) + ) + ( Ref Nothing ( Local ( Name "g" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Profunctor", qnameName = Name "profunctorFn" + }, LiteralObject Nothing + [ + ( PropName "dimap", Abs Nothing + ( ParamNamed Nothing ( Name "a2b" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "c2d" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "b2c" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Profunctor" ) ( Name "composeFlipped" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "a2b" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Profunctor" ) ( Name "composeFlipped" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "b2c" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "c2d" ) ) 0 ) + ) + ) + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Profunctor", qnameName = Name "dimap" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "dimap" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ProfunctorDictLens.Test", qnameName = Name "unwrap" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Newtype" ) ( Name "unwrap" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ProfunctorDictLens.Test", qnameName = Name "discard" + }, App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ProfunctorDictLens.Test", qnameName = Name "logShow" + }, Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ) + ( PropName "showIntImpl" ) + ) + ] + ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ProfunctorDictLens.Test", qnameName = Name "Wrapped" + }, Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ProfunctorDictLens.Test", qnameName = Name "_Wrapped" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictProfunctor" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Profunctor" ) ( Name "dimap" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictProfunctor" ) ) 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "unwrap" ) ) 0 + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "Wrapped" ) ) 0 + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ProfunctorDictLens.Test", qnameName = Name "_Wrapped1" + }, App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "_Wrapped" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Profunctor" ) ( Name "profunctorFn" ) ) 0 ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "Wrapped", Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "Wrapped" ) ) 0 + ), + ( Name "_Wrapped", Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "_Wrapped" ) ) 0 + ), + ( Name "main", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "unwrap" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.ProfunctorDictLens.Test" ) + ( Name "_Wrapped1" ) + ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "add" ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) + ( LiteralInt Nothing 10 ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "unwrap" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.ProfunctorDictLens.Test" ) + ( Name "_Wrapped1" ) + ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "mul" ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 2 ) + ) + ) + ) + ( LiteralInt Nothing 10 ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ProfunctorDictLens.Test" ) ( Name "unwrap" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Profunctor" ) ( Name "dimap" ) ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.Profunctor" ) + ( Name "profunctorFn" ) + ) 0 + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Newtype" ) ( Name "unwrap" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Unsafe.Coerce" ) ( Name "foreign" ) ) 0 + ) + ( PropName "unsafeCoerce" ) + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "sub", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.0/src/Data/Ring.purs" + [ ( Nothing, Name "intSub" ) ] + ) + ( PropName "intSub" ) + ), + ( PropName "Semiring0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.Semiring" ) + ( Name "semiringInt" ) + ) 0 + ) + ) + ] + ) + ( PropName "sub" ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 5 ) + ) + ) + ) + ( LiteralInt Nothing 10 ) + ) + ) + ) + ) + ) + ) + ), + ( Name "newtypeWrapped", LiteralObject Nothing + [ + ( PropName "Coercible0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ] + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua new file mode 100644 index 0000000..cbc4b27 --- /dev/null +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua @@ -0,0 +1,129 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_Semiring_foreign = { + intAdd = function(x) return function(y) return x + y end end, + intMul = function(x) return function(y) return x * y end end +} +M.Unsafe_Coerce_foreign = { unsafeCoerce = function(x) return x end } +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Data_Semiring_semiringInt = { + add = M.Data_Semiring_foreign.intAdd, + zero = 0, + mul = M.Data_Semiring_foreign.intMul, + one = 1 +} +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Data_Newtype_unwrap = function() + return M.Unsafe_Coerce_foreign.unsafeCoerce +end +M.Data_Profunctor_composeFlipped = function(f) + return function(g) + return (function(f1) + return function(g1) return function(x) return f1(g1(x)) end end + end)(g)(f) + end +end +M.Data_Profunctor_profunctorFn = { + dimap = function(a2b) + return function(c2d) + return function(b2c) + return M.Data_Profunctor_composeFlipped(a2b)(M.Data_Profunctor_composeFlipped(b2c)(c2d)) + end + end + end +} +M.Data_Profunctor_dimap = function(dict) return dict.dimap end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_ProfunctorDictLens_Test_unwrap = M.Data_Newtype_unwrap() +M.Golden_ProfunctorDictLens_Test_discard = (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect) +M.Golden_ProfunctorDictLens_Test_logShow = function(a) + return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(a)) +end +M.Golden_ProfunctorDictLens_Test_Wrapped = function(x) return x end +M.Golden_ProfunctorDictLens_Test__Wrapped = function(dictProfunctor) + return M.Data_Profunctor_dimap(dictProfunctor)(M.Golden_ProfunctorDictLens_Test_unwrap)(M.Golden_ProfunctorDictLens_Test_Wrapped) +end +M.Golden_ProfunctorDictLens_Test__Wrapped1 = M.Golden_ProfunctorDictLens_Test__Wrapped(M.Data_Profunctor_profunctorFn) +return M.Golden_ProfunctorDictLens_Test_discard(M.Golden_ProfunctorDictLens_Test_logShow(M.Golden_ProfunctorDictLens_Test_unwrap(M.Golden_ProfunctorDictLens_Test__Wrapped1(function( v ) + return M.Data_Semiring_semiringInt.add(v)(1) +end)(10))))(function() + return M.Golden_ProfunctorDictLens_Test_discard(M.Golden_ProfunctorDictLens_Test_logShow(M.Golden_ProfunctorDictLens_Test_unwrap(M.Golden_ProfunctorDictLens_Test__Wrapped1(function( v ) + return M.Data_Semiring_semiringInt.mul(v)(2) + end)(10))))(function() + return M.Golden_ProfunctorDictLens_Test_logShow(M.Golden_ProfunctorDictLens_Test_unwrap(M.Data_Profunctor_dimap(M.Data_Profunctor_profunctorFn)(M.Data_Newtype_unwrap())(M.Unsafe_Coerce_foreign.unsafeCoerce)(function( v ) + return (function(x) return function(y) return x - y end end)(v)(5) + end)(10))) + end) +end)() diff --git a/test/ps/spago.dhall b/test/ps/spago.dhall index d7992f0..24e3ee1 100644 --- a/test/ps/spago.dhall +++ b/test/ps/spago.dhall @@ -1,5 +1,13 @@ { name = "test-project" -, dependencies = [ "console", "effect", "foldable-traversable", "prelude" ] +, dependencies = + [ "console" + , "effect" + , "foldable-traversable" + , "maybe" + , "newtype" + , "prelude" + , "profunctor" + ] , packages = ./packages.dhall , sources = [ "golden/**/*.purs" ] } From 5a797bee5c0ee0abc193b6bb07e14ae86465ad77 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 16:52:41 +0200 Subject: [PATCH 25/40] test: lock regression for #30 (maybe chain optimizer crash) Reproduces the nested maybe/map chain from issue #30 that used to crash the currying optimizer with 'Impossible subexpressions: IfThenElse'. The crash site was removed wholesale with the currying optimizer in 965d1fe; lib/ no longer contains the error call at all. Two modules cover both link modes: Golden.MaybeChain.Test with main and an eval golden (LinkAsApplication), and Golden.MaybeChainModule.Test without main (LinkAsModule, the mode the crash was reported in). --- test/ps/golden/Golden/MaybeChain/Test.purs | 15 + .../golden/Golden/MaybeChainModule/Test.purs | 14 + .../output/Golden.MaybeChain.Test/corefn.json | 1 + .../Golden.MaybeChain.Test/eval/.gitignore | 1 + .../Golden.MaybeChain.Test/eval/golden.txt | 2 + .../output/Golden.MaybeChain.Test/golden.ir | 465 ++++++++++++++++++ .../output/Golden.MaybeChain.Test/golden.lua | 116 +++++ .../Golden.MaybeChainModule.Test/corefn.json | 1 + .../Golden.MaybeChainModule.Test/golden.ir | 187 +++++++ .../Golden.MaybeChainModule.Test/golden.lua | 38 ++ 10 files changed, 840 insertions(+) create mode 100644 test/ps/golden/Golden/MaybeChain/Test.purs create mode 100644 test/ps/golden/Golden/MaybeChainModule/Test.purs create mode 100644 test/ps/output/Golden.MaybeChain.Test/corefn.json create mode 100644 test/ps/output/Golden.MaybeChain.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.MaybeChain.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.MaybeChain.Test/golden.ir create mode 100644 test/ps/output/Golden.MaybeChain.Test/golden.lua create mode 100644 test/ps/output/Golden.MaybeChainModule.Test/corefn.json create mode 100644 test/ps/output/Golden.MaybeChainModule.Test/golden.ir create mode 100644 test/ps/output/Golden.MaybeChainModule.Test/golden.lua diff --git a/test/ps/golden/Golden/MaybeChain/Test.purs b/test/ps/golden/Golden/MaybeChain/Test.purs new file mode 100644 index 0000000..014285e --- /dev/null +++ b/test/ps/golden/Golden/MaybeChain/Test.purs @@ -0,0 +1,15 @@ +module Golden.MaybeChain.Test where + +import Prelude + +import Data.Maybe (Maybe(..), maybe) +import Effect (Effect) +import Effect.Console (logShow) + +-- Repro for issue #30: nested maybe/map chains used to make the +-- (since removed) currying optimizer crash with +-- "Impossible subexpressions: IfThenElse". +main :: Effect Unit +main = do + logShow $ maybe 0 identity (maybe Nothing Just (map (\x -> x) Nothing)) + logShow $ maybe 0 identity (maybe Nothing Just (map (\x -> x) (Just 42))) diff --git a/test/ps/golden/Golden/MaybeChainModule/Test.purs b/test/ps/golden/Golden/MaybeChainModule/Test.purs new file mode 100644 index 0000000..7290eac --- /dev/null +++ b/test/ps/golden/Golden/MaybeChainModule/Test.purs @@ -0,0 +1,14 @@ +module Golden.MaybeChainModule.Test where + +import Prelude + +import Data.Maybe (Maybe(..), maybe) + +-- Same expressions as Golden.MaybeChain.Test, but without `main` and +-- without an eval golden, so the golden suite compiles this module in +-- LinkAsModule mode: the mode in which issue #30 reported the crash. +chainedNothing :: Int +chainedNothing = maybe 0 identity (maybe Nothing Just (map (\x -> x) Nothing)) + +chainedJust :: Int +chainedJust = maybe 0 identity (maybe Nothing Just (map (\x -> x) (Just 42))) diff --git a/test/ps/output/Golden.MaybeChain.Test/corefn.json b/test/ps/output/Golden.MaybeChain.Test/corefn.json new file mode 100644 index 0000000..f629d56 --- /dev/null +++ b/test/ps/output/Golden.MaybeChain.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,10],"start":[14,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,10],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,29],"start":[14,21]}},"type":"Var","value":{"identifier":"identity","moduleName":["Control","Category"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,29],"start":[14,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"categoryFn","moduleName":["Control","Category"]}},"type":"App"},"identifier":"identity"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,54],"start":[14,51]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,64],"start":[14,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorMaybe","moduleName":["Data","Maybe"]}},"type":"App"},"identifier":"map"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,20],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,74],"start":[14,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,74],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[14,74],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,74],"start":[14,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","MaybeChain","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,74],"start":[14,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,18],"start":[14,13]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,20],"start":[14,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,20],"start":[14,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,29],"start":[14,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"identity","moduleName":["Golden","MaybeChain","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,74],"start":[14,13]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,36],"start":[14,31]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,44],"start":[14,31]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,44],"start":[14,37]}},"type":"Var","value":{"identifier":"Nothing","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,49],"start":[14,31]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,49],"start":[14,45]}},"type":"Var","value":{"identifier":"Just","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,73],"start":[14,31]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","MaybeChain","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,64],"start":[14,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,63],"start":[14,56]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,63],"start":[14,62]}},"type":"Var","value":{"identifier":"x","sourcePos":[14,57]}},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,72],"start":[14,51]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,72],"start":[14,65]}},"type":"Var","value":{"identifier":"Nothing","moduleName":["Data","Maybe"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,74],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,74],"start":[14,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","MaybeChain","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[15,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,18],"start":[15,13]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,20],"start":[15,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,20],"start":[15,19]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[15,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"identity","moduleName":["Golden","MaybeChain","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[15,13]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,36],"start":[15,31]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,44],"start":[15,31]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[15,44],"start":[15,37]}},"type":"Var","value":{"identifier":"Nothing","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,49],"start":[15,31]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[15,49],"start":[15,45]}},"type":"Var","value":{"identifier":"Just","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,75],"start":[15,31]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","MaybeChain","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,64],"start":[15,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,63],"start":[15,56]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[15,63],"start":[15,62]}},"type":"Var","value":{"identifier":"x","sourcePos":[15,57]}},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,74],"start":[15,51]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[15,70],"start":[15,66]}},"type":"Var","value":{"identifier":"Just","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,73],"start":[15,66]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,73],"start":[15,71]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Control","Category"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Data","Function"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Data","Functor"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Data","Maybe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,76],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","MaybeChain","Test"],"modulePath":"golden/Golden/MaybeChain/Test.purs","reExports":{},"sourceSpan":{"end":[15,76],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.MaybeChain.Test/eval/.gitignore b/test/ps/output/Golden.MaybeChain.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.MaybeChain.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.MaybeChain.Test/eval/golden.txt b/test/ps/output/Golden.MaybeChain.Test/eval/golden.txt new file mode 100644 index 0000000..dcd912c --- /dev/null +++ b/test/ps/output/Golden.MaybeChain.Test/eval/golden.txt @@ -0,0 +1,2 @@ +0 +42 diff --git a/test/ps/output/Golden.MaybeChain.Test/golden.ir b/test/ps/output/Golden.MaybeChain.Test/golden.ir new file mode 100644 index 0000000..1b8373c --- /dev/null +++ b/test/ps/output/Golden.MaybeChain.Test/golden.ir @@ -0,0 +1,465 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "Nothing" + }, Ctor Nothing SumType + ( ModuleName "Data.Maybe" ) + ( TyName "Maybe" ) + ( CtorName "Nothing" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "Just" + }, Ctor Nothing SumType + ( ModuleName "Data.Maybe" ) + ( TyName "Maybe" ) + ( CtorName "Just" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "maybe" }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v2" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.MaybeChain.Test", qnameName = Name "logShow" + }, Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ) + ( PropName "showIntImpl" ) + ) + ] + ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.MaybeChain.Test", qnameName = Name "identity" + }, ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "identity", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ), + ( PropName "Semigroupoid0", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "compose", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "g" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "g" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ) + ) + ) + ] + ) + ) + ] + ) + ( PropName "identity" ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.MaybeChain.Test", qnameName = Name "map" + }, ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ) + ) + ] + ) + ( PropName "map" ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "main", App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChain.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( LiteralInt Nothing 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChain.Test" ) ( Name "identity" ) ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChain.Test" ) ( Name "map" ) ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChain.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( LiteralInt Nothing 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChain.Test" ) ( Name "identity" ) ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChain.Test" ) ( Name "map" ) ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( LiteralInt Nothing 42 ) + ) + ) + ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.MaybeChain.Test/golden.lua b/test/ps/output/Golden.MaybeChain.Test/golden.lua new file mode 100644 index 0000000..8c97669 --- /dev/null +++ b/test/ps/output/Golden.MaybeChain.Test/golden.lua @@ -0,0 +1,116 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Data_Maybe_Nothing = { ["$ctor"] = "Data.Maybe∷Maybe.Nothing" } +M.Data_Maybe_Just = function(value0) + return { ["$ctor"] = "Data.Maybe∷Maybe.Just", value0 = value0 } +end +M.Data_Maybe_maybe = function(v) + return function(v1) + return function(v2) + if "Data.Maybe∷Maybe.Nothing" == v2["$ctor"] then + return v + else + if "Data.Maybe∷Maybe.Just" == v2["$ctor"] then + return v1(v2.value0) + else + return error("No patterns matched") + end + end + end + end +end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_MaybeChain_Test_logShow = function(a) + return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(a)) +end +M.Golden_MaybeChain_Test_identity = function(x) return x end +M.Golden_MaybeChain_Test_map = function(v) + return function(v1) + if "Data.Maybe∷Maybe.Just" == v1["$ctor"] then + return M.Data_Maybe_Just(v(v1.value0)) + else + return M.Data_Maybe_Nothing + end + end +end +return (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect)(M.Golden_MaybeChain_Test_logShow(M.Data_Maybe_maybe(0)(M.Golden_MaybeChain_Test_identity)(M.Data_Maybe_maybe(M.Data_Maybe_Nothing)(M.Data_Maybe_Just)(M.Golden_MaybeChain_Test_map(function( x ) + return x +end)(M.Data_Maybe_Nothing)))))(function() + return M.Golden_MaybeChain_Test_logShow(M.Data_Maybe_maybe(0)(M.Golden_MaybeChain_Test_identity)(M.Data_Maybe_maybe(M.Data_Maybe_Nothing)(M.Data_Maybe_Just)(M.Golden_MaybeChain_Test_map(function( x ) + return x + end)(M.Data_Maybe_Just(42))))) +end)() diff --git a/test/ps/output/Golden.MaybeChainModule.Test/corefn.json b/test/ps/output/Golden.MaybeChainModule.Test/corefn.json new file mode 100644 index 0000000..f961d4f --- /dev/null +++ b/test/ps/output/Golden.MaybeChainModule.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[11,34],"start":[11,26]}},"type":"Var","value":{"identifier":"identity","moduleName":["Control","Category"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[11,34],"start":[11,26]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"categoryFn","moduleName":["Control","Category"]}},"type":"App"},"identifier":"identity"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[11,59],"start":[11,56]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[11,69],"start":[11,56]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorMaybe","moduleName":["Data","Maybe"]}},"type":"App"},"identifier":"map"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,22],"start":[10,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[11,23],"start":[11,18]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,25],"start":[11,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,25],"start":[11,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[11,34],"start":[11,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"identity","moduleName":["Golden","MaybeChainModule","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[11,79],"start":[11,18]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[11,41],"start":[11,36]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,49],"start":[11,36]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,49],"start":[11,42]}},"type":"Var","value":{"identifier":"Nothing","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[11,54],"start":[11,36]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,54],"start":[11,50]}},"type":"Var","value":{"identifier":"Just","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[11,78],"start":[11,36]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","MaybeChainModule","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,69],"start":[11,56]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,68],"start":[11,61]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[11,68],"start":[11,67]}},"type":"Var","value":{"identifier":"x","sourcePos":[11,62]}},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[11,77],"start":[11,56]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[11,77],"start":[11,70]}},"type":"Var","value":{"identifier":"Nothing","moduleName":["Data","Maybe"]}},"type":"App"},"type":"App"},"type":"App"},"identifier":"chainedNothing"},{"annotation":{"meta":null,"sourceSpan":{"end":[13,19],"start":[13,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,20],"start":[14,15]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,22],"start":[14,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,31],"start":[14,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"identity","moduleName":["Golden","MaybeChainModule","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,78],"start":[14,15]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,38],"start":[14,33]}},"type":"Var","value":{"identifier":"maybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,46],"start":[14,33]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,46],"start":[14,39]}},"type":"Var","value":{"identifier":"Nothing","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,51],"start":[14,33]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,51],"start":[14,47]}},"type":"Var","value":{"identifier":"Just","moduleName":["Data","Maybe"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,77],"start":[14,33]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","MaybeChainModule","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,66],"start":[14,53]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,65],"start":[14,58]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,65],"start":[14,64]}},"type":"Var","value":{"identifier":"x","sourcePos":[14,59]}},"type":"Abs"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,76],"start":[14,53]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,72],"start":[14,68]}},"type":"Var","value":{"identifier":"Just","moduleName":["Data","Maybe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,75],"start":[14,68]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,75],"start":[14,73]}},"type":"Literal","value":{"literalType":"IntLiteral","value":42}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"identifier":"chainedJust"}],"exports":["chainedNothing","chainedJust"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,78],"start":[1,1]}},"moduleName":["Control","Category"]},{"annotation":{"meta":null,"sourceSpan":{"end":[14,78],"start":[1,1]}},"moduleName":["Data","Functor"]},{"annotation":{"meta":null,"sourceSpan":{"end":[14,78],"start":[1,1]}},"moduleName":["Data","Maybe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[14,78],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","MaybeChainModule","Test"],"modulePath":"golden/Golden/MaybeChainModule/Test.purs","reExports":{},"sourceSpan":{"end":[14,78],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.MaybeChainModule.Test/golden.ir b/test/ps/output/Golden.MaybeChainModule.Test/golden.ir new file mode 100644 index 0000000..079b572 --- /dev/null +++ b/test/ps/output/Golden.MaybeChainModule.Test/golden.ir @@ -0,0 +1,187 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "Nothing" + }, Ctor Nothing SumType + ( ModuleName "Data.Maybe" ) + ( TyName "Maybe" ) + ( CtorName "Nothing" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "Just" + }, Ctor Nothing SumType + ( ModuleName "Data.Maybe" ) + ( TyName "Maybe" ) + ( CtorName "Just" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "maybe" }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v2" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.MaybeChainModule.Test", qnameName = Name "identity" + }, ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "identity", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ), + ( PropName "Semigroupoid0", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "compose", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "g" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "g" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ) + ) + ) + ] + ) + ) + ] + ) + ( PropName "identity" ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.MaybeChainModule.Test", qnameName = Name "map" + }, ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ) + ) + ] + ) + ( PropName "map" ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "chainedNothing", App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( LiteralInt Nothing 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChainModule.Test" ) ( Name "identity" ) ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChainModule.Test" ) ( Name "map" ) ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ) + ), + ( Name "chainedJust", App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( LiteralInt Nothing 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChainModule.Test" ) ( Name "identity" ) ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "maybe" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.MaybeChainModule.Test" ) ( Name "map" ) ) 0 + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( LiteralInt Nothing 42 ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.MaybeChainModule.Test/golden.lua b/test/ps/output/Golden.MaybeChainModule.Test/golden.lua new file mode 100644 index 0000000..55d9d79 --- /dev/null +++ b/test/ps/output/Golden.MaybeChainModule.Test/golden.lua @@ -0,0 +1,38 @@ +local M = {} +M.Data_Maybe_Nothing = { ["$ctor"] = "Data.Maybe∷Maybe.Nothing" } +M.Data_Maybe_Just = function(value0) + return { ["$ctor"] = "Data.Maybe∷Maybe.Just", value0 = value0 } +end +M.Data_Maybe_maybe = function(v) + return function(v1) + return function(v2) + if "Data.Maybe∷Maybe.Nothing" == v2["$ctor"] then + return v + else + if "Data.Maybe∷Maybe.Just" == v2["$ctor"] then + return v1(v2.value0) + else + return error("No patterns matched") + end + end + end + end +end +M.Golden_MaybeChainModule_Test_identity = function(x) return x end +M.Golden_MaybeChainModule_Test_map = function(v) + return function(v1) + if "Data.Maybe∷Maybe.Just" == v1["$ctor"] then + return M.Data_Maybe_Just(v(v1.value0)) + else + return M.Data_Maybe_Nothing + end + end +end +return { + chainedNothing = M.Data_Maybe_maybe(0)(M.Golden_MaybeChainModule_Test_identity)(M.Data_Maybe_maybe(M.Data_Maybe_Nothing)(M.Data_Maybe_Just)(M.Golden_MaybeChainModule_Test_map(function( x ) + return x + end)(M.Data_Maybe_Nothing))), + chainedJust = M.Data_Maybe_maybe(0)(M.Golden_MaybeChainModule_Test_identity)(M.Data_Maybe_maybe(M.Data_Maybe_Nothing)(M.Data_Maybe_Just)(M.Golden_MaybeChainModule_Test_map(function( x ) + return x + end)(M.Data_Maybe_Just(42)))) +} From 42cefb6f65f7d9ddb50f75e61c9c2bd5cfae1bf4 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Fri, 12 Jun 2026 21:30:06 +0200 Subject: [PATCH 26/40] fix: escape special characters in Char literals A Char literal compiled to a raw character inside a double-quoted Lua string. For control characters this produces an unparseable chunk: '\n' splits the string literal across lines, and stock Lua refuses to load the file. Escape Char literals the same way String literals are escaped (decodeStringEscaping). --- lib/Language/PureScript/Backend/Lua.hs | 3 +- test/ps/golden/Golden/CharLiterals/Test.purs | 20 + .../Golden.CharLiterals.Test/corefn.json | 1 + .../Golden.CharLiterals.Test/eval/.gitignore | 1 + .../Golden.CharLiterals.Test/eval/golden.txt | 8 + .../output/Golden.CharLiterals.Test/golden.ir | 573 ++++++++++++++++++ .../Golden.CharLiterals.Test/golden.lua | 162 +++++ 7 files changed, 767 insertions(+), 1 deletion(-) create mode 100644 test/ps/golden/Golden/CharLiterals/Test.purs create mode 100644 test/ps/output/Golden.CharLiterals.Test/corefn.json create mode 100644 test/ps/output/Golden.CharLiterals.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.CharLiterals.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.CharLiterals.Test/golden.ir create mode 100644 test/ps/output/Golden.CharLiterals.Test/golden.lua diff --git a/lib/Language/PureScript/Backend/Lua.hs b/lib/Language/PureScript/Backend/Lua.hs index eaf7d24..31c230f 100644 --- a/lib/Language/PureScript/Backend/Lua.hs +++ b/lib/Language/PureScript/Backend/Lua.hs @@ -33,6 +33,7 @@ import Language.PureScript.Backend.Lua.Types qualified as Lua import Language.PureScript.Backend.Types (AppOrModule (..)) import Language.PureScript.Names (ModuleName (..), runModuleName) import Language.PureScript.Names qualified as PS +import Language.PureScript.PSString (decodeStringEscaping, mkString) import Path (Abs, Dir, Path) import Prelude hiding (exp, local) @@ -149,7 +150,7 @@ fromIR foreigns topLevelNames modname ir = case ir of IR.LiteralString _ann s → pure . Right $ Lua.String s IR.LiteralChar _ann c → - pure . Right $ Lua.String $ Text.singleton c + pure (Right (Lua.String (decodeStringEscaping (mkString (Text.singleton c))))) IR.LiteralBool _ann b → pure . Right $ Lua.Boolean b IR.LiteralArray _ann exprs → diff --git a/test/ps/golden/Golden/CharLiterals/Test.purs b/test/ps/golden/Golden/CharLiterals/Test.purs new file mode 100644 index 0000000..1b21e51 --- /dev/null +++ b/test/ps/golden/Golden/CharLiterals/Test.purs @@ -0,0 +1,20 @@ +-- Char literals must be escaped in generated Lua: an unescaped '\n' inside +-- a quoted Lua string splits it across lines, producing a chunk no Lua +-- interpreter can parse. +module Golden.CharLiterals.Test where + +import Prelude + +import Effect (Effect) +import Effect.Console (log) + +main :: Effect Unit +main = do + log (show '\n') + log (show '\t') + log (show '\r') + log (show '\'') + log (show '\\') + log (show 'a') + log (show ('\n' == '\n')) + log (show ('\t' < '\n')) diff --git a/test/ps/output/Golden.CharLiterals.Test/corefn.json b/test/ps/output/Golden.CharLiterals.Test/corefn.json new file mode 100644 index 0000000..6fbd271 --- /dev/null +++ b/test/ps/output/Golden.CharLiterals.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[{"LineComment":" Char literals must be escaped in generated Lua: an unescaped '\\n' inside"},{"LineComment":" a quoted Lua string splits it across lines, producing a chunk no Lua"},{"LineComment":" interpreter can parse."}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,18],"start":[13,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[13,18],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[13,18],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,12],"start":[13,8]}},"type":"Var","value":{"identifier":"show","moduleName":["Data","Show"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[13,17],"start":[13,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showChar","moduleName":["Data","Show"]}},"type":"App"},"identifier":"show"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[19,12],"start":[19,8]}},"type":"Var","value":{"identifier":"show","moduleName":["Data","Show"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[19,27],"start":[19,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showBoolean","moduleName":["Data","Show"]}},"type":"App"},"identifier":"show1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[19,21],"start":[19,19]}},"type":"Var","value":{"identifier":"eq","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[19,26],"start":[19,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqChar","moduleName":["Data","Eq"]}},"type":"App"},"identifier":"eq"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[20,20],"start":[20,19]}},"type":"Var","value":{"identifier":"lessThan","moduleName":["Data","Ord"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[20,25],"start":[20,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"ordChar","moduleName":["Data","Ord"]}},"type":"App"},"identifier":"lessThan"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,20],"start":[11,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,18],"start":[13,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,6],"start":[13,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,18],"start":[13,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,13]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\n"}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[13,18],"start":[13,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,18],"start":[13,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[14,6],"start":[14,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,17],"start":[14,13]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\t"}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,18],"start":[14,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,18],"start":[15,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,6],"start":[15,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,18],"start":[15,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,17],"start":[15,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,17],"start":[15,13]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\r"}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,18],"start":[15,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,18],"start":[15,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,6],"start":[16,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,17],"start":[16,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,17],"start":[16,13]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"'"}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[17,6],"start":[17,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,17],"start":[17,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,17],"start":[17,13]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\\"}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[18,6],"start":[18,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[18,16],"start":[18,13]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"a"}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,28],"start":[19,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[19,6],"start":[19,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,28],"start":[19,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show1","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,27],"start":[19,8]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,18],"start":[19,14]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\n"}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,22]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\n"}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[19,28],"start":[19,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,28],"start":[19,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[20,6],"start":[20,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[20,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"show1","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,26],"start":[20,8]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"lessThan","moduleName":["Golden","CharLiterals","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,25],"start":[20,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,18],"start":[20,14]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\t"}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,25],"start":[20,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,25],"start":[20,21]}},"type":"Literal","value":{"literalType":"CharLiteral","value":"\n"}},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[4,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[4,1]}},"moduleName":["Data","Eq"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[4,1]}},"moduleName":["Data","Ord"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[4,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[4,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[4,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,27],"start":[4,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","CharLiterals","Test"],"modulePath":"golden/Golden/CharLiterals/Test.purs","reExports":{},"sourceSpan":{"end":[20,27],"start":[4,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.CharLiterals.Test/eval/.gitignore b/test/ps/output/Golden.CharLiterals.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.CharLiterals.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.CharLiterals.Test/eval/golden.txt b/test/ps/output/Golden.CharLiterals.Test/eval/golden.txt new file mode 100644 index 0000000..d4c9fd8 --- /dev/null +++ b/test/ps/output/Golden.CharLiterals.Test/eval/golden.txt @@ -0,0 +1,8 @@ +'\n' +'\t' +'\r' +'\'' +'\\' +'a' +true +true diff --git a/test/ps/output/Golden.CharLiterals.Test/golden.ir b/test/ps/output/Golden.CharLiterals.Test/golden.ir new file mode 100644 index 0000000..ac1a435 --- /dev/null +++ b/test/ps/output/Golden.CharLiterals.Test/golden.ir @@ -0,0 +1,573 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqChar" + }, LiteralObject Nothing + [ + ( PropName "eq", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.0/src/Data/Eq.purs" + [ ( Nothing, Name "eqCharImpl" ) ] + ) + ( PropName "eqCharImpl" ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Show", qnameName = Name "show" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "show" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CharLiterals.Test", qnameName = Name "discard" + }, App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CharLiterals.Test", qnameName = Name "show" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "show" ) ) 0 ) + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + [ ( Nothing, Name "showCharImpl" ) ] + ) + ( PropName "showCharImpl" ) + ) + ] + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CharLiterals.Test", qnameName = Name "show1" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "show" ) ) 0 ) + ( LiteralObject Nothing + [ + ( PropName "show", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( LiteralString Nothing "true" ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralBool Nothing False ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralString Nothing "false" ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "main", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) 0 ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "show" ) ) 0 + ) + ( LiteralChar Nothing ' ' ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) 0 ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "show" ) ) 0 + ) + ( LiteralChar Nothing '\x9' ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) 0 + ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "show" ) ) 0 + ) + ( LiteralChar Nothing '\xd' ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) 0 + ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.CharLiterals.Test" ) ( Name "show" ) ) 0 + ) + ( LiteralChar Nothing ''' ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CharLiterals.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) 0 + ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CharLiterals.Test" ) + ( Name "show" ) + ) 0 + ) + ( LiteralChar Nothing '\' ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CharLiterals.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Console" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CharLiterals.Test" ) + ( Name "show" ) + ) 0 + ) + ( LiteralChar Nothing 'a' ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CharLiterals.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Console" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CharLiterals.Test" ) + ( Name "show1" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqChar" ) + ) 0 + ) + ( PropName "eq" ) + ) + ( LiteralChar Nothing ' ' ) + ) + ( LiteralChar Nothing ' ' ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Console" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "log" ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CharLiterals.Test" ) + ( Name "show1" ) + ) 0 + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Ordering∷Ordering.LT" ) + ( ReflectCtor Nothing + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "compare", App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.0/src/Data/Ord.purs" + [ ( Nothing, Name "ordCharImpl" ) ] + ) + ( PropName "ordCharImpl" ) + ) + ( Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "LT" ) [] + ) + ) + ( Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "EQ" ) [] + ) + ) + ( Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "GT" ) [] + ) + ), + ( PropName "Eq0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqChar" ) + ) 0 + ) + ) + ] + ) + ( PropName "compare" ) + ) + ( LiteralChar Nothing '\x9' ) + ) + ( LiteralChar Nothing ' ' ) + ) + ) + ) ( LiteralBool Nothing True ) ( LiteralBool Nothing False ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.CharLiterals.Test/golden.lua b/test/ps/output/Golden.CharLiterals.Test/golden.lua new file mode 100644 index 0000000..c5e43fb --- /dev/null +++ b/test/ps/output/Golden.CharLiterals.Test/golden.lua @@ -0,0 +1,162 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Effect_Console_foreign = { + log = function(s) return function() print(s) end end +} +M.Data_Eq_eqChar = { + eq = ((function() + local refEq = function(r1) return function(r2) return r1 == r2 end end + return { eqCharImpl = refEq } + end)()).eqCharImpl +} +M.Data_Show_show = function(dict) return dict.show end +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_CharLiterals_Test_discard = (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect) +M.Golden_CharLiterals_Test_show = M.Data_Show_show({ + show = function(n) + local code = n:byte() + if code < 0x20 or code == 0x7F then + if n == "\x07" then return "'\\a'" end + if n == "\b" then return "'\\b'" end + if n == "\f" then return "'\\f'" end + if n == "\n" then return "'\\n'" end + if n == "\r" then return "'\\r'" end + if n == "\t" then return "'\\t'" end + if n == "\v" then return "'\\v'" end + return "'\\" .. code:toString(10) .. "'" + end + if n == "'" or n == "\\" then return "'\\" .. n .. "'" end + return "'" .. n .. "'" + end +}) +M.Golden_CharLiterals_Test_show1 = M.Data_Show_show({ + show = function(v) + if v then + return "true" + else + if false == v then + return "false" + else + return error("No patterns matched") + end + end + end +}) +return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show("\n")))(function( ) + return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show("\t")))(function( ) + return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show("\r")))(function( ) + return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show("\'")))(function( ) + return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show("\\")))(function( ) + return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show("a")))(function( ) + return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show1(M.Data_Eq_eqChar.eq("\n")("\n"))))(function( ) + return M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show1((function( ) + if "Data.Ordering∷Ordering.LT" == ((function() + local unsafeCoerceImpl = function(lt) + return function(eq) + return function(gt) + return function(x) + return function(y) + if x < y then + return lt + elseif x == y then + return eq + else + return gt + end + end + end + end + end + end + return { ordCharImpl = unsafeCoerceImpl } + end)()).ordCharImpl({ + ["$ctor"] = "Data.Ordering∷Ordering.LT" + })({ ["$ctor"] = "Data.Ordering∷Ordering.EQ" })({ + ["$ctor"] = "Data.Ordering∷Ordering.GT" + })("\t")("\n")["$ctor"] then + return true + else + return false + end + end)())) + end) + end) + end) + end) + end) + end) +end)() From 7973b70832e9f065f59a50cca16e85b5a7569519 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sat, 13 Jun 2026 23:02:52 +0200 Subject: [PATCH 27/40] test: golden for Data.String.CodePoints over UTF-8 (closes #36) Add Golden.StringCodePoints exercising the implemented CodePoints (Unisay/purescript-lua-strings v6.2.0) end to end: decode, length vs byte length, take/drop on code-point boundaries, codePointAt including an astral code point, uncons, encode round-trip and singleton. Output is all Ints/Bools so the eval golden stays ASCII. Bump test/ps to package set psc-0.15.15-20260613-2 (strings v6.2.0 and prelude v7.2.1). The prelude bump reflows the version paths embedded in every golden.ir and updates Show.lua in CharLiterals golden.lua (the Lua 5.1 fixes); no eval golden changed. luacheck on generated goldens now also passes --no-redefined: linked library fallbacks reuse a parameter name and shadow, which is harmless in generated code (same rationale as the existing --no-unused). --- .../PureScript/Backend/Lua/Golden/Spec.hs | 2 + .../golden/Golden/StringCodePoints/Test.purs | 48 + .../output/Golden.ArrayOfUnits.Test/golden.ir | 6 +- .../Golden.BugListGenericEq.Test/golden.ir | 6 +- .../output/Golden.CharLiterals.Test/golden.ir | 6 +- .../Golden.CharLiterals.Test/golden.lua | 4 +- .../Golden.DerivedFunctor.Test/golden.ir | 4 +- .../ps/output/Golden.Fibonacci.Test/golden.ir | 6 +- .../Golden.GenericEqTwoTypes.Test/golden.ir | 6 +- .../output/Golden.HelloPrelude.Test/golden.ir | 2 +- test/ps/output/Golden.Issue37.Test/golden.ir | 2 +- .../output/Golden.MaybeChain.Test/golden.ir | 2 +- .../Golden.ProfunctorDictLens.Test/golden.ir | 6 +- .../Golden.StringCodePoints.Test/corefn.json | 1 + .../eval/.gitignore | 1 + .../eval/golden.txt | 12 + .../Golden.StringCodePoints.Test/golden.ir | 3043 +++++++++++++++++ .../Golden.StringCodePoints.Test/golden.lua | 764 +++++ test/ps/packages.dhall | 4 +- test/ps/spago.dhall | 3 + 20 files changed, 3901 insertions(+), 27 deletions(-) create mode 100644 test/ps/golden/Golden/StringCodePoints/Test.purs create mode 100644 test/ps/output/Golden.StringCodePoints.Test/corefn.json create mode 100644 test/ps/output/Golden.StringCodePoints.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.StringCodePoints.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.StringCodePoints.Test/golden.ir create mode 100644 test/ps/output/Golden.StringCodePoints.Test/golden.lua diff --git a/test/Language/PureScript/Backend/Lua/Golden/Spec.hs b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs index 50ba4a7..9e3df3f 100644 --- a/test/Language/PureScript/Backend/Lua/Golden/Spec.hs +++ b/test/Language/PureScript/Backend/Lua/Golden/Spec.hs @@ -165,6 +165,8 @@ spec = do , "--std min" , "--no-color" , "--no-unused" -- TODO: harden eventually + , "--no-redefined" -- generated code shadows freely (e.g. + -- inlined library fallbacks reusing a parameter name) , "--no-max-line-length" , "--formatter plain" , "--allow-defined" diff --git a/test/ps/golden/Golden/StringCodePoints/Test.purs b/test/ps/golden/Golden/StringCodePoints/Test.purs new file mode 100644 index 0000000..32b68ff --- /dev/null +++ b/test/ps/golden/Golden/StringCodePoints/Test.purs @@ -0,0 +1,48 @@ +-- Exercises Data.String.CodePoints end to end on the released package set +-- (Unisay/purescript-lua-strings v6.2.0). The test string mixes UTF-8 widths +-- 1..4: 'a' (1 byte), 'é' (2), 'Я' (2, Cyrillic), '𝐀' (4, astral), 'z' (1). +-- Output is all Ints/Bools via fromEnum so the golden stays ASCII and does +-- not depend on how strings are shown. +module Golden.StringCodePoints.Test where + +import Prelude + +import Data.Enum (fromEnum, toEnum) +import Data.Maybe (fromJust) +import Data.String.CodePoints (CodePoint) +import Data.String.CodePoints as SCP +import Data.String.CodeUnits as SCU +import Effect (Effect) +import Effect.Console (logShow) +import Partial.Unsafe (unsafePartial) + +str :: String +str = "aéЯ𝐀z" + +codes :: String -> Array Int +codes = map fromEnum <<< SCP.toCodePointArray + +main :: Effect Unit +main = do + -- decode every code point + logShow (codes str) + -- code-point length vs byte length + logShow (SCP.length str) + logShow (SCU.length str) + -- take/drop split on a code-point boundary (not mid-multibyte) + logShow (codes (SCP.take 2 str)) + logShow (codes (SCP.drop 2 str)) + -- indexing, including the astral code point and out of range + logShow (fromEnum <$> SCP.codePointAt 0 str) + logShow (fromEnum <$> SCP.codePointAt 3 str) + logShow (fromEnum <$> SCP.codePointAt 5 str) + -- uncons head and the decoded tail + logShow ((fromEnum <<< _.head) <$> SCP.uncons str) + logShow ((codes <<< _.tail) <$> SCP.uncons str) + -- encode round-trips back to the original bytes + logShow (SCP.fromCodePointArray (SCP.toCodePointArray str) == str) + -- singleton of an astral code point decodes back to itself + logShow (codes (SCP.singleton (cp 0x1D400))) + +cp :: Int -> CodePoint +cp = unsafePartial fromJust <<< toEnum diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir index 7d484a1..6244fc6 100644 --- a/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir +++ b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Unit", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs" + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.1/src/Data/Unit.purs" [ ( Just Always, Name "unit" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName @@ -552,7 +552,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.BugListGenericEq.Test/golden.ir b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir index 672bd68..f1dc37f 100644 --- a/test/ps/output/Golden.BugListGenericEq.Test/golden.ir +++ b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.0/src/Data/HeytingAlgebra.purs" + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.1/src/Data/HeytingAlgebra.purs" [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] ), Standalone ( QName @@ -120,7 +120,7 @@ UberModule ( Nothing, Name "get", App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.0/src/Record/Unsafe.purs" + ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.1/src/Record/Unsafe.purs" [ ( Nothing, Name "unsafeGet" ) ] ) ( PropName "unsafeGet" ) @@ -883,7 +883,7 @@ UberModule [ ( PropName "eq", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.0/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" [ ( Nothing, Name "eqIntImpl" ) ] ) ( PropName "eqIntImpl" ) diff --git a/test/ps/output/Golden.CharLiterals.Test/golden.ir b/test/ps/output/Golden.CharLiterals.Test/golden.ir index ac1a435..2d1b1fa 100644 --- a/test/ps/output/Golden.CharLiterals.Test/golden.ir +++ b/test/ps/output/Golden.CharLiterals.Test/golden.ir @@ -19,7 +19,7 @@ UberModule [ ( PropName "eq", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.0/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" [ ( Nothing, Name "eqCharImpl" ) ] ) ( PropName "eqCharImpl" ) @@ -266,7 +266,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" [ ( Nothing, Name "showCharImpl" ) ] ) ( PropName "showCharImpl" ) @@ -511,7 +511,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.0/src/Data/Ord.purs" + ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.1/src/Data/Ord.purs" [ ( Nothing, Name "ordCharImpl" ) ] ) ( PropName "ordCharImpl" ) diff --git a/test/ps/output/Golden.CharLiterals.Test/golden.lua b/test/ps/output/Golden.CharLiterals.Test/golden.lua index c5e43fb..0faefe2 100644 --- a/test/ps/output/Golden.CharLiterals.Test/golden.lua +++ b/test/ps/output/Golden.CharLiterals.Test/golden.lua @@ -90,14 +90,14 @@ M.Golden_CharLiterals_Test_show = M.Data_Show_show({ show = function(n) local code = n:byte() if code < 0x20 or code == 0x7F then - if n == "\x07" then return "'\\a'" end + if n == "\a" then return "'\\a'" end if n == "\b" then return "'\\b'" end if n == "\f" then return "'\\f'" end if n == "\n" then return "'\\n'" end if n == "\r" then return "'\\r'" end if n == "\t" then return "'\\t'" end if n == "\v" then return "'\\v'" end - return "'\\" .. code:toString(10) .. "'" + return "'\\" .. tostring(code) .. "'" end if n == "'" or n == "\\" then return "'\\" .. n .. "'" end return "'" .. n .. "'" diff --git a/test/ps/output/Golden.DerivedFunctor.Test/golden.ir b/test/ps/output/Golden.DerivedFunctor.Test/golden.ir index 021f2f6..3c06bf6 100644 --- a/test/ps/output/Golden.DerivedFunctor.Test/golden.ir +++ b/test/ps/output/Golden.DerivedFunctor.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName @@ -285,7 +285,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.Fibonacci.Test/golden.ir b/test/ps/output/Golden.Fibonacci.Test/golden.ir index 8296ee6..e4d6877 100644 --- a/test/ps/output/Golden.Fibonacci.Test/golden.ir +++ b/test/ps/output/Golden.Fibonacci.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName @@ -30,7 +30,7 @@ UberModule [ ( PropName "sub", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.0/src/Data/Ring.purs" + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" [ ( Nothing, Name "intSub" ) ] ) ( PropName "intSub" ) @@ -114,7 +114,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir index 35a5c01..a1c6973 100644 --- a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.0/src/Data/HeytingAlgebra.purs" + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.1/src/Data/HeytingAlgebra.purs" [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] ), Standalone ( QName @@ -90,7 +90,7 @@ UberModule [ ( PropName "eq", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.0/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" [ ( Nothing, Name "eqIntImpl" ) ] ) ( PropName "eqIntImpl" ) @@ -132,7 +132,7 @@ UberModule ( Nothing, Name "get", App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.0/src/Record/Unsafe.purs" + ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.1/src/Record/Unsafe.purs" [ ( Nothing, Name "unsafeGet" ) ] ) ( PropName "unsafeGet" ) diff --git a/test/ps/output/Golden.HelloPrelude.Test/golden.ir b/test/ps/output/Golden.HelloPrelude.Test/golden.ir index b7675b7..15b9f39 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/golden.ir +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.ir @@ -217,7 +217,7 @@ UberModule ) ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs" + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.1/src/Data/Unit.purs" [ ( Just Always, Name "unit" ) ] ) ( PropName "unit" ) diff --git a/test/ps/output/Golden.Issue37.Test/golden.ir b/test/ps/output/Golden.Issue37.Test/golden.ir index 346ed34..54bed84 100644 --- a/test/ps/output/Golden.Issue37.Test/golden.ir +++ b/test/ps/output/Golden.Issue37.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Unit", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs" + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.1/src/Data/Unit.purs" [ ( Just Always, Name "unit" ) ] ), Standalone ( QName diff --git a/test/ps/output/Golden.MaybeChain.Test/golden.ir b/test/ps/output/Golden.MaybeChain.Test/golden.ir index 1b8373c..6461efd 100644 --- a/test/ps/output/Golden.MaybeChain.Test/golden.ir +++ b/test/ps/output/Golden.MaybeChain.Test/golden.ir @@ -279,7 +279,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir index ca8f9e1..16df027 100644 --- a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName @@ -368,7 +368,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) @@ -556,7 +556,7 @@ UberModule [ ( PropName "sub", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.0/src/Data/Ring.purs" + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" [ ( Nothing, Name "intSub" ) ] ) ( PropName "intSub" ) diff --git a/test/ps/output/Golden.StringCodePoints.Test/corefn.json b/test/ps/output/Golden.StringCodePoints.Test/corefn.json new file mode 100644 index 0000000..2de48cb --- /dev/null +++ b/test/ps/output/Golden.StringCodePoints.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[{"LineComment":" Exercises Data.String.CodePoints end to end on the released package set"},{"LineComment":" (Unisay/purescript-lua-strings v6.2.0). The test string mixes UTF-8 widths"},{"LineComment":" 1..4: 'a' (1 byte), 'é' (2), 'Я' (2, Cyrillic), '𝐀' (4, astral), 'z' (1)."},{"LineComment":" Output is all Ints/Bools via fromEnum so the golden stays ASCII and does"},{"LineComment":" not depend on how strings are shown."}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,32],"start":[48,29]}},"type":"Var","value":{"identifier":"compose","moduleName":["Control","Semigroupoid"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semigroupoidFn","moduleName":["Control","Semigroupoid"]}},"type":"App"},"identifier":"compose"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,28],"start":[48,20]}},"type":"Var","value":{"identifier":"fromJust","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"fromJust"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,21],"start":[23,13]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Data","Enum"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,21],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"boundedEnumCodePoint","moduleName":["Data","String","CodePoints"]}},"type":"App"},"identifier":"fromEnum"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Data","Show"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"showArray"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[28,10],"start":[28,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[30,10],"start":[30,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,10],"start":[36,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showMaybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"type":"App"},"identifier":"logShow2"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,24],"start":[36,21]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorMaybe","moduleName":["Data","Maybe"]}},"type":"App"},"identifier":"map"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[41,10],"start":[41,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showMaybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"identifier":"logShow3"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,10],"start":[43,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showBoolean","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow4"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,64],"start":[43,62]}},"type":"Var","value":{"identifier":"eq","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqString","moduleName":["Data","Eq"]}},"type":"App"},"identifier":"eq"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,14],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,14],"start":[20,7]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"aéЯ𝐀z"}},"identifier":"str"},{"annotation":{"meta":null,"sourceSpan":{"end":[47,23],"start":[47,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,19],"start":[48,6]}},"type":"Var","value":{"identifier":"unsafePartial","moduleName":["Partial","Unsafe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromJust","moduleName":["Golden","StringCodePoints","Test"]}},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,39],"start":[48,33]}},"type":"Var","value":{"identifier":"toEnum","moduleName":["Data","Enum"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,39],"start":[48,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"boundedEnumCodePoint","moduleName":["Data","String","CodePoints"]}},"type":"App"},"type":"App"},"identifier":"cp"},{"annotation":{"meta":null,"sourceSpan":{"end":[22,29],"start":[22,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,46],"start":[23,9]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,12],"start":[23,9]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,21],"start":[23,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorArray","moduleName":["Data","Functor"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,21],"start":[23,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,46],"start":[23,9]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,46],"start":[23,26]}},"type":"Var","value":{"identifier":"toCodePointArray","moduleName":["Data","String","CodePoints"]}},"type":"App"},"identifier":"codes"},{"annotation":{"meta":null,"sourceSpan":{"end":[25,20],"start":[25,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,17],"start":[28,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,18]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow1","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[30,22],"start":[30,12]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,26],"start":[30,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,26],"start":[30,23]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow1","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[31,22],"start":[31,12]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","String","CodeUnits"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,26],"start":[31,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,26],"start":[31,23]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,17],"start":[33,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,34],"start":[33,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[33,27],"start":[33,19]}},"type":"Var","value":{"identifier":"take","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,29],"start":[33,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,29],"start":[33,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,33],"start":[33,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,33],"start":[33,30]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[34,17],"start":[34,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,34],"start":[34,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[34,27],"start":[34,19]}},"type":"Var","value":{"identifier":"drop","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,30]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,40],"start":[36,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,42],"start":[36,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,42],"start":[36,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[37,40],"start":[37,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,42],"start":[37,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,42],"start":[37,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[38,40],"start":[38,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,42],"start":[38,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,42],"start":[38,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,26]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,26]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"head","type":"Accessor"},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[40,48],"start":[40,38]}},"type":"Var","value":{"identifier":"uncons","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,49]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow3","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,18],"start":[41,13]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,23]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,23]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"tail","type":"Accessor"},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[41,45],"start":[41,35]}},"type":"Var","value":{"identifier":"uncons","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,46]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow4","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,34],"start":[43,12]}},"type":"Var","value":{"identifier":"fromCodePointArray","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,61],"start":[43,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,56],"start":[43,36]}},"type":"Var","value":{"identifier":"toCodePointArray","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,60],"start":[43,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,60],"start":[43,57]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,65]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,47],"start":[45,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,17],"start":[45,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,46],"start":[45,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[45,32],"start":[45,19]}},"type":"Var","value":{"identifier":"singleton","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,45],"start":[45,19]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,36],"start":[45,34]}},"type":"Var","value":{"identifier":"cp","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,44],"start":[45,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,44],"start":[45,37]}},"type":"Literal","value":{"literalType":"IntLiteral","value":119808}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["str","codes","main","cp"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Control","Semigroupoid"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Enum"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Eq"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Functor"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Maybe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","String","CodePoints"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","String","CodeUnits"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Golden","StringCodePoints","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Partial","Unsafe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,15],"start":[8,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","StringCodePoints","Test"],"modulePath":"golden/Golden/StringCodePoints/Test.purs","reExports":{},"sourceSpan":{"end":[48,39],"start":[6,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.StringCodePoints.Test/eval/.gitignore b/test/ps/output/Golden.StringCodePoints.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.StringCodePoints.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.StringCodePoints.Test/eval/golden.txt b/test/ps/output/Golden.StringCodePoints.Test/eval/golden.txt new file mode 100644 index 0000000..4853a97 --- /dev/null +++ b/test/ps/output/Golden.StringCodePoints.Test/eval/golden.txt @@ -0,0 +1,12 @@ +[97,233,1071,119808,122] +5 +10 +[97,233] +[1071,119808,122] +(Just 97) +(Just 119808) +Nothing +(Just 97) +(Just [233,1071,119808,122]) +true +[119808] diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.ir b/test/ps/output/Golden.StringCodePoints.Test/golden.ir new file mode 100644 index 0000000..7701eac --- /dev/null +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.ir @@ -0,0 +1,3043 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.1/src/Data/HeytingAlgebra.purs" + [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" + [ + ( Nothing, Name "eqIntImpl" ), + ( Nothing, Name "eqCharImpl" ), + ( Nothing, Name "eqStringImpl" ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Show", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ), ( Nothing, Name "showArrayImpl" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.1/src/Data/Ord.purs" + [ ( Nothing, Name "ordIntImpl" ), ( Nothing, Name "ordCharImpl" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Bounded", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Bounded" ) ".spago/prelude/v7.2.1/src/Data/Bounded.purs" + [ ( Nothing, Name "topChar" ), ( Nothing, Name "bottomChar" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.EuclideanRing", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.EuclideanRing" ) ".spago/prelude/v7.2.1/src/Data/EuclideanRing.purs" + [ ( Nothing, Name "intDegree" ), ( Nothing, Name "intDiv" ), ( Nothing, Name "intMod" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Enum" ) ".spago/enums/v6.1.0/src/Data/Enum.purs" + [ ( Nothing, Name "toCharCode" ), ( Nothing, Name "fromCharCode" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodeUnits", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.String.CodeUnits" ) ".spago/strings/v6.2.0/src/Data/String/CodeUnits.purs" + [ ( Nothing, Name "singleton" ), ( Nothing, Name "length" ), ( Nothing, Name "drop" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.String.CodePoints" ) ".spago/strings/v6.2.0/src/Data/String/CodePoints.purs" + [ + ( Nothing, Name "_singleton" ), + ( Nothing, Name "_fromCodePointArray" ), + ( Nothing, Name "_toCodePointArray" ), + ( Nothing, Name "_codePointAt" ), + ( Nothing, Name "_take" ), + ( Nothing, Name "_unsafeCodePointAt0" ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Semigroupoid", qnameName = Name "semigroupoidFn" + }, LiteralObject Nothing + [ + ( PropName "compose", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "g" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "g" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Semigroupoid", qnameName = Name "compose" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "compose" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "heytingAlgebraBoolean" + }, LiteralObject Nothing + [ + ( PropName "ff", LiteralBool Nothing False ), + ( PropName "tt", LiteralBool Nothing True ), + ( PropName "implies", Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "b" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "disj" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "not" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "b" ) ) 0 ) + ) + ) + ), + ( PropName "conj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolConj" ) + ), + ( PropName "disj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolDisj" ) + ), + ( PropName "not", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolNot" ) + ) + ] + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "conj" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "conj" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqInt" }, LiteralObject Nothing + [ + ( PropName "eq", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "foreign" ) ) 0 ) + ( PropName "eqIntImpl" ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eq" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "eq" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semigroup", qnameName = Name "semigroupString" + }, LiteralObject Nothing + [ + ( PropName "append", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Semigroup" ) ".spago/prelude/v7.2.1/src/Data/Semigroup.purs" + [ ( Nothing, Name "concatString" ) ] + ) + ( PropName "concatString" ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semigroup", qnameName = Name "append" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "append" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Show", qnameName = Name "showInt" + }, LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "foreign" ) ) 0 ) + ( PropName "showIntImpl" ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Show", qnameName = Name "show" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "show" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ordering", qnameName = Name "LT" + }, Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "LT" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ordering", qnameName = Name "GT" + }, Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "GT" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ordering", qnameName = Name "EQ" + }, Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "EQ" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "semiringInt" + }, LiteralObject Nothing + [ + ( PropName "add", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intAdd" ) + ), + ( PropName "zero", LiteralInt Nothing 0 ), + ( PropName "mul", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMul" ) + ), + ( PropName "one", LiteralInt Nothing 1 ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "add" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "add" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ring", qnameName = Name "sub" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "sub" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ring", qnameName = Name "ringInt" + }, LiteralObject Nothing + [ + ( PropName "sub", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + [ ( Nothing, Name "intSub" ) ] + ) + ( PropName "intSub" ) + ), + ( PropName "Semiring0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "ordInt" + }, LiteralObject Nothing + [ + ( PropName "compare", App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "foreign" ) ) 0 ) + ( PropName "ordIntImpl" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "LT" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "EQ" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "GT" ) ) 0 ) + ), + ( PropName "Eq0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eqInt" ) ) 0 ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "ordChar" + }, LiteralObject Nothing + [ + ( PropName "compare", App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "foreign" ) ) 0 ) + ( PropName "ordCharImpl" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "LT" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "EQ" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "GT" ) ) 0 ) + ), + ( PropName "Eq0", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "eq", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "foreign" ) ) 0 ) + ( PropName "eqCharImpl" ) + ) + ] + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "compare" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "compare" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "greaterThanOrEq" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictOrd" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a2" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Ordering∷Ordering.LT" ) + ( ReflectCtor Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "compare" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictOrd" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a1" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a2" ) ) 0 ) + ) + ) + ) ( LiteralBool Nothing False ) ( LiteralBool Nothing True ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "lessThan" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictOrd" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a2" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Ordering∷Ordering.LT" ) + ( ReflectCtor Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "compare" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictOrd" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a1" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a2" ) ) 0 ) + ) + ) + ) ( LiteralBool Nothing True ) ( LiteralBool Nothing False ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "lessThanOrEq" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictOrd" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a1" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a2" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Ordering∷Ordering.GT" ) + ( ReflectCtor Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "compare" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictOrd" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a1" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a2" ) ) 0 ) + ) + ) + ) ( LiteralBool Nothing False ) ( LiteralBool Nothing True ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Functor", qnameName = Name "map" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "map" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Bounded", qnameName = Name "top" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "top" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Bounded", qnameName = Name "boundedChar" + }, LiteralObject Nothing + [ + ( PropName "top", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "foreign" ) ) 0 ) + ( PropName "topChar" ) + ), + ( PropName "bottom", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "foreign" ) ) 0 ) + ( PropName "bottomChar" ) + ), + ( PropName "Ord0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordChar" ) ) 0 ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Bounded", qnameName = Name "bottom" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bottom" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.EuclideanRing", qnameName = Name "euclideanRingInt" + }, LiteralObject Nothing + [ + ( PropName "degree", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.EuclideanRing" ) ( Name "foreign" ) ) 0 ) + ( PropName "intDegree" ) + ), + ( PropName "div", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.EuclideanRing" ) ( Name "foreign" ) ) 0 ) + ( PropName "intDiv" ) + ), + ( PropName "mod", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.EuclideanRing" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMod" ) + ), + ( PropName "CommutativeRing0", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "Ring0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ring" ) ( Name "ringInt" ) ) 0 ) + ) + ] + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "append" }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Semigroup" ) ( Name "append" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semigroup" ) ( Name "semigroupString" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "Nothing" + }, Ctor Nothing SumType + ( ModuleName "Data.Maybe" ) + ( TyName "Maybe" ) + ( CtorName "Nothing" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "Just" + }, Ctor Nothing SumType + ( ModuleName "Data.Maybe" ) + ( TyName "Maybe" ) + ( CtorName "Just" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "showMaybe" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictShow" ) ) + ( LiteralObject Nothing + [ + ( PropName "show", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "append" ) ) 0 ) + ( LiteralString Nothing "(Just " ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "append" ) ) 0 ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "show" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictShow" ) ) 0 ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( LiteralString Nothing ")" ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( LiteralString Nothing "Nothing" ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "isNothing" }, Abs Nothing + ( ParamNamed Nothing ( Name "v2" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) ) + ) ( LiteralBool Nothing True ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) ) + ) ( LiteralBool Nothing False ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "functorMaybe" + }, LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Maybe", qnameName = Name "fromJust" + }, Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ( PropName "value0" ) ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Tuple", qnameName = Name "snd" }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ( PropName "value1" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Tuple", qnameName = Name "fst" }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ( PropName "value0" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "sub" }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ring" ) ( Name "sub" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ring" ) ( Name "ringInt" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "bottom1" }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "bottom" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "boundedChar" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "top1" }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "top" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "boundedChar" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "toEnum" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "toEnum" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "fromEnum" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "fromEnum" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "defaultSucc" }, Abs Nothing + ( ParamNamed Nothing ( Name "toEnum'" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "fromEnum'" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "toEnum'" ) ) 0 ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "add" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "fromEnum'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "defaultPred" }, Abs Nothing + ( ParamNamed Nothing ( Name "toEnum'" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "fromEnum'" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( Ref Nothing ( Local ( Name "toEnum'" ) ) 0 ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "sub" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Local ( Name "fromEnum'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "charToEnum" }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "conj" ) ) 0 ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Ord" ) ( Name "greaterThanOrEq" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "toCharCode" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "bottom1" ) ) 0 ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "lessThanOrEq" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "toCharCode" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "top1" ) ) 0 ) + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "fromCharCode" ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "boundedEnumChar" + }, LiteralObject Nothing + [ + ( PropName "cardinality", App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "sub" ) ) 0 ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "toCharCode" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "top1" ) ) 0 ) + ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "toCharCode" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "bottom1" ) ) 0 ) + ) + ), + ( PropName "toEnum", Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "charToEnum" ) ) 0 + ), + ( PropName "fromEnum", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "toCharCode" ) + ), + ( PropName "Bounded0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "boundedChar" ) ) 0 ) + ), + ( PropName "Enum1", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "succ", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "defaultSucc" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "charToEnum" ) ) 0 ) + ) + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "toCharCode" ) + ) + ), + ( PropName "pred", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "defaultPred" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "charToEnum" ) ) 0 ) + ) + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "foreign" ) ) 0 ) + ( PropName "toCharCode" ) + ) + ), + ( PropName "Ord0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordChar" ) ) 0 ) + ) + ] + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "add" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "add" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "sub" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ring" ) ( Name "sub" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ring" ) ( Name "ringInt" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "append" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Semigroup" ) ( Name "append" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semigroup" ) ( Name "semigroupString" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "conj" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "conj" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "heytingAlgebraBoolean" ) ) 0 + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "lessThanOrEq" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "lessThanOrEq" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "fromEnum" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "fromEnum" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "boundedEnumChar" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "compose" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Semigroupoid" ) ( Name "compose" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Control.Semigroupoid" ) ( Name "semigroupoidFn" ) ) 0 + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "eq" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Eq" ) ( Name "eqInt" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "lessThan" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "lessThan" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "unsafeCodePointAt0" + }, App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "foreign" ) ) 0 ) + ( PropName "_unsafeCodePointAt0" ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "s" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "cu0", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "fromEnum" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.String.Unsafe" ) ".spago/strings/v6.2.0/src/Data/String/Unsafe.purs" + [ ( Nothing, Name "charAt" ) ] + ) + ( PropName "charAt" ) + ) + ( LiteralInt Nothing 0 ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) :| [] + ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "conj" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "conj" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "lessThanOrEq" ) + ) 0 + ) + ( LiteralInt Nothing 55296 ) + ) + ( Ref Nothing ( Local ( Name "cu0" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "lessThanOrEq" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "cu0" ) ) 0 ) + ) + ( LiteralInt Nothing 56319 ) + ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Ordering∷Ordering.GT" ) + ( ReflectCtor Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Ord" ) ( Name "compare" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 + ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodeUnits" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "length" ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) ( LiteralBool Nothing True ) ( LiteralBool Nothing False ) + ) + ) + ( Let Nothing + ( Standalone + ( Nothing, Name "cu1", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "fromEnum" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.String.Unsafe" ) ".spago/strings/v6.2.0/src/Data/String/Unsafe.purs" + [ ( Nothing, Name "charAt" ) ] + ) + ( PropName "charAt" ) + ) + ( LiteralInt Nothing 1 ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) :| [] + ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "conj" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "lessThanOrEq" ) + ) 0 + ) + ( LiteralInt Nothing 56320 ) + ) + ( Ref Nothing ( Local ( Name "cu1" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "lessThanOrEq" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "cu1" ) ) 0 ) + ) + ( LiteralInt Nothing 57343 ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "add" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "add" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Semiring" ) + ( Name "semiringInt" ) + ) 0 + ) + ( PropName "mul" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "sub" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "cu0" ) ) 0 ) + ) + ( LiteralInt Nothing 55296 ) + ) + ) + ( LiteralInt Nothing 1024 ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "sub" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "cu1" ) ) 0 ) + ) + ( LiteralInt Nothing 56320 ) + ) + ) + ) + ( LiteralInt Nothing 65536 ) + ) + ( Ref Nothing ( Local ( Name "cu0" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "cu0" ) ) 0 ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "fromCharCode" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "compose" ) ) 0 ) + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodeUnits" ) ( Name "foreign" ) ) 0 + ) + ( PropName "singleton" ) + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "v", App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toEnum" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "boundedEnumChar" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) :| [] + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ( PropName "value0" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Ord" ) ( Name "lessThan" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "fromEnum" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "boundedEnumChar" ) ) 0 + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Bounded" ) ( Name "bottom" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "boundedEnumChar" ) ) 0 + ) + ( PropName "Bounded0" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "bottom" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Bounded" ) ( Name "boundedChar" ) ) 0 + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Bounded" ) ( Name "top" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Bounded" ) ( Name "boundedChar" ) ) 0 + ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "singletonFallback" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "lessThanOrEq" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 65535 ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "fromCharCode" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "append" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "fromCharCode" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "add" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.EuclideanRing" ) + ( Name "euclideanRingInt" ) + ) 0 + ) + ( PropName "div" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "sub" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 65536 ) + ) + ) + ( LiteralInt Nothing 1024 ) + ) + ) + ( LiteralInt Nothing 55296 ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "fromCharCode" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "add" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.EuclideanRing" ) + ( Name "euclideanRingInt" ) + ) 0 + ) + ( PropName "mod" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "sub" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 65536 ) + ) + ) + ( LiteralInt Nothing 1024 ) + ) + ) + ( LiteralInt Nothing 56320 ) + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "singleton" + }, App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "foreign" ) ) 0 ) + ( PropName "_singleton" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "singletonFallback" ) ) 0 + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "ordCodePoint" + }, LiteralObject Nothing + [ + ( PropName "compare", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "compare" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) + ), + ( PropName "Eq0", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "eq", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "eq" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "uncons" + }, Abs Nothing + ( ParamNamed Nothing ( Name "s" ) ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "eq" ) ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodeUnits" ) ( Name "foreign" ) ) 0 + ) + ( PropName "length" ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) + ( LiteralInt Nothing 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( LiteralObject Nothing + [ + ( PropName "head", App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "unsafeCodePointAt0" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ), + ( PropName "tail", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "drop" ) ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ] + ) + ) + ) + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "takeFallback" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "lessThan" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 1 ) + ) + ( LiteralString Nothing "" ) + ( Let Nothing + ( Standalone + ( Nothing, Name "v2", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "uncons" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) :| [] + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "append" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "singleton" ) + ) 0 + ) + ( ObjectProp Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) + ( PropName "value0" ) + ) + ( PropName "head" ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "takeFallback" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "sub" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ( ObjectProp Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v2" ) ) 0 ) + ( PropName "value0" ) + ) + ( PropName "tail" ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "take" + }, Abs Nothing + ( ParamNamed Nothing ( Name "n" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "s" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "foreign" ) ) 0 + ) + ( PropName "_take" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "takeFallback" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "drop" + }, Abs Nothing + ( ParamNamed Nothing ( Name "n" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "s" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodeUnits" ) ( Name "foreign" ) ) 0 + ) + ( PropName "drop" ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodeUnits" ) ( Name "foreign" ) ) 0 + ) + ( PropName "length" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "take" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "toCodePointArray" + }, App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "foreign" ) ) 0 + ) + ( PropName "_toCodePointArray" ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "s" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "unfoldr", App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Unfoldable" ) ".spago/unfoldable/v6.1.0/src/Data/Unfoldable.purs" + [ ( Nothing, Name "unfoldrArrayImpl" ) ] + ) + ( PropName "unfoldrArrayImpl" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Maybe" ) ( Name "isNothing" ) ) 0 + ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Partial.Unsafe" ) ".spago/partial/v4.1.0/src/Partial/Unsafe.purs" + [ ( Nothing, Name "_unsafePartial" ) ] + ) + ( PropName "_unsafePartial" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Maybe" ) ( Name "fromJust" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Tuple" ) ( Name "fst" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Tuple" ) ( Name "snd" ) ) 0 ) + ), + ( PropName "Unfoldable10", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "unfoldr1", App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Unfoldable1" ) ".spago/unfoldable/v6.1.0/src/Data/Unfoldable1.purs" + [ ( Nothing, Name "unfoldr1ArrayImpl" ) ] + ) + ( PropName "unfoldr1ArrayImpl" ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.Maybe" ) + ( Name "isNothing" ) + ) 0 + ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Partial.Unsafe" ) ".spago/partial/v4.1.0/src/Partial/Unsafe.purs" + [ ( Nothing, Name "_unsafePartial" ) ] + ) + ( PropName "_unsafePartial" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Maybe" ) + ( Name "fromJust" ) + ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Tuple" ) ( Name "fst" ) ) 0 + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Tuple" ) ( Name "snd" ) ) 0 + ) + ) + ] + ) + ) + ] + ) + ( PropName "unfoldr" ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "s1" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Functor" ) ( Name "map" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Maybe" ) ( Name "functorMaybe" ) ) 0 + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( App Nothing + ( App Nothing + ( Ctor Nothing ProductType + ( ModuleName "Data.Tuple" ) + ( TyName "Tuple" ) + ( CtorName "Tuple" ) + [ FieldName "value0", FieldName "value1" ] + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "head" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "tail" ) + ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "uncons" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "s1" ) ) 0 ) + ) + ) + ) + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "unsafeCodePointAt0" ) ) 0 + ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "codePointAtFallback" + }, Abs Nothing + ( ParamNamed Nothing ( Name "n" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "s" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "v", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "uncons" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "s" ) ) 0 ) + ) :| [] + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "eq" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ( LiteralInt Nothing 0 ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( ObjectProp Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ( PropName "head" ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "codePointAtFallback" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "sub" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ( LiteralInt Nothing 1 ) + ) + ) + ( ObjectProp Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ( PropName "tail" ) + ) + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ) + ) + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "codePointAt" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "lessThan" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( LiteralInt Nothing 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 0 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "" ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 0 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "unsafeCodePointAt0" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "_codePointAt" ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "codePointAtFallback" ) + ) 0 + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "unsafeCodePointAt0" ) + ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 0 ) ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "unsafeCodePointAt0" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "_codePointAt" ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "codePointAtFallback" ) + ) 0 + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "unsafeCodePointAt0" ) + ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ) + ) + ) + ) + ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "boundedEnumCodePoint" + }, LiteralObject Nothing + [ + ( PropName "cardinality", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "add" ) ) 0 + ) + ( LiteralInt Nothing 1114111 ) + ) + ( LiteralInt Nothing 1 ) + ), + ( PropName "fromEnum", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ), + ( PropName "toEnum", Abs Nothing + ( ParamNamed Nothing ( Name "n" ) ) + ( IfThenElse Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "conj" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Ord" ) ( Name "greaterThanOrEq" ) ) 0 + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ( LiteralInt Nothing 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "lessThanOrEq" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ( LiteralInt Nothing 1114111 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) 0 ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) 0 ) + ) + ), + ( PropName "Bounded0", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "bottom", LiteralInt Nothing 0 ), + ( PropName "top", LiteralInt Nothing 1114111 ), + ( PropName "Ord0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "ordCodePoint" ) ) 0 + ) + ) + ] + ) + ), + ( PropName "Enum1", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "Lazy_enumCodePoint" ) + ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "Lazy_enumCodePoint" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "enumCodePoint" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "succ", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "defaultSucc" ) ) 0 + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toEnum" ) ) 0 ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "boundedEnumCodePoint" ) + ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "fromEnum" ) ) 0 ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "boundedEnumCodePoint" ) + ) 0 + ) + ) + ), + ( PropName "pred", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Enum" ) ( Name "defaultPred" ) ) 0 + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toEnum" ) ) 0 ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "boundedEnumCodePoint" ) + ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "fromEnum" ) ) 0 ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "boundedEnumCodePoint" ) + ) 0 + ) + ) + ), + ( PropName "Ord0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "ordCodePoint" ) ) 0 + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "logShow" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictShow" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "show" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictShow" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "compose" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Semigroupoid" ) ( Name "compose" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Control.Semigroupoid" ) ( Name "semigroupoidFn" ) ) 0 + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "fromEnum" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "fromEnum" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "boundedEnumCodePoint" ) ) 0 + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "discard" + }, App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "showArray" + }, LiteralObject Nothing + [ + ( PropName "show", App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "foreign" ) ) 0 ) + ( PropName "showArrayImpl" ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "show" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showInt" ) ) 0 ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "logShow" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "showArray" ) ) 0 + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "logShow1" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showInt" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "logShow2" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow" ) ) 0 ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "showMaybe" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showInt" ) ) 0 ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "map" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Functor" ) ( Name "map" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "functorMaybe" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "cp" + }, App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "compose" ) ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Partial.Unsafe" ) ".spago/partial/v4.1.0/src/Partial/Unsafe.purs" + [ ( Nothing, Name "_unsafePartial" ) ] + ) + ( PropName "_unsafePartial" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "fromJust" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toEnum" ) ) 0 ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "boundedEnumCodePoint" ) ) 0 + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "codes" + }, App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "compose" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Functor" ) ( Name "map" ) ) 0 ) + ( LiteralObject Nothing + [ + ( PropName "map", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Functor" ) ".spago/prelude/v7.2.1/src/Data/Functor.purs" + [ ( Nothing, Name "arrayMap" ) ] + ) + ( PropName "arrayMap" ) + ) + ] + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "fromEnum" ) ) 0 + ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "toCodePointArray" ) ) 0 + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "str", LiteralString Nothing "aéЯ𝐀z" ), + ( Name "codes", Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "codes" ) ) 0 + ), + ( Name "main", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "codes" ) ) 0 + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "logShow1" ) ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "compose" ) ) 0 + ) + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Array" ) ".spago/arrays/v7.3.0/src/Data/Array.purs" + [ ( Nothing, Name "length" ) ] + ) + ( PropName "length" ) + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "toCodePointArray" ) + ) 0 + ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow1" ) + ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.String.CodeUnits" ) ( Name "foreign" ) ) 0 + ) + ( PropName "length" ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "codes" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "take" ) + ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "codes" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "drop" ) + ) 0 + ) + ( LiteralInt Nothing 2 ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow2" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "map" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "fromEnum" ) + ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "codePointAt" ) + ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow2" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "map" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "fromEnum" ) + ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "codePointAt" ) + ) 0 + ) + ( LiteralInt Nothing 3 ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow2" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "map" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "fromEnum" ) + ) 0 + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "codePointAt" ) + ) 0 + ) + ( LiteralInt Nothing 5 ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow2" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "map" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "compose" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "fromEnum" ) + ) 0 + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "head" ) + ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "uncons" ) + ) 0 + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Console" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Maybe" ) + ( Name "showMaybe" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "showArray" ) + ) 0 + ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "map" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "compose" ) + ) 0 + ) + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "codes" ) + ) 0 + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "tail" ) + ) + ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "uncons" ) + ) 0 + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "discard" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Console" ) + ( Name "logShow" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "show", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Ref Nothing + ( Local ( Name "v" ) ) 0 + ) + ( LiteralString Nothing "true" ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralBool Nothing False ) + ( Ref Nothing + ( Local ( Name "v" ) ) 0 + ) + ) + ( LiteralString Nothing "false" ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eq" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "eq", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "eqStringImpl" ) + ) + ] + ) + ) + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "_fromCodePointArray" ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "singletonFallback" ) + ) 0 + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "toCodePointArray" ) + ) 0 + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ( LiteralString Nothing "aéЯ𝐀z" ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "codes" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "singleton" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.StringCodePoints.Test" ) + ( Name "cp" ) + ) 0 + ) + ( LiteralInt Nothing 119808 ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( Name "cp", Ref Nothing + ( Imported ( ModuleName "Golden.StringCodePoints.Test" ) ( Name "cp" ) ) 0 + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.lua b/test/ps/output/Golden.StringCodePoints.Test/golden.lua new file mode 100644 index 0000000..dd273d1 --- /dev/null +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.lua @@ -0,0 +1,764 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_HeytingAlgebra_foreign = { + boolConj = function(b1) return function(b2) return b1 and b2 end end, + boolDisj = function(b1) return function(b2) return b1 or b2 end end, + boolNot = function(b) return not b end +} +M.Data_Eq_foreign = (function() + local refEq = function(r1) return function(r2) return r1 == r2 end end + return { eqIntImpl = refEq, eqCharImpl = refEq, eqStringImpl = refEq } +end)() +M.Data_Show_foreign = { + showIntImpl = function(n) return tostring(n) end, + showArrayImpl = function(f) + return function(xs) + local l = #xs + local ss = {} + for i = 1, l do ss[i] = f(xs[i]) end + return "[" .. table.concat(ss, ",") .. "]" + end + end +} +M.Data_Semiring_foreign = { + intAdd = function(x) return function(y) return x + y end end, + intMul = function(x) return function(y) return x * y end end +} +M.Data_Ord_foreign = (function() + local unsafeCoerceImpl = function(lt) + return function(eq) + return function(gt) + return function(x) + return function(y) + if x < y then + return lt + elseif x == y then + return eq + else + return gt + end + end + end + end + end + end + return { ordIntImpl = unsafeCoerceImpl, ordCharImpl = unsafeCoerceImpl } +end)() +M.Data_Bounded_foreign = (function() + -- Lua 5.1 compatibility: + -- * math.maxinteger/math.mininteger appeared in Lua 5.3; PureScript Int + -- is a 32-bit integer, so its bounds are spelled out literally. + -- * "\u{...}" escapes appeared in Lua 5.3 (PUC Lua 5.1 silently reads + -- "\u" as "u"). A Char is a single byte in pslua, so its bounds are + -- the byte bounds. + return { topChar = "\255", bottomChar = "\0" } +end)() +M.Data_EuclideanRing_foreign = (function() + -- math.maxinteger is Lua 5.3+; PureScript Int is 32-bit, hence the + -- literal bound in intDegree. + return { + intDegree = function(x) return math.min(math.abs(x), 2147483647) end, + intDiv = function(x) + return function(y) + if y == 0 then return 0 end + return y > 0 and math.floor(x / y) or -math.floor(x / -y) + end + end, + intMod = function(x) + return function(y) + if y == 0 then return 0 end + local yy = math.abs(y) + return ((x % yy) + yy) % yy + end + end + } +end)() +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Data_Enum_foreign = { + toCharCode = function(c) return c:byte() end, + fromCharCode = string.char +} +M.Data_String_CodeUnits_foreign = (function() + -- PureScript indices are 0-based, Lua string positions are 1-based; + -- the exports below convert between the two. Pattern arguments are + -- literal strings, hence string.find in plain mode. Index clamping + -- mirrors the upstream JS implementation (String.prototype.indexOf, + -- lastIndexOf, slice and substring). + return { + singleton = function(c) return c end, + length = function(s) return #s end, + drop = function(n) return function(s) return s:sub(math.max(n, 0) + 1) end end + } +end)() +M.Data_String_CodePoints_foreign = (function() + -- In pslua a PureScript String is a Lua byte string holding UTF-8, + -- so code-point operations decode/encode UTF-8 directly. The PureScript + -- fallback arguments are written for UTF-16 code units and are wrong + -- under this representation; every export ignores them. + -- + -- Lua 5.1: no utf8 library, no bit operators - plain arithmetic only. + + -- Decodes the code point starting at byte position i. + -- Returns the code point and the position of the next one. + -- An invalid leading byte is returned as-is (one byte consumed). + local function decode(s, i) + local b1 = s:byte(i) + if b1 < 0x80 then return b1, i + 1 end + if b1 >= 0xC2 and b1 <= 0xDF then + local b2 = s:byte(i + 1) + if b2 and b2 >= 0x80 and b2 <= 0xBF then + return (b1 - 0xC0) * 0x40 + (b2 - 0x80), i + 2 + end + elseif b1 >= 0xE0 and b1 <= 0xEF then + local b2, b3 = s:byte(i + 1, i + 2) + if b2 and b2 >= 0x80 and b2 <= 0xBF + and b3 and b3 >= 0x80 and b3 <= 0xBF then + return (b1 - 0xE0) * 0x1000 + (b2 - 0x80) * 0x40 + (b3 - 0x80), i + 3 + end + elseif b1 >= 0xF0 and b1 <= 0xF4 then + local b2, b3, b4 = s:byte(i + 1, i + 3) + if b2 and b2 >= 0x80 and b2 <= 0xBF + and b3 and b3 >= 0x80 and b3 <= 0xBF + and b4 and b4 >= 0x80 and b4 <= 0xBF then + return (b1 - 0xF0) * 0x40000 + (b2 - 0x80) * 0x1000 + + (b3 - 0x80) * 0x40 + (b4 - 0x80), i + 4 + end + end + return b1, i + 1 + end + + -- Encodes a code point as a UTF-8 byte string. + local function encode(cp) + if cp < 0x80 then return string.char(cp) end + if cp < 0x800 then + return string.char(0xC0 + math.floor(cp / 0x40), 0x80 + cp % 0x40) + end + if cp < 0x10000 then + return string.char( + 0xE0 + math.floor(cp / 0x1000), + 0x80 + math.floor(cp / 0x40) % 0x40, + 0x80 + cp % 0x40 + ) + end + return string.char( + 0xF0 + math.floor(cp / 0x40000), + 0x80 + math.floor(cp / 0x1000) % 0x40, + 0x80 + math.floor(cp / 0x40) % 0x40, + 0x80 + cp % 0x40 + ) + end + return { + _singleton = function(_) + return function(cp) return encode(cp) end + end, + _fromCodePointArray = function(_) + return function(cps) + local t = {} + for k = 1, #cps do t[k] = encode(cps[k]) end + return table.concat(t) + end + end, + _toCodePointArray = function(_) + return function(_) + return function(s) + local t, k, i = {}, 0, 1 + while i <= #s do + local cp, j = decode(s, i) + k = k + 1 + t[k] = cp + i = j + end + return t + end + end + end, + _codePointAt = function(_) + return function(just) + return function(nothing) + return function(_) + return function(n) + return function(s) + local k, i = 0, 1 + while i <= #s do + local cp, j = decode(s, i) + if k == n then return just(cp) end + k = k + 1 + i = j + end + return nothing + end + end + end + end + end + end, + _take = function(_) + return function(n) + return function(s) + if n < 1 then return "" end + local k, i = 0, 1 + while i <= #s do + local _, j = decode(s, i) + k = k + 1 + i = j + if k == n then break end + end + return s:sub(1, i - 1) + end + end + end, + _unsafeCodePointAt0 = function(_) + return function(s) + local cp = decode(s, 1) + return cp + end + end + } +end)() +M.Control_Semigroupoid_semigroupoidFn = { + compose = function(f) + return function(g) return function(x) return f(g(x)) end end + end +} +M.Control_Semigroupoid_compose = function(dict) return dict.compose end +M.Data_HeytingAlgebra_heytingAlgebraBoolean = { + ff = false, + tt = true, + implies = function(a) + return function(b) + return M.Data_HeytingAlgebra_heytingAlgebraBoolean.disj(M.Data_HeytingAlgebra_heytingAlgebraBoolean._not_(a))(b) + end + end, + conj = M.Data_HeytingAlgebra_foreign.boolConj, + disj = M.Data_HeytingAlgebra_foreign.boolDisj, + _not_ = M.Data_HeytingAlgebra_foreign.boolNot +} +M.Data_HeytingAlgebra_conj = function(dict) return dict.conj end +M.Data_Eq_eqInt = { eq = M.Data_Eq_foreign.eqIntImpl } +M.Data_Eq_eq = function(dict) return dict.eq end +M.Data_Semigroup_semigroupString = { + append = function(s1) return function(s2) return s1 .. s2 end end +} +M.Data_Semigroup_append = function(dict) return dict.append end +M.Data_Show_showInt = { show = M.Data_Show_foreign.showIntImpl } +M.Data_Show_show = function(dict) return dict.show end +M.Data_Ordering_LT = { ["$ctor"] = "Data.Ordering∷Ordering.LT" } +M.Data_Ordering_GT = { ["$ctor"] = "Data.Ordering∷Ordering.GT" } +M.Data_Ordering_EQ = { ["$ctor"] = "Data.Ordering∷Ordering.EQ" } +M.Data_Semiring_semiringInt = { + add = M.Data_Semiring_foreign.intAdd, + zero = 0, + mul = M.Data_Semiring_foreign.intMul, + one = 1 +} +M.Data_Semiring_add = function(dict) return dict.add end +M.Data_Ring_sub = function(dict) return dict.sub end +M.Data_Ring_ringInt = { + sub = function(x) return function(y) return x - y end end, + Semiring0 = function() return M.Data_Semiring_semiringInt end +} +M.Data_Ord_ordInt = { + compare = M.Data_Ord_foreign.ordIntImpl(M.Data_Ordering_LT)(M.Data_Ordering_EQ)(M.Data_Ordering_GT), + Eq0 = function() return M.Data_Eq_eqInt end +} +M.Data_Ord_ordChar = { + compare = M.Data_Ord_foreign.ordCharImpl(M.Data_Ordering_LT)(M.Data_Ordering_EQ)(M.Data_Ordering_GT), + Eq0 = function() return { eq = M.Data_Eq_foreign.eqCharImpl } end +} +M.Data_Ord_compare = function(dict) return dict.compare end +M.Data_Ord_greaterThanOrEq = function(dictOrd) + return function(a1) + return function(a2) + if "Data.Ordering∷Ordering.LT" == M.Data_Ord_compare(dictOrd)(a1)(a2)["$ctor"] then + return false + else + return true + end + end + end +end +M.Data_Ord_lessThan = function(dictOrd) + return function(a1) + return function(a2) + if "Data.Ordering∷Ordering.LT" == M.Data_Ord_compare(dictOrd)(a1)(a2)["$ctor"] then + return true + else + return false + end + end + end +end +M.Data_Ord_lessThanOrEq = function(dictOrd) + return function(a1) + return function(a2) + if "Data.Ordering∷Ordering.GT" == M.Data_Ord_compare(dictOrd)(a1)(a2)["$ctor"] then + return false + else + return true + end + end + end +end +M.Data_Functor_map = function(dict) return dict.map end +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Data_Bounded_top = function(dict) return dict.top end +M.Data_Bounded_boundedChar = { + top = M.Data_Bounded_foreign.topChar, + bottom = M.Data_Bounded_foreign.bottomChar, + Ord0 = function() return M.Data_Ord_ordChar end +} +M.Data_Bounded_bottom = function(dict) return dict.bottom end +M.Data_EuclideanRing_euclideanRingInt = { + degree = M.Data_EuclideanRing_foreign.intDegree, + div = M.Data_EuclideanRing_foreign.intDiv, + mod = M.Data_EuclideanRing_foreign.intMod, + CommutativeRing0 = function() + return { Ring0 = function() return M.Data_Ring_ringInt end } + end +} +M.Data_Maybe_append = M.Data_Semigroup_append(M.Data_Semigroup_semigroupString) +M.Data_Maybe_Nothing = { ["$ctor"] = "Data.Maybe∷Maybe.Nothing" } +M.Data_Maybe_Just = function(value0) + return { ["$ctor"] = "Data.Maybe∷Maybe.Just", value0 = value0 } +end +M.Data_Maybe_showMaybe = function(dictShow) + return { + show = function(v) + if "Data.Maybe∷Maybe.Just" == v["$ctor"] then + return M.Data_Maybe_append("(Just ")(M.Data_Maybe_append(M.Data_Show_show(dictShow)(v.value0))(")")) + else + if "Data.Maybe∷Maybe.Nothing" == v["$ctor"] then + return "Nothing" + else + return error("No patterns matched") + end + end + end + } +end +M.Data_Maybe_isNothing = function(v2) + if "Data.Maybe∷Maybe.Nothing" == v2["$ctor"] then + return true + else + if "Data.Maybe∷Maybe.Just" == v2["$ctor"] then + return false + else + return error("No patterns matched") + end + end +end +M.Data_Maybe_functorMaybe = { + map = function(v) + return function(v1) + if "Data.Maybe∷Maybe.Just" == v1["$ctor"] then + return M.Data_Maybe_Just(v(v1.value0)) + else + return M.Data_Maybe_Nothing + end + end + end +} +M.Data_Maybe_fromJust = function() + return function(v) + if "Data.Maybe∷Maybe.Just" == v["$ctor"] then + return v.value0 + else + return error("No patterns matched") + end + end +end +M.Data_Tuple_snd = function(v) return v.value1 end +M.Data_Tuple_fst = function(v) return v.value0 end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Data_Enum_sub = M.Data_Ring_sub(M.Data_Ring_ringInt) +M.Data_Enum_bottom1 = M.Data_Bounded_bottom(M.Data_Bounded_boundedChar) +M.Data_Enum_top1 = M.Data_Bounded_top(M.Data_Bounded_boundedChar) +M.Data_Enum_toEnum = function(dict) return dict.toEnum end +M.Data_Enum_fromEnum = function(dict) return dict.fromEnum end +M.Data_Enum_defaultSucc = function(toEnumPrime) + return function(fromEnumPrime) + return function(a) + return toEnumPrime(M.Data_Semiring_add(M.Data_Semiring_semiringInt)(fromEnumPrime(a))(1)) + end + end +end +M.Data_Enum_defaultPred = function(toEnumPrime) + return function(fromEnumPrime) + return function(a) + return toEnumPrime(M.Data_Enum_sub(fromEnumPrime(a))(1)) + end + end +end +M.Data_Enum_charToEnum = function(v) + if M.Data_HeytingAlgebra_conj(M.Data_HeytingAlgebra_heytingAlgebraBoolean)(M.Data_Ord_greaterThanOrEq(M.Data_Ord_ordInt)(v)(M.Data_Enum_foreign.toCharCode(M.Data_Enum_bottom1)))(M.Data_Ord_lessThanOrEq(M.Data_Ord_ordInt)(v)(M.Data_Enum_foreign.toCharCode(M.Data_Enum_top1))) then + return M.Data_Maybe_Just(M.Data_Enum_foreign.fromCharCode(v)) + else + return M.Data_Maybe_Nothing + end +end +M.Data_Enum_boundedEnumChar = { + cardinality = M.Data_Enum_sub(M.Data_Enum_foreign.toCharCode(M.Data_Enum_top1))(M.Data_Enum_foreign.toCharCode(M.Data_Enum_bottom1)), + toEnum = M.Data_Enum_charToEnum, + fromEnum = M.Data_Enum_foreign.toCharCode, + Bounded0 = function() return M.Data_Bounded_boundedChar end, + Enum1 = function() + return { + succ = M.Data_Enum_defaultSucc(M.Data_Enum_charToEnum)(M.Data_Enum_foreign.toCharCode), + pred = M.Data_Enum_defaultPred(M.Data_Enum_charToEnum)(M.Data_Enum_foreign.toCharCode), + Ord0 = function() return M.Data_Ord_ordChar end + } + end +} +M.Data_String_CodePoints_add = M.Data_Semiring_add(M.Data_Semiring_semiringInt) +M.Data_String_CodePoints_sub = M.Data_Ring_sub(M.Data_Ring_ringInt) +M.Data_String_CodePoints_append = M.Data_Semigroup_append(M.Data_Semigroup_semigroupString) +M.Data_String_CodePoints_conj = M.Data_HeytingAlgebra_conj(M.Data_HeytingAlgebra_heytingAlgebraBoolean) +M.Data_String_CodePoints_lessThanOrEq = M.Data_Ord_lessThanOrEq(M.Data_Ord_ordInt) +M.Data_String_CodePoints_fromEnum = M.Data_Enum_fromEnum(M.Data_Enum_boundedEnumChar) +M.Data_String_CodePoints_compose = M.Control_Semigroupoid_compose(M.Control_Semigroupoid_semigroupoidFn) +M.Data_String_CodePoints_eq = M.Data_Eq_eq(M.Data_Eq_eqInt) +M.Data_String_CodePoints_lessThan = M.Data_Ord_lessThan(M.Data_Ord_ordInt) +M.Data_String_CodePoints_unsafeCodePointAt0 = M.Data_String_CodePoints_foreign._unsafeCodePointAt0(function( s ) + local cu0 = M.Data_String_CodePoints_fromEnum((function(i) + return function(s) + if i >= 0 and i < #s then return s:sub(i + 1, i + 1) end + error("Data.String.Unsafe.charAt: Invalid index.") + end + end)(0)(s)) + if M.Data_String_CodePoints_conj(M.Data_String_CodePoints_conj(M.Data_String_CodePoints_lessThanOrEq(55296)(cu0))(M.Data_String_CodePoints_lessThanOrEq(cu0)(56319)))((function( ) + if "Data.Ordering∷Ordering.GT" == M.Data_Ord_compare(M.Data_Ord_ordInt)(M.Data_String_CodeUnits_foreign.length(s))(1)["$ctor"] then + return true + else + return false + end + end)()) then + local cu1 = M.Data_String_CodePoints_fromEnum((function(i) + return function(s) + if i >= 0 and i < #s then return s:sub(i + 1, i + 1) end + error("Data.String.Unsafe.charAt: Invalid index.") + end + end)(1)(s)) + if M.Data_String_CodePoints_conj(M.Data_String_CodePoints_lessThanOrEq(56320)(cu1))(M.Data_String_CodePoints_lessThanOrEq(cu1)(57343)) then + return M.Data_String_CodePoints_add(M.Data_String_CodePoints_add(M.Data_Semiring_semiringInt.mul(M.Data_String_CodePoints_sub(cu0)(55296))(1024))(M.Data_String_CodePoints_sub(cu1)(56320)))(65536) + else + return cu0 + end + else + return cu0 + end +end) +M.Data_String_CodePoints_fromCharCode = M.Data_String_CodePoints_compose(M.Data_String_CodeUnits_foreign.singleton)(function( x ) + local v = M.Data_Enum_toEnum(M.Data_Enum_boundedEnumChar)(x) + if "Data.Maybe∷Maybe.Just" == v["$ctor"] then + return v.value0 + else + if "Data.Maybe∷Maybe.Nothing" == v["$ctor"] then + if M.Data_Ord_lessThan(M.Data_Ord_ordInt)(x)(M.Data_Enum_fromEnum(M.Data_Enum_boundedEnumChar)(M.Data_Bounded_bottom(M.Data_Enum_boundedEnumChar.Bounded0()))) then + return M.Data_Bounded_bottom(M.Data_Bounded_boundedChar) + else + return M.Data_Bounded_top(M.Data_Bounded_boundedChar) + end + else + return error("No patterns matched") + end + end +end) +M.Data_String_CodePoints_singletonFallback = function(v) + if M.Data_String_CodePoints_lessThanOrEq(v)(65535) then + return M.Data_String_CodePoints_fromCharCode(v) + else + return M.Data_String_CodePoints_append(M.Data_String_CodePoints_fromCharCode(M.Data_String_CodePoints_add(M.Data_EuclideanRing_euclideanRingInt.div(M.Data_String_CodePoints_sub(v)(65536))(1024))(55296)))(M.Data_String_CodePoints_fromCharCode(M.Data_String_CodePoints_add(M.Data_EuclideanRing_euclideanRingInt.mod(M.Data_String_CodePoints_sub(v)(65536))(1024))(56320))) + end +end +M.Data_String_CodePoints_singleton = M.Data_String_CodePoints_foreign._singleton(M.Data_String_CodePoints_singletonFallback) +M.Data_String_CodePoints_ordCodePoint = { + compare = function(x) + return function(y) return M.Data_Ord_compare(M.Data_Ord_ordInt)(x)(y) end + end, + Eq0 = function() + return { + eq = function(x) + return function(y) return M.Data_String_CodePoints_eq(x)(y) end + end + } + end +} +M.Data_String_CodePoints_uncons = function(s) + if M.Data_String_CodePoints_eq(M.Data_String_CodeUnits_foreign.length(s))(0) then + return M.Data_Maybe_Nothing + else + return M.Data_Maybe_Just({ + head = M.Data_String_CodePoints_unsafeCodePointAt0(s), + tail = M.Data_String_CodePoints_drop(1)(s) + }) + end +end +M.Data_String_CodePoints_takeFallback = function(v) + return function(v1) + if M.Data_String_CodePoints_lessThan(v)(1) then + return "" + else + local v2 = M.Data_String_CodePoints_uncons(v1) + if "Data.Maybe∷Maybe.Just" == v2["$ctor"] then + return M.Data_String_CodePoints_append(M.Data_String_CodePoints_singleton(v2.value0.head))(M.Data_String_CodePoints_takeFallback(M.Data_String_CodePoints_sub(v)(1))(v2.value0.tail)) + else + return v1 + end + end + end +end +M.Data_String_CodePoints_take = function(n) + return function(s) + return M.Data_String_CodePoints_foreign._take(M.Data_String_CodePoints_takeFallback)(n)(s) + end +end +M.Data_String_CodePoints_drop = function(n) + return function(s) + return M.Data_String_CodeUnits_foreign.drop(M.Data_String_CodeUnits_foreign.length(M.Data_String_CodePoints_take(n)(s)))(s) + end +end +M.Data_String_CodePoints_toCodePointArray = M.Data_String_CodePoints_foreign._toCodePointArray(function( s ) + return (function(isNothing) + return function(fromJust) + return function(fst) + return function(snd) + return function(f) + return function(b) + local result = {} + local value = b + while true do + local maybe = f(value) + if isNothing(maybe) then + return result + end + local tuple = fromJust(maybe) + table.insert(result, fst(tuple)) + value = snd(tuple) + end + end + end + end + end + end + end)(M.Data_Maybe_isNothing)((function(f) return f(); end)(function() + return M.Data_Maybe_fromJust() + end))(M.Data_Tuple_fst)(M.Data_Tuple_snd)(function(s1) + return M.Data_Functor_map(M.Data_Maybe_functorMaybe)(function(v) + return (function(value0) + return function(value1) + return { + ["$ctor"] = "Data.Tuple∷Tuple.Tuple", + value0 = value0, + value1 = value1 + } + end + end)(v.head)(v.tail) + end)(M.Data_String_CodePoints_uncons(s1)) + end)(s) +end)(M.Data_String_CodePoints_unsafeCodePointAt0) +M.Data_String_CodePoints_codePointAtFallback = function(n) + return function(s) + local v = M.Data_String_CodePoints_uncons(s) + if "Data.Maybe∷Maybe.Just" == v["$ctor"] then + if M.Data_String_CodePoints_eq(n)(0) then + return M.Data_Maybe_Just(v.value0.head) + else + return M.Data_String_CodePoints_codePointAtFallback(M.Data_String_CodePoints_sub(n)(1))(v.value0.tail) + end + else + return M.Data_Maybe_Nothing + end + end +end +M.Data_String_CodePoints_codePointAt = function(v) + return function(v1) + if M.Data_String_CodePoints_lessThan(v)(0) then + return M.Data_Maybe_Nothing + else + if 0 == v then + if "" == v1 then + return M.Data_Maybe_Nothing + else + if 0 == v then + return M.Data_Maybe_Just(M.Data_String_CodePoints_unsafeCodePointAt0(v1)) + else + return M.Data_String_CodePoints_foreign._codePointAt(M.Data_String_CodePoints_codePointAtFallback)(M.Data_Maybe_Just)(M.Data_Maybe_Nothing)(M.Data_String_CodePoints_unsafeCodePointAt0)(v)(v1) + end + end + else + if 0 == v then + return M.Data_Maybe_Just(M.Data_String_CodePoints_unsafeCodePointAt0(v1)) + else + return M.Data_String_CodePoints_foreign._codePointAt(M.Data_String_CodePoints_codePointAtFallback)(M.Data_Maybe_Just)(M.Data_Maybe_Nothing)(M.Data_String_CodePoints_unsafeCodePointAt0)(v)(v1) + end + end + end + end +end +M.Data_String_CodePoints_boundedEnumCodePoint = { + cardinality = M.Data_String_CodePoints_add(1114111)(1), + fromEnum = function(v) return v end, + toEnum = function(n) + if M.Data_String_CodePoints_conj(M.Data_Ord_greaterThanOrEq(M.Data_Ord_ordInt)(n)(0))(M.Data_String_CodePoints_lessThanOrEq(n)(1114111)) then + return M.Data_Maybe_Just(n) + else + return M.Data_Maybe_Nothing + end + end, + Bounded0 = function() + return { + bottom = 0, + top = 1114111, + Ord0 = function() return M.Data_String_CodePoints_ordCodePoint end + } + end, + Enum1 = function() return M.Data_String_CodePoints_Lazy_enumCodePoint(0) end +} +M.Data_String_CodePoints_Lazy_enumCodePoint = PSLUA_runtime_lazy("enumCodePoint")(function( ) + return { + succ = M.Data_Enum_defaultSucc(M.Data_Enum_toEnum(M.Data_String_CodePoints_boundedEnumCodePoint))(M.Data_Enum_fromEnum(M.Data_String_CodePoints_boundedEnumCodePoint)), + pred = M.Data_Enum_defaultPred(M.Data_Enum_toEnum(M.Data_String_CodePoints_boundedEnumCodePoint))(M.Data_Enum_fromEnum(M.Data_String_CodePoints_boundedEnumCodePoint)), + Ord0 = function() return M.Data_String_CodePoints_ordCodePoint end + } +end) +M.Effect_Console_logShow = function(dictShow) + return function(a) + return (function(s) return function() print(s) end end)(M.Data_Show_show(dictShow)(a)) + end +end +M.Golden_StringCodePoints_Test_compose = M.Control_Semigroupoid_compose(M.Control_Semigroupoid_semigroupoidFn) +M.Golden_StringCodePoints_Test_fromEnum = M.Data_Enum_fromEnum(M.Data_String_CodePoints_boundedEnumCodePoint) +M.Golden_StringCodePoints_Test_discard = (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect) +M.Golden_StringCodePoints_Test_showArray = { + show = M.Data_Show_foreign.showArrayImpl(M.Data_Show_show(M.Data_Show_showInt)) +} +M.Golden_StringCodePoints_Test_logShow = M.Effect_Console_logShow(M.Golden_StringCodePoints_Test_showArray) +M.Golden_StringCodePoints_Test_logShow1 = M.Effect_Console_logShow(M.Data_Show_showInt) +M.Golden_StringCodePoints_Test_logShow2 = M.Effect_Console_logShow(M.Data_Maybe_showMaybe(M.Data_Show_showInt)) +M.Golden_StringCodePoints_Test_map = M.Data_Functor_map(M.Data_Maybe_functorMaybe) +M.Golden_StringCodePoints_Test_cp = M.Golden_StringCodePoints_Test_compose((function(f) return f(); end)(function( ) + return M.Data_Maybe_fromJust() +end))(M.Data_Enum_toEnum(M.Data_String_CodePoints_boundedEnumCodePoint)) +M.Golden_StringCodePoints_Test_codes = M.Golden_StringCodePoints_Test_compose(M.Data_Functor_map({ + map = function(f) + return function(arr) + local l = #arr + local result = {} + for i = 1, l do result[i] = f(arr[i]) end + return result + end + end +})(M.Golden_StringCodePoints_Test_fromEnum))(M.Data_String_CodePoints_toCodePointArray) +return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow(M.Golden_StringCodePoints_Test_codes("aéЯ𝐀z")))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow1(M.Data_String_CodePoints_compose(function(xs) return #xs end)(M.Data_String_CodePoints_toCodePointArray)("aéЯ𝐀z")))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow1(M.Data_String_CodeUnits_foreign.length("aéЯ𝐀z")))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow(M.Golden_StringCodePoints_Test_codes(M.Data_String_CodePoints_take(2)("aéЯ𝐀z"))))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow(M.Golden_StringCodePoints_Test_codes(M.Data_String_CodePoints_drop(2)("aéЯ𝐀z"))))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow2(M.Golden_StringCodePoints_Test_map(M.Golden_StringCodePoints_Test_fromEnum)(M.Data_String_CodePoints_codePointAt(0)("aéЯ𝐀z"))))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow2(M.Golden_StringCodePoints_Test_map(M.Golden_StringCodePoints_Test_fromEnum)(M.Data_String_CodePoints_codePointAt(3)("aéЯ𝐀z"))))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow2(M.Golden_StringCodePoints_Test_map(M.Golden_StringCodePoints_Test_fromEnum)(M.Data_String_CodePoints_codePointAt(5)("aéЯ𝐀z"))))(function( ) + return M.Golden_StringCodePoints_Test_discard(M.Golden_StringCodePoints_Test_logShow2(M.Golden_StringCodePoints_Test_map(M.Golden_StringCodePoints_Test_compose(M.Golden_StringCodePoints_Test_fromEnum)(function( v ) + return v.head + end))(M.Data_String_CodePoints_uncons("aéЯ𝐀z"))))(function() + return M.Golden_StringCodePoints_Test_discard(M.Effect_Console_logShow(M.Data_Maybe_showMaybe(M.Golden_StringCodePoints_Test_showArray))(M.Golden_StringCodePoints_Test_map(M.Golden_StringCodePoints_Test_compose(M.Golden_StringCodePoints_Test_codes)(function( v ) + return v.tail + end))(M.Data_String_CodePoints_uncons("aéЯ𝐀z"))))(function() + return M.Golden_StringCodePoints_Test_discard(M.Effect_Console_logShow({ + show = function(v) + if v then + return "true" + else + if false == v then + return "false" + else + return error("No patterns matched") + end + end + end + })(M.Data_Eq_eq({ + eq = M.Data_Eq_foreign.eqStringImpl + })(M.Data_String_CodePoints_foreign._fromCodePointArray(M.Data_String_CodePoints_singletonFallback)(M.Data_String_CodePoints_toCodePointArray("aéЯ𝐀z")))("aéЯ𝐀z")))(function( ) + return M.Golden_StringCodePoints_Test_logShow(M.Golden_StringCodePoints_Test_codes(M.Data_String_CodePoints_singleton(M.Golden_StringCodePoints_Test_cp(119808)))) + end) + end) + end) + end) + end) + end) + end) + end) + end) + end) +end)() diff --git a/test/ps/packages.dhall b/test/ps/packages.dhall index d74319c..b6e98a0 100644 --- a/test/ps/packages.dhall +++ b/test/ps/packages.dhall @@ -3,7 +3,7 @@ let upstream-ps = sha256:e48c9b283ca89ec994453459fb74c4b5b5a9432349f83a2e104f39dd869a0f6e let upstream-lua = - https://github.com/Unisay/purescript-lua-package-sets/releases/download/psc-0.15.15-20260612/packages.dhall - sha256:e031a7820831578424a5270b778f9f31a5aadee7a719a9fa95f8d58f406b308d + https://github.com/Unisay/purescript-lua-package-sets/releases/download/psc-0.15.15-20260613-2/packages.dhall + sha256:b006e1fd8aa8cd290faf65852f37f62ad3bf5fe97fa3a7c30c97ff7ddfa49807 in upstream-ps // upstream-lua diff --git a/test/ps/spago.dhall b/test/ps/spago.dhall index 24e3ee1..e2214cb 100644 --- a/test/ps/spago.dhall +++ b/test/ps/spago.dhall @@ -2,11 +2,14 @@ , dependencies = [ "console" , "effect" + , "enums" , "foldable-traversable" , "maybe" + , "partial" , "newtype" , "prelude" , "profunctor" + , "strings" ] , packages = ./packages.dhall , sources = [ "golden/**/*.purs" ] From 9003c17092a9fd232827c40929cccdf7e421dd4d Mon Sep 17 00:00:00 2001 From: Andrew Condon Date: Sat, 10 Jan 2026 15:29:30 +0100 Subject: [PATCH 28/40] fix: wrap table literals in parentheses before indexing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Lua, table constructor literals cannot be directly indexed without parentheses. The expression `{ ["key"] = val }["key"]` is a syntax error, while `({ ["key"] = val })["key"]` is valid. This fix adds the same `wrapPrec PrecAtom` wrapping to `VarIndex` that was already applied to `VarField`, ensuring table literals are properly parenthesized when used with bracket indexing. Fixes pattern matching on ADT constructors that would generate invalid Lua like: if "Mod∷Type.Ctor" == { ["$ctor"] = "Mod∷Type.Ctor" }["$ctor"] then Now correctly generates: if "Mod∷Type.Ctor" == ({ ["$ctor"] = "Mod∷Type.Ctor" })["$ctor"] then Co-Authored-By: Claude Opus 4.5 --- lib/Language/PureScript/Backend/Lua/Printer.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Language/PureScript/Backend/Lua/Printer.hs b/lib/Language/PureScript/Backend/Lua/Printer.hs index 5e8b419..5025a48 100644 --- a/lib/Language/PureScript/Backend/Lua/Printer.hs +++ b/lib/Language/PureScript/Backend/Lua/Printer.hs @@ -108,7 +108,7 @@ printRow = \case printVar ∷ Lua.Var → ADoc printVar = \case Lua.VarName name → printName name - Lua.VarIndex (Ann e) (Ann i) → printedExp e <> brackets (printedExp i) + Lua.VarIndex (Ann e) (Ann i) → wrapPrec PrecAtom (printExp e) <> brackets (printedExp i) Lua.VarField (Ann e) n → wrapPrec PrecAtom (printExp e) <> "." <> printName n printFunctionCall ∷ PADoc → [PADoc] → ADoc From 9ef0167af14e3fbe9c579d87eab6abb4d8b7e7a0 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 10:35:19 +0200 Subject: [PATCH 29/40] fix: simplify list construction in fromIR function --- lib/Language/PureScript/Backend/Lua.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Language/PureScript/Backend/Lua.hs b/lib/Language/PureScript/Backend/Lua.hs index 31c230f..9ef7321 100644 --- a/lib/Language/PureScript/Backend/Lua.hs +++ b/lib/Language/PureScript/Backend/Lua.hs @@ -200,7 +200,7 @@ fromIR foreigns topLevelNames modname ir = case ir of -- PS sometimes inserts syntetic unused argument "Prim.undefined" IR.Ref _ann (IR.Imported (IR.ModuleName "Prim") (IR.Name "undefined")) _ → pure [] - _ → goExp arg <&> \a → [a] + _ → (: []) <$> goExp arg IR.Ref _ann qualifiedName index → case qualifiedName of IR.Local name From 772da83757a6bf25ba0fd94e784f03b77750283f Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 10:38:33 +0200 Subject: [PATCH 30/40] test: printer unit test for indexing a table literal Mirror the existing VarField spec case for VarIndex: a table constructor must be parenthesised before bracket indexing, since `{ ["foo"] = 1 }["foo"]` is a Lua syntax error while `({ ["foo"] = 1 })["foo"]` is valid. Without the preceding fix this assertion fails with a clear diff. Regenerate the CharLiterals and StringCodePoints goldens, where the same wrapPrec PrecAtom now parenthesises function-call results before ["$ctor"] indexing, matching VarField. Purely syntactic: IR and eval output are unchanged and both files pass luacheck. --- .../Language/PureScript/Backend/Lua/Printer/Spec.hs | 13 +++++++++++++ test/ps/output/Golden.CharLiterals.Test/golden.lua | 4 ++-- .../output/Golden.StringCodePoints.Test/golden.lua | 8 ++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/test/Language/PureScript/Backend/Lua/Printer/Spec.hs b/test/Language/PureScript/Backend/Lua/Printer/Spec.hs index f1f4857..56c6ef2 100644 --- a/test/Language/PureScript/Backend/Lua/Printer/Spec.hs +++ b/test/Language/PureScript/Backend/Lua/Printer/Spec.hs @@ -35,6 +35,19 @@ spec = do let s = Lua.assign (Lua.VarName [Lua.name|foo|]) (Lua.Boolean True) renderedStatement s `shouldBe` "foo = true" + describe "VarIndex" do + it "var[index]" do + let e = Lua.varName [Lua.name|expr|] + renderedExpression (Lua.varIndex e (Lua.String "foo")) + `shouldBe` "expr[\"foo\"]" + + -- A table constructor must be parenthesised before bracket indexing: + -- `{ ["foo"] = 1 }["foo"]` is a Lua syntax error, `({ … })["foo"]` is not. + it "({[\"foo\"] = 1})[\"foo\"]" do + let e = Lua.table [Lua.tableRowKV (Lua.String "foo") (Lua.Integer 1)] + renderedExpression (Lua.varIndex e (Lua.String "foo")) + `shouldBe` "({ [\"foo\"] = 1 })[\"foo\"]" + describe "Local declaration" do it "without a value" do let s = Lua.Local [Lua.name|foo|] Nothing diff --git a/test/ps/output/Golden.CharLiterals.Test/golden.lua b/test/ps/output/Golden.CharLiterals.Test/golden.lua index 0faefe2..363105b 100644 --- a/test/ps/output/Golden.CharLiterals.Test/golden.lua +++ b/test/ps/output/Golden.CharLiterals.Test/golden.lua @@ -124,7 +124,7 @@ return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_ return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show("a")))(function( ) return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show1(M.Data_Eq_eqChar.eq("\n")("\n"))))(function( ) return M.Effect_Console_foreign.log(M.Golden_CharLiterals_Test_show1((function( ) - if "Data.Ordering∷Ordering.LT" == ((function() + if "Data.Ordering∷Ordering.LT" == (((function() local unsafeCoerceImpl = function(lt) return function(eq) return function(gt) @@ -147,7 +147,7 @@ return M.Golden_CharLiterals_Test_discard(M.Effect_Console_foreign.log(M.Golden_ ["$ctor"] = "Data.Ordering∷Ordering.LT" })({ ["$ctor"] = "Data.Ordering∷Ordering.EQ" })({ ["$ctor"] = "Data.Ordering∷Ordering.GT" - })("\t")("\n")["$ctor"] then + })("\t")("\n"))["$ctor"] then return true else return false diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.lua b/test/ps/output/Golden.StringCodePoints.Test/golden.lua index dd273d1..9a0c9ce 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/golden.lua +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.lua @@ -301,7 +301,7 @@ M.Data_Ord_compare = function(dict) return dict.compare end M.Data_Ord_greaterThanOrEq = function(dictOrd) return function(a1) return function(a2) - if "Data.Ordering∷Ordering.LT" == M.Data_Ord_compare(dictOrd)(a1)(a2)["$ctor"] then + if "Data.Ordering∷Ordering.LT" == (M.Data_Ord_compare(dictOrd)(a1)(a2))["$ctor"] then return false else return true @@ -312,7 +312,7 @@ end M.Data_Ord_lessThan = function(dictOrd) return function(a1) return function(a2) - if "Data.Ordering∷Ordering.LT" == M.Data_Ord_compare(dictOrd)(a1)(a2)["$ctor"] then + if "Data.Ordering∷Ordering.LT" == (M.Data_Ord_compare(dictOrd)(a1)(a2))["$ctor"] then return true else return false @@ -323,7 +323,7 @@ end M.Data_Ord_lessThanOrEq = function(dictOrd) return function(a1) return function(a2) - if "Data.Ordering∷Ordering.GT" == M.Data_Ord_compare(dictOrd)(a1)(a2)["$ctor"] then + if "Data.Ordering∷Ordering.GT" == (M.Data_Ord_compare(dictOrd)(a1)(a2))["$ctor"] then return false else return true @@ -496,7 +496,7 @@ M.Data_String_CodePoints_unsafeCodePointAt0 = M.Data_String_CodePoints_foreign._ end end)(0)(s)) if M.Data_String_CodePoints_conj(M.Data_String_CodePoints_conj(M.Data_String_CodePoints_lessThanOrEq(55296)(cu0))(M.Data_String_CodePoints_lessThanOrEq(cu0)(56319)))((function( ) - if "Data.Ordering∷Ordering.GT" == M.Data_Ord_compare(M.Data_Ord_ordInt)(M.Data_String_CodeUnits_foreign.length(s))(1)["$ctor"] then + if "Data.Ordering∷Ordering.GT" == (M.Data_Ord_compare(M.Data_Ord_ordInt)(M.Data_String_CodeUnits_foreign.length(s))(1))["$ctor"] then return true else return false From dc61bb50f01d0b4714cd834fbc04ba1603dfb608 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 15:17:38 +0200 Subject: [PATCH 31/40] fix: create parent directory of --lua-output-file (#61) --- exe/Main.hs | 15 +++++++------- lib/Language/PureScript/Backend/Output.hs | 20 +++++++++++++++++++ pslua.cabal | 2 ++ .../PureScript/Backend/Output/Spec.hs | 14 +++++++++++++ test/Main.hs | 2 ++ 5 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 lib/Language/PureScript/Backend/Output.hs create mode 100644 test/Language/PureScript/Backend/Output/Spec.hs diff --git a/exe/Main.hs b/exe/Main.hs index 1c66926..a12450a 100644 --- a/exe/Main.hs +++ b/exe/Main.hs @@ -9,6 +9,7 @@ import Language.PureScript.Backend qualified as Backend import Language.PureScript.Backend.IR qualified as IR import Language.PureScript.Backend.Lua qualified as Lua import Language.PureScript.Backend.Lua.Printer qualified as Printer +import Language.PureScript.Backend.Output (withOutputFile) import Language.PureScript.CoreFn.Reader qualified as CoreFn import Language.PureScript.Names (runIdent, runModuleName) import Main.Utf8 qualified as Utf8 @@ -53,19 +54,19 @@ main = Utf8.withUtf8 do & Oops.runOops let outputFile = toFilePath luaOutput - withFile outputFile WriteMode \h → + withOutputFile luaOutput \h → renderIO h . layoutPretty defaultLayoutOptions $ Printer.printLuaChunk lua when (OutputIR `elem` extraOutputs) do - irOutputFile ← toFilePath <$> replaceExtension ".ir" luaOutput - withFile irOutputFile WriteMode (`pHPrint` ir) - putTextLn $ "Wrote IR to " <> toText irOutputFile + irOutputPath ← replaceExtension ".ir" luaOutput + withOutputFile irOutputPath (`pHPrint` ir) + putTextLn $ "Wrote IR to " <> toText (toFilePath irOutputPath) when (OutputLuaAst `elem` extraOutputs) do - luaAstOutputFile ← toFilePath <$> replaceExtension ".lua-ast" luaOutput - withFile luaAstOutputFile WriteMode (`pHPrint` lua) - putTextLn $ "Wrote Lua AST to " <> toText luaAstOutputFile + luaAstOutputPath ← replaceExtension ".lua-ast" luaOutput + withOutputFile luaAstOutputPath (`pHPrint` lua) + putTextLn $ "Wrote Lua AST to " <> toText (toFilePath luaAstOutputPath) putTextLn $ "Wrote linked modules to " <> toText outputFile diff --git a/lib/Language/PureScript/Backend/Output.hs b/lib/Language/PureScript/Backend/Output.hs new file mode 100644 index 0000000..63df543 --- /dev/null +++ b/lib/Language/PureScript/Backend/Output.hs @@ -0,0 +1,20 @@ +module Language.PureScript.Backend.Output + ( withOutputFile + ) where + +import Path (Abs, File, Path, parent, toFilePath) +import Path.IO (ensureDir) + +-------------------------------------------------------------------------------- +-- Output ---------------------------------------------------------------------- + +{- | Open a file for writing, first creating its parent directory (and any +missing ancestors). pslua's @--lua-output-file@ may point into a directory +that does not exist yet (a gitignored @dist/@, say); plain 'withFile' would +abort with @does not exist@, a sharp edge each fork's build script would +otherwise work around with @mkdir -p@. +-} +withOutputFile ∷ Path Abs File → (Handle → IO r) → IO r +withOutputFile path action = do + ensureDir (parent path) + withFile (toFilePath path) WriteMode action diff --git a/pslua.cabal b/pslua.cabal index d8dad70..66c11f7 100644 --- a/pslua.cabal +++ b/pslua.cabal @@ -140,6 +140,7 @@ library Language.PureScript.Backend.Lua.Printer Language.PureScript.Backend.Lua.Traversal Language.PureScript.Backend.Lua.Types + Language.PureScript.Backend.Output Language.PureScript.Backend.Types Language.PureScript.Comments Language.PureScript.CoreFn @@ -172,6 +173,7 @@ test-suite spec Language.PureScript.Backend.Lua.Linker.Foreign.Spec Language.PureScript.Backend.Lua.Optimizer.Spec Language.PureScript.Backend.Lua.Printer.Spec + Language.PureScript.Backend.Output.Spec Test.Hspec.Expectations.Pretty Test.Hspec.Extra Test.Hspec.Golden diff --git a/test/Language/PureScript/Backend/Output/Spec.hs b/test/Language/PureScript/Backend/Output/Spec.hs new file mode 100644 index 0000000..b2b9795 --- /dev/null +++ b/test/Language/PureScript/Backend/Output/Spec.hs @@ -0,0 +1,14 @@ +module Language.PureScript.Backend.Output.Spec (spec) where + +import Language.PureScript.Backend.Output (withOutputFile) +import Path (parseRelFile, ()) +import Path.IO (doesFileExist, withSystemTempDir) +import Test.Hspec (Spec, describe, it, shouldReturn) + +spec ∷ Spec +spec = describe "Language.PureScript.Backend.Output" do + it "withOutputFile creates the missing parent directory" do + withSystemTempDir "pslua-output" \tmp → do + file ← (tmp ) <$> parseRelFile "nested/dir/out.lua" + withOutputFile file (const pass) + doesFileExist file `shouldReturn` True diff --git a/test/Main.hs b/test/Main.hs index 6d27b1d..545ba10 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -11,6 +11,7 @@ import Language.PureScript.Backend.Lua.Golden.Spec qualified as Golden import Language.PureScript.Backend.Lua.Linker.Foreign.Spec qualified as LuaLinkerForeign import Language.PureScript.Backend.Lua.Optimizer.Spec qualified as LuaOptimizer import Language.PureScript.Backend.Lua.Printer.Spec qualified as Printer +import Language.PureScript.Backend.Output.Spec qualified as Output import Test.Hspec (hspec) main ∷ IO () @@ -26,3 +27,4 @@ main = hspec do LuaOptimizer.spec Printer.spec LuaLinkerForeign.spec + Output.spec From c4cbc64854dc491484be21e0648c95d7f20c2e34 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 15:37:25 +0200 Subject: [PATCH 32/40] fix: array-literal pattern binders read 1-based Lua indices (#49) --- lib/Language/PureScript/Backend/Lua.hs | 7 +- .../golden/Golden/ArrayPatternMatch/Test.purs | 26 + .../Golden.ArrayPatternMatch.Test/corefn.json | 1 + .../eval/.gitignore | 1 + .../eval/golden.txt | 4 + .../Golden.ArrayPatternMatch.Test/golden.ir | 490 ++++++++++++++++++ .../Golden.ArrayPatternMatch.Test/golden.lua | 128 +++++ 7 files changed, 654 insertions(+), 3 deletions(-) create mode 100644 test/ps/golden/Golden/ArrayPatternMatch/Test.purs create mode 100644 test/ps/output/Golden.ArrayPatternMatch.Test/corefn.json create mode 100644 test/ps/output/Golden.ArrayPatternMatch.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.ArrayPatternMatch.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir create mode 100644 test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua diff --git a/lib/Language/PureScript/Backend/Lua.hs b/lib/Language/PureScript/Backend/Lua.hs index 9ef7321..1a59af8 100644 --- a/lib/Language/PureScript/Backend/Lua.hs +++ b/lib/Language/PureScript/Backend/Lua.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE QuasiQuotes #-} - module Language.PureScript.Backend.Lua ( fromUberModule , fromIR @@ -177,7 +175,10 @@ fromIR foreigns topLevelNames modname ir = case ir of IR.ArrayLength _ann e → Right . Lua.hash <$> goExp e IR.ArrayIndex _ann expr index → - Right . flip Lua.varIndex (Lua.Integer (fromIntegral index)) <$> goExp expr + -- IR array indices are 0-based (de Bruijn-style, like the source language), + -- but Lua tables are 1-based, so shift by one. This mirrors the arrays FFI + -- `indexImpl`, which reads `xs[i + 1]`. See issue #49. + Right . flip Lua.varIndex (Lua.Integer (fromIntegral index + 1)) <$> goExp expr IR.ObjectProp _ann expr propName → Right . flip Lua.varField (fromPropName propName) <$> goExp expr IR.ObjectUpdate _ann expr propValues → do diff --git a/test/ps/golden/Golden/ArrayPatternMatch/Test.purs b/test/ps/golden/Golden/ArrayPatternMatch/Test.purs new file mode 100644 index 0000000..b5de225 --- /dev/null +++ b/test/ps/golden/Golden/ArrayPatternMatch/Test.purs @@ -0,0 +1,26 @@ +module Golden.ArrayPatternMatch.Test where + +import Prelude + +import Effect (Effect) +import Effect.Console (logShow) + +-- Matching an array-literal pattern destructures by index. The binders must +-- read 1-based Lua slots; the regression in #49 read them 0-based, so the +-- first element came back nil and the match crashed at runtime. +firstTwo :: Array Int -> Int +firstTwo = case _ of + [ a, b ] -> a + b + _ -> -1 + +lastOfThree :: Array Int -> Int +lastOfThree = case _ of + [ _, _, c ] -> c + _ -> -1 + +main :: Effect Unit +main = do + logShow (firstTwo [ 10, 20 ]) + logShow (firstTwo [ 1, 2, 3 ]) + logShow (firstTwo []) + logShow (lastOfThree [ 7, 8, 9 ]) diff --git a/test/ps/output/Golden.ArrayPatternMatch.Test/corefn.json b/test/ps/output/Golden.ArrayPatternMatch.Test/corefn.json new file mode 100644 index 0000000..17e6160 --- /dev/null +++ b/test/ps/output/Golden.ArrayPatternMatch.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[19,10],"start":[19,8]}},"type":"Var","value":{"identifier":"negate","moduleName":["Data","Ring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[19,10],"start":[19,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"ringInt","moduleName":["Data","Ring"]}},"type":"App"},"identifier":"negate"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[13,18],"start":[13,17]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[13,20],"start":[13,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"add"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,32],"start":[23,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,32],"start":[23,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,32],"start":[23,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,10],"start":[23,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,32],"start":[23,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[16,32],"start":[16,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,10],"start":[17,15]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,10],"start":[17,15]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,14],"start":[18,3]}},"binderType":"LiteralBinder","literal":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,6],"start":[18,5]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,8]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,12],"start":[18,11]}},"binderType":"VarBinder","identifier":"c"}]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[18,19],"start":[18,18]}},"type":"Var","value":{"identifier":"c","sourcePos":[18,11]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,4],"start":[19,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"negate","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,10],"start":[19,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,10],"start":[19,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"lastOfThree"},{"annotation":{"meta":null,"sourceSpan":{"end":[11,29],"start":[11,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[12,12]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[12,12]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,11],"start":[13,3]}},"binderType":"LiteralBinder","literal":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,6],"start":[13,5]}},"binderType":"VarBinder","identifier":"a"},{"annotation":{"meta":null,"sourceSpan":{"end":[13,9],"start":[13,8]}},"binderType":"VarBinder","identifier":"b"}]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,20],"start":[13,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,16],"start":[13,15]}},"type":"Var","value":{"identifier":"a","sourcePos":[13,5]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[13,20],"start":[13,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,20],"start":[13,19]}},"type":"Var","value":{"identifier":"b","sourcePos":[13,8]}},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,4],"start":[14,3]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"negate","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[14,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,10],"start":[14,9]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"identifier":"firstTwo"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,20],"start":[21,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,32],"start":[23,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,32],"start":[23,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,20],"start":[23,12]}},"type":"Var","value":{"identifier":"firstTwo","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,31],"start":[23,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,31],"start":[23,21]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,25],"start":[23,23]}},"type":"Literal","value":{"literalType":"IntLiteral","value":10}},{"annotation":{"meta":null,"sourceSpan":{"end":[23,29],"start":[23,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":20}}]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,32],"start":[23,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,32],"start":[23,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,33],"start":[24,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,33],"start":[24,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[24,20],"start":[24,12]}},"type":"Var","value":{"identifier":"firstTwo","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[24,32],"start":[24,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,32],"start":[24,21]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,24],"start":[24,23]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[24,27],"start":[24,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[24,30],"start":[24,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}}]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,33],"start":[24,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,33],"start":[24,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,24],"start":[25,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,24],"start":[25,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[25,20],"start":[25,12]}},"type":"Var","value":{"identifier":"firstTwo","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,23],"start":[25,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,23],"start":[25,21]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,24],"start":[25,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,24],"start":[25,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[26,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[26,23],"start":[26,12]}},"type":"Var","value":{"identifier":"lastOfThree","moduleName":["Golden","ArrayPatternMatch","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,35],"start":[26,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,35],"start":[26,24]}},"type":"Literal","value":{"literalType":"ArrayLiteral","value":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,27],"start":[26,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":7}},{"annotation":{"meta":null,"sourceSpan":{"end":[26,30],"start":[26,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":8}},{"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,32]}},"type":"Literal","value":{"literalType":"IntLiteral","value":9}}]}},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["firstTwo","lastOfThree","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Data","Ring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Golden","ArrayPatternMatch","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,36],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","ArrayPatternMatch","Test"],"modulePath":"golden/Golden/ArrayPatternMatch/Test.purs","reExports":{},"sourceSpan":{"end":[26,36],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.ArrayPatternMatch.Test/eval/.gitignore b/test/ps/output/Golden.ArrayPatternMatch.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.ArrayPatternMatch.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.ArrayPatternMatch.Test/eval/golden.txt b/test/ps/output/Golden.ArrayPatternMatch.Test/eval/golden.txt new file mode 100644 index 0000000..45bdfe9 --- /dev/null +++ b/test/ps/output/Golden.ArrayPatternMatch.Test/eval/golden.txt @@ -0,0 +1,4 @@ +30 +-1 +-1 +9 diff --git a/test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir new file mode 100644 index 0000000..1764425 --- /dev/null +++ b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir @@ -0,0 +1,490 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "semiringInt" + }, LiteralObject Nothing + [ + ( PropName "add", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intAdd" ) + ), + ( PropName "zero", LiteralInt Nothing 0 ), + ( PropName "mul", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMul" ) + ), + ( PropName "one", LiteralInt Nothing 1 ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ArrayPatternMatch.Test", qnameName = Name "negate" + }, Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "sub", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + [ ( Nothing, Name "intSub" ) ] + ) + ( PropName "intSub" ) + ), + ( PropName "Semiring0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ) + ] + ) + ( PropName "sub" ) + ) + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "sub", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + [ ( Nothing, Name "intSub" ) ] + ) + ( PropName "intSub" ) + ), + ( PropName "Semiring0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ) + ] + ) + ( PropName "Semiring0" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ( PropName "zero" ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ArrayPatternMatch.Test", qnameName = Name "discard" + }, App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ArrayPatternMatch.Test", qnameName = Name "logShow" + }, Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ) + ( PropName "showIntImpl" ) + ) + ] + ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ArrayPatternMatch.Test", qnameName = Name "lastOfThree" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralInt Nothing 3 ) + ( ArrayLength Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( ArrayIndex Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) 2 ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "negate" ) ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.ArrayPatternMatch.Test", qnameName = Name "firstTwo" + }, Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralInt Nothing 2 ) + ( ArrayLength Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Semiring" ) ( Name "semiringInt" ) ) 0 + ) + ( PropName "add" ) + ) + ( ArrayIndex Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) 0 ) + ) + ( ArrayIndex Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) 1 ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "negate" ) ) 0 + ) + ( LiteralInt Nothing 1 ) + ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "firstTwo", Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "firstTwo" ) ) 0 + ), + ( Name "lastOfThree", Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "lastOfThree" ) ) 0 + ), + ( Name "main", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "firstTwo" ) ) 0 + ) + ( LiteralArray Nothing [ LiteralInt Nothing 10, LiteralInt Nothing 20 ] ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "logShow" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.ArrayPatternMatch.Test" ) + ( Name "firstTwo" ) + ) 0 + ) + ( LiteralArray Nothing + [ LiteralInt Nothing 1, LiteralInt Nothing 2, LiteralInt Nothing 3 ] + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.ArrayPatternMatch.Test" ) ( Name "discard" ) ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.ArrayPatternMatch.Test" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.ArrayPatternMatch.Test" ) + ( Name "firstTwo" ) + ) 0 + ) + ( LiteralArray Nothing [] ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.ArrayPatternMatch.Test" ) + ( Name "logShow" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.ArrayPatternMatch.Test" ) + ( Name "lastOfThree" ) + ) 0 + ) + ( LiteralArray Nothing + [ LiteralInt Nothing 7, LiteralInt Nothing 8, LiteralInt Nothing 9 ] + ) + ) + ) + ) + ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua new file mode 100644 index 0000000..84b8d23 --- /dev/null +++ b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua @@ -0,0 +1,128 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_Semiring_foreign = { + intAdd = function(x) return function(y) return x + y end end, + intMul = function(x) return function(y) return x * y end end +} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end +} +M.Data_Semiring_semiringInt = { + add = M.Data_Semiring_foreign.intAdd, + zero = 0, + mul = M.Data_Semiring_foreign.intMul, + one = 1 +} +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Golden_ArrayPatternMatch_Test_negate = function(a) + return (function(x) return function(y) return x - y end end)(((function() + return M.Data_Semiring_semiringInt + end)()).zero)(a) +end +M.Golden_ArrayPatternMatch_Test_discard = (function(dictBind) + return M.Control_Bind_bind(dictBind) +end)(M.Effect_bindEffect) +M.Golden_ArrayPatternMatch_Test_logShow = function(a) + return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(a)) +end +M.Golden_ArrayPatternMatch_Test_lastOfThree = function(v) + if 3 == #(v) then + return v[3] + else + return M.Golden_ArrayPatternMatch_Test_negate(1) + end +end +M.Golden_ArrayPatternMatch_Test_firstTwo = function(v) + if 2 == #(v) then + return M.Data_Semiring_semiringInt.add(v[1])(v[2]) + else + return M.Golden_ArrayPatternMatch_Test_negate(1) + end +end +return M.Golden_ArrayPatternMatch_Test_discard(M.Golden_ArrayPatternMatch_Test_logShow(M.Golden_ArrayPatternMatch_Test_firstTwo({ + [1] = 10, + [2] = 20 +})))(function() + return M.Golden_ArrayPatternMatch_Test_discard(M.Golden_ArrayPatternMatch_Test_logShow(M.Golden_ArrayPatternMatch_Test_firstTwo({ + [1] = 1, + [2] = 2, + [3] = 3 + })))(function() + return M.Golden_ArrayPatternMatch_Test_discard(M.Golden_ArrayPatternMatch_Test_logShow(M.Golden_ArrayPatternMatch_Test_firstTwo({})))(function( ) + return M.Golden_ArrayPatternMatch_Test_logShow(M.Golden_ArrayPatternMatch_Test_lastOfThree({ + [1] = 7, + [2] = 8, + [3] = 9 + })) + end) + end) +end)() From 7e1a8529bbe90961249ba026cac26d8ef19a50cb Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 16:42:59 +0200 Subject: [PATCH 33/40] fix: lower De Bruijn indices when a binder is removed (#56) The IR uses per-name De Bruijn indices: a `Ref (Local n) k` selects the k-th enclosing binder named `n`. Two optimizer passes removed a binder without lowering the references that had skipped over it, leaving them pointing one binder too far out -- an unbound local that the Lua backend rejects with `UnexpectedRefBound`. This aborts `Data.Array` compilation (`foldRecM`, #56): * beta reduction drops the applied lambda; * dead-code elimination blanks an unused named binder to `ParamUnused`. Both now repair the survivors with a new `unshift`, the inverse of `shift 1`. `shift` is refactored to share its scope-tracking traversal (`overFreeIndex`) with `unshift` so the two cannot drift apart. Tests: property and example coverage for shift/unshift/substitute, including the classic capture-avoiding cases (Types spec); a well-scopedness invariant over a well-scoped expression generator (this found the DCE sibling bug) plus deterministic regressions for both passes (Optimizer spec); and an eval golden `Golden.TailRecM2Shadow` over the `foldRecM` shape that triggered #56. --- lib/Language/PureScript/Backend/IR/DCE.hs | 12 +- .../PureScript/Backend/IR/Optimizer.hs | 7 +- lib/Language/PureScript/Backend/IR/Types.hs | 171 ++-- test/Language/PureScript/Backend/IR/Gen.hs | 70 ++ .../PureScript/Backend/IR/Optimizer/Spec.hs | 149 +++- .../PureScript/Backend/IR/Types/Spec.hs | 108 ++- .../golden/Golden/TailRecM2Shadow/Test.purs | 25 + .../Golden.TailRecM2Shadow.Test/corefn.json | 1 + .../eval/.gitignore | 1 + .../eval/golden.txt | 1 + .../Golden.TailRecM2Shadow.Test/golden.ir | 741 ++++++++++++++++++ .../Golden.TailRecM2Shadow.Test/golden.lua | 188 +++++ test/ps/spago.dhall | 1 + 13 files changed, 1397 insertions(+), 78 deletions(-) create mode 100644 test/ps/golden/Golden/TailRecM2Shadow/Test.purs create mode 100644 test/ps/output/Golden.TailRecM2Shadow.Test/corefn.json create mode 100644 test/ps/output/Golden.TailRecM2Shadow.Test/eval/.gitignore create mode 100644 test/ps/output/Golden.TailRecM2Shadow.Test/eval/golden.txt create mode 100644 test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir create mode 100644 test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua diff --git a/lib/Language/PureScript/Backend/IR/DCE.hs b/lib/Language/PureScript/Backend/IR/DCE.hs index 7f95c96..0b5239d 100644 --- a/lib/Language/PureScript/Backend/IR/DCE.hs +++ b/lib/Language/PureScript/Backend/IR/DCE.hs @@ -30,6 +30,7 @@ import Language.PureScript.Backend.IR.Types , getAnn , listGrouping , rewriteExpTopDown + , unshift ) data EntryPoint = EntryPoint ModuleName [Name] @@ -122,16 +123,19 @@ eliminateDeadCode uber@UberModule {..} = pure . \case Abs ann param b | not (paramId `member` reachableIds) → - Rewritten Recurse (Abs ann param' b) + Rewritten Recurse (Abs ann param' b') where paramId ∷ Id = case param of ParamUnused (pid, _) → pid ParamNamed (pid, _) _name → pid - param' = + -- Blanking an unused named binder drops a slot from that name's + -- De Bruijn namespace, so references in the body that skipped over it + -- (index ≥ 1) must be lowered, just as in beta reduction (issue #56). + (param', b') = case param of - ParamUnused pann → ParamUnused pann - ParamNamed pann _name → ParamUnused pann + ParamUnused pann → (ParamUnused pann, b) + ParamNamed pann name → (ParamUnused pann, unshift name 0 b) Let ann binds body → Rewritten Recurse case NE.nonEmpty preservedBinds of Nothing → body diff --git a/lib/Language/PureScript/Backend/IR/Optimizer.hs b/lib/Language/PureScript/Backend/IR/Optimizer.hs index cce95af..58fd0ab 100644 --- a/lib/Language/PureScript/Backend/IR/Optimizer.hs +++ b/lib/Language/PureScript/Backend/IR/Optimizer.hs @@ -32,6 +32,7 @@ import Language.PureScript.Backend.IR.Types , substitute , thenRewrite , unIndex + , unshift ) optimizedUberModule ∷ UberModule → UberModule @@ -301,7 +302,11 @@ betaReduce ∷ RewriteRule Ann betaReduce = pure . \case App _ (Abs _ (ParamNamed _ param) body) r → - Rewritten Recurse $ substitute (Local param) 0 r body + -- Removing the λ closes a binder for 'param', so any reference to it + -- that the substitution shifted past the binder must be lowered back + -- with 'unshift'; otherwise it is left pointing one binder too far out + -- and reaches the Lua backend as an unbound local (issue #56). + Rewritten Recurse . unshift param 0 $ substitute (Local param) 0 r body _ → NoChange {- Note [Eta reduction is unsound] diff --git a/lib/Language/PureScript/Backend/IR/Types.hs b/lib/Language/PureScript/Backend/IR/Types.hs index c1c2b8c..b278507 100644 --- a/lib/Language/PureScript/Backend/IR/Types.hs +++ b/lib/Language/PureScript/Backend/IR/Types.hs @@ -736,7 +736,87 @@ substitute name idx replacement = substitute' idx where go = substitute' index --- | Increase the index of all bound variables matching the given variable name +{- | Rewrite the De Bruijn index of every reference to @namespace@ that is free +with respect to @minIndex@, using @adjust minIndex index@. Binders for other +names are transparent; a binder for @namespace@ raises @minIndex@ by one (see +Note [Sequential scoping of Let bindings] for the @Let@ case). This is the +shared traversal behind 'shift' (which makes room for a new binder) and +'unshift' (which closes the gap left by a removed one); keeping both on one +traversal stops them from drifting apart. +-} +overFreeIndex + ∷ (Index → Index → Index) + -- ^ Given the current @minIndex@ and a reference's index, the new index + → Name + -- ^ The variable name to match (a.k.a. the namespace) + → Index + -- ^ The minimum bound at or above which references are considered free + → RawExp ann + → RawExp ann +overFreeIndex adjust namespace = go + where + go minIndex expression = + case expression of + Ref ann (Local name) index + | name == namespace → + Ref ann (Local name) (adjust minIndex index) + Abs ann argument body → + Abs ann argument (go minIndex' body) + where + minIndex' + | paramName argument == Just namespace = minIndex + 1 + | otherwise = minIndex + -- See Note [Sequential scoping of Let bindings] + Let ann binds body → + Let ann binds' body' + where + (bodyMinIndex, binds') = mapAccumL withGrouping minIndex binds + body' = go bodyMinIndex body + withGrouping minIdx grouping = + case grouping of + Standalone (annotation, boundName, expr) → + ( if boundName == namespace then minIdx + 1 else minIdx + , Standalone (annotation, boundName, go minIdx expr) + ) + RecursiveGroup recBinds → + ( minIdx' + , RecursiveGroup $ + recBinds <&> \(nameAnn, boundName, expr) → + (nameAnn, boundName, go minIdx' expr) + ) + where + minIdx' = + minIdx + + fromIntegral + (length (filter (== namespace) (bindingNames grouping))) + App ann argument function → + App ann (go minIndex argument) (go minIndex function) + LiteralArray ann as → + LiteralArray ann (go minIndex <$> as) + LiteralObject ann props → + LiteralObject ann (go minIndex <<$>> props) + ReflectCtor ann a → + ReflectCtor ann (go minIndex a) + DataArgumentByIndex ann idx a → + DataArgumentByIndex ann idx (go minIndex a) + Eq ann a b → + Eq ann (go minIndex a) (go minIndex b) + ArrayLength ann a → + ArrayLength ann (go minIndex a) + ArrayIndex ann a indx → + ArrayIndex ann (go minIndex a) indx + ObjectProp ann a prop → + ObjectProp ann (go minIndex a) prop + ObjectUpdate ann a patches → + ObjectUpdate ann (go minIndex a) (go minIndex <<$>> patches) + IfThenElse ann p th el → + IfThenElse ann (go minIndex p) (go minIndex th) (go minIndex el) + _ → expression + +{- | Increase the index of all references to the given name bound at or above +@minIndex@. Used to make room when a new binder for that name is introduced, +e.g. when substituting a term under a λ that shadows the name. +-} shift ∷ Int -- ^ The amount to shift by @@ -747,72 +827,29 @@ shift → RawExp ann -- ^ The expression to shift → RawExp ann -shift offset namespace minIndex expression = - case expression of - Ref ann (Local name) index → - Ref ann (Local name) $ - index - + if name == namespace && minIndex <= index - then fromIntegral offset - else 0 - Abs ann argument body → - Abs ann argument (shift offset namespace minIndex' body) - where - minIndex' - | paramName argument == Just namespace = minIndex + 1 - | otherwise = minIndex - -- See Note [Sequential scoping of Let bindings] - Let ann binds body → - Let ann binds' body' - where - (bodyMinIndex, binds') = mapAccumL withGrouping minIndex binds - body' = shift offset namespace bodyMinIndex body - withGrouping minIdx grouping = - case grouping of - Standalone (annotation, boundName, expr) → - ( if boundName == namespace then minIdx + 1 else minIdx - , Standalone - ( annotation - , boundName - , shift offset namespace minIdx expr - ) - ) - RecursiveGroup recBinds → - ( minIdx' - , RecursiveGroup $ - recBinds <&> \(nameAnn, boundName, expr) → - (nameAnn, boundName, shift offset namespace minIdx' expr) - ) - where - minIdx' = - minIdx - + fromIntegral - (length (filter (== namespace) (bindingNames grouping))) - App ann argument function → - App ann (go argument) (go function) - LiteralArray ann as → - LiteralArray ann (go <$> as) - LiteralObject ann props → - LiteralObject ann (go <<$>> props) - ReflectCtor ann a → - ReflectCtor ann (go a) - DataArgumentByIndex ann idx a → - DataArgumentByIndex ann idx (go a) - Eq ann a b → - Eq ann (go a) (go b) - ArrayLength ann a → - ArrayLength ann (go a) - ArrayIndex ann a indx → - ArrayIndex ann (go a) indx - ObjectProp ann a prop → - ObjectProp ann (go a) prop - ObjectUpdate ann a patches → - ObjectUpdate ann (go a) (go <<$>> patches) - IfThenElse ann p th el → - IfThenElse ann (go p) (go th) (go el) - _ → expression - where - go = shift offset namespace minIndex +shift offset = + overFreeIndex \minIndex index → + if minIndex <= index then index + fromIntegral offset else index + +{- | Decrease by one the index of references to the given name bound strictly +above @minIndex@: the inverse of @shift 1@, to be applied after a binder for +the name is removed (e.g. by beta reduction) so that references which pointed +past that binder are lowered back into place. References at exactly @minIndex@ +are the removed binder itself and have already been consumed by the +accompanying substitution, so the strict @minIndex < index@ guard both leaves +genuine inner references untouched and keeps the 'Natural' index from +underflowing. +-} +unshift + ∷ Name + -- ^ The variable name to match (a.k.a. the namespace) + → Index + -- ^ References bound strictly above this bound are lowered + → RawExp ann + → RawExp ann +unshift = + overFreeIndex \minIndex index → + if minIndex < index then index - 1 else index $(makePrisms ''AlgebraicType) $(makePrisms ''Parameter) diff --git a/test/Language/PureScript/Backend/IR/Gen.hs b/test/Language/PureScript/Backend/IR/Gen.hs index 2f8bf82..a7e9498 100644 --- a/test/Language/PureScript/Backend/IR/Gen.hs +++ b/test/Language/PureScript/Backend/IR/Gen.hs @@ -1,5 +1,6 @@ module Language.PureScript.Backend.IR.Gen where +import Data.Map.Strict qualified as Map import Data.Text qualified as Text import Hedgehog (MonadGen) import Hedgehog.Corpus qualified as Corpus @@ -57,6 +58,75 @@ exp = ) ] +{- | A generation-time scope: each local name in scope mapped to the number of +enclosing binders for it. Lets 'scopedExp' emit only references that resolve +to a binder (a valid De Bruijn index for that name). +-} +type Scope = Map IR.Name Natural + +{- | Generate a closed, well-scoped expression: every local reference has an +index below the number of enclosing binders of that name. Restricted to +λ / application / if / object / reference / scalar, which is enough to +exercise beta reduction and name shadowing (the surface of issues #37 and +#56) while keeping well-scopedness easy to guarantee by construction. 'Let' +is intentionally left out; its sequential scoping is covered by the +hand-written specs. +-} +scopedExp ∷ ∀ m. MonadGen m ⇒ m IR.Exp +scopedExp = + -- Cap the size hard: beta reduction duplicates substituted arguments, so an + -- unbounded term can blow the optimizer up exponentially in memory. Small + -- terms are plenty to surface scoping bugs (issues #37 / #56 both shrink to + -- a handful of binders). + Gen.scale (min 8) (scopedExpIn mempty) + +scopedExpIn ∷ ∀ m. MonadGen m ⇒ Scope → m IR.Exp +scopedExpIn scope = + Gen.recursiveFrequency + ((4, scalarExp) : [(5, scopedRef) | not (null inScope)]) + [ (6, IR.application <$> scopedExpIn scope <*> scopedExpIn scope) + , + ( 3 + , IR.ifThenElse + <$> scopedExpIn scope + <*> scopedExpIn scope + <*> scopedExpIn scope + ) + , (5, genAbs) + , (4, genRedex) + , + ( 2 + , IR.literalObject + <$> Gen.list + (Range.linear 1 4) + ((,) <$> genPropName <*> scopedExpIn scope) + ) + ] + where + inScope = [(nm, count) | (nm, count) ← Map.toList scope, count > 0] + scopedRef = do + (nm, count) ← Gen.element inScope + index ← Gen.integral (Range.linear 0 (fromIntegral count - 1)) + pure (IR.refLocal nm index) + genAbs = do + (param, body) ← genBinderBody + pure (IR.abstraction param body) + -- An immediately-applied λ: a beta redex. Generating these directly (rather + -- than hoping an application's head happens to be a λ) is what makes the + -- well-scopedness property actually exercise beta reduction, including the + -- shadowing case behind issue #56. + genRedex = do + (param, body) ← genBinderBody + arg ← scopedExpIn scope + pure (IR.application (IR.abstraction param body) arg) + genBinderBody = do + param ← parameter + let scope' = case param of + IR.ParamNamed _ nm → Map.insertWith (+) nm 1 scope + IR.ParamUnused _ → scope + body ← scopedExpIn scope' + pure (param, body) + binding ∷ MonadGen m ⇒ m IR.Binding binding = Gen.frequency [(8, standaloneBinding), (2, recursiveBinding)] diff --git a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs index bb98952..3b1d24f 100644 --- a/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs @@ -1,14 +1,15 @@ module Language.PureScript.Backend.IR.Optimizer.Spec where -import Control.Lens (universeOf) +import Control.Lens (toListOf, universeOf) import Data.Map qualified as Map -import Hedgehog (annotateShow, forAll, (===)) +import Hedgehog (PropertyT, annotateShow, forAll, (===)) import Hedgehog.Gen qualified as Gen import Language.PureScript.Backend.IR.Gen qualified as Gen import Language.PureScript.Backend.IR.Linker (LinkMode (..)) import Language.PureScript.Backend.IR.Linker qualified as Linker import Language.PureScript.Backend.IR.Names ( Name (..) + , PropName (..) , QName (..) , Qualified (Local) , moduleNameFromString @@ -20,7 +21,8 @@ import Language.PureScript.Backend.IR.Optimizer ) import Language.PureScript.Backend.IR.Types ( Exp - , Grouping (Standalone) + , Grouping (..) + , Index , Module (..) , RawExp (..) , abstraction @@ -31,17 +33,59 @@ import Language.PureScript.Backend.IR.Types , lets , literalBool , literalInt + , literalObject , noAnn + , paramName , paramNamed , paramUnused , refImported , refLocal , refLocal0 , subexpressions + , unIndex ) -import Test.Hspec (Spec, describe) +import Test.Hspec (Spec, SpecWith, describe, it) +import Test.Hspec.Hedgehog (hedgehog, modifyMaxShrinks, modifyMaxSuccess) import Test.Hspec.Hedgehog.Extended (test) +-- | Like 'test', but runs the property over many generated inputs. +prop ∷ String → PropertyT IO () → SpecWith () +prop title = + modifyMaxShrinks (const 20) + . modifyMaxSuccess (const 100) + . it title + . hedgehog + +{- | Local references whose De Bruijn index points past every enclosing binder +of that name: unbound locals, which the Lua backend rejects (see +Note [Locals are uniquely named after renameShadowedNames]). An empty result +means the expression is well-scoped. The binder bookkeeping mirrors +'shift'/'unshift'; see Note [Sequential scoping of Let bindings] for 'Let'. +-} +unboundLocals ∷ Exp → [(Name, Index)] +unboundLocals = go Map.empty + where + go ∷ Map Name Natural → Exp → [(Name, Index)] + go scope = \case + Ref _ (Local nm) index + | unIndex index < Map.findWithDefault 0 nm scope → [] + | otherwise → [(nm, index)] + Abs _ param body → go (bindName (paramName param) scope) body + Let _ binds body → + let (bodyScope, errs) = foldl' letGrouping (scope, []) (toList binds) + in errs <> go bodyScope body + other → foldMap (go scope) (toListOf subexpressions other) + where + bindName Nothing sc = sc + bindName (Just nm) sc = Map.insertWith (+) nm 1 sc + letGrouping (sc, errs) = \case + Standalone (_ann, nm, e) → + (Map.insertWith (+) nm 1 sc, errs <> go sc e) + RecursiveGroup recBinds → + let names = (\(_ann, nm, _e) → nm) <$> toList recBinds + sc' = foldr (\nm → Map.insertWith (+) nm 1) sc names + in (sc', errs <> foldMap (\(_ann, _nm, e) → go sc' e) recBinds) + spec ∷ Spec spec = describe "IR Optimizer" do describe "optimizes expressions" do @@ -212,6 +256,103 @@ spec = describe "IR Optimizer" do annotateShow optimized unboundLocalRefs === [] + -- Issue #56: beta reduction removes a binder, so any reference that the + -- substitution shifted past it must be lowered back. Here `b` is bound by + -- an outer λ, while the reduced inner λ is *also* named `b`; reducing it + -- must drop the outer reference from index 1 back to 0 rather than leave it + -- unbound. This is the IR shape `Data.Array.foldRecM` boils down to. + test "beta reduction does not unbind a reference shadowed by the binder" do + let a = Name "a" + b = Name "b" + inner = + abstraction (paramNamed a) $ + abstraction (paramNamed b) $ + literalObject + [ (PropName "p", refLocal a 0) + , (PropName "q", refLocal b 0) + ] + -- (\b -> (\a -> \b -> { p: a, q: b }) b 0) + shadowed = + abstraction (paramNamed b) $ + application + (application inner (refLocal b 0)) + (literalInt 0) + original = + Linker.UberModule + { uberModuleForeigns = [] + , uberModuleBindings = [] + , uberModuleExports = [(Name "foldRecMShape", shadowed)] + } + -- After the redexes are reduced only the outer λ remains, so the + -- surviving reference is `b` at index 0. + expected = + abstraction (paramNamed b) $ + literalObject + [ (PropName "p", refLocal b 0) + , (PropName "q", literalInt 0) + ] + optimized = optimizedUberModule original + offending = + foldMap (unboundLocals . snd) (Linker.uberModuleExports optimized) + annotateShow optimized + offending === [] + Linker.uberModuleExports optimized === [(Name "foldRecMShape", expected)] + + -- Sibling of #56 in the DCE pass (found by the property below). Dead-code + -- elimination blanks an unused named binder to ParamUnused. Here the inner + -- λj is unused, yet the body references the *outer* j (at index 1, skipping + -- the inner one); blanking the inner binder must lower that reference to 0, + -- otherwise it is left unbound. + test "blanking an unused shadowing binder keeps outer references bound" do + let j = Name "j" + k = Name "k" + -- \j -> (\k -> { foo: (\_ -> \j -> k) 0 }) j + shadowed = + abstraction (paramNamed j) $ + application + ( abstraction (paramNamed k) $ + literalObject + [ + ( PropName "foo" + , application + ( abstraction paramUnused $ + abstraction (paramNamed j) (refLocal k 0) + ) + (literalInt 0) + ) + ] + ) + (refLocal j 0) + original = + Linker.UberModule + { uberModuleForeigns = [] + , uberModuleBindings = [] + , uberModuleExports = [(Name "shape", shadowed)] + } + optimized = optimizedUberModule original + offending = + foldMap (unboundLocals . snd) (Linker.uberModuleExports optimized) + annotateShow optimized + offending === [] + + -- The general invariant behind #37 and #56: optimizing a well-scoped + -- expression must never produce an unbound local reference. Runs through the + -- whole 'optimizedUberModule' pipeline (not a single 'optimizedExpression' + -- pass) because the #56 dangling reference only surfaces once an enclosing + -- redex is reduced on a later iteration. + prop "optimization keeps expressions well-scoped" do + e ← forAll Gen.scopedExp + annotateShow e + unboundLocals e === [] -- the generator only emits well-scoped terms + let optimized = + optimizedUberModule + Linker.UberModule + { Linker.uberModuleForeigns = [] + , Linker.uberModuleBindings = [] + , Linker.uberModuleExports = [(Name "root", e)] + } + foldMap (unboundLocals . snd) (Linker.uberModuleExports optimized) === [] + describe "renames shadowed names" do test "nested λ-abstractions" do name ← forAll Gen.name diff --git a/test/Language/PureScript/Backend/IR/Types/Spec.hs b/test/Language/PureScript/Backend/IR/Types/Spec.hs index 01d0f70..54aae3a 100644 --- a/test/Language/PureScript/Backend/IR/Types/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Types/Spec.hs @@ -1,7 +1,10 @@ module Language.PureScript.Backend.IR.Types.Spec where import Data.Map qualified as Map -import Hedgehog ((===)) +import Hedgehog (PropertyT, annotateShow, forAll, (===)) +import Hedgehog.Gen qualified as Gen +import Hedgehog.Range qualified as Range +import Language.PureScript.Backend.IR.Gen qualified as Gen import Language.PureScript.Backend.IR.Names ( ModuleName (..) , Name (..) @@ -10,6 +13,7 @@ import Language.PureScript.Backend.IR.Names import Language.PureScript.Backend.IR.Types ( Exp , Grouping (..) + , Index , abstraction , application , countFreeRef @@ -23,10 +27,23 @@ import Language.PureScript.Backend.IR.Types , refLocal , shift , substitute + , unshift ) -import Test.Hspec (Spec, describe) +import Test.Hspec (Spec, SpecWith, describe, it) +import Test.Hspec.Hedgehog (hedgehog, modifyMaxShrinks, modifyMaxSuccess) import Test.Hspec.Hedgehog.Extended (test) +{- | Like 'test', but runs the property over many generated inputs. The bare +'test' helper pins maxSuccess to 1, which is fine for example-based checks +but too weak for the algebraic laws below. +-} +prop ∷ String → PropertyT IO () → SpecWith () +prop title = + modifyMaxShrinks (const 20) + . modifyMaxSuccess (const 100) + . it title + . hedgehog + spec ∷ Spec spec = describe "Types" do test "countFreeRefs" do @@ -98,6 +115,93 @@ spec = describe "Types" do lets (Standalone (noAnn, x, literalInt 42) :| []) (literalInt 0) substitute (Local x) 0 (literalInt 42) original === expected + describe "shift / unshift (De Bruijn re-indexing)" do + let x = Name "x" + y = Name "y" + + -- 'unshift' is the inverse of 'shift 1': raising every free reference to a + -- name and then lowering it again must return the original expression. + prop "unshift undoes shift 1 (round-trip)" do + e ← forAll Gen.exp + n ← forAll Gen.name + minIndex ← forAll (Gen.integral (Range.linear (0 ∷ Index) 3)) + annotateShow e + unshift n minIndex (shift 1 n minIndex e) === e + + test "unshift: a reference bound above minIndex is lowered" do + unshift x 0 (refLocal x 2) === refLocal x 1 + + test "unshift: the reference at minIndex (removed binder) is left alone" do + unshift x 1 (refLocal x 1) === refLocal x 1 + + test "unshift: a reference to a different name is untouched" do + unshift x 0 (refLocal y 3) === refLocal y 3 + + test "unshift: only references free under a shadowing binder are lowered" do + -- under \x the inner reference x@0 is bound by it (left alone), while the + -- outer reference x@2 is free and must drop to x@1. + unshift x 0 (abstraction (paramNamed x) (refLocal x 0)) + === abstraction (paramNamed x) (refLocal x 0) + unshift x 0 (abstraction (paramNamed x) (refLocal x 2)) + === abstraction (paramNamed x) (refLocal x 1) + + describe "substitute (capture-avoiding)" do + -- Replacing a variable by a reference to itself (at the same index) is the + -- identity: this exercises the capture-avoiding shifting that 'substitute' + -- performs as it descends under same-named binders. + prop "substituting a variable for itself is the identity" do + e ← forAll Gen.exp + n ← forAll Gen.name + index ← forAll (Gen.integral (Range.linear (0 ∷ Index) 3)) + annotateShow e + substitute (Local n) index (refLocal n index) e === e + + -- The classic textbook cases the property above can only sample at random. + let x = Name "x" + y = Name "y" + z = Name "z" + + -- (λy. x)[x ≔ y] must not capture the free y: in De Bruijn terms the + -- replacement's y is shifted to index 1 so it keeps referring to the outer + -- y rather than the λ that now encloses it. + test "a free variable is not captured by a binder of its name" do + substitute + (Local x) + 0 + (refLocal y 0) + (abstraction (paramNamed y) (refLocal x 0)) + === abstraction (paramNamed y) (refLocal y 1) + + -- (λz. x)[x ≔ y]: z shadows neither x nor y, so the result is just (λz. y). + test "substitution passes through an unrelated binder unchanged" do + substitute + (Local x) + 0 + (refLocal y 0) + (abstraction (paramNamed z) (refLocal x 0)) + === abstraction (paramNamed z) (refLocal y 0) + + -- (λx. x)[x ≔ 42]: the inner x is bound by its own λx, not the variable + -- being substituted, so the redex is left untouched. + test "a shadowing binder of the same name stops the substitution" do + substitute + (Local x) + 0 + (literalInt 42) + (abstraction (paramNamed x) (refLocal x 0)) + === abstraction (paramNamed x) (refLocal x 0) + + -- (λx. x⟨outer⟩)[x ≔ y]: here the body's reference points past the binder + -- (index 1), so it is the one being substituted; the replacement y is not + -- captured by λx, so it stays at index 0. + test "a reference reaching past a shadowing binder is substituted" do + substitute + (Local x) + 0 + (refLocal y 0) + (abstraction (paramNamed x) (refLocal x 1)) + === abstraction (paramNamed x) (refLocal y 0) + expr ∷ Exp expr = abstraction diff --git a/test/ps/golden/Golden/TailRecM2Shadow/Test.purs b/test/ps/golden/Golden/TailRecM2Shadow/Test.purs new file mode 100644 index 0000000..bf78834 --- /dev/null +++ b/test/ps/golden/Golden/TailRecM2Shadow/Test.purs @@ -0,0 +1,25 @@ +module Golden.TailRecM2Shadow.Test where + +import Prelude + +import Control.Monad.Rec.Class (class MonadRec, Step(..), tailRecM2) +import Effect (Effect) +import Effect.Console (logShow) + +-- Regression for #56. The outer parameter is named `b`, and `tailRecM2`'s own +-- third parameter is also `b`. `tailRecM2` is a single-use dictionary accessor, +-- so the optimizer inlines and beta-reduces it; reducing under the inner `b` +-- capture-shifts the outer reference to index 1, and removing that binder must +-- lower it back to 0. The optimizer used to skip the lowering, leaving an +-- unbound `Local b index 1` that aborted Lua codegen for `Data.Array.foldRecM`. +sumFrom :: forall m. MonadRec m => Int -> Int -> m Int +sumFrom b n = tailRecM2 go b 0 + where + go acc i + | i >= n = pure (Done acc) + | otherwise = pure (Loop { a: acc + i, b: i + 1 }) + +main :: Effect Unit +main = do + r <- sumFrom 0 5 + logShow r diff --git a/test/ps/output/Golden.TailRecM2Shadow.Test/corefn.json b/test/ps/output/Golden.TailRecM2Shadow.Test/corefn.json new file mode 100644 index 0000000..83854c4 --- /dev/null +++ b/test/ps/output/Golden.TailRecM2Shadow.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[19,11],"start":[19,9]}},"type":"Var","value":{"identifier":"greaterThanOrEq","moduleName":["Data","Ord"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[19,13],"start":[19,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"ordInt","moduleName":["Data","Ord"]}},"type":"App"},"identifier":"greaterThanOrEq"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[20,40],"start":[20,39]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[20,42],"start":[20,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semiringInt","moduleName":["Data","Semiring"]}},"type":"App"},"identifier":"add"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[25,10],"start":[25,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[25,12],"start":[25,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,55],"start":[15,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,55],"start":[15,1]}},"argument":"dictMonadRec","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[19,20],"start":[19,16]}},"type":"Var","value":{"identifier":"pure","moduleName":["Control","Applicative"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[19,31],"start":[19,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,31],"start":[19,16]}},"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[19,31],"start":[19,16]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictMonadRec","sourcePos":[0,0]}},"fieldName":"Monad0","type":"Accessor"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[19,31],"start":[19,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"fieldName":"Applicative0","type":"Accessor"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[19,31],"start":[19,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"type":"App"},"identifier":"pure"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[16,24],"start":[16,15]}},"type":"Var","value":{"identifier":"tailRecM2","moduleName":["Control","Monad","Rec","Class"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[16,27],"start":[16,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictMonadRec","sourcePos":[0,0]}},"type":"App"},"identifier":"tailRecM2"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,55],"start":[15,1]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[15,55],"start":[15,1]}},"argument":"n","body":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[16,31],"start":[16,15]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,55],"start":[18,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,55],"start":[18,3]}},"argument":"acc","body":{"annotation":{"meta":null,"sourceSpan":{"end":[20,55],"start":[18,3]}},"argument":"i","body":{"annotation":{"meta":null,"sourceSpan":{"end":[20,55],"start":[18,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,9],"start":[18,6]}},"binderType":"VarBinder","identifier":"acc1"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,11],"start":[18,10]}},"binderType":"VarBinder","identifier":"i1"}],"expressions":[{"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"pure","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,31],"start":[19,16]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,26],"start":[19,22]}},"type":"Var","value":{"identifier":"Done","moduleName":["Control","Monad","Rec","Class"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,30],"start":[19,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,30],"start":[19,27]}},"type":"Var","value":{"identifier":"acc1","sourcePos":[18,6]}},"type":"App"},"type":"App"},"guard":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"greaterThanOrEq","moduleName":["Golden","TailRecM2Shadow","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[19,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,8],"start":[19,7]}},"type":"Var","value":{"identifier":"i1","sourcePos":[18,10]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[19,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[19,13],"start":[19,12]}},"type":"Var","value":{"identifier":"n","sourcePos":[16,1]}},"type":"App"}},{"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"pure","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,55],"start":[20,19]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[20,29],"start":[20,25]}},"type":"Var","value":{"identifier":"Loop","moduleName":["Control","Monad","Rec","Class"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,54],"start":[20,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,54],"start":[20,30]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["a",{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","TailRecM2Shadow","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,42],"start":[20,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,38],"start":[20,35]}},"type":"Var","value":{"identifier":"acc1","sourcePos":[18,6]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,42],"start":[20,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,42],"start":[20,41]}},"type":"Var","value":{"identifier":"i1","sourcePos":[18,10]}},"type":"App"}],["b",{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","TailRecM2Shadow","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,52],"start":[20,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,48],"start":[20,47]}},"type":"Var","value":{"identifier":"i1","sourcePos":[18,10]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,52],"start":[20,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,52],"start":[20,51]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"}]]}},"type":"App"},"type":"App"},"guard":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[20,16],"start":[20,7]}},"type":"Var","value":{"identifier":"otherwise","moduleName":["Data","Boolean"]}}}],"isGuarded":true}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,55],"start":[18,3]}},"type":"Var","value":{"identifier":"acc","sourcePos":[18,6]}},{"annotation":{"meta":null,"sourceSpan":{"end":[20,55],"start":[18,3]}},"type":"Var","value":{"identifier":"i","sourcePos":[18,10]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"go"}],"expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"tailRecM2","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,27],"start":[16,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,27],"start":[16,25]}},"type":"Var","value":{"identifier":"go","sourcePos":[18,3]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[16,29],"start":[16,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,29],"start":[16,28]}},"type":"Var","value":{"identifier":"b","sourcePos":[16,1]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[16,31],"start":[16,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,31],"start":[16,30]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"type":"Let"},"type":"Abs"},"type":"Abs"},"type":"Let"},"type":"Abs"},"identifier":"sumFrom"},{"annotation":{"meta":null,"sourceSpan":{"end":[22,20],"start":[22,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[24,19],"start":[24,3]}},"type":"Var","value":{"identifier":"bind","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[24,19],"start":[24,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,19],"start":[24,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[24,15],"start":[24,8]}},"type":"Var","value":{"identifier":"sumFrom","moduleName":["Golden","TailRecM2Shadow","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[24,17],"start":[24,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"monadRecEffect","moduleName":["Control","Monad","Rec","Class"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,17],"start":[24,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,17],"start":[24,16]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,19],"start":[24,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,19],"start":[24,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[24,19],"start":[24,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[24,19],"start":[24,3]}},"argument":"r","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","TailRecM2Shadow","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[25,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[25,11]}},"type":"Var","value":{"identifier":"r","sourcePos":[24,3]}},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["sumFrom","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Control","Applicative"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Control","Monad","Rec","Class"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Data","Boolean"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Data","Ord"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Golden","TailRecM2Shadow","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,12],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","TailRecM2Shadow","Test"],"modulePath":"golden/Golden/TailRecM2Shadow/Test.purs","reExports":{},"sourceSpan":{"end":[25,12],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.TailRecM2Shadow.Test/eval/.gitignore b/test/ps/output/Golden.TailRecM2Shadow.Test/eval/.gitignore new file mode 100644 index 0000000..d2dc29b --- /dev/null +++ b/test/ps/output/Golden.TailRecM2Shadow.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.TailRecM2Shadow.Test/eval/golden.txt b/test/ps/output/Golden.TailRecM2Shadow.Test/eval/golden.txt new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/test/ps/output/Golden.TailRecM2Shadow.Test/eval/golden.txt @@ -0,0 +1 @@ +10 diff --git a/test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir new file mode 100644 index 0000000..794ecc5 --- /dev/null +++ b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir @@ -0,0 +1,741 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ), ( Nothing, Name "untilE" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect.Ref", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect.Ref" ) ".spago/refs/v6.1.0/src/Effect/Ref.purs" + [ ( Nothing, Name "_new" ), ( Nothing, Name "read" ), ( Nothing, Name "write" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Applicative", qnameName = Name "pure" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "pure" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Bind", qnameName = Name "bind" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "bind" ) ) + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "monadEffect" + }, LiteralObject Nothing + [ + ( PropName "Applicative0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), + ( PropName "Bind1", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ] + ) :| + [ + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "bindEffect" + }, LiteralObject Nothing + [ + ( PropName "bind", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "bindE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "applicativeEffect" + }, LiteralObject Nothing + [ + ( PropName "pure", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 ) + ( PropName "pureE" ) + ), + ( PropName "Apply0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_applyEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_functorEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "functorEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "map", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "applicativeEffect" ) + ) 0 + ) + ( PropName "Apply0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ( PropName "apply" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "Lazy_applyEffect" + }, App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "PSLUA_runtime_lazy" ) ) 0 ) + ( LiteralString Nothing "applyEffect" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "apply", Let Nothing + ( Standalone + ( Nothing, Name "bind", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 + ) + ( PropName "Bind1" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "f'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing ( Local ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a'" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Applicative" ) + ( Name "pure" ) + ) 0 + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "monadEffect" ) + ) 0 + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a'" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Functor0", Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 + ) + ( LiteralInt Nothing 0 ) + ) + ) + ] + ) + ) + ), + ( QName + { qnameModuleName = ModuleName "Effect", qnameName = Name "functorEffect" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "Lazy_functorEffect" ) ) 0 ) + ( LiteralInt Nothing 0 ) + ) + ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Monad.Rec.Class", qnameName = Name "bind" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Control.Monad.Rec.Class", qnameName = Name "pure" + }, App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "applicativeEffect" ) ) 0 ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.TailRecM2Shadow.Test", qnameName = Name "add" + }, ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "add", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intAdd" ) + ), + ( PropName "zero", LiteralInt Nothing 0 ), + ( PropName "mul", ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Semiring" ) ( Name "foreign" ) ) 0 ) + ( PropName "intMul" ) + ), + ( PropName "one", LiteralInt Nothing 1 ) + ] + ) + ( PropName "add" ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.TailRecM2Shadow.Test", qnameName = Name "sumFrom" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictMonadRec" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "pure", App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Applicative" ) ( Name "pure" ) ) 0 ) + ( App Nothing + ( ObjectProp Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictMonadRec" ) ) 0 ) + ( PropName "Monad0" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ( PropName "Applicative0" ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "undefined" ) ) 0 ) + ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "b" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "n" ) ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictMonadRec" ) ) 0 ) + ( PropName "tailRecM" ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "o" ) ) + ( IfThenElse Nothing + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Ordering∷Ordering.LT" ) + ( ReflectCtor Nothing + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "compare", App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.1/src/Data/Ord.purs" + [ ( Nothing, Name "ordIntImpl" ) ] + ) + ( PropName "ordIntImpl" ) + ) + ( Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "LT" ) [] + ) + ) + ( Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "EQ" ) [] + ) + ) + ( Ctor Nothing SumType + ( ModuleName "Data.Ordering" ) + ( TyName "Ordering" ) + ( CtorName "GT" ) [] + ) + ), + ( PropName "Eq0", Abs Nothing ( ParamUnused Nothing ) + ( LiteralObject Nothing + [ + ( PropName "eq", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" + [ ( Nothing, Name "eqIntImpl" ) ] + ) + ( PropName "eqIntImpl" ) + ) + ] + ) + ) + ] + ) + ( PropName "compare" ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "o" ) ) 0 ) + ( PropName "b" ) + ) + ) + ( Ref Nothing ( Local ( Name "n" ) ) 0 ) + ) + ) + ) ( LiteralBool Nothing False ) ( LiteralBool Nothing True ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "pure" ) ) 0 ) + ( App Nothing + ( Ctor Nothing SumType + ( ModuleName "Control.Monad.Rec.Class" ) + ( TyName "Step" ) + ( CtorName "Done" ) + [ FieldName "value0" ] + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "o" ) ) 0 ) + ( PropName "a" ) + ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "pure" ) ) 0 ) + ( App Nothing + ( Ctor Nothing SumType + ( ModuleName "Control.Monad.Rec.Class" ) + ( TyName "Step" ) + ( CtorName "Loop" ) + [ FieldName "value0" ] + ) + ( LiteralObject Nothing + [ + ( PropName "a", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.TailRecM2Shadow.Test" ) + ( Name "add" ) + ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "o" ) ) 0 ) + ( PropName "a" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "o" ) ) 0 ) + ( PropName "b" ) + ) + ), + ( PropName "b", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.TailRecM2Shadow.Test" ) + ( Name "add" ) + ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "o" ) ) 0 ) + ( PropName "b" ) + ) + ) + ( LiteralInt Nothing 1 ) + ) + ] + ) + ) + ) + ) + ) + ) + ( LiteralObject Nothing + [ + ( PropName "a", Ref Nothing ( Local ( Name "b" ) ) 0 ), + ( PropName "b", LiteralInt Nothing 0 ) + ] + ) + ) + ) + ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "sumFrom", Ref Nothing + ( Imported ( ModuleName "Golden.TailRecM2Shadow.Test" ) ( Name "sumFrom" ) ) 0 + ), + ( Name "main", App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.TailRecM2Shadow.Test" ) ( Name "sumFrom" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "tailRecM", Abs Nothing + ( ParamNamed Nothing ( Name "f" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Monad.Rec.Class" ) + ( Name "bind" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Bind" ) ( Name "bind" ) ) 0 + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Effect.Ref" ) ( Name "foreign" ) ) 0 + ) + ( PropName "_new" ) + ) + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "r" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "discard", Abs Nothing + ( ParamNamed Nothing ( Name "dictBind" ) ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Bind" ) + ( Name "bind" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "dictBind" ) ) 0 ) + ) + ) + ] + ) + ( PropName "discard" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "bindEffect" ) ) 0 + ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Effect" ) ( Name "foreign" ) ) 0 + ) + ( PropName "untilE" ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Monad.Rec.Class" ) + ( Name "bind" ) + ) 0 + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Ref" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "read" ) + ) + ( Ref Nothing ( Local ( Name "r" ) ) 0 ) + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Control.Monad.Rec.Class∷Step.Loop" ) + ( ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Monad.Rec.Class" ) + ( Name "bind" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "f" ) ) 0 ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "e" ) ) + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Monad.Rec.Class" ) + ( Name "bind" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Ref" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "write" ) + ) + ( Ref Nothing ( Local ( Name "e" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "r" ) ) 0 ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Monad.Rec.Class" ) + ( Name "pure" ) + ) 0 + ) ( LiteralBool Nothing False ) + ) + ) + ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Control.Monad.Rec.Class∷Step.Done" ) + ( ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Control.Monad.Rec.Class" ) + ( Name "pure" ) + ) 0 + ) ( LiteralBool Nothing True ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Effect" ) + ( Name "functorEffect" ) + ) 0 + ) + ( PropName "map" ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Partial.Unsafe" ) ".spago/partial/v4.1.0/src/Partial/Unsafe.purs" + [ ( Nothing, Name "_unsafePartial" ) ] + ) + ( PropName "_unsafePartial" ) + ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Control.Monad.Rec.Class∷Step.Done" ) + ( ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ) + ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported + ( ModuleName "Effect.Ref" ) + ( Name "foreign" ) + ) 0 + ) + ( PropName "read" ) + ) + ( Ref Nothing ( Local ( Name "r" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ) + ), + ( PropName "Monad0", Abs Nothing ( ParamUnused Nothing ) + ( Ref Nothing ( Imported ( ModuleName "Effect" ) ( Name "monadEffect" ) ) 0 ) + ) + ] + ) + ) + ( LiteralInt Nothing 0 ) + ) + ( LiteralInt Nothing 5 ) + ) + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "r" ) ) + ( App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ) + ( PropName "log" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( LiteralObject Nothing + [ + ( PropName "show", ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ) + ( PropName "showIntImpl" ) + ) + ] + ) + ( PropName "show" ) + ) + ( Ref Nothing ( Local ( Name "r" ) ) 0 ) + ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua new file mode 100644 index 0000000..2b9e127 --- /dev/null +++ b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua @@ -0,0 +1,188 @@ +local function PSLUA_runtime_lazy(name) + return function(init) + return function() + local state = 0 + local val = nil + if state == 2 then + return val + else + if state == 1 then + return error(name .. " was needed before it finished initializing") + else + state = 1 + val = init() + state = 2 + return val + end + end + end + end +end +local M = {} +M.Data_Semiring_foreign = { + intAdd = function(x) return function(y) return x + y end end, + intMul = function(x) return function(y) return x * y end end +} +M.Effect_foreign = { + pureE = function(a) + return function() + return a + end + end, + bindE = function(a) + return function(f) + return function() + return f(a())() + end + end + end, + untilE = function(f) + return function() + while not f() do + end + end + end +} +M.Effect_Ref_foreign = { + _new = function(val) return function() return {value = val} end end, + read = function(ref) return function() return ref.value end end, + write = function(val) + return function(ref) return function() ref.value = val end end + end +} +M.Control_Applicative_pure = function(dict) return dict.pure end +M.Control_Bind_bind = function(dict) return dict.bind end +M.Effect_monadEffect = { + Applicative0 = function() return M.Effect_applicativeEffect end, + Bind1 = function() return M.Effect_bindEffect end +} +M.Effect_bindEffect = { + bind = M.Effect_foreign.bindE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_applicativeEffect = { + pure = M.Effect_foreign.pureE, + Apply0 = function() return M.Effect_Lazy_applyEffect(0) end +} +M.Effect_Lazy_functorEffect = PSLUA_runtime_lazy("functorEffect")(function() + return { + map = function(f) + return function(a) + return (M.Effect_applicativeEffect.Apply0()).apply(M.Control_Applicative_pure(M.Effect_applicativeEffect)(f))(a) + end + end + } +end) +M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function() + return { + apply = (function() + return function(f) + local bind = M.Control_Bind_bind(M.Effect_monadEffect.Bind1()) + return function(a) + return bind(f)(function(fPrime) + return bind(a)(function(aPrime) + return M.Control_Applicative_pure(M.Effect_monadEffect.Applicative0())(fPrime(aPrime)) + end) + end) + end + end + end)(), + Functor0 = function() return M.Effect_Lazy_functorEffect(0) end + } +end) +M.Effect_functorEffect = M.Effect_Lazy_functorEffect(0) +M.Control_Monad_Rec_Class_bind = M.Control_Bind_bind(M.Effect_bindEffect) +M.Control_Monad_Rec_Class_pure = M.Control_Applicative_pure(M.Effect_applicativeEffect) +M.Golden_TailRecM2Shadow_Test_add = M.Data_Semiring_foreign.intAdd +M.Golden_TailRecM2Shadow_Test_sumFrom = function(dictMonadRec) + return function(b) + local pure = M.Control_Applicative_pure((dictMonadRec.Monad0()).Applicative0()) + return function(n) + return dictMonadRec.tailRecM(function(o) + if (function() + if "Data.Ordering∷Ordering.LT" == (((function() + local unsafeCoerceImpl = function(lt) + return function(eq) + return function(gt) + return function(x) + return function(y) + if x < y then + return lt + elseif x == y then + return eq + else + return gt + end + end + end + end + end + end + return { ordIntImpl = unsafeCoerceImpl } + end)()).ordIntImpl({ ["$ctor"] = "Data.Ordering∷Ordering.LT" })({ + ["$ctor"] = "Data.Ordering∷Ordering.EQ" + })({ ["$ctor"] = "Data.Ordering∷Ordering.GT" })(o.b)(n))["$ctor"] then + return false + else + return true + end + end)() then + return pure((function(value0) + return { + ["$ctor"] = "Control.Monad.Rec.Class∷Step.Done", + value0 = value0 + } + end)(o.a)) + else + return pure((function(value0) + return { + ["$ctor"] = "Control.Monad.Rec.Class∷Step.Loop", + value0 = value0 + } + end)({ + a = M.Golden_TailRecM2Shadow_Test_add(o.a)(o.b), + b = M.Golden_TailRecM2Shadow_Test_add(o.b)(1) + })) + end + end)({ a = b, b = 0 }) + end + end +end +return M.Control_Bind_bind(M.Effect_bindEffect)(M.Golden_TailRecM2Shadow_Test_sumFrom({ + tailRecM = function(f) + return function(a) + return M.Control_Monad_Rec_Class_bind(M.Control_Bind_bind(M.Effect_bindEffect)(f(a))(M.Effect_Ref_foreign._new))(function( r ) + return (function(dictBind) + return M.Control_Bind_bind(dictBind) + end)(M.Effect_bindEffect)(M.Effect_foreign.untilE(M.Control_Monad_Rec_Class_bind(M.Effect_Ref_foreign.read(r))(function( v ) + if "Control.Monad.Rec.Class∷Step.Loop" == v["$ctor"] then + return M.Control_Monad_Rec_Class_bind(f(v.value0))(function(e) + return M.Control_Monad_Rec_Class_bind(M.Effect_Ref_foreign.write(e)(r))(function( ) + return M.Control_Monad_Rec_Class_pure(false) + end) + end) + else + if "Control.Monad.Rec.Class∷Step.Done" == v["$ctor"] then + return M.Control_Monad_Rec_Class_pure(true) + else + return error("No patterns matched") + end + end + end)))(function() + return M.Effect_functorEffect.map((function(f) return f(); end)(function( ) + return function(v) + if "Control.Monad.Rec.Class∷Step.Done" == v["$ctor"] then + return v.value0 + else + return error("No patterns matched") + end + end + end))(M.Effect_Ref_foreign.read(r)) + end) + end) + end + end, + Monad0 = function() return M.Effect_monadEffect end +})(0)(5))(function(r) + return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(r)) +end)() diff --git a/test/ps/spago.dhall b/test/ps/spago.dhall index e2214cb..abaca65 100644 --- a/test/ps/spago.dhall +++ b/test/ps/spago.dhall @@ -10,6 +10,7 @@ , "prelude" , "profunctor" , "strings" + , "tailrec" ] , packages = ./packages.dhall , sources = [ "golden/**/*.purs" ] From c0414366cdc791b1d67a7d5df89658aff2438521 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sun, 14 Jun 2026 20:39:55 +0200 Subject: [PATCH 34/40] chore: point package-set + fork links at purescript-lua org The package set, the prelude/strings forks, and this compiler repo moved from Unisay/* to the purescript-lua org. Update the README badges and links, the CLAUDE.md references, the test package-set URL, and a golden test comment. The template and example repos stay under Unisay, so their links are left unchanged. --- CLAUDE.md | 4 ++-- README.md | 14 +++++++------- test/ps/golden/Golden/StringCodePoints/Test.purs | 2 +- test/ps/packages.dhall | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d48cef5..13a4027 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -296,7 +296,7 @@ The project uses Hedgehog for property-based testing: edit `compiler-nix-name` / `easy-ps.purs-*` in `flake.nix`. 2. PureScript package sets live in `test/ps/packages.dhall` as `upstream-ps // upstream-lua`. The right operand wins: `upstream-lua` - (releases of `Unisay/purescript-lua-package-sets`) overrides core + (releases of `purescript-lua/purescript-lua-package-sets`) overrides core packages with Lua forks that ship `.lua` FFI files. 3. After changing package sets or `purs`: `cd test/ps && spago build -u '-g corefn'`, then `cabal test all`. Drop the `sha256:` annotations @@ -311,7 +311,7 @@ The project uses Hedgehog for property-based testing: - **`unit` must not be `nil`**: Lua tables cannot hold `nil` values, so `Array Unit` silently collapses to an empty table if the prelude defines - `unit = nil`. Requires `Unisay/purescript-lua-prelude` ≥ v7.2.0, where + `unit = nil`. Requires `purescript-lua/purescript-lua-prelude` ≥ v7.2.0, where `unit = {}`. If eval goldens for unit arrays start printing `0`, a package set downgraded the prelude — do not accept such goldens. - A generated-Lua change that only passes `luacheck` is not verified: diff --git a/README.md b/README.md index e298c27..8502488 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Purescript Backend for Lua -[![Purescript Lua CI](https://github.com/Unisay/purescript-lua/actions/workflows/ci.yaml/badge.svg)](https://github.com/Unisay/purescript-lua/actions/workflows/ci.yaml) +[![Purescript Lua CI](https://github.com/purescript-lua/purescript-lua/actions/workflows/ci.yaml/badge.svg)](https://github.com/purescript-lua/purescript-lua/actions/workflows/ci.yaml) 🔋 Status: (2024-04-20) the project is in the "_ready to be experimented with_" state (read: it likely contains bugs but is already usable). 💡 If you have an idea on how to use Purescript to Lua compilation please contribute it here: -https://github.com/Unisay/purescript-lua/discussions/categories/ideas +https://github.com/purescript-lua/purescript-lua/discussions/categories/ideas ## Features @@ -13,7 +13,7 @@ https://github.com/Unisay/purescript-lua/discussions/categories/ideas - [x] FFI with Lua. - [x] Dead Code Elimination (DCE). - [x] Code inlining. -- [x] [Package Set](https://github.com/Unisay/purescript-lua-package-sets) for PureScript/Lua libs. +- [x] [Package Set](https://github.com/purescript-lua/purescript-lua-package-sets) for PureScript/Lua libs. - [x] All core libs added to the package set. ## Quick Start @@ -56,15 +56,15 @@ Assuming that `pslua` executable is already available on your PATH ### Using nix with flakes ``` -nix run 'github:Unisay/purescript-lua' -- --help +nix run 'github:purescript-lua/purescript-lua' -- --help ``` ## Installation -If you're on a x86 64bit Linux system then you can download a pre-built executable from the [releases](https://github.com/Unisay/purescript-lua/releases) page: +If you're on a x86 64bit Linux system then you can download a pre-built executable from the [releases](https://github.com/purescript-lua/purescript-lua/releases) page: ``` -wget -c https://github.com/Unisay/purescript-lua/releases/download/0.1.1-alpha/pslua-linux_x86_64.tar.gz -O - | tar -xz +wget -c https://github.com/purescript-lua/purescript-lua/releases/download/0.1.1-alpha/pslua-linux_x86_64.tar.gz -O - | tar -xz ``` alternatively, @@ -72,7 +72,7 @@ alternatively, ### Using nix with flakes ``` -nix profile install 'github:Unisay/purescript-lua' +nix profile install 'github:purescript-lua/purescript-lua' ``` will make `pslua` executable available for use. diff --git a/test/ps/golden/Golden/StringCodePoints/Test.purs b/test/ps/golden/Golden/StringCodePoints/Test.purs index 32b68ff..9204b68 100644 --- a/test/ps/golden/Golden/StringCodePoints/Test.purs +++ b/test/ps/golden/Golden/StringCodePoints/Test.purs @@ -1,5 +1,5 @@ -- Exercises Data.String.CodePoints end to end on the released package set --- (Unisay/purescript-lua-strings v6.2.0). The test string mixes UTF-8 widths +-- (purescript-lua/purescript-lua-strings v6.2.0). The test string mixes UTF-8 widths -- 1..4: 'a' (1 byte), 'é' (2), 'Я' (2, Cyrillic), '𝐀' (4, astral), 'z' (1). -- Output is all Ints/Bools via fromEnum so the golden stays ASCII and does -- not depend on how strings are shown. diff --git a/test/ps/packages.dhall b/test/ps/packages.dhall index b6e98a0..e4f599e 100644 --- a/test/ps/packages.dhall +++ b/test/ps/packages.dhall @@ -3,7 +3,7 @@ let upstream-ps = sha256:e48c9b283ca89ec994453459fb74c4b5b5a9432349f83a2e104f39dd869a0f6e let upstream-lua = - https://github.com/Unisay/purescript-lua-package-sets/releases/download/psc-0.15.15-20260613-2/packages.dhall + https://github.com/purescript-lua/purescript-lua-package-sets/releases/download/psc-0.15.15-20260613-2/packages.dhall sha256:b006e1fd8aa8cd290faf65852f37f62ad3bf5fe97fa3a7c30c97ff7ddfa49807 in upstream-ps // upstream-lua From 31f792f4f8bd1139851191d2e9b69e42ebcc559c Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Mon, 15 Jun 2026 10:12:33 +0200 Subject: [PATCH 35/40] chore: add .claude/settings.local.json to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3cc8bf0..58eb197 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ result-* .envrc.local .hspec-failures .local/ +.claude/settings.local.json From 061baa18dbdab065a8bd268d5fe3cb9c57ae1bdd Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Mon, 15 Jun 2026 10:56:27 +0200 Subject: [PATCH 36/40] chore: wire `nix fmt` (treefmt-nix) + robust pre-commit hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert treefmt.toml → treefmt.nix and expose `nix fmt` / `formatter`: cabal-fmt, nixfmt, yamlfmt, and dhall (test/ps/{packages,spago}.dhall). fourmolu is deliberately left OUT of `nix fmt`: its `--haddock-style` is global (single/multi/multi-compact) with no per-comment or by-length mode, so any choice rewrites the source's deliberate Haddock mix (short `-- |`, long `{- | … -}`). Haskell stays a manual `fourmolu -i lib/ exe/ test/` step. Excludes test/ps/output goldens and .hlint.yaml (yamlfmt strips its trailing template comments). CI gains a content-based format check (`nix fmt && git diff --exit-code`). The pre-commit hook is now a tracked .githooks/pre-commit wired via `git config core.hooksPath` — worktree/ submodule-safe, never clobbers an existing .git/hooks, and surfaces `nix fmt` failures instead of swallowing them. cabal-fmt/nixfmt reflow pslua.cabal/shell.nix. --- .githooks/pre-commit | 19 +++++++++++++++++++ .github/workflows/ci.yaml | 2 ++ CLAUDE.md | 8 ++++---- flake.lock | 23 ++++++++++++++++++++++- flake.nix | 10 +++++++++- pslua.cabal | 9 +++++---- shell.nix | 3 +-- treefmt.nix | 27 +++++++++++++++++++++++++++ treefmt.toml | 28 ---------------------------- 9 files changed, 89 insertions(+), 40 deletions(-) create mode 100755 .githooks/pre-commit create mode 100644 treefmt.nix delete mode 100644 treefmt.toml diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..72cb16f --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Content-based format gate. CI's `nix fmt && git diff --exit-code` is +# authoritative; this hook is just a local convenience. +# +# Tracked under .githooks/ and wired via `git config core.hooksPath .githooks` +# in the dev-shell shellHook — robust across git worktrees and submodules +# (where .git is a file) and it never clobbers a developer's .git/hooks. +set -u +command -v nix >/dev/null 2>&1 || exit 0 # no nix here → skip; CI still gates + +before=$(git diff) +if ! nix fmt >/dev/null 2>&1; then + echo "pre-commit: 'nix fmt' failed — fix the formatter error, then commit." >&2 + exit 1 +fi +if [ "$before" != "$(git diff)" ]; then + echo "pre-commit: 'nix fmt' reformatted files — re-stage them, then commit." >&2 + exit 1 +fi diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3b6c524..8621234 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,3 +24,5 @@ jobs: - name: "🔨 Build & test" run: >- nix develop --accept-flake-config --allow-import-from-derivation --command cabal test all --test-show-details=direct + - name: "🎨 Format check" + run: nix --accept-flake-config fmt && git diff --exit-code diff --git a/CLAUDE.md b/CLAUDE.md index 13a4027..7a6408e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -84,11 +84,11 @@ This finds all files named `golden.*` in `test/ps/output` and deletes them, then ### Code Formatting & Linting ```bash -# Format Haskell code with Fourmolu -fourmolu -i lib/ exe/ test/ +# Format Cabal/Nix/YAML/Dhall via treefmt +nix fmt -# Or use treefmt to format all files -treefmt +# Haskell is formatted separately with Fourmolu (NOT part of `nix fmt`) +fourmolu -i lib/ exe/ test/ # Run HLint hlint lib/ exe/ test/ diff --git a/flake.lock b/flake.lock index 8e7fce8..957e9bc 100644 --- a/flake.lock +++ b/flake.lock @@ -647,7 +647,8 @@ "nixpkgs": [ "haskellNix", "nixpkgs-unstable" - ] + ], + "treefmt-nix": "treefmt-nix" } }, "stackage": { @@ -695,6 +696,26 @@ "repo": "default", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1780220602, + "narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "db947814a175b7ca6ded66e21383d938df01c227", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index d09efd3..1b7be9e 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,8 @@ nixpkgs.follows = "haskellNix/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; easy-purescript-nix.url = "github:justinwoo/easy-purescript-nix"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { @@ -12,6 +14,7 @@ flake-utils, haskellNix, easy-purescript-nix, + treefmt-nix, }: let supportedSystems = [ "x86_64-linux" ]; @@ -60,10 +63,13 @@ lua51Packages.lua lua51Packages.luacheck nil - treefmt upx yamlfmt ]; + # `nix fmt` runs treefmt (treefmt.nix). Robust pre-commit hook: + # point git at the tracked .githooks/ dir (works in worktrees/ + # submodules; never clobbers an existing .git/hooks/pre-commit). + shellHook = "git config core.hooksPath .githooks"; }; crossPlatforms = @@ -75,12 +81,14 @@ }) ]; flake = pkgs.psluaProject.flake { }; + treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; in flake // { legacyPackages = pkgs; packages.default = flake.packages."pslua:exe:pslua"; packages.static = flake.ciJobs.x86_64-unknown-linux-musl.packages."pslua:exe:pslua"; + formatter = treefmtEval.config.build.wrapper; } ); diff --git a/pslua.cabal b/pslua.cabal index 66c11f7..5df7ff5 100644 --- a/pslua.cabal +++ b/pslua.cabal @@ -12,10 +12,11 @@ extra-source-files: common shared ghc-options: -O2 -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns - -Werror=missing-fields -Werror=missing-methods -Werror=missing-signatures - -Wmissing-deriving-strategies -Wunused-foralls -Wunused-foralls - -fprint-explicit-foralls -fprint-explicit-kinds -Wcompat - -Widentities -Werror=incomplete-patterns -Wredundant-constraints + -Werror=missing-fields -Werror=missing-methods + -Werror=missing-signatures -Wmissing-deriving-strategies + -Wunused-foralls -Wunused-foralls -fprint-explicit-foralls + -fprint-explicit-kinds -Wcompat -Widentities + -Werror=incomplete-patterns -Wredundant-constraints -Wpartial-fields -Wtabs -Wmissing-local-signatures -fhelpful-errors -fprint-expanded-synonyms -fwarn-unused-do-bind diff --git a/shell.nix b/shell.nix index 0f9438a..8745f50 100644 --- a/shell.nix +++ b/shell.nix @@ -1,2 +1 @@ -(builtins.getFlake - ("git+file://" + toString ./.)).devShells.${builtins.currentSystem}.default +(builtins.getFlake ("git+file://" + toString ./.)).devShells.${builtins.currentSystem}.default diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 0000000..c420122 --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + projectRootFile = "flake.nix"; + + # Haskell (fourmolu) is deliberately NOT wired into `nix fmt`. fourmolu's + # --haddock-style is global (single-line | multi-line | multi-line-compact) + # with no per-comment or by-length mode, so any choice rewrites the + # hand-authored Haddock — single-line line-prefixes long block comments + # (annoying to copy), while multi-line bloats short ones. The source keeps a + # deliberate mix (short `-- |`, long `{- | … -}`), so Haskell stays a manual + # `fourmolu -i lib/ exe/ test/` step the author runs when they choose. + programs.cabal-fmt.enable = true; + programs.nixfmt.enable = true; + programs.yamlfmt.enable = true; + programs.dhall.enable = true; # test/ps/{packages,spago}.dhall + + # Generated goldens are committed; never reformat them. (test/ps/.spago is + # gitignored, so treefmt's git-aware walk already skips it.) + settings.global.excludes = [ + "test/ps/output/**" + "dist-newstyle/**" + "result" + # yamlfmt strips the trailing template comments from .hlint.yaml; keep it + # hand-maintained. + ".hlint.yaml" + ]; +} diff --git a/treefmt.toml b/treefmt.toml deleted file mode 100644 index a4b1470..0000000 --- a/treefmt.toml +++ /dev/null @@ -1,28 +0,0 @@ -[formatter.haskell] -command = "fourmolu" -options = [ - "--ghc-opt", - "-XImportQualifiedPost", - "--ghc-opt", - "-XTypeApplications", - "--record-brace-space", - "true", - "--single-constraint-parens", - "never", - "--mode", - "inplace", -] -includes = ["*.hs"] - -[formatter.cabal] -command = "cabal-fmt" -options = ["--inplace"] -includes = ["*.cabal"] - -[formatter.nix] -command = "nixfmt" -includes = ["*.nix"] - -[formatter.yaml] -command = "yamlfmt" -includes = ["*.yaml", "*.yml" ] From 62e36537ecafd35081f521a7d49a7b1ae2e13ff7 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Mon, 15 Jun 2026 12:32:46 +0200 Subject: [PATCH 37/40] ci: isolate format check into its own job The format check ran in the tests job after 'cabal test all', which regenerates test/ps/output/*/corefn.json (treefmt excludes that path). 'git diff --exit-code' then tripped on the regenerated corefn rather than on any formatting issue. Move it to a dedicated job with a clean checkout. --- .github/workflows/ci.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8621234..7cc3ff3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,5 +24,20 @@ jobs: - name: "🔨 Build & test" run: >- nix develop --accept-flake-config --allow-import-from-derivation --command cabal test all --test-show-details=direct + format: + runs-on: ubuntu-latest + steps: + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "❄ Install Nix" + uses: cachix/install-nix-action@v26 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: cachix/cachix-action@v14 + with: + name: purescript-lua + # Run on a clean checkout so `git diff` sees only what treefmt changed — + # the `tests` job regenerates test/ps/output/*/corefn.json (which treefmt + # excludes), and that churn would otherwise trip `git diff --exit-code`. - name: "🎨 Format check" run: nix --accept-flake-config fmt && git diff --exit-code From de17ec0f0e5ca685befa6ff1d271f1973f389697 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Mon, 15 Jun 2026 15:12:21 +0200 Subject: [PATCH 38/40] test(ps): repoint the golden set at psc-0.15.15-20260615 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Points test/ps at the new Lua package-set release (the FFI-audit fixes) and regenerates the goldens. Churn is cosmetic and behaviour-preserving: - golden.ir: only `.spago//` source-path bumps. - golden.lua: only foreign-table content from the bumped forks (chiefly effect's pureE/bindE reformatting; plus the audited FFI fixes where they survive DCE). - one corefn.json: a source-comment org rename (Unisay -> purescript-lua). - All eval/golden.txt are unchanged — runtime output is identical across every executable golden, so no behaviour changed. --- .../output/Golden.ArrayOfUnits.Test/golden.ir | 12 +++---- .../Golden.ArrayOfUnits.Test/golden.lua | 14 ++------ .../Golden.ArrayPatternMatch.Test/golden.ir | 12 +++---- .../Golden.ArrayPatternMatch.Test/golden.lua | 14 ++------ .../Golden.BugListGenericEq.Test/golden.ir | 10 +++--- .../Golden.BugListGenericEq.Test/golden.lua | 14 ++------ .../output/Golden.CharLiterals.Test/golden.ir | 10 +++--- .../Golden.CharLiterals.Test/golden.lua | 14 ++------ .../Golden.DerivedFunctor.Test/golden.ir | 8 ++--- .../Golden.DerivedFunctor.Test/golden.lua | 14 ++------ .../ps/output/Golden.Fibonacci.Test/golden.ir | 8 ++--- .../Golden.GenericEqTwoTypes.Test/golden.ir | 10 +++--- .../Golden.GenericEqTwoTypes.Test/golden.lua | 14 ++------ .../output/Golden.HelloPrelude.Test/golden.ir | 4 +-- .../Golden.HelloPrelude.Test/golden.lua | 14 ++------ test/ps/output/Golden.Issue37.Test/golden.ir | 4 +-- test/ps/output/Golden.Issue37.Test/golden.lua | 14 ++------ .../output/Golden.MaybeChain.Test/golden.ir | 6 ++-- .../output/Golden.MaybeChain.Test/golden.lua | 14 ++------ .../Golden.ProfunctorDictLens.Test/golden.ir | 10 +++--- .../Golden.ProfunctorDictLens.Test/golden.lua | 14 ++------ .../Golden.StringCodePoints.Test/corefn.json | 2 +- .../Golden.StringCodePoints.Test/golden.ir | 28 +++++++-------- .../Golden.StringCodePoints.Test/golden.lua | 34 ++++++++++++------- .../Golden.TailRecM2Shadow.Test/golden.ir | 12 +++---- .../Golden.TailRecM2Shadow.Test/golden.lua | 21 ++---------- test/ps/packages.dhall | 4 +-- 27 files changed, 114 insertions(+), 221 deletions(-) diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir index 6244fc6..e4eaa4a 100644 --- a/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir +++ b/test/ps/output/Golden.ArrayOfUnits.Test/golden.ir @@ -4,25 +4,25 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Unit", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.1/src/Data/Unit.purs" + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.3.0/src/Data/Unit.purs" [ ( Just Always, Name "unit" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.3.0/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Foldable", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Foldable" ) ".spago/foldable-traversable/v6.1.0/src/Data/Foldable.purs" + ( ModuleName "Data.Foldable" ) ".spago/foldable-traversable/v6.1.1/src/Data/Foldable.purs" [ ( Nothing, Name "foldrArray" ), ( Nothing, Name "foldlArray" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -356,7 +356,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -552,7 +552,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua b/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua index 8bf2834..65f5a34 100644 --- a/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua +++ b/test/ps/output/Golden.ArrayOfUnits.Test/golden.lua @@ -47,18 +47,8 @@ M.Data_Foldable_foreign = { end } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Control_Semigroupoid_semigroupoidFn = { compose = function(f) diff --git a/test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir index 1764425..fa44fa3 100644 --- a/test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir +++ b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.3.0/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -248,7 +248,7 @@ UberModule [ ( PropName "sub", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.3.0/src/Data/Ring.purs" [ ( Nothing, Name "intSub" ) ] ) ( PropName "intSub" ) @@ -269,7 +269,7 @@ UberModule [ ( PropName "sub", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.3.0/src/Data/Ring.purs" [ ( Nothing, Name "intSub" ) ] ) ( PropName "intSub" ) @@ -317,7 +317,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -328,7 +328,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua index 84b8d23..2d7cdf3 100644 --- a/test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua +++ b/test/ps/output/Golden.ArrayPatternMatch.Test/golden.lua @@ -24,18 +24,8 @@ M.Data_Semiring_foreign = { intMul = function(x) return function(y) return x * y end end } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Data_Semiring_semiringInt = { add = M.Data_Semiring_foreign.intAdd, diff --git a/test/ps/output/Golden.BugListGenericEq.Test/golden.ir b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir index f1dc37f..a32d044 100644 --- a/test/ps/output/Golden.BugListGenericEq.Test/golden.ir +++ b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.1/src/Data/HeytingAlgebra.purs" + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.3.0/src/Data/HeytingAlgebra.purs" [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -120,7 +120,7 @@ UberModule ( Nothing, Name "get", App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.1/src/Record/Unsafe.purs" + ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.3.0/src/Record/Unsafe.purs" [ ( Nothing, Name "unsafeGet" ) ] ) ( PropName "unsafeGet" ) @@ -454,7 +454,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -883,7 +883,7 @@ UberModule [ ( PropName "eq", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.3.0/src/Data/Eq.purs" [ ( Nothing, Name "eqIntImpl" ) ] ) ( PropName "eqIntImpl" ) diff --git a/test/ps/output/Golden.BugListGenericEq.Test/golden.lua b/test/ps/output/Golden.BugListGenericEq.Test/golden.lua index f5acb82..2a0dae4 100644 --- a/test/ps/output/Golden.BugListGenericEq.Test/golden.lua +++ b/test/ps/output/Golden.BugListGenericEq.Test/golden.lua @@ -25,18 +25,8 @@ M.Data_HeytingAlgebra_foreign = { boolNot = function(b) return not b end } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Type_Proxy_Proxy = { ["$ctor"] = "Type.Proxy∷Proxy.Proxy" } M.Data_HeytingAlgebra_heytingAlgebraBoolean = { diff --git a/test/ps/output/Golden.CharLiterals.Test/golden.ir b/test/ps/output/Golden.CharLiterals.Test/golden.ir index 2d1b1fa..38dcea0 100644 --- a/test/ps/output/Golden.CharLiterals.Test/golden.ir +++ b/test/ps/output/Golden.CharLiterals.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ), Standalone ( QName @@ -19,7 +19,7 @@ UberModule [ ( PropName "eq", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.3.0/src/Data/Eq.purs" [ ( Nothing, Name "eqCharImpl" ) ] ) ( PropName "eqCharImpl" ) @@ -266,7 +266,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showCharImpl" ) ] ) ( PropName "showCharImpl" ) @@ -511,7 +511,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.1/src/Data/Ord.purs" + ( ModuleName "Data.Ord" ) ".spago/prelude/v7.3.0/src/Data/Ord.purs" [ ( Nothing, Name "ordCharImpl" ) ] ) ( PropName "ordCharImpl" ) diff --git a/test/ps/output/Golden.CharLiterals.Test/golden.lua b/test/ps/output/Golden.CharLiterals.Test/golden.lua index 363105b..a51ecc6 100644 --- a/test/ps/output/Golden.CharLiterals.Test/golden.lua +++ b/test/ps/output/Golden.CharLiterals.Test/golden.lua @@ -20,18 +20,8 @@ local function PSLUA_runtime_lazy(name) end local M = {} M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Effect_Console_foreign = { log = function(s) return function() print(s) end end diff --git a/test/ps/output/Golden.DerivedFunctor.Test/golden.ir b/test/ps/output/Golden.DerivedFunctor.Test/golden.ir index 3c06bf6..1c55384 100644 --- a/test/ps/output/Golden.DerivedFunctor.Test/golden.ir +++ b/test/ps/output/Golden.DerivedFunctor.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.3.0/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -274,7 +274,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -285,7 +285,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.DerivedFunctor.Test/golden.lua b/test/ps/output/Golden.DerivedFunctor.Test/golden.lua index 98a7157..842a85d 100644 --- a/test/ps/output/Golden.DerivedFunctor.Test/golden.lua +++ b/test/ps/output/Golden.DerivedFunctor.Test/golden.lua @@ -24,18 +24,8 @@ M.Data_Semiring_foreign = { intMul = function(x) return function(y) return x * y end end } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Data_Semiring_semiringInt = { add = M.Data_Semiring_foreign.intAdd, diff --git a/test/ps/output/Golden.Fibonacci.Test/golden.ir b/test/ps/output/Golden.Fibonacci.Test/golden.ir index e4d6877..758f919 100644 --- a/test/ps/output/Golden.Fibonacci.Test/golden.ir +++ b/test/ps/output/Golden.Fibonacci.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.3.0/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName @@ -30,7 +30,7 @@ UberModule [ ( PropName "sub", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.3.0/src/Data/Ring.purs" [ ( Nothing, Name "intSub" ) ] ) ( PropName "intSub" ) @@ -103,7 +103,7 @@ UberModule ( Name "main", App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -114,7 +114,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir index a1c6973..0cdfdf1 100644 --- a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.1/src/Data/HeytingAlgebra.purs" + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.3.0/src/Data/HeytingAlgebra.purs" [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -90,7 +90,7 @@ UberModule [ ( PropName "eq", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.3.0/src/Data/Eq.purs" [ ( Nothing, Name "eqIntImpl" ) ] ) ( PropName "eqIntImpl" ) @@ -132,7 +132,7 @@ UberModule ( Nothing, Name "get", App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.1/src/Record/Unsafe.purs" + ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.3.0/src/Record/Unsafe.purs" [ ( Nothing, Name "unsafeGet" ) ] ) ( PropName "unsafeGet" ) @@ -676,7 +676,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) diff --git a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua index 5f1c3f7..3521b57 100644 --- a/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua +++ b/test/ps/output/Golden.GenericEqTwoTypes.Test/golden.lua @@ -25,18 +25,8 @@ M.Data_HeytingAlgebra_foreign = { boolNot = function(b) return not b end } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Type_Proxy_Proxy = { ["$ctor"] = "Type.Proxy∷Proxy.Proxy" } M.Data_HeytingAlgebra_heytingAlgebraBoolean = { diff --git a/test/ps/output/Golden.HelloPrelude.Test/golden.ir b/test/ps/output/Golden.HelloPrelude.Test/golden.ir index 15b9f39..b45d2f9 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/golden.ir +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -217,7 +217,7 @@ UberModule ) ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.1/src/Data/Unit.purs" + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.3.0/src/Data/Unit.purs" [ ( Just Always, Name "unit" ) ] ) ( PropName "unit" ) diff --git a/test/ps/output/Golden.HelloPrelude.Test/golden.lua b/test/ps/output/Golden.HelloPrelude.Test/golden.lua index 8b4fad2..ba1958e 100644 --- a/test/ps/output/Golden.HelloPrelude.Test/golden.lua +++ b/test/ps/output/Golden.HelloPrelude.Test/golden.lua @@ -20,18 +20,8 @@ local function PSLUA_runtime_lazy(name) end local M = {} M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Control_Applicative_pure = function(dict) return dict.pure end M.Effect_monadEffect = { diff --git a/test/ps/output/Golden.Issue37.Test/golden.ir b/test/ps/output/Golden.Issue37.Test/golden.ir index 54bed84..5846454 100644 --- a/test/ps/output/Golden.Issue37.Test/golden.ir +++ b/test/ps/output/Golden.Issue37.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Unit", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.1/src/Data/Unit.purs" + ( ModuleName "Data.Unit" ) ".spago/prelude/v7.3.0/src/Data/Unit.purs" [ ( Just Always, Name "unit" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName diff --git a/test/ps/output/Golden.Issue37.Test/golden.lua b/test/ps/output/Golden.Issue37.Test/golden.lua index cf75054..63ff611 100644 --- a/test/ps/output/Golden.Issue37.Test/golden.lua +++ b/test/ps/output/Golden.Issue37.Test/golden.lua @@ -21,18 +21,8 @@ end local M = {} M.Data_Unit_foreign = { unit = {} } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Control_Applicative_pure = function(dict) return dict.pure end M.Control_Bind_bind = function(dict) return dict.bind end diff --git a/test/ps/output/Golden.MaybeChain.Test/golden.ir b/test/ps/output/Golden.MaybeChain.Test/golden.ir index 6461efd..f18e58b 100644 --- a/test/ps/output/Golden.MaybeChain.Test/golden.ir +++ b/test/ps/output/Golden.MaybeChain.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -268,7 +268,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -279,7 +279,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.MaybeChain.Test/golden.lua b/test/ps/output/Golden.MaybeChain.Test/golden.lua index 8c97669..42fadfd 100644 --- a/test/ps/output/Golden.MaybeChain.Test/golden.lua +++ b/test/ps/output/Golden.MaybeChain.Test/golden.lua @@ -20,18 +20,8 @@ local function PSLUA_runtime_lazy(name) end local M = {} M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Control_Applicative_pure = function(dict) return dict.pure end M.Control_Bind_bind = function(dict) return dict.bind end diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir index 16df027..d3471e9 100644 --- a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.ir @@ -4,7 +4,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.3.0/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName @@ -16,7 +16,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName @@ -357,7 +357,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -368,7 +368,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) @@ -556,7 +556,7 @@ UberModule [ ( PropName "sub", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.3.0/src/Data/Ring.purs" [ ( Nothing, Name "intSub" ) ] ) ( PropName "intSub" ) diff --git a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua index cbc4b27..0b60332 100644 --- a/test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua +++ b/test/ps/output/Golden.ProfunctorDictLens.Test/golden.lua @@ -25,18 +25,8 @@ M.Data_Semiring_foreign = { } M.Unsafe_Coerce_foreign = { unsafeCoerce = function(x) return x end } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end } M.Data_Semiring_semiringInt = { add = M.Data_Semiring_foreign.intAdd, diff --git a/test/ps/output/Golden.StringCodePoints.Test/corefn.json b/test/ps/output/Golden.StringCodePoints.Test/corefn.json index 2de48cb..c141882 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/corefn.json +++ b/test/ps/output/Golden.StringCodePoints.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.16","comments":[{"LineComment":" Exercises Data.String.CodePoints end to end on the released package set"},{"LineComment":" (Unisay/purescript-lua-strings v6.2.0). The test string mixes UTF-8 widths"},{"LineComment":" 1..4: 'a' (1 byte), 'é' (2), 'Я' (2, Cyrillic), '𝐀' (4, astral), 'z' (1)."},{"LineComment":" Output is all Ints/Bools via fromEnum so the golden stays ASCII and does"},{"LineComment":" not depend on how strings are shown."}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,32],"start":[48,29]}},"type":"Var","value":{"identifier":"compose","moduleName":["Control","Semigroupoid"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semigroupoidFn","moduleName":["Control","Semigroupoid"]}},"type":"App"},"identifier":"compose"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,28],"start":[48,20]}},"type":"Var","value":{"identifier":"fromJust","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"fromJust"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,21],"start":[23,13]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Data","Enum"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,21],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"boundedEnumCodePoint","moduleName":["Data","String","CodePoints"]}},"type":"App"},"identifier":"fromEnum"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Data","Show"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"showArray"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[28,10],"start":[28,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[30,10],"start":[30,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,10],"start":[36,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showMaybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"type":"App"},"identifier":"logShow2"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,24],"start":[36,21]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorMaybe","moduleName":["Data","Maybe"]}},"type":"App"},"identifier":"map"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[41,10],"start":[41,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showMaybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"identifier":"logShow3"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,10],"start":[43,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showBoolean","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow4"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,64],"start":[43,62]}},"type":"Var","value":{"identifier":"eq","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqString","moduleName":["Data","Eq"]}},"type":"App"},"identifier":"eq"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,14],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,14],"start":[20,7]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"aéЯ𝐀z"}},"identifier":"str"},{"annotation":{"meta":null,"sourceSpan":{"end":[47,23],"start":[47,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,19],"start":[48,6]}},"type":"Var","value":{"identifier":"unsafePartial","moduleName":["Partial","Unsafe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromJust","moduleName":["Golden","StringCodePoints","Test"]}},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,39],"start":[48,33]}},"type":"Var","value":{"identifier":"toEnum","moduleName":["Data","Enum"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,39],"start":[48,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"boundedEnumCodePoint","moduleName":["Data","String","CodePoints"]}},"type":"App"},"type":"App"},"identifier":"cp"},{"annotation":{"meta":null,"sourceSpan":{"end":[22,29],"start":[22,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,46],"start":[23,9]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,12],"start":[23,9]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,21],"start":[23,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorArray","moduleName":["Data","Functor"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,21],"start":[23,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,46],"start":[23,9]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,46],"start":[23,26]}},"type":"Var","value":{"identifier":"toCodePointArray","moduleName":["Data","String","CodePoints"]}},"type":"App"},"identifier":"codes"},{"annotation":{"meta":null,"sourceSpan":{"end":[25,20],"start":[25,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,17],"start":[28,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,18]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow1","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[30,22],"start":[30,12]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,26],"start":[30,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,26],"start":[30,23]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow1","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[31,22],"start":[31,12]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","String","CodeUnits"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,26],"start":[31,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,26],"start":[31,23]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,17],"start":[33,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,34],"start":[33,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[33,27],"start":[33,19]}},"type":"Var","value":{"identifier":"take","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,29],"start":[33,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,29],"start":[33,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,33],"start":[33,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,33],"start":[33,30]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[34,17],"start":[34,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,34],"start":[34,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[34,27],"start":[34,19]}},"type":"Var","value":{"identifier":"drop","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,30]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,40],"start":[36,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,42],"start":[36,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,42],"start":[36,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[37,40],"start":[37,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,42],"start":[37,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,42],"start":[37,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[38,40],"start":[38,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,42],"start":[38,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,42],"start":[38,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,26]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,26]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"head","type":"Accessor"},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[40,48],"start":[40,38]}},"type":"Var","value":{"identifier":"uncons","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,49]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow3","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,18],"start":[41,13]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,23]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,23]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"tail","type":"Accessor"},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[41,45],"start":[41,35]}},"type":"Var","value":{"identifier":"uncons","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,46]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow4","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,34],"start":[43,12]}},"type":"Var","value":{"identifier":"fromCodePointArray","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,61],"start":[43,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,56],"start":[43,36]}},"type":"Var","value":{"identifier":"toCodePointArray","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,60],"start":[43,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,60],"start":[43,57]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,65]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,47],"start":[45,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,17],"start":[45,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,46],"start":[45,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[45,32],"start":[45,19]}},"type":"Var","value":{"identifier":"singleton","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,45],"start":[45,19]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,36],"start":[45,34]}},"type":"Var","value":{"identifier":"cp","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,44],"start":[45,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,44],"start":[45,37]}},"type":"Literal","value":{"literalType":"IntLiteral","value":119808}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["str","codes","main","cp"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Control","Semigroupoid"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Enum"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Eq"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Functor"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Maybe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","String","CodePoints"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","String","CodeUnits"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Golden","StringCodePoints","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Partial","Unsafe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,15],"start":[8,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","StringCodePoints","Test"],"modulePath":"golden/Golden/StringCodePoints/Test.purs","reExports":{},"sourceSpan":{"end":[48,39],"start":[6,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[{"LineComment":" Exercises Data.String.CodePoints end to end on the released package set"},{"LineComment":" (purescript-lua/purescript-lua-strings v6.2.0). The test string mixes UTF-8 widths"},{"LineComment":" 1..4: 'a' (1 byte), 'é' (2), 'Я' (2, Cyrillic), '𝐀' (4, astral), 'z' (1)."},{"LineComment":" Output is all Ints/Bools via fromEnum so the golden stays ASCII and does"},{"LineComment":" not depend on how strings are shown."}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,32],"start":[48,29]}},"type":"Var","value":{"identifier":"compose","moduleName":["Control","Semigroupoid"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"semigroupoidFn","moduleName":["Control","Semigroupoid"]}},"type":"App"},"identifier":"compose"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,28],"start":[48,20]}},"type":"Var","value":{"identifier":"fromJust","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"fromJust"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,21],"start":[23,13]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Data","Enum"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,21],"start":[23,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"boundedEnumCodePoint","moduleName":["Data","String","CodePoints"]}},"type":"App"},"identifier":"fromEnum"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Data","Show"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"showArray"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[28,10],"start":[28,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[30,10],"start":[30,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow1"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,10],"start":[36,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showMaybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"type":"App"},"identifier":"logShow2"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,24],"start":[36,21]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorMaybe","moduleName":["Data","Maybe"]}},"type":"App"},"identifier":"map"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[41,10],"start":[41,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showMaybe","moduleName":["Data","Maybe"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showArray","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"identifier":"logShow3"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,10],"start":[43,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showBoolean","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow4"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,64],"start":[43,62]}},"type":"Var","value":{"identifier":"eq","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqString","moduleName":["Data","Eq"]}},"type":"App"},"identifier":"eq"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,14],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[20,14],"start":[20,7]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"aéЯ𝐀z"}},"identifier":"str"},{"annotation":{"meta":null,"sourceSpan":{"end":[47,23],"start":[47,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,19],"start":[48,6]}},"type":"Var","value":{"identifier":"unsafePartial","moduleName":["Partial","Unsafe"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,6]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromJust","moduleName":["Golden","StringCodePoints","Test"]}},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[48,6]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,39],"start":[48,33]}},"type":"Var","value":{"identifier":"toEnum","moduleName":["Data","Enum"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,39],"start":[48,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"boundedEnumCodePoint","moduleName":["Data","String","CodePoints"]}},"type":"App"},"type":"App"},"identifier":"cp"},{"annotation":{"meta":null,"sourceSpan":{"end":[22,29],"start":[22,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,46],"start":[23,9]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,12],"start":[23,9]}},"type":"Var","value":{"identifier":"map","moduleName":["Data","Functor"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[23,21],"start":[23,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"functorArray","moduleName":["Data","Functor"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,21],"start":[23,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,46],"start":[23,9]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[23,46],"start":[23,26]}},"type":"Var","value":{"identifier":"toCodePointArray","moduleName":["Data","String","CodePoints"]}},"type":"App"},"identifier":"codes"},{"annotation":{"meta":null,"sourceSpan":{"end":[25,20],"start":[25,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,17],"start":[28,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,18]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,22],"start":[28,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow1","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[30,22],"start":[30,12]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[30,26],"start":[30,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,26],"start":[30,23]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[30,27],"start":[30,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow1","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[31,22],"start":[31,12]}},"type":"Var","value":{"identifier":"length","moduleName":["Data","String","CodeUnits"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,26],"start":[31,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,26],"start":[31,23]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,27],"start":[31,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,17],"start":[33,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,34],"start":[33,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[33,27],"start":[33,19]}},"type":"Var","value":{"identifier":"take","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,29],"start":[33,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,29],"start":[33,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,33],"start":[33,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,33],"start":[33,30]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,35],"start":[33,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[34,17],"start":[34,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,34],"start":[34,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[34,27],"start":[34,19]}},"type":"Var","value":{"identifier":"drop","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,30]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,35],"start":[34,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[36,40],"start":[36,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,42],"start":[36,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,42],"start":[36,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,46],"start":[36,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,47],"start":[36,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[37,40],"start":[37,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,42],"start":[37,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,42],"start":[37,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,46],"start":[37,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[38,40],"start":[38,25]}},"type":"Var","value":{"identifier":"codePointAt","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,42],"start":[38,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,42],"start":[38,41]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,46],"start":[38,43]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,47],"start":[38,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow2","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"fromEnum","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,26]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[40,32],"start":[40,26]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"head","type":"Accessor"},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[40,48],"start":[40,38]}},"type":"Var","value":{"identifier":"uncons","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,52],"start":[40,49]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow3","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"map","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,12]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"compose","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,18],"start":[41,13]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,23]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[41,29],"start":[41,23]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},"fieldName":"tail","type":"Accessor"},"type":"Abs"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[41,45],"start":[41,35]}},"type":"Var","value":{"identifier":"uncons","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,49],"start":[41,46]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,50],"start":[41,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow4","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eq","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,34],"start":[43,12]}},"type":"Var","value":{"identifier":"fromCodePointArray","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,61],"start":[43,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,56],"start":[43,36]}},"type":"Var","value":{"identifier":"toCodePointArray","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,60],"start":[43,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,60],"start":[43,57]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,68],"start":[43,65]}},"type":"Var","value":{"identifier":"str","moduleName":["Golden","StringCodePoints","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,69],"start":[43,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,47],"start":[45,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,17],"start":[45,12]}},"type":"Var","value":{"identifier":"codes","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,46],"start":[45,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[45,32],"start":[45,19]}},"type":"Var","value":{"identifier":"singleton","moduleName":["Data","String","CodePoints"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,45],"start":[45,19]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,36],"start":[45,34]}},"type":"Var","value":{"identifier":"cp","moduleName":["Golden","StringCodePoints","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,44],"start":[45,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,44],"start":[45,37]}},"type":"Literal","value":{"literalType":"IntLiteral","value":119808}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["str","codes","main","cp"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Control","Semigroupoid"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Enum"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Eq"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Functor"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Maybe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","String","CodePoints"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Data","String","CodeUnits"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Golden","StringCodePoints","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Partial","Unsafe"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,15],"start":[8,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,39],"start":[6,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","StringCodePoints","Test"],"modulePath":"golden/Golden/StringCodePoints/Test.purs","reExports":{},"sourceSpan":{"end":[48,39],"start":[6,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.ir b/test/ps/output/Golden.StringCodePoints.Test/golden.ir index 7701eac..a5580bd 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/golden.ir +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.1/src/Data/HeytingAlgebra.purs" + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.3.0/src/Data/HeytingAlgebra.purs" [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.3.0/src/Data/Eq.purs" [ ( Nothing, Name "eqIntImpl" ), ( Nothing, Name "eqCharImpl" ), @@ -20,43 +20,43 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Show", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ), ( Nothing, Name "showArrayImpl" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.3.0/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Ord", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.1/src/Data/Ord.purs" + ( ModuleName "Data.Ord" ) ".spago/prelude/v7.3.0/src/Data/Ord.purs" [ ( Nothing, Name "ordIntImpl" ), ( Nothing, Name "ordCharImpl" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Bounded", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Bounded" ) ".spago/prelude/v7.2.1/src/Data/Bounded.purs" + ( ModuleName "Data.Bounded" ) ".spago/prelude/v7.3.0/src/Data/Bounded.purs" [ ( Nothing, Name "topChar" ), ( Nothing, Name "bottomChar" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.EuclideanRing", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.EuclideanRing" ) ".spago/prelude/v7.2.1/src/Data/EuclideanRing.purs" + ( ModuleName "Data.EuclideanRing" ) ".spago/prelude/v7.3.0/src/Data/EuclideanRing.purs" [ ( Nothing, Name "intDegree" ), ( Nothing, Name "intDiv" ), ( Nothing, Name "intMod" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Enum" ) ".spago/enums/v6.1.0/src/Data/Enum.purs" + ( ModuleName "Data.Enum" ) ".spago/enums/v6.1.1/src/Data/Enum.purs" [ ( Nothing, Name "toCharCode" ), ( Nothing, Name "fromCharCode" ) ] ), Standalone ( QName @@ -192,7 +192,7 @@ UberModule [ ( PropName "append", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Semigroup" ) ".spago/prelude/v7.2.1/src/Data/Semigroup.purs" + ( ModuleName "Data.Semigroup" ) ".spago/prelude/v7.3.0/src/Data/Semigroup.purs" [ ( Nothing, Name "concatString" ) ] ) ( PropName "concatString" ) @@ -272,7 +272,7 @@ UberModule [ ( PropName "sub", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.1/src/Data/Ring.purs" + ( ModuleName "Data.Ring" ) ".spago/prelude/v7.3.0/src/Data/Ring.purs" [ ( Nothing, Name "intSub" ) ] ) ( PropName "intSub" ) @@ -2296,7 +2296,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -2435,7 +2435,7 @@ UberModule [ ( PropName "map", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Functor" ) ".spago/prelude/v7.2.1/src/Data/Functor.purs" + ( ModuleName "Data.Functor" ) ".spago/prelude/v7.3.0/src/Data/Functor.purs" [ ( Nothing, Name "arrayMap" ) ] ) ( PropName "arrayMap" ) @@ -2493,7 +2493,7 @@ UberModule ) ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Array" ) ".spago/arrays/v7.3.0/src/Data/Array.purs" + ( ModuleName "Data.Array" ) ".spago/arrays/v7.4.1/src/Data/Array.purs" [ ( Nothing, Name "length" ) ] ) ( PropName "length" ) diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.lua b/test/ps/output/Golden.StringCodePoints.Test/golden.lua index 9a0c9ce..09d452d 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/golden.lua +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.lua @@ -93,23 +93,31 @@ M.Data_EuclideanRing_foreign = (function() } end)() M.Effect_foreign = { - pureE = function(a) - return function() - return a - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end +} +M.Data_Enum_foreign = { + toCharCode = function(c) + -- pslua compiles a PureScript Char as a string of its UTF-8 bytes, so decode + -- the first code point (JS does c.charCodeAt(0)) rather than the first byte. + local b1 = c:byte(1) + if b1 < 0x80 then return b1 end + if b1 < 0xE0 then return (b1 - 0xC0) * 0x40 + (c:byte(2) - 0x80) end + if b1 < 0xF0 then return (b1 - 0xE0) * 0x1000 + (c:byte(2) - 0x80) * 0x40 + (c:byte(3) - 0x80) end + return (b1 - 0xF0) * 0x40000 + (c:byte(2) - 0x80) * 0x1000 + (c:byte(3) - 0x80) * 0x40 + (c:byte(4) - 0x80) end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end + fromCharCode = function(n) + -- Encode the code point as UTF-8 (JS String.fromCharCode over 0..65535); + -- string.char alone errors above 255 and emits a raw byte for 128..255. + if n < 0x80 then return string.char(n) end + if n < 0x800 then return string.char(0xC0 + math.floor(n / 0x40), 0x80 + (n % 0x40)) end + if n < 0x10000 then + return string.char(0xE0 + math.floor(n / 0x1000), 0x80 + (math.floor(n / 0x40) % 0x40), 0x80 + (n % 0x40)) end + return string.char(0xF0 + math.floor(n / 0x40000), 0x80 + (math.floor(n / 0x1000) % 0x40), + 0x80 + (math.floor(n / 0x40) % 0x40), 0x80 + (n % 0x40)) end } -M.Data_Enum_foreign = { - toCharCode = function(c) return c:byte() end, - fromCharCode = string.char -} M.Data_String_CodeUnits_foreign = (function() -- PureScript indices are 0-based, Lua string positions are 1-based; -- the exports below convert between the two. Pattern arguments are diff --git a/test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir index 794ecc5..7955b36 100644 --- a/test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir +++ b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.ir @@ -4,13 +4,13 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.1/src/Data/Semiring.purs" + ( ModuleName "Data.Semiring" ) ".spago/prelude/v7.3.0/src/Data/Semiring.purs" [ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ] ), Standalone ( QName { qnameModuleName = ModuleName "Effect", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs" + ( ModuleName "Effect" ) ".spago/effect/v4.1.3/src/Effect.purs" [ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ), ( Nothing, Name "untilE" ) ] ), Standalone ( QName @@ -314,7 +314,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Ord" ) ".spago/prelude/v7.2.1/src/Data/Ord.purs" + ( ModuleName "Data.Ord" ) ".spago/prelude/v7.3.0/src/Data/Ord.purs" [ ( Nothing, Name "ordIntImpl" ) ] ) ( PropName "ordIntImpl" ) @@ -342,7 +342,7 @@ UberModule [ ( PropName "eq", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Eq" ) ".spago/prelude/v7.2.1/src/Data/Eq.purs" + ( ModuleName "Data.Eq" ) ".spago/prelude/v7.3.0/src/Data/Eq.purs" [ ( Nothing, Name "eqIntImpl" ) ] ) ( PropName "eqIntImpl" ) @@ -712,7 +712,7 @@ UberModule ( App Nothing ( ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs" + ( ModuleName "Effect.Console" ) ".spago/console/v6.1.1/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] ) ( PropName "log" ) @@ -723,7 +723,7 @@ UberModule [ ( PropName "show", ObjectProp ( Just Always ) ( ForeignImport Nothing - ( ModuleName "Data.Show" ) ".spago/prelude/v7.2.1/src/Data/Show.purs" + ( ModuleName "Data.Show" ) ".spago/prelude/v7.3.0/src/Data/Show.purs" [ ( Nothing, Name "showIntImpl" ) ] ) ( PropName "showIntImpl" ) diff --git a/test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua index 2b9e127..ca93c8e 100644 --- a/test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua +++ b/test/ps/output/Golden.TailRecM2Shadow.Test/golden.lua @@ -24,24 +24,9 @@ M.Data_Semiring_foreign = { intMul = function(x) return function(y) return x * y end end } M.Effect_foreign = { - pureE = function(a) - return function() - return a - end - end, - bindE = function(a) - return function(f) - return function() - return f(a())() - end - end - end, - untilE = function(f) - return function() - while not f() do - end - end - end + pureE = function(a) return function() return a end end, + bindE = function(a) return function(f) return function() return f(a())() end end end, + untilE = function(f) return function() while not f() do end end end } M.Effect_Ref_foreign = { _new = function(val) return function() return {value = val} end end, diff --git a/test/ps/packages.dhall b/test/ps/packages.dhall index e4f599e..1399e89 100644 --- a/test/ps/packages.dhall +++ b/test/ps/packages.dhall @@ -3,7 +3,7 @@ let upstream-ps = sha256:e48c9b283ca89ec994453459fb74c4b5b5a9432349f83a2e104f39dd869a0f6e let upstream-lua = - https://github.com/purescript-lua/purescript-lua-package-sets/releases/download/psc-0.15.15-20260613-2/packages.dhall - sha256:b006e1fd8aa8cd290faf65852f37f62ad3bf5fe97fa3a7c30c97ff7ddfa49807 + https://github.com/purescript-lua/purescript-lua-package-sets/releases/download/psc-0.15.15-20260615/packages.dhall + sha256:76624f5210200039e6510b8b7666851cfe4d665fab75bf65707474bd53ca5c8a in upstream-ps // upstream-lua From 331b2b8d4d940a7bacf24eb87d156aa39352172a Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Mon, 15 Jun 2026 15:53:10 +0200 Subject: [PATCH 39/40] test: bound golden-diff memory and cap the test RTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The golden suite spiked to ~21 GiB (and got OOM-killed) when many goldens differed: hspec held two full pretty-printed blobs plus their diff per failure. Two changes: - Test.Hspec.Golden now reports a bounded, line-oriented summary by default (first differing line + a small window + line counts + the actual-file path); set PSLUA_GOLDEN_FULL_DIFF=1 for the complete expected/actual diff. - The test suite's RTS opts go from -N (all 24 cores → parallel-GC RSS scales with core count) to -N4 -c -M16g, so peak residency is bounded and a runaway heap-overflows cleanly instead of OOM-killing the machine. Full suite: 233 examples, 0 failures. --- pslua.cabal | 11 ++- test/Test/Hspec/Golden.hs | 77 +++++++++++++++++-- .../Golden.StringCodePoints.Test/golden.ir | 2 +- .../Golden.StringCodePoints.Test/golden.lua | 18 +++-- test/ps/packages.dhall | 4 +- 5 files changed, 95 insertions(+), 17 deletions(-) diff --git a/pslua.cabal b/pslua.cabal index 5df7ff5..2bdd954 100644 --- a/pslua.cabal +++ b/pslua.cabal @@ -181,7 +181,16 @@ test-suite spec Test.Hspec.Hedgehog.Extended hs-source-dirs: test - ghc-options: -threaded -rtsopts -fprof-auto -with-rtsopts=-N + + -- Bound the test runner's memory. -N (= all cores) made the parallel GC's + -- peak RSS scale with the core count (24 here); -N4 caps that. -c compacts + -- the oldest generation to lower peak residency, and -M16g turns a runaway + -- (e.g. a large golden mismatch) into a clean "heap overflow" instead of an + -- OOM kill that takes the whole machine down. See Test.Hspec.Golden for the + -- bounded golden-diff that keeps failures cheap. + ghc-options: + -threaded -rtsopts -fprof-auto "-with-rtsopts=-N4 -c -M16g" + build-depends: , call-stack ^>=0.4.0 , exceptions ^>=0.10.8 diff --git a/test/Test/Hspec/Golden.hs b/test/Test/Hspec/Golden.hs index 381ac97..5b93c30 100644 --- a/test/Test/Hspec/Golden.hs +++ b/test/Test/Hspec/Golden.hs @@ -8,6 +8,7 @@ module Test.Hspec.Golden ) where +import Data.Text qualified as Text import Path (Abs, File, Path, parent, toFilePath) import Path.IO (createDirIfMissing, doesFileExist) import Test.Hspec.Core.Spec @@ -17,6 +18,15 @@ import Test.Hspec.Core.Spec , ResultStatus (..) ) +{- | Env var that opts back into the full expected/actual diff. By default a +golden mismatch reports only a bounded, line-oriented summary (the first +differing line plus a small window) so a run with many mismatches does not +hold two full pretty-printed blobs — and their diff — per failure. Set this +(to anything) for the complete diff, à la tasty-golden's options. +-} +fullDiffEnvVar ∷ String +fullDiffEnvVar = "PSLUA_GOLDEN_FULL_DIFF" + {- | Golden tests parameters @ @@ -86,6 +96,10 @@ fromGoldenResult = \case Result "Files golden and actual not match" (Failure Nothing (ExpectedButGot Nothing expected actual)) + MissmatchSummary summary → + Result + "Files golden and actual not match" + (Failure Nothing (Reason summary)) defaultGolden ∷ Path Abs File @@ -95,7 +109,7 @@ defaultGolden defaultGolden goldenFile actualFile produceOutput = Golden { produceOutput - , encodePretty = show + , encodePretty = toString , writeToFile = \f → writeFileBS (toFilePath f) . encodeUtf8 , readFromFile = fmap decodeUtf8 . readFileBS . toFilePath , goldenFile @@ -106,10 +120,48 @@ defaultGolden goldenFile actualFile produceOutput = -- | Possible results from a golden test execution data GoldenResult = MissmatchOutput String String + | -- | A bounded, line-oriented mismatch summary (the default). + MissmatchSummary String | SameOutput | FirstExecutionSucceed | FirstExecutionFail +{- | A bounded, line-oriented summary of a golden mismatch: the first differing +line, a small window of each side, the line counts, and a pointer to the actual +file. Keeps each failure O(window) instead of retaining two full blobs (and +their diff). Set 'fullDiffEnvVar' for the complete expected/actual diff. +-} +boundedSummary ∷ Maybe (Path Abs File) → String → String → String +boundedSummary mActual expected actual = + let els = Text.lines (toText expected) + als = Text.lines (toText actual) + common = length (takeWhile (uncurry (==)) (zip els als)) + win = 8 + numbered ls = + [ " " <> show (common + i + 1) <> " | " <> toString l + | (i, l) ← zip [0 ..] (take win (drop common ls)) + ] + in toString . Text.unlines . fmap toText . concat $ + [ + [ "Golden mismatch (first difference at line " + <> show (common + 1) + <> ")." + , " expected: " + <> show (length els) + <> " line(s); actual: " + <> show (length als) + <> " line(s)." + , " expected, from the first difference:" + ] + , numbered els + , [" actual, from the first difference:"] + , numbered als + , + [ " full actual output: " <> maybe "(not written)" toFilePath mActual + , " re-run with " <> fullDiffEnvVar <> "=1 for the complete diff." + ] + ] + -- | Runs a Golden test. runGolden ∷ Eq str ⇒ Golden str → IO GoldenResult runGolden Golden {..} = do @@ -134,10 +186,19 @@ runGolden Golden {..} = do else FirstExecutionSucceed else do contentGolden ← readFromFile goldenFile - pure - if contentGolden == output - then SameOutput - else - MissmatchOutput - (encodePretty contentGolden) - (encodePretty output) + if contentGolden == output + then pure SameOutput + else do + wantFull ← isJust <$> lookupEnv fullDiffEnvVar + pure + if wantFull + then + MissmatchOutput + (encodePretty contentGolden) + (encodePretty output) + else + MissmatchSummary $ + boundedSummary + actualFile + (encodePretty contentGolden) + (encodePretty output) diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.ir b/test/ps/output/Golden.StringCodePoints.Test/golden.ir index a5580bd..b18b624 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/golden.ir +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.ir @@ -56,7 +56,7 @@ UberModule ( QName { qnameModuleName = ModuleName "Data.Enum", qnameName = Name "foreign" }, ForeignImport Nothing - ( ModuleName "Data.Enum" ) ".spago/enums/v6.1.1/src/Data/Enum.purs" + ( ModuleName "Data.Enum" ) ".spago/enums/v6.1.2/src/Data/Enum.purs" [ ( Nothing, Name "toCharCode" ), ( Nothing, Name "fromCharCode" ) ] ), Standalone ( QName diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.lua b/test/ps/output/Golden.StringCodePoints.Test/golden.lua index 09d452d..25716f1 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/golden.lua +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.lua @@ -98,13 +98,21 @@ M.Effect_foreign = { } M.Data_Enum_foreign = { toCharCode = function(c) - -- pslua compiles a PureScript Char as a string of its UTF-8 bytes, so decode - -- the first code point (JS does c.charCodeAt(0)) rather than the first byte. + -- pslua compiles a PureScript Char literal as a string of its UTF-8 bytes, + -- so decode the first code point (JS c.charCodeAt(0)) when the WHOLE + -- sequence is present. But Data.String.CodeUnits hands this single raw bytes + -- (it slices a String byte-wise and lets the CodePoints layer reassemble), + -- so a lone lead/continuation byte must return that byte rather than read a + -- missing c:byte(2) and crash on nil. + local n = #c local b1 = c:byte(1) if b1 < 0x80 then return b1 end - if b1 < 0xE0 then return (b1 - 0xC0) * 0x40 + (c:byte(2) - 0x80) end - if b1 < 0xF0 then return (b1 - 0xE0) * 0x1000 + (c:byte(2) - 0x80) * 0x40 + (c:byte(3) - 0x80) end - return (b1 - 0xF0) * 0x40000 + (c:byte(2) - 0x80) * 0x1000 + (c:byte(3) - 0x80) * 0x40 + (c:byte(4) - 0x80) + if b1 < 0xE0 and n >= 2 then return (b1 - 0xC0) * 0x40 + (c:byte(2) - 0x80) end + if b1 < 0xF0 and n >= 3 then return (b1 - 0xE0) * 0x1000 + (c:byte(2) - 0x80) * 0x40 + (c:byte(3) - 0x80) end + if b1 >= 0xF0 and n >= 4 then + return (b1 - 0xF0) * 0x40000 + (c:byte(2) - 0x80) * 0x1000 + (c:byte(3) - 0x80) * 0x40 + (c:byte(4) - 0x80) + end + return b1 end, fromCharCode = function(n) -- Encode the code point as UTF-8 (JS String.fromCharCode over 0..65535); diff --git a/test/ps/packages.dhall b/test/ps/packages.dhall index 1399e89..a280947 100644 --- a/test/ps/packages.dhall +++ b/test/ps/packages.dhall @@ -3,7 +3,7 @@ let upstream-ps = sha256:e48c9b283ca89ec994453459fb74c4b5b5a9432349f83a2e104f39dd869a0f6e let upstream-lua = - https://github.com/purescript-lua/purescript-lua-package-sets/releases/download/psc-0.15.15-20260615/packages.dhall - sha256:76624f5210200039e6510b8b7666851cfe4d665fab75bf65707474bd53ca5c8a + https://github.com/purescript-lua/purescript-lua-package-sets/releases/download/psc-0.15.15-20260615-2/packages.dhall + sha256:da1998fd6cf7c411b8decb16d2be5a8b1499a0789e1ac5a2790d2ad9868aaf6e in upstream-ps // upstream-lua From c32ae27843159cfc5488dccc894ce24bed7810a9 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Mon, 15 Jun 2026 15:53:11 +0200 Subject: [PATCH 40/40] docs: point template/example links at the purescript-lua org (#103) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8502488..a3778bf 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ Consider configuring [Cachix](https://docs.cachix.org/installation) as a binary ``` cachix use purescript-lua ``` -You can use this [template repository](https://github.com/Unisay/purescript-lua-template) to initialize your project. +You can use this [template repository](https://github.com/purescript-lua/purescript-lua-template) to initialize your project. -Here is an another [example](https://github.com/Unisay/purescript-lua-example) project: Nginx server running Lua code using [OpenResty](https://openresty.org/). +Here is an another [example](https://github.com/purescript-lua/purescript-lua-example) project: Nginx server running Lua code using [OpenResty](https://openresty.org/). If you use [Spago](https://github.com/purescript/spago) to build your PureScript project, then you can configure `pslua` as a custom backend like this: