From 842578168c7d5422b716be18b59d703b0a539059 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sat, 11 Jul 2026 12:37:23 +0200 Subject: [PATCH 1/2] feat(foreign-lift): lift the *.Uncurried mk wrappers to n-ary definitions (#227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lifter's two remaining shape gaps close: a multi-parameter function literal now lifts to a single n-ary AbsN (declining varargs and duplicate parameter names, which Lua binds to the last same-named parameter), and a nullary call lifts as an application to the EffectRunArg marker — the shape magic-do emits, erased back to an empty argument list at code generation. mkFn2..10, mkSTFn1..10 and mkEffectFn1..10 join the allowlist as inline-always IR, so a definition like add3 = mkFn3 \a b c -> … beta-reduces to the n-ary literal itself instead of re-currying every call through two closures, and the mk accessors drop out of the emitted FFI tables like the run ones (#198). runFn0/mkFn0 stay absent by policy, not liftability: forcing a pure Fn0 must not be marked an effect run. The allowlist Haddock now also warns future extenders (#187) off the Effect/ST core, whose thunk-shaped bodies became technically liftable with this change: magic-do recognises bind chains by name, so inlining a lifted core during the optimizer fixpoint would blind it. Lifting the core behind a marker magic-do understands is tracked as #228. --- ...23511_unisay_lift_uncurried_mk_wrappers.md | 16 +++ .../PureScript/Backend/Lua/ForeignLift.hs | 121 +++++++++++++----- .../Backend/Lua/ForeignLift/Spec.hs | 121 ++++++++++++++++-- 3 files changed, 214 insertions(+), 44 deletions(-) create mode 100644 changelog.d/20260711_123511_unisay_lift_uncurried_mk_wrappers.md diff --git a/changelog.d/20260711_123511_unisay_lift_uncurried_mk_wrappers.md b/changelog.d/20260711_123511_unisay_lift_uncurried_mk_wrappers.md new file mode 100644 index 00000000..c69a6aee --- /dev/null +++ b/changelog.d/20260711_123511_unisay_lift_uncurried_mk_wrappers.md @@ -0,0 +1,16 @@ +### Changed + +- The `mk` half of the `*.Uncurried` FFI wrappers now lifts to n-ary + definitions (#227), completing the pair started by the `run` half (#198). + The foreign lifter (#178) learned the two missing shapes: a multi-parameter + function literal becomes a single n-ary `AbsN` (varargs and duplicate + parameter names decline), and a nullary call becomes an application to the + `EffectRunArg` marker — the shape magic-do emits, erased back to `()` at + code generation. `mkFn2`…`mkFn10`, `mkSTFn1`…`mkSTFn10`, and + `mkEffectFn1`…`mkEffectFn10` join the allowlist as inline-always IR, so a + definition like `add3 = mkFn3 \a b c -> a + b + c` beta-reduces to the + n-ary literal itself — `function(a, b, c) return a + b + c end`, zero + closures per call, where the opaque wrapper re-curried every call through + two. With both halves lifted, a saturated `runFn3 add3 1 2 3` site calls + that definition directly as `add3(1, 2, 3)`, and the `mk` accessors drop + out of the emitted FFI tables just like the `run` ones. diff --git a/lib/Language/PureScript/Backend/Lua/ForeignLift.hs b/lib/Language/PureScript/Backend/Lua/ForeignLift.hs index ba0f0199..e981c0c1 100644 --- a/lib/Language/PureScript/Backend/Lua/ForeignLift.hs +++ b/lib/Language/PureScript/Backend/Lua/ForeignLift.hs @@ -33,18 +33,33 @@ shed at code generation ('Language.PureScript.Backend.Lua.fromIR'), turning @runSTFn2(pushImpl)(x)(arr)()@ from four calls and three closures into one @pushImpl(x, arr)@. +The @mk@ half lifts too (issue #227): @mkFn3@ becomes +@\\fn -> AbsN [a, b, c] (fn(a)(b)(c))@ — the inner multi-parameter +literal is one n-ary 'AbsN' — and the effectful variants run the +re-curried call by applying it to the 'EffectRunArg' marker +(@mkEffectFn2@'s trailing @fn(a)(b)()@). Inlined at a definition site +like @add3 = mkFn3 \\a b c -> …@, beta reduction leaves the n-ary +literal itself: zero closures per call, and the @mk@ accessors drop out +of the emitted FFI tables just like the @run@ ones. + = What lifts The translatable subset, mirroring the shapes the prelude forks actually use: - * curried single-parameter function literals → nested 'Abs'; + * function literals → one n-ary 'AbsN' binding every parameter at a + single call (a curried chain is nested unary 'Abs'); varargs and + duplicate parameter names decline (Lua binds the body's reference + to the /last/ same-named parameter — an 'AbsN' would miscompile + it); * a zero-parameter function literal (the @*.Uncurried@ effect thunk, @function() … end@) → a unary 'Abs' with an unused parameter; - * a saturated call @fn(a, b, …)@ of one or more arguments → the n-ary - 'AppN' node (issue #198); a nullary @fn()@ has no 'AppN' and does not - lift, and a literal-lambda head called at any arity other than its - own declines (Note [n-ary application]); + * a call @fn(a, b, …)@ → the n-ary 'AppN' node (issue #198); a + nullary @fn()@ — the trailing effect run of the @mk{ST,Effect}FnN@ + wrappers — becomes an application to the 'EffectRunArg' marker + (issue #227); a literal-lambda head called at any arity other than + its own declines (Note [n-ary application]), the marker counting + as one argument; * @return@ / @if … then … else@ trees (an @elseif@ is a nested @if@ in the else branch) → 'IfThenElse', provided every branch returns a value (a branch that falls through to @nil@ does not lift); @@ -56,8 +71,8 @@ use: the @refEq@ aliases resolve. Everything else — loops, mutation, varargs, table constructors, -multi-parameter function literals, string/char literals — leaves the -export opaque (correct for e.g. @foldlArray@). +string/char literals — leaves the export opaque (correct for e.g. +@foldlArray@). -} module Language.PureScript.Backend.Lua.ForeignLift ( liftForeigns @@ -86,18 +101,21 @@ import Language.PureScript.Backend.IR.Types , PrimOp (..) , RawExp (AbsN, ForeignImport, ObjectProp) , abstraction + , abstractionN , applicationN , eq , ifThenElse , literalBool , literalFloat , literalInt + , noAnn , paramNamed , paramUnused , primBinOp , primNot , refLocal , setAnn + , pattern EffectRunArg ) import Language.PureScript.Backend.Lua.Key qualified as Key import Language.PureScript.Backend.Lua.Linker.Foreign (Source (..)) @@ -121,10 +139,24 @@ import Prelude hiding (show) -- Allowlist ------------------------------------------------------------------- {- | The foreign exports lifted into the IR: the arithmetic, comparison, -boolean, and concatenation core of the prelude (issue #178), plus the -@run@ half of the @*.Uncurried@ wrappers (issue #198). Membership is a -hard contract (see the module header): a listed export that fails to lift -is a compile error. A broader allowlist is follow-up work (issue #187). +boolean, and concatenation core of the prelude (issue #178), plus both +halves of the @*.Uncurried@ wrappers — @run@ (issue #198) and @mk@ +(issue #227). Membership is a hard contract (see the module header): a +listed export that fails to lift is a compile error. A broader allowlist +is follow-up work (issue #187). + +A warning to that follow-up: do /not/ list the Effect\/ST core — +@Effect.bindE@\/@pureE@, @Control.Monad.ST.Internal.bind_@\/@pure_@ — +even though its thunk-shaped bodies are technically liftable now that +nullary calls translate. Magic-do +('Language.PureScript.Backend.IR.MagicDo') recognises bind chains by +/name/, resolving dictionaries to the @Effect.bindEffect@ and +@Control.Monad.ST.Internal.bindST@ instances; a lifted core would be +inlined away during the optimizer fixpoint that runs first, blinding +magic-do — no flat @do@ chunks, and no chunked statement sequences +keeping the output under Lua's local-variable limits (issue #19). +Lifting the core behind a marker magic-do understands is tracked as +issue #228. -} allowlist ∷ Set QName allowlist = @@ -152,19 +184,29 @@ allowlist = ] ) , ("Data.Semigroup", ["concatString"]) - , -- The @run@ half of the uncurried FFI wrappers (issue #198). Their - -- @mk@ counterparts need an n-ary 'AbsN' (issue #227) and stay opaque; - -- @runFn0@ is a nullary call with no 'AppN', @runFn1@ is PureScript - -- @id@ with no foreign — both absent below. - ("Data.Function.Uncurried", runWrappers "runFn" [2 .. 10]) - , ("Control.Monad.ST.Uncurried", runWrappers "runSTFn" [1 .. 10]) - , ("Effect.Uncurried", runWrappers "runEffectFn" [1 .. 10]) + , -- Both halves of the uncurried FFI wrappers: @run@ (issue #198) + -- and @mk@ (issue #227). @runFn0@/@mkFn0@ are absent by policy, + -- not liftability: their bodies force a /pure/ @Fn0@ with a + -- nullary call, which must not be marked an effect run. + -- @runFn1@/@mkFn1@ are PureScript @id@ with no foreign. + + ( "Data.Function.Uncurried" + , wrappers "runFn" [2 .. 10] <> wrappers "mkFn" [2 .. 10] + ) + , + ( "Control.Monad.ST.Uncurried" + , wrappers "runSTFn" [1 .. 10] <> wrappers "mkSTFn" [1 .. 10] + ) + , + ( "Effect.Uncurried" + , wrappers "runEffectFn" [1 .. 10] <> wrappers "mkEffectFn" [1 .. 10] + ) ] - -- @[prefix | n <- arities]@, e.g. @runWrappers "runFn" [2, 3]@ is + -- @[prefix | n <- arities]@, e.g. @wrappers "runFn" [2, 3]@ is -- @["runFn2", "runFn3"]@. - runWrappers ∷ Text → [Int] → [Text] - runWrappers prefix arities = [prefix <> toText (show n) | n ← arities] + wrappers ∷ Text → [Int] → [Text] + wrappers prefix arities = [prefix <> toText (show n) | n ← arities] -------------------------------------------------------------------------------- -- Orchestration --------------------------------------------------------------- @@ -299,13 +341,20 @@ liftLuaExp env bound = \case a' ← liftLuaExp env bound a b' ← liftLuaExp env bound b liftBinOp op a' b' - -- Only single-parameter (curried) function literals lift: a Lua - -- function binds every parameter at one call, so translating a - -- multi-parameter one to nested 'Abs' would misapply it (it would - -- fail the WellApplied invariant). The prelude FFI is curried anyway. - Function [(_ann, ParamNamed param)] body → - abstraction (paramNamed (irName param)) - <$> liftBlock env (Set.insert param bound) body + -- A function literal binds every parameter at one call, so it lifts + -- to a single n-ary 'AbsN' (issue #227) — nested unary 'Abs' would + -- misapply when curried (it would fail the WellApplied invariant). + -- Varargs decline (the length check fails on the filtered-out + -- 'ParamVararg'), and so do duplicate parameter names: Lua binds the + -- body's reference to the /last/ same-named parameter, which an + -- 'AbsN' would silently miscompile. + Function params body + | Just names ← nonEmpty [name | (_ann, ParamNamed name) ← params] + , length names == length params + , let paramSet = Set.fromList (toList names) + , Set.size paramSet == length names → + abstractionN (paramNamed . irName <$> names) + <$> liftBlock env (Set.union bound paramSet) body -- A zero-parameter function literal is the effect thunk of the -- @run{ST,Effect}FnN@ wrappers: @function() return fn(a, b) end@. It -- lifts to a unary 'Abs' with an unused parameter — the shape @@ -313,18 +362,24 @@ liftLuaExp env bound = \case -- saturated site fuses the thunk away entirely (issue #198). Function [] body → abstraction paramUnused <$> liftBlock env bound body - -- A saturated call @fn(a, b, …)@ — the body of the @runFnN@ wrappers — - -- lifts to the n-ary 'AppN' node (issue #198). A nullary call @fn()@ - -- has no 'AppN' representation, so 'nonEmpty' declines it (e.g. - -- @runFn0 = \\fn -> fn()@ stays opaque). + -- A call @fn(a, b, …)@ — the body of the @runFnN@ wrappers — lifts to + -- the n-ary 'AppN' node (issue #198). A nullary call @fn()@ — the + -- trailing effect run of the @mk{ST,Effect}FnN@ wrappers — lifts as + -- an application to the 'EffectRunArg' marker (issue #227): the shape + -- magic-do emits, which the Lua backend erases back to an empty + -- argument list. FunctionCall (_ann, fn) args → do fn' ← liftLuaExp env bound fn - args' ← nonEmpty args >>= traverse (\(_ann', a) → liftLuaExp env bound a) + args' ← case nonEmpty args of + Nothing → Just (EffectRunArg noAnn :| []) + Just ne → traverse (\(_ann', a) → liftLuaExp env bound a) ne -- A literal-lambda head (an inlined header local, or a parenthesized -- function literal) must be called at exactly its own arity: any -- other count would build an ill-formed 'AppN' (Note [n-ary -- application]). Splitting the spine instead would change the -- program — Lua drops surplus arguments — so a mismatch declines. + -- The marker counts as one argument: a nullary call passes a thunk + -- head and declines any wider literal. case fn' of AbsN _ params _ | length params /= length args' → Nothing _ → Just (applicationN fn' args') diff --git a/test/Language/PureScript/Backend/Lua/ForeignLift/Spec.hs b/test/Language/PureScript/Backend/Lua/ForeignLift/Spec.hs index c9c05284..acf4200a 100644 --- a/test/Language/PureScript/Backend/Lua/ForeignLift/Spec.hs +++ b/test/Language/PureScript/Backend/Lua/ForeignLift/Spec.hs @@ -4,14 +4,18 @@ import Language.PureScript.Backend.IR.Names (Name (..)) import Language.PureScript.Backend.IR.Types ( PrimOp (..) , abstraction + , abstractionN + , application , applicationN , eq , ifThenElse + , noAnn , paramNamed , paramUnused , primBinOp , primNot , refLocal + , pattern EffectRunArg ) import Language.PureScript.Backend.Lua.ForeignLift (liftExport) import Language.PureScript.Backend.Lua.Linker.Foreign @@ -95,6 +99,18 @@ spec = describe "Foreign lift (#178)" do primBinOp PrimConcat (refLocal (Name "s1")) (refLocal (Name "s2")) ) + it "lifts a multi-parameter function literal to one n-ary AbsN (#227)" do + -- A Lua function binds every parameter at one call, so the literal + -- becomes a single n-ary 'AbsN' — nested unary 'Abs' would misapply + -- when curried (Note [n-ary application]). + liftExport + (source "return { f = function(x, y) return x + y end }") + (Name "f") + `shouldBe` Just + ( abstractionN (paramNamed (Name "x") :| [paramNamed (Name "y")]) $ + primBinOp PrimAdd (refLocal (Name "x")) (refLocal (Name "y")) + ) + describe "lifts the *.Uncurried run wrappers (#198)" do it "lifts runFn3 to a saturated n-ary call" do -- The pure wrapper: `\fn a b c -> fn(a, b, c)`. The body is a single @@ -156,26 +172,99 @@ spec = describe "Foreign lift (#178)" do applicationN (refLocal fn) (refLocal a :| []) ) - it "declines the mk* wrappers (their inner function is n-ary, #227)" do + describe "lifts the *.Uncurried mk wrappers (#227)" do + it "lifts mkFn2 to an n-ary literal over a re-curried call" do -- `mkFn2 = \fn -> function(a, b) return fn(a)(b) end`: the inner - -- multi-parameter function needs an n-ary AbsN (issue #227), so the - -- wrapper stays an opaque foreign, not on this allowlist. + -- multi-parameter literal becomes a single n-ary 'AbsN'; its body + -- re-curries the wrapped function, so the call chain lifts as + -- nested unary applications. Marked inline-always downstream, a + -- `mkFn2 \a b -> …` definition beta-reduces to the two-parameter + -- literal itself — zero closures per call. let src = "return { mkFn2 = function(fn) " <> "return function(a, b) return fn(a)(b) end end }" - liftExport (source src) (Name "mkFn2") `shouldSatisfy` isNothing + fn = Name "fn" + a = Name "a" + b = Name "b" + liftExport (source src) (Name "mkFn2") + `shouldBe` Just + ( abstraction (paramNamed fn) $ + abstractionN (paramNamed a :| [paramNamed b]) $ + applicationN + (applicationN (refLocal fn) (refLocal a :| [])) + (refLocal b :| []) + ) - describe "declines everything outside the subset" do - it "declines a multi-parameter function (would misapply when curried)" do - liftExport (source "return { f = function(x, y) return x + y end }") (Name "f") - `shouldSatisfy` isNothing + it "lifts mkEffectFn2 (effect run of the re-curried call)" do + -- `mkEffectFn2 = \fn -> function(a, b) return fn(a)(b)() end`: the + -- trailing nullary call runs the effect the wrapped function + -- returns, and lifts as an application to the 'EffectRunArg' + -- marker — the shape magic-do emits, erased to an empty argument + -- list at code generation. + let src = + "return { mkEffectFn2 = function(fn) " + <> "return function(a, b) return fn(a)(b)() end end }" + fn = Name "fn" + a = Name "a" + b = Name "b" + liftExport (source src) (Name "mkEffectFn2") + `shouldBe` Just + ( abstraction (paramNamed fn) $ + abstractionN (paramNamed a :| [paramNamed b]) $ + application + ( applicationN + (applicationN (refLocal fn) (refLocal a :| [])) + (refLocal b :| []) + ) + (EffectRunArg noAnn) + ) - it "declines a nullary call (AppN cannot express a zero-argument call)" do - -- `runFn0 = \fn -> fn()`. An n-ary AppN needs at least one argument; - -- the zero-argument call falls outside the subset and stays opaque. + it "lifts mkSTFn1 (unary inner literal, the nullary-call half alone)" do + -- The arity-1 wrappers keep a unary inner literal, so this + -- exercises only the nullary-call half of #227: `fn(a)()` becomes + -- the effect-run application under a plain unary 'Abs'. + let src = + "return { mkSTFn1 = function(fn) " + <> "return function(a) return fn(a)() end end }" + fn = Name "fn" + a = Name "a" + liftExport (source src) (Name "mkSTFn1") + `shouldBe` Just + ( abstraction (paramNamed fn) $ + abstraction (paramNamed a) $ + application + (applicationN (refLocal fn) (refLocal a :| [])) + (EffectRunArg noAnn) + ) + + it "lifts a nullary call to an effect-run application" do + -- `runFn0 = \fn -> fn()`. The zero-argument call lifts as an + -- application to the 'EffectRunArg' marker. `runFn0`/`mkFn0` + -- nonetheless stay off the allowlist by policy, not liftability: + -- forcing a pure `Fn0` is not an effect run and must not be + -- marked as one. liftExport (source "return { runFn0 = function(fn) return fn() end }") (Name "runFn0") + `shouldBe` Just + ( abstraction (paramNamed (Name "fn")) $ + application (refLocal (Name "fn")) (EffectRunArg noAnn) + ) + + describe "declines everything outside the subset" do + it "declines a vararg function literal" do + liftExport + (source "return { f = function(a, ...) return a end }") + (Name "f") + `shouldSatisfy` isNothing + + it "declines duplicate parameter names" do + -- Lua's `function(a, a)` binds the body's `a` to the *last* + -- parameter; an 'AbsN' with two same-named parameters would + -- silently miscompile that reference, so the literal declines. + liftExport + (source "return { f = function(a, a) return a end }") + (Name "f") `shouldSatisfy` isNothing it "declines a literal-lambda call at a mismatched arity" do @@ -189,6 +278,16 @@ spec = describe "Foreign lift (#178)" do <> "return { f = function(a) return k(a, a) end }" liftExport (source src) (Name "f") `shouldSatisfy` isNothing + it "declines an under-applied multi-parameter literal head" do + -- The mirror image: `local k = function(a, b) return a end` now + -- inlines to a two-parameter 'AbsN' (#227), and calling it with + -- one argument would again build an ill-formed 'AppN' — Lua pads + -- the missing parameter with nil, so the mismatch declines. + let src = + "local k = function(a, b) return a end\n" + <> "return { f = function(x) return k(x) end }" + liftExport (source src) (Name "f") `shouldSatisfy` isNothing + it "declines a body with a table index" do liftExport (source "return { f = function(xs) return xs[1] end }") (Name "f") `shouldSatisfy` isNothing From b8b61d7705a9cdc2ff7a9037a7f2e0b0e7fc5051 Mon Sep 17 00:00:00 2001 From: Yura Lazarev Date: Sat, 11 Jul 2026 12:37:33 +0200 Subject: [PATCH 2/2] test(golden): exercise the mk half of UncurriedLift through the lifter (#227) The module doc gains the mk half, and a new point-free mulByFn = mkFn2 mul reduces the wrapper's lifted body against a dictionary-resolved intMul rather than a literal lambda. The goldens show the payoff: add3, mul2 and mulByFn become plain n-ary literals, sumST becomes function(a, b) return pure(a + b)() end, and the Data.Function.Uncurried, Effect.Uncurried and Control.Monad.ST.Uncurried foreign tables disappear from the output. The hand-written eval oracle gains the 48 line for the new runFn2 mulByFn 6 8 site. --- .../Golden.UncurriedLift.Test/corefn.json | 2 +- .../Golden.UncurriedLift.Test/eval/golden.txt | 1 + .../Golden.UncurriedLift.Test/golden.ir | 209 ++++++++---------- .../Golden.UncurriedLift.Test/golden.lua | 66 +++--- test/ps/src/Golden/UncurriedLift/Test.purs | 20 +- 5 files changed, 141 insertions(+), 157 deletions(-) diff --git a/test/ps/output/Golden.UncurriedLift.Test/corefn.json b/test/ps/output/Golden.UncurriedLift.Test/corefn.json index d464c367..7cb64878 100644 --- a/test/ps/output/Golden.UncurriedLift.Test/corefn.json +++ b/test/ps/output/Golden.UncurriedLift.Test/corefn.json @@ -1 +1 @@ -{"builtWith":"0.15.16","comments":[{"LineComment":" | Exercises the lifting of the @*.Uncurried@ run wrappers to direct"},{"LineComment":" | n-ary calls (issue #198)."},{"LineComment":" |"},{"LineComment":" | The pure @runFn2@/@runFn3@ sites must collapse to a single Lua call"},{"LineComment":" | (@add3(1, 2, 3)@), not the curried-onion @runFn3(add3)(1)(2)(3)@. The"},{"LineComment":" | effectful @runEffectFn2@ site sits in statement position, where the"},{"LineComment":" | run wrapper's thunk (run by magic-do, shed by codegen) fuses away to"},{"LineComment":" | a direct @logTwice(a, b)@ — one call and no closures where the"},{"LineComment":" | fallback paid four calls and three."},{"LineComment":" |"},{"LineComment":" | The @runSTFn2@ site links @Control.Monad.ST.Uncurried@'s real fork"},{"LineComment":" | FFI through the lifter, so a fork release that reshapes it trips the"},{"LineComment":" | allowlist hard contract here instead of only downstream."}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[37,29],"start":[37,25]}},"type":"Var","value":{"identifier":"pure","moduleName":["Control","Applicative"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[37,37],"start":[37,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeST","moduleName":["Control","Monad","ST","Internal"]}},"type":"App"},"identifier":"pure"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[37,34],"start":[37,33]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[37,36],"start":[37,31]}},"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":[29,25],"start":[29,24]}},"type":"Var","value":{"identifier":"mul","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[29,27],"start":[29,22]}},"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":[33,8],"start":[33,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[33,8],"start":[33,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":[33,8],"start":[33,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":[53,10],"start":[53,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[53,30],"start":[53,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":[36,39],"start":[36,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[37,16],"start":[37,9]}},"type":"Var","value":{"identifier":"mkSTFn2","moduleName":["Control","Monad","ST","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,37],"start":[37,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,37],"start":[37,17]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[37,37],"start":[37,17]}},"argument":"b","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"pure","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,37],"start":[37,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,36],"start":[37,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,32],"start":[37,31]}},"type":"Var","value":{"identifier":"a","sourcePos":[37,18]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,36],"start":[37,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,36],"start":[37,35]}},"type":"Var","value":{"identifier":"b","sourcePos":[37,20]}},"type":"App"},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"sumST"},{"annotation":{"meta":null,"sourceSpan":{"end":[28,24],"start":[28,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[29,13],"start":[29,8]}},"type":"Var","value":{"identifier":"mkFn2","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,27],"start":[29,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,27],"start":[29,14]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[29,27],"start":[29,14]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"mul","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[29,27],"start":[29,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,23],"start":[29,22]}},"type":"Var","value":{"identifier":"a","sourcePos":[29,15]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[29,27],"start":[29,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[29,27],"start":[29,26]}},"type":"Var","value":{"identifier":"b","sourcePos":[29,17]}},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"mul2"},{"annotation":{"meta":null,"sourceSpan":{"end":[31,41],"start":[31,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[32,23],"start":[32,12]}},"type":"Var","value":{"identifier":"mkEffectFn2","moduleName":["Effect","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,8],"start":[32,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,8],"start":[32,24]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[34,8],"start":[32,24]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,8],"start":[33,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[33,6],"start":[33,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,8],"start":[33,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,8],"start":[33,7]}},"type":"Var","value":{"identifier":"a","sourcePos":[32,25]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[33,8],"start":[33,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,8],"start":[33,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[34,6],"start":[34,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,8],"start":[34,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,8],"start":[34,7]}},"type":"Var","value":{"identifier":"b","sourcePos":[32,27]}},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"logTwice"},{"annotation":{"meta":null,"sourceSpan":{"end":[25,28],"start":[25,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[26,13],"start":[26,8]}},"type":"Var","value":{"identifier":"mkFn3","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,14]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,14]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,14]}},"argument":"c","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,24]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,25],"start":[26,24]}},"type":"Var","value":{"identifier":"a","sourcePos":[26,15]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,29],"start":[26,28]}},"type":"Var","value":{"identifier":"b","sourcePos":[26,17]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[26,33],"start":[26,32]}},"type":"Var","value":{"identifier":"c","sourcePos":[26,19]}},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"add3"},{"annotation":{"meta":null,"sourceSpan":{"end":[44,30],"start":[44,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[45,25],"start":[45,19]}},"type":"Var","value":{"identifier":"runFn3","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,30],"start":[45,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,30],"start":[45,26]}},"type":"Var","value":{"identifier":"add3","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[45,32],"start":[45,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,32],"start":[45,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[45,34],"start":[45,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,34],"start":[45,33]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"identifier":"addOnePlusTwoTo"},{"annotation":{"meta":null,"sourceSpan":{"end":[47,20],"start":[47,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[52,40],"start":[52,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[52,15],"start":[52,3]}},"type":"Var","value":{"identifier":"runEffectFn2","moduleName":["Effect","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[52,24],"start":[52,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[52,24],"start":[52,16]}},"type":"Var","value":{"identifier":"logTwice","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[52,32],"start":[52,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[52,32],"start":[52,25]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"hello"}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[52,40],"start":[52,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[52,40],"start":[52,33]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"world"}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[52,40],"start":[52,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[52,40],"start":[52,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[53,30],"start":[53,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[53,30],"start":[53,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[53,18],"start":[53,12]}},"type":"Var","value":{"identifier":"runFn3","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[53,23],"start":[53,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[53,23],"start":[53,19]}},"type":"Var","value":{"identifier":"add3","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[53,25],"start":[53,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[53,25],"start":[53,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[53,27],"start":[53,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[53,27],"start":[53,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[53,29],"start":[53,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[53,29],"start":[53,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[53,30],"start":[53,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[53,30],"start":[53,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,28],"start":[54,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,28],"start":[54,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[54,18],"start":[54,12]}},"type":"Var","value":{"identifier":"runFn2","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,23],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,23],"start":[54,19]}},"type":"Var","value":{"identifier":"mul2","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,25],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,25],"start":[54,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,27],"start":[54,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,27],"start":[54,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[54,28],"start":[54,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,28],"start":[54,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[55,32],"start":[55,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[55,32],"start":[55,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[55,27],"start":[55,12]}},"type":"Var","value":{"identifier":"addOnePlusTwoTo","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[55,31],"start":[55,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[55,31],"start":[55,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":100}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[55,32],"start":[55,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[55,32],"start":[55,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[56,32],"start":[56,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[56,32],"start":[56,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[56,27],"start":[56,12]}},"type":"Var","value":{"identifier":"addOnePlusTwoTo","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[56,31],"start":[56,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[56,31],"start":[56,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":200}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[56,32],"start":[56,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[56,32],"start":[56,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[57,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[57,18],"start":[57,12]}},"type":"Var","value":{"identifier":"run","moduleName":["Control","Monad","ST","Internal"]}},"annotation":{"meta":null,"sourceSpan":{"end":[57,40],"start":[57,12]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[57,28],"start":[57,20]}},"type":"Var","value":{"identifier":"runSTFn2","moduleName":["Control","Monad","ST","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[57,34],"start":[57,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[57,34],"start":[57,29]}},"type":"Var","value":{"identifier":"sumST","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[57,37],"start":[57,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[57,37],"start":[57,35]}},"type":"Literal","value":{"literalType":"IntLiteral","value":40}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[57,39],"start":[57,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[57,39],"start":[57,38]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"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"},"identifier":"main"}],"exports":["add3","mul2","logTwice","sumST","addOnePlusTwoTo","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Control","Applicative"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[18,30],"start":[18,1]}},"moduleName":["Control","Monad","ST"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Control","Monad","ST","Internal"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Control","Monad","ST","Uncurried"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Data","Function","Uncurried"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Effect","Uncurried"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Golden","UncurriedLift","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[16,15],"start":[16,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[57,41],"start":[14,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","UncurriedLift","Test"],"modulePath":"src/Golden/UncurriedLift/Test.purs","reExports":{},"sourceSpan":{"end":[57,41],"start":[14,1]}} \ No newline at end of file +{"builtWith":"0.15.16","comments":[{"LineComment":" | Exercises the lifting of the @*.Uncurried@ run wrappers to direct"},{"LineComment":" | n-ary calls (issue #198) and of the mk wrappers to n-ary"},{"LineComment":" | definitions (issue #227)."},{"LineComment":" |"},{"LineComment":" | The pure @runFn2@/@runFn3@ sites must collapse to a single Lua call"},{"LineComment":" | (@add3(1, 2, 3)@), not the curried-onion @runFn3(add3)(1)(2)(3)@. The"},{"LineComment":" | effectful @runEffectFn2@ site sits in statement position, where the"},{"LineComment":" | run wrapper's thunk (run by magic-do, shed by codegen) fuses away to"},{"LineComment":" | a direct @logTwice(a, b)@ — one call and no closures where the"},{"LineComment":" | fallback paid four calls and three."},{"LineComment":" |"},{"LineComment":" | The mk half: each @mkFnN@/@mkEffectFnN@/@mkSTFnN@ definition must"},{"LineComment":" | become a single n-ary Lua literal (@add3 = function(a, b, c) …@),"},{"LineComment":" | not an opaque @mkFn3(…)@ wrapper that re-curries every call through"},{"LineComment":" | two closures. @mulByFn@ applies @mkFn2@ point-free to a named"},{"LineComment":" | function, so the wrapper's lifted body reduces against a"},{"LineComment":" | dictionary-resolved @intMul@ rather than a literal lambda."},{"LineComment":" |"},{"LineComment":" | The @runSTFn2@/@mkSTFn2@ sites link @Control.Monad.ST.Uncurried@'s"},{"LineComment":" | real fork FFI through the lifter, so a fork release that reshapes it"},{"LineComment":" | trips the allowlist hard contract here instead of only downstream."}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,29],"start":[48,25]}},"type":"Var","value":{"identifier":"pure","moduleName":["Control","Applicative"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,37],"start":[48,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"applicativeST","moduleName":["Control","Monad","ST","Internal"]}},"type":"App"},"identifier":"pure"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,34],"start":[48,33]}},"type":"Var","value":{"identifier":"add","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[48,36],"start":[48,31]}},"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":[40,20],"start":[40,17]}},"type":"Var","value":{"identifier":"mul","moduleName":["Data","Semiring"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[40,20],"start":[40,17]}},"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":[44,8],"start":[44,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[44,8],"start":[44,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":[44,8],"start":[44,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":[64,10],"start":[64,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[64,30],"start":[64,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":[47,39],"start":[47,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[48,16],"start":[48,9]}},"type":"Var","value":{"identifier":"mkSTFn2","moduleName":["Control","Monad","ST","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,37],"start":[48,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,37],"start":[48,17]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[48,37],"start":[48,17]}},"argument":"b","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"pure","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,37],"start":[48,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,36],"start":[48,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,32],"start":[48,31]}},"type":"Var","value":{"identifier":"a","sourcePos":[48,18]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,36],"start":[48,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,36],"start":[48,35]}},"type":"Var","value":{"identifier":"b","sourcePos":[48,20]}},"type":"App"},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"sumST"},{"annotation":{"meta":null,"sourceSpan":{"end":[39,27],"start":[39,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[40,16],"start":[40,11]}},"type":"Var","value":{"identifier":"mkFn2","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,20],"start":[40,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"mul","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"identifier":"mulByFn"},{"annotation":{"meta":null,"sourceSpan":{"end":[36,24],"start":[36,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[37,13],"start":[37,8]}},"type":"Var","value":{"identifier":"mkFn2","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,27],"start":[37,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,27],"start":[37,14]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[37,27],"start":[37,14]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"mul","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,27],"start":[37,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,23],"start":[37,22]}},"type":"Var","value":{"identifier":"a","sourcePos":[37,15]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[37,27],"start":[37,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,27],"start":[37,26]}},"type":"Var","value":{"identifier":"b","sourcePos":[37,17]}},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"mul2"},{"annotation":{"meta":null,"sourceSpan":{"end":[42,41],"start":[42,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[43,23],"start":[43,12]}},"type":"Var","value":{"identifier":"mkEffectFn2","moduleName":["Effect","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,8],"start":[43,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,8],"start":[43,24]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[45,8],"start":[43,24]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[44,8],"start":[44,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[44,6],"start":[44,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[44,8],"start":[44,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[44,8],"start":[44,7]}},"type":"Var","value":{"identifier":"a","sourcePos":[43,25]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[44,8],"start":[44,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[44,8],"start":[44,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[45,6],"start":[45,3]}},"type":"Var","value":{"identifier":"log","moduleName":["Effect","Console"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,8],"start":[45,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,8],"start":[45,7]}},"type":"Var","value":{"identifier":"b","sourcePos":[43,27]}},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"logTwice"},{"annotation":{"meta":null,"sourceSpan":{"end":[33,28],"start":[33,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[34,13],"start":[34,8]}},"type":"Var","value":{"identifier":"mkFn3","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,14]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,14]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,14]}},"argument":"c","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,24]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"add","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,25],"start":[34,24]}},"type":"Var","value":{"identifier":"a","sourcePos":[34,15]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,29],"start":[34,28]}},"type":"Var","value":{"identifier":"b","sourcePos":[34,17]}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,33],"start":[34,32]}},"type":"Var","value":{"identifier":"c","sourcePos":[34,19]}},"type":"App"},"type":"Abs"},"type":"Abs"},"type":"Abs"},"type":"App"},"identifier":"add3"},{"annotation":{"meta":null,"sourceSpan":{"end":[55,30],"start":[55,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[56,25],"start":[56,19]}},"type":"Var","value":{"identifier":"runFn3","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[56,30],"start":[56,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[56,30],"start":[56,26]}},"type":"Var","value":{"identifier":"add3","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[56,32],"start":[56,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[56,32],"start":[56,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[56,34],"start":[56,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[56,34],"start":[56,33]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"identifier":"addOnePlusTwoTo"},{"annotation":{"meta":null,"sourceSpan":{"end":[58,20],"start":[58,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[63,40],"start":[63,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[63,15],"start":[63,3]}},"type":"Var","value":{"identifier":"runEffectFn2","moduleName":["Effect","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[63,24],"start":[63,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[63,24],"start":[63,16]}},"type":"Var","value":{"identifier":"logTwice","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[63,32],"start":[63,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[63,32],"start":[63,25]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"hello"}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[63,40],"start":[63,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[63,40],"start":[63,33]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"world"}},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[63,40],"start":[63,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[63,40],"start":[63,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[64,30],"start":[64,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[64,30],"start":[64,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[64,18],"start":[64,12]}},"type":"Var","value":{"identifier":"runFn3","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[64,23],"start":[64,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[64,23],"start":[64,19]}},"type":"Var","value":{"identifier":"add3","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[64,25],"start":[64,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[64,25],"start":[64,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[64,27],"start":[64,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[64,27],"start":[64,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[64,29],"start":[64,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[64,29],"start":[64,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[64,30],"start":[64,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[64,30],"start":[64,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[65,28],"start":[65,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[65,28],"start":[65,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[65,18],"start":[65,12]}},"type":"Var","value":{"identifier":"runFn2","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[65,23],"start":[65,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[65,23],"start":[65,19]}},"type":"Var","value":{"identifier":"mul2","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[65,25],"start":[65,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[65,25],"start":[65,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[65,27],"start":[65,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[65,27],"start":[65,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[65,28],"start":[65,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[65,28],"start":[65,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[66,31],"start":[66,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[66,31],"start":[66,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[66,18],"start":[66,12]}},"type":"Var","value":{"identifier":"runFn2","moduleName":["Data","Function","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[66,26],"start":[66,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[66,26],"start":[66,19]}},"type":"Var","value":{"identifier":"mulByFn","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[66,28],"start":[66,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[66,28],"start":[66,27]}},"type":"Literal","value":{"literalType":"IntLiteral","value":6}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[66,30],"start":[66,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[66,30],"start":[66,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":8}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[66,31],"start":[66,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[66,31],"start":[66,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[67,32],"start":[67,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[67,32],"start":[67,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[67,27],"start":[67,12]}},"type":"Var","value":{"identifier":"addOnePlusTwoTo","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[67,31],"start":[67,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[67,31],"start":[67,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":100}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[67,32],"start":[67,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[67,32],"start":[67,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[68,32],"start":[68,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[68,32],"start":[68,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[68,27],"start":[68,12]}},"type":"Var","value":{"identifier":"addOnePlusTwoTo","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[68,31],"start":[68,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[68,31],"start":[68,28]}},"type":"Literal","value":{"literalType":"IntLiteral","value":200}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[68,32],"start":[68,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[68,32],"start":[68,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","UncurriedLift","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[69,3]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[69,18],"start":[69,12]}},"type":"Var","value":{"identifier":"run","moduleName":["Control","Monad","ST","Internal"]}},"annotation":{"meta":null,"sourceSpan":{"end":[69,40],"start":[69,12]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[69,28],"start":[69,20]}},"type":"Var","value":{"identifier":"runSTFn2","moduleName":["Control","Monad","ST","Uncurried"]}},"annotation":{"meta":null,"sourceSpan":{"end":[69,34],"start":[69,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[69,34],"start":[69,29]}},"type":"Var","value":{"identifier":"sumST","moduleName":["Golden","UncurriedLift","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[69,37],"start":[69,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[69,37],"start":[69,35]}},"type":"Literal","value":{"literalType":"IntLiteral","value":40}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[69,39],"start":[69,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[69,39],"start":[69,38]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"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"},"identifier":"main"}],"exports":["add3","mul2","mulByFn","logTwice","sumST","addOnePlusTwoTo","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Control","Applicative"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[26,30],"start":[26,1]}},"moduleName":["Control","Monad","ST"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Control","Monad","ST","Internal"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Control","Monad","ST","Uncurried"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Data","Function","Uncurried"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Data","Semiring"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Effect","Uncurried"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Golden","UncurriedLift","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[24,15],"start":[24,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[69,41],"start":[22,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","UncurriedLift","Test"],"modulePath":"src/Golden/UncurriedLift/Test.purs","reExports":{},"sourceSpan":{"end":[69,41],"start":[22,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.UncurriedLift.Test/eval/golden.txt b/test/ps/output/Golden.UncurriedLift.Test/eval/golden.txt index 461e2a39..4d75869b 100644 --- a/test/ps/output/Golden.UncurriedLift.Test/eval/golden.txt +++ b/test/ps/output/Golden.UncurriedLift.Test/eval/golden.txt @@ -2,6 +2,7 @@ hello world 6 20 +48 103 203 42 diff --git a/test/ps/output/Golden.UncurriedLift.Test/golden.ir b/test/ps/output/Golden.UncurriedLift.Test/golden.ir index 4afdf03d..40768c64 100644 --- a/test/ps/output/Golden.UncurriedLift.Test/golden.ir +++ b/test/ps/output/Golden.UncurriedLift.Test/golden.ir @@ -18,29 +18,11 @@ UberModule ( Nothing, Name "run" ) ] ), Standalone - ( QName - { qnameModuleName = ModuleName "Control.Monad.ST.Uncurried", qnameName = Name "foreign" - }, ForeignImport Nothing - ( ModuleName "Control.Monad.ST.Uncurried" ) ".spago/p/st/6d41fd264a05b9a089e79322b22b906597ea7c36/src/Control/Monad/ST/Uncurried.purs" - [ ( Nothing, Name "mkSTFn2" ) ] - ), Standalone - ( QName - { qnameModuleName = ModuleName "Data.Function.Uncurried", qnameName = Name "foreign" - }, ForeignImport Nothing - ( ModuleName "Data.Function.Uncurried" ) ".spago/p/functions/03cdfb3561c4e055a53bdba2c491ed3e063eb468/src/Data/Function/Uncurried.purs" - [ ( Nothing, Name "mkFn2" ), ( Nothing, Name "mkFn3" ) ] - ), Standalone ( QName { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "foreign" }, ForeignImport Nothing ( ModuleName "Effect.Console" ) ".spago/p/console/f82835a0b873aafe6bd7b14dd30cc150553d4ab9/src/Effect/Console.purs" [ ( Nothing, Name "log" ) ] - ), Standalone - ( QName - { qnameModuleName = ModuleName "Effect.Uncurried", qnameName = Name "foreign" - }, ForeignImport Nothing - ( ModuleName "Effect.Uncurried" ) ".spago/p/effect/82bac3dff904fa34534c4f5b9deeb5da359471c8/src/Effect/Uncurried.purs" - [ ( Nothing, Name "mkEffectFn2" ) ] ), RecursiveGroup ( ( QName @@ -117,7 +99,7 @@ UberModule [ ( PropName "apply", Let Nothing ( Standalone - ( Nothing, Name "bind$604", ObjectProp Nothing + ( Nothing, Name "bind$753", ObjectProp Nothing ( AppN Nothing ( ObjectProp Nothing ( Ref Nothing @@ -136,23 +118,23 @@ UberModule ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "f$605" ) :| [] ) + ( ParamNamed Nothing ( Name "f$754" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "a$606" ) :| [] ) + ( ParamNamed Nothing ( Name "a$755" ) :| [] ) ( AppN Nothing ( AppN Nothing - ( Ref Nothing ( Local ( Name "bind$604" ) ) ) - ( Ref Nothing ( Local ( Name "f$605" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "bind$753" ) ) ) + ( Ref Nothing ( Local ( Name "f$754" ) ) :| [] ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "f'$607" ) :| [] ) + ( ParamNamed Nothing ( Name "f'$756" ) :| [] ) ( AppN Nothing ( AppN Nothing - ( Ref Nothing ( Local ( Name "bind$604" ) ) ) - ( Ref Nothing ( Local ( Name "a$606" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "bind$753" ) ) ) + ( Ref Nothing ( Local ( Name "a$755" ) ) :| [] ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "a'$608" ) :| [] ) + ( ParamNamed Nothing ( Name "a'$757" ) :| [] ) ( AppN Nothing ( ObjectProp Nothing ( AppN Nothing @@ -175,8 +157,8 @@ UberModule ( PropName "pure" ) ) ( AppN Nothing - ( Ref Nothing ( Local ( Name "f'$607" ) ) ) - ( Ref Nothing ( Local ( Name "a'$608" ) ) :| [] ) :| [] + ( Ref Nothing ( Local ( Name "f'$756" ) ) ) + ( Ref Nothing ( Local ( Name "a'$757" ) ) :| [] ) :| [] ) ) :| [] ) @@ -210,79 +192,52 @@ UberModule ), Standalone ( QName { qnameModuleName = ModuleName "Golden.UncurriedLift.Test", qnameName = Name "sumST" - }, AppN Nothing - ( ObjectProp ( Just Always ) - ( Ref Nothing - ( Imported ( ModuleName "Control.Monad.ST.Uncurried" ) ( Name "foreign" ) ) - ) - ( PropName "mkSTFn2" ) - ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "a" ) :| [] ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "b" ) :| [] ) - ( AppN Nothing - ( ObjectProp Nothing - ( Ref Nothing - ( Imported ( ModuleName "Control.Monad.ST.Internal" ) ( Name "applicativeST" ) ) - ) - ( PropName "pure" ) - ) - ( PrimBinOp Nothing PrimAdd - ( Ref Nothing ( Local ( Name "a" ) ) ) - ( Ref Nothing ( Local ( Name "b" ) ) ) :| [] + }, AbsN Nothing + ( ParamNamed Nothing ( Name "a$705" ) :| [ ParamNamed Nothing ( Name "b$706" ) ] ) + ( AppN Nothing + ( AppN Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported ( ModuleName "Control.Monad.ST.Internal" ) ( Name "applicativeST" ) ) ) + ( PropName "pure" ) + ) + ( PrimBinOp Nothing PrimAdd + ( Ref Nothing ( Local ( Name "a$705" ) ) ) + ( Ref Nothing ( Local ( Name "b$706" ) ) ) :| [] ) - ) :| [] + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) ) ), Standalone ( QName - { qnameModuleName = ModuleName "Golden.UncurriedLift.Test", qnameName = Name "mul2" - }, AppN Nothing - ( ObjectProp ( Just Always ) - ( Ref Nothing ( Imported ( ModuleName "Data.Function.Uncurried" ) ( Name "foreign" ) ) ) - ( PropName "mkFn2" ) + { qnameModuleName = ModuleName "Golden.UncurriedLift.Test", qnameName = Name "mulByFn" + }, AbsN Nothing + ( ParamNamed Nothing ( Name "a$696" ) :| [ ParamNamed Nothing ( Name "b$697" ) ] ) + ( PrimBinOp Nothing PrimMul + ( Ref Nothing ( Local ( Name "a$696" ) ) ) + ( Ref Nothing ( Local ( Name "b$697" ) ) ) ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "a" ) :| [] ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "b" ) :| [] ) - ( PrimBinOp Nothing PrimMul - ( Ref Nothing ( Local ( Name "a" ) ) ) - ( Ref Nothing ( Local ( Name "b" ) ) ) - ) - ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.UncurriedLift.Test", qnameName = Name "mul2" + }, AbsN Nothing + ( ParamNamed Nothing ( Name "a$699" ) :| [ ParamNamed Nothing ( Name "b$700" ) ] ) + ( PrimBinOp Nothing PrimMul + ( Ref Nothing ( Local ( Name "a$699" ) ) ) + ( Ref Nothing ( Local ( Name "b$700" ) ) ) ) ), Standalone ( QName { qnameModuleName = ModuleName "Golden.UncurriedLift.Test", qnameName = Name "logTwice" - }, AppN Nothing - ( ObjectProp ( Just Always ) - ( Ref Nothing ( Imported ( ModuleName "Effect.Uncurried" ) ( Name "foreign" ) ) ) - ( PropName "mkEffectFn2" ) - ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "a" ) :| [] ) + }, AbsN Nothing + ( ParamNamed Nothing ( Name "a$671" ) :| [ ParamNamed Nothing ( Name "b$672" ) ] ) + ( AppN Nothing ( AbsN Nothing - ( ParamNamed Nothing ( Name "b" ) :| [] ) - ( AbsN Nothing - ( ParamUnused Nothing :| [] ) - ( Let Nothing - ( Standalone - ( Nothing, Name "_", AppN Nothing - ( AppN Nothing - ( ObjectProp ( Just Always ) - ( Ref Nothing - ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) - ) - ( PropName "log" ) - ) - ( Ref Nothing ( Local ( Name "a" ) ) :| [] ) - ) - ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) - ) :| [] - ) - ( AppN Nothing + ( ParamUnused Nothing :| [] ) + ( Let Nothing + ( Standalone + ( Nothing, Name "_", AppN Nothing ( AppN Nothing ( ObjectProp ( Just Always ) ( Ref Nothing @@ -290,47 +245,49 @@ UberModule ) ( PropName "log" ) ) - ( Ref Nothing ( Local ( Name "b" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "a$671" ) ) :| [] ) ) ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ) :| [] + ) + ( AppN Nothing + ( AppN Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) ) + ( PropName "log" ) + ) + ( Ref Nothing ( Local ( Name "b$672" ) ) :| [] ) ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) ) ) - ) :| [] + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) ) ), Standalone ( QName { qnameModuleName = ModuleName "Golden.UncurriedLift.Test", qnameName = Name "add3" - }, AppN Nothing - ( ObjectProp ( Just Always ) - ( Ref Nothing ( Imported ( ModuleName "Data.Function.Uncurried" ) ( Name "foreign" ) ) ) - ( PropName "mkFn3" ) + }, AbsN Nothing + ( ParamNamed Nothing + ( Name "a$692" ) :| + [ ParamNamed Nothing ( Name "b$693" ), ParamNamed Nothing ( Name "c$694" ) ] ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "a" ) :| [] ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "b" ) :| [] ) - ( AbsN Nothing - ( ParamNamed Nothing ( Name "c" ) :| [] ) - ( PrimBinOp Nothing PrimAdd - ( PrimBinOp Nothing PrimAdd - ( Ref Nothing ( Local ( Name "a" ) ) ) - ( Ref Nothing ( Local ( Name "b" ) ) ) - ) - ( Ref Nothing ( Local ( Name "c" ) ) ) - ) - ) - ) :| [] + ( PrimBinOp Nothing PrimAdd + ( PrimBinOp Nothing PrimAdd + ( Ref Nothing ( Local ( Name "a$692" ) ) ) + ( Ref Nothing ( Local ( Name "b$693" ) ) ) + ) + ( Ref Nothing ( Local ( Name "c$694" ) ) ) ) ), Standalone ( QName { qnameModuleName = ModuleName "Golden.UncurriedLift.Test", qnameName = Name "addOnePlusTwoTo" }, AbsN Nothing - ( ParamNamed Nothing ( Name "c$547" ) :| [] ) + ( ParamNamed Nothing ( Name "c$680" ) :| [] ) ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Golden.UncurriedLift.Test" ) ( Name "add3" ) ) ) ( LiteralInt Nothing 1 :| - [ LiteralInt Nothing 2, Ref Nothing ( Local ( Name "c$547" ) ) ] + [ LiteralInt Nothing 2, Ref Nothing ( Local ( Name "c$680" ) ) ] ) ) ) @@ -342,6 +299,9 @@ UberModule ( Name "mul2", Ref Nothing ( Imported ( ModuleName "Golden.UncurriedLift.Test" ) ( Name "mul2" ) ) ), + ( Name "mulByFn", Ref Nothing + ( Imported ( ModuleName "Golden.UncurriedLift.Test" ) ( Name "mulByFn" ) ) + ), ( Name "logTwice", Ref Nothing ( Imported ( ModuleName "Golden.UncurriedLift.Test" ) ( Name "logTwice" ) ) ), @@ -412,6 +372,27 @@ UberModule ) ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) ) + ( PropName "log" ) + ) + ( AppN Nothing + ( ObjectProp ( Just Always ) + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "foreign" ) ) ) + ( PropName "showIntImpl" ) + ) + ( AppN Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.UncurriedLift.Test" ) ( Name "mulByFn" ) ) + ) + ( LiteralInt Nothing 6 :| [ LiteralInt Nothing 8 ] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone ( Nothing, Name "_", AppN Nothing ( AppN Nothing ( ObjectProp ( Just Always ) diff --git a/test/ps/output/Golden.UncurriedLift.Test/golden.lua b/test/ps/output/Golden.UncurriedLift.Test/golden.lua index 276e6c7e..b2ef50b1 100644 --- a/test/ps/output/Golden.UncurriedLift.Test/golden.lua +++ b/test/ps/output/Golden.UncurriedLift.Test/golden.lua @@ -28,19 +28,9 @@ M.Control_Monad_ST_Internal_foreign = { end, run = function(f) return f() end } -M.Control_Monad_ST_Uncurried_foreign = { - mkSTFn2 = function(fn) return function(a, b) return fn(a)(b)() end end -} -M.Data_Function_Uncurried_foreign = { - mkFn2 = function(fn) return function(a, b) return fn(a)(b) end end, - mkFn3 = function(fn) return function(a, b, c) return fn(a)(b)(c) end end -} M.Effect_Console_foreign = { log = function(s) return function() print(s) end end } -M.Effect_Uncurried_foreign = { - mkEffectFn2 = function(fn) return function(a, b) return fn(a)(b)() end end -} M.Control_Monad_ST_Internal_monadST = { Applicative0 = function() return M.Control_Monad_ST_Internal_applicativeST @@ -58,12 +48,12 @@ M.Control_Monad_ST_Internal_applicativeST = { M.Control_Monad_ST_Internal_Lazy_applyST = PSLUA_runtime_lazy("applyST")(function( ) return { apply = (function() - local bind_S_604 = (M.Control_Monad_ST_Internal_monadST.Bind1()).bind - return function(f_S_605) - return function(a_S_606) - return bind_S_604(f_S_605)(function(fPrime_S_607) - return bind_S_604(a_S_606)(function(aPrime_S_608) - return (M.Control_Monad_ST_Internal_monadST.Applicative0()).pure(fPrime_S_607(aPrime_S_608)) + local bind_S_753 = (M.Control_Monad_ST_Internal_monadST.Bind1()).bind + return function(f_S_754) + return function(a_S_755) + return bind_S_753(f_S_754)(function(fPrime_S_756) + return bind_S_753(a_S_755)(function(aPrime_S_757) + return (M.Control_Monad_ST_Internal_monadST.Applicative0()).pure(fPrime_S_756(aPrime_S_757)) end) end) end @@ -74,34 +64,34 @@ M.Control_Monad_ST_Internal_Lazy_applyST = PSLUA_runtime_lazy("applyST")(functio end } end) -M.Golden_UncurriedLift_Test_sumST = M.Control_Monad_ST_Uncurried_foreign.mkSTFn2(function( a ) - return function(b) - return M.Control_Monad_ST_Internal_applicativeST.pure(a + b) - end -end) -M.Golden_UncurriedLift_Test_mul2 = M.Data_Function_Uncurried_foreign.mkFn2(function( a ) - return function(b) return a * b end -end) -M.Golden_UncurriedLift_Test_logTwice = M.Effect_Uncurried_foreign.mkEffectFn2(function( a ) - return function(b) - return function() - local Effect_Console_foreign = M.Effect_Console_foreign - local _ = Effect_Console_foreign.log(a)() - return Effect_Console_foreign.log(b)() - end - end -end) -M.Golden_UncurriedLift_Test_add3 = M.Data_Function_Uncurried_foreign.mkFn3(function( a ) - return function(b) return function(c) return a + b + c end end -end) -M.Golden_UncurriedLift_Test_addOnePlusTwoTo = function(c_S_547) - return M.Golden_UncurriedLift_Test_add3(1, 2, c_S_547) +M.Golden_UncurriedLift_Test_sumST = function(a_S_705, b_S_706) + return M.Control_Monad_ST_Internal_applicativeST.pure(a_S_705 + b_S_706)() +end +M.Golden_UncurriedLift_Test_mulByFn = function(a_S_696, b_S_697) + return a_S_696 * b_S_697 +end +M.Golden_UncurriedLift_Test_mul2 = function(a_S_699, b_S_700) + return a_S_699 * b_S_700 +end +M.Golden_UncurriedLift_Test_logTwice = function(a_S_671, b_S_672) + local Effect_Console_foreign = M.Effect_Console_foreign + return (function() + local _ = Effect_Console_foreign.log(a_S_671)() + return Effect_Console_foreign.log(b_S_672)() + end)() +end +M.Golden_UncurriedLift_Test_add3 = function(a_S_692, b_S_693, c_S_694) + return a_S_692 + b_S_693 + c_S_694 +end +M.Golden_UncurriedLift_Test_addOnePlusTwoTo = function(c_S_680) + return M.Golden_UncurriedLift_Test_add3(1, 2, c_S_680) end return (function() local Data_Show_foreign, Effect_Console_foreign, Golden_UncurriedLift_Test_add3 = M.Data_Show_foreign, M.Effect_Console_foreign, M.Golden_UncurriedLift_Test_add3 local _ = M.Golden_UncurriedLift_Test_logTwice("hello", "world") local _ = Effect_Console_foreign.log(Data_Show_foreign.showIntImpl(Golden_UncurriedLift_Test_add3(1, 2, 3)))() local _ = Effect_Console_foreign.log(Data_Show_foreign.showIntImpl(M.Golden_UncurriedLift_Test_mul2(4, 5)))() + local _ = Effect_Console_foreign.log(Data_Show_foreign.showIntImpl(M.Golden_UncurriedLift_Test_mulByFn(6, 8)))() local _ = Effect_Console_foreign.log(Data_Show_foreign.showIntImpl(Golden_UncurriedLift_Test_add3(1, 2, 100)))() local _ = Effect_Console_foreign.log(Data_Show_foreign.showIntImpl(Golden_UncurriedLift_Test_add3(1, 2, 200)))() return Effect_Console_foreign.log(Data_Show_foreign.showIntImpl(M.Control_Monad_ST_Internal_foreign.run(function( ) diff --git a/test/ps/src/Golden/UncurriedLift/Test.purs b/test/ps/src/Golden/UncurriedLift/Test.purs index e4e23227..b5fbfcdf 100644 --- a/test/ps/src/Golden/UncurriedLift/Test.purs +++ b/test/ps/src/Golden/UncurriedLift/Test.purs @@ -1,5 +1,6 @@ -- | Exercises the lifting of the @*.Uncurried@ run wrappers to direct --- | n-ary calls (issue #198). +-- | n-ary calls (issue #198) and of the mk wrappers to n-ary +-- | definitions (issue #227). -- | -- | The pure @runFn2@/@runFn3@ sites must collapse to a single Lua call -- | (@add3(1, 2, 3)@), not the curried-onion @runFn3(add3)(1)(2)(3)@. The @@ -8,9 +9,16 @@ -- | a direct @logTwice(a, b)@ — one call and no closures where the -- | fallback paid four calls and three. -- | --- | The @runSTFn2@ site links @Control.Monad.ST.Uncurried@'s real fork --- | FFI through the lifter, so a fork release that reshapes it trips the --- | allowlist hard contract here instead of only downstream. +-- | The mk half: each @mkFnN@/@mkEffectFnN@/@mkSTFnN@ definition must +-- | become a single n-ary Lua literal (@add3 = function(a, b, c) …@), +-- | not an opaque @mkFn3(…)@ wrapper that re-curries every call through +-- | two closures. @mulByFn@ applies @mkFn2@ point-free to a named +-- | function, so the wrapper's lifted body reduces against a +-- | dictionary-resolved @intMul@ rather than a literal lambda. +-- | +-- | The @runSTFn2@/@mkSTFn2@ sites link @Control.Monad.ST.Uncurried@'s +-- | real fork FFI through the lifter, so a fork release that reshapes it +-- | trips the allowlist hard contract here instead of only downstream. module Golden.UncurriedLift.Test where import Prelude @@ -28,6 +36,9 @@ add3 = mkFn3 \a b c -> a + b + c mul2 :: Fn2 Int Int Int mul2 = mkFn2 \a b -> a * b +mulByFn :: Fn2 Int Int Int +mulByFn = mkFn2 mul + logTwice :: EffectFn2 String String Unit logTwice = mkEffectFn2 \a b -> do log a @@ -52,6 +63,7 @@ main = do runEffectFn2 logTwice "hello" "world" -- hello / world logShow (runFn3 add3 1 2 3) -- 6 logShow (runFn2 mul2 4 5) -- 20 + logShow (runFn2 mulByFn 6 8) -- 48 logShow (addOnePlusTwoTo 100) -- 103 logShow (addOnePlusTwoTo 200) -- 203 logShow (ST.run (runSTFn2 sumST 40 2)) -- 42