diff --git a/backend-es/test/snapshots-out/Snapshot.Comparison01.js b/backend-es/test/snapshots-out/Snapshot.Comparison01.js new file mode 100644 index 00000000..e1b2d6ba --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.Comparison01.js @@ -0,0 +1,45 @@ +import * as $runtime from "../runtime.js"; +import * as Data$dComparison from "../Data.Comparison/index.js"; +import * as Data$dOrd from "../Data.Ord/index.js"; +import * as Data$dOrdering from "../Data.Ordering/index.js"; +import * as Data$dTuple from "../Data.Tuple/index.js"; +const defaultComparison1 = /* #__PURE__ */ (() => Data$dOrd.ordRecord()((() => { + const eqRowCons2 = {eqRecord: v => ra => rb => ra.foo === rb.foo}; + return { + compareRecord: v => ra => rb => { + const left = Data$dOrd.ordInt.compare(ra.foo)(rb.foo); + if (left.tag === "LT" || (left.tag === "GT" || !(left.tag === "EQ"))) { return left; } + return Data$dOrdering.EQ; + }, + EqRecord0: () => eqRowCons2 + }; +})()).compare)(); +const test8 = /* #__PURE__ */ (() => Data$dComparison.monoidComparison.mempty)(); +const test7 = /* #__PURE__ */ (() => { + const defCom = Data$dTuple.ordTuple(Data$dOrd.ordInt)(Data$dTuple.ordTuple(Data$dOrd.ordString)(Data$dOrd.ordBoolean)).compare; + return Data$dComparison.semigroupComparison.append(x => y => defCom(x._1)(y._1))(Data$dComparison.semigroupComparison.append(x => y => defCom(x._2._1)(y._2._1))(x => y => defCom(x._2._2)(y._2._2))); +})(); +const test6 = x => y => Data$dOrd.ordInt.compare(x.foo)(y.foo); +const test5 = /* #__PURE__ */ (() => Data$dOrd.ordInt.compare)(); +const test4 = /* #__PURE__ */ (() => Data$dComparison.monoidComparison.mempty)(); +const test3 = /* #__PURE__ */ (() => { + const defCom = Data$dOrd.ordRecord()((() => { + const eqRowCons2 = {eqRecord: v => ra => rb => ra.bar === rb.bar && (ra.baz === rb.baz && ra.foo === rb.foo)}; + return { + compareRecord: v => ra => rb => { + const left = Data$dOrd.ordString.compare(ra.bar)(rb.bar); + if (left.tag === "LT" || (left.tag === "GT" || !(left.tag === "EQ"))) { return left; } + const left$1 = Data$dOrd.ordBoolean.compare(ra.baz)(rb.baz); + if (left$1.tag === "LT" || (left$1.tag === "GT" || !(left$1.tag === "EQ"))) { return left$1; } + const left$2 = Data$dOrd.ordInt.compare(ra.foo)(rb.foo); + if (left$2.tag === "LT" || (left$2.tag === "GT" || !(left$2.tag === "EQ"))) { return left$2; } + return Data$dOrdering.EQ; + }, + EqRecord0: () => eqRowCons2 + }; + })()).compare; + return Data$dComparison.semigroupComparison.append(x => y => defCom(x.foo)(y.foo))(Data$dComparison.semigroupComparison.append(x => y => defCom(x.bar)(y.bar))(x => y => defCom(x.baz)(y.baz))); +})(); +const test2 = x => y => defaultComparison1(x.foo)(y.foo); +const test1 = defaultComparison1; +export {defaultComparison1, test1, test2, test3, test4, test5, test6, test7, test8}; diff --git a/backend-es/test/snapshots-out/Snapshot.Const01.js b/backend-es/test/snapshots-out/Snapshot.Const01.js new file mode 100644 index 00000000..47c5d601 --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.Const01.js @@ -0,0 +1,25 @@ +import * as $runtime from "../runtime.js"; +import * as Data$dEuclideanRing from "../Data.EuclideanRing/index.js"; +import * as Data$dOrd from "../Data.Ord/index.js"; +const test9 = ""; +const test8 = "hi"; +const test7 = "h"; +const test6 = -2147483648; +const test5 = 2147483647; +const test4 = /* #__PURE__ */ (() => Data$dOrd.ordString.compare("h")("i"))(); +const test3 = true; +const test21 = ""; +const test20 = "hi"; +const test2 = false; +const test19 = 1; +const test18 = false; +const test17 = true; +const test16 = /* #__PURE__ */ Data$dEuclideanRing.intMod(2)(2); +const test15 = /* #__PURE__ */ Data$dEuclideanRing.intDiv(1)(1); +const test14 = 1; +const test13 = 0; +const test12 = 1; +const test11 = 0; +const test10 = 2; +const test1 = false; +export {test1, test10, test11, test12, test13, test14, test15, test16, test17, test18, test19, test2, test20, test21, test3, test4, test5, test6, test7, test8, test9}; diff --git a/backend-es/test/snapshots-out/Snapshot.DefaultRulesBiapply01.js b/backend-es/test/snapshots-out/Snapshot.DefaultRulesBiapply01.js new file mode 100644 index 00000000..ba7f46fb --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.DefaultRulesBiapply01.js @@ -0,0 +1,7 @@ +import * as $runtime from "../runtime.js"; +import * as Data$dTuple from "../Data.Tuple/index.js"; +const test4 = /* #__PURE__ */ Data$dTuple.$Tuple(6, "hello world"); +const test3 = /* #__PURE__ */ Data$dTuple.$Tuple(3, "hello world"); +const test2 = /* #__PURE__ */ Data$dTuple.$Tuple("b", 2); +const test1 = /* #__PURE__ */ Data$dTuple.$Tuple("a", 1); +export {test1, test2, test3, test4}; diff --git a/backend-es/test/snapshots-out/Snapshot.DefaultRulesBifunctor01.js b/backend-es/test/snapshots-out/Snapshot.DefaultRulesBifunctor01.js new file mode 100644 index 00000000..914cb102 --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.DefaultRulesBifunctor01.js @@ -0,0 +1,5 @@ +import * as $runtime from "../runtime.js"; +import * as Data$dTuple from "../Data.Tuple/index.js"; +const test2 = /* #__PURE__ */ Data$dTuple.$Tuple(true, "1"); +const test1 = /* #__PURE__ */ Data$dTuple.$Tuple("true", 1); +export {test1, test2}; diff --git a/backend-es/test/snapshots-out/Snapshot.DefaultRulesContravariant01.js b/backend-es/test/snapshots-out/Snapshot.DefaultRulesContravariant01.js new file mode 100644 index 00000000..0c504ef8 --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.DefaultRulesContravariant01.js @@ -0,0 +1,6 @@ +import * as $runtime from "../runtime.js"; +const test4 = x => x + 5 | 0; +const test3 = x => x + 4 | 0; +const test2 = 1; +const test1 = 1; +export {test1, test2, test3, test4}; diff --git a/backend-es/test/snapshots-out/Snapshot.GenericBounded01.js b/backend-es/test/snapshots-out/Snapshot.GenericBounded01.js new file mode 100644 index 00000000..c897ef62 --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.GenericBounded01.js @@ -0,0 +1,55 @@ +// @inline export genericTest1.to arity=1 +import * as $runtime from "../runtime.js"; +import * as Data$dGeneric$dRep from "../Data.Generic.Rep/index.js"; +import * as Data$dOrdering from "../Data.Ordering/index.js"; +const $Test1 = tag => ({tag}); +const Bottom1 = /* #__PURE__ */ $Test1("Bottom1"); +const Ignored1 = /* #__PURE__ */ $Test1("Ignored1"); +const Top1 = /* #__PURE__ */ $Test1("Top1"); +const eqTest1 = { + eq: x => y => { + if (x.tag === "Bottom1") { return y.tag === "Bottom1"; } + if (x.tag === "Ignored1") { return y.tag === "Ignored1"; } + if (x.tag === "Top1") { return y.tag === "Top1"; } + return false; + } +}; +const ordTest1 = { + compare: x => y => { + if (x.tag === "Bottom1") { + if (y.tag === "Bottom1") { return Data$dOrdering.EQ; } + return Data$dOrdering.LT; + } + if (y.tag === "Bottom1") { return Data$dOrdering.GT; } + if (x.tag === "Ignored1") { + if (y.tag === "Ignored1") { return Data$dOrdering.EQ; } + return Data$dOrdering.LT; + } + if (y.tag === "Ignored1") { return Data$dOrdering.GT; } + if (x.tag === "Top1") { + if (y.tag === "Top1") { return Data$dOrdering.EQ; } + $runtime.fail(); + } + $runtime.fail(); + }, + Eq0: () => eqTest1 +}; +const genericTest1 = { + to: x => { + if (x.tag === "Inl") { return Bottom1; } + if (x.tag === "Inr") { + if (x._1.tag === "Inl") { return Ignored1; } + if (x._1.tag === "Inr") { return Top1; } + $runtime.fail(); + } + $runtime.fail(); + }, + from: x => { + if (x.tag === "Bottom1") { return Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments); } + if (x.tag === "Ignored1") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments)); } + if (x.tag === "Top1") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.NoArguments)); } + $runtime.fail(); + } +}; +const boundedTest1 = {bottom: Bottom1, top: Top1, Ord0: () => ordTest1}; +export {$Test1, Bottom1, Ignored1, Top1, boundedTest1, eqTest1, genericTest1, ordTest1}; diff --git a/backend-es/test/snapshots-out/Snapshot.GenericBounded02.js b/backend-es/test/snapshots-out/Snapshot.GenericBounded02.js new file mode 100644 index 00000000..7d5a2e3d --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.GenericBounded02.js @@ -0,0 +1,102 @@ +// @inline export genericTest2.to arity=1 +import * as $runtime from "../runtime.js"; +import * as Data$dGeneric$dRep from "../Data.Generic.Rep/index.js"; +import * as Data$dOrd from "../Data.Ord/index.js"; +import * as Data$dOrdering from "../Data.Ordering/index.js"; +const $Test2 = (tag, _1, _2, _3) => ({tag, _1, _2, _3}); +const Bottom2 = value0 => value1 => value2 => $Test2("Bottom2", value0, value1, value2); +const Ignored2 = value0 => value1 => value2 => $Test2("Ignored2", value0, value1, value2); +const Top2 = value0 => value1 => value2 => $Test2("Top2", value0, value1, value2); +const eqTest2 = { + eq: x => y => { + if (x.tag === "Bottom2") { + if (y.tag === "Bottom2") { return x._1 === y._1 && x._2 === y._2 && (x._3.a === y._3.a && x._3.b === y._3.b); } + return false; + } + if (x.tag === "Ignored2") { + if (y.tag === "Ignored2") { return x._1 === y._1 && x._2 === y._2 && (x._3.a === y._3.a && x._3.b === y._3.b); } + return false; + } + if (x.tag === "Top2") { + if (y.tag === "Top2") { return x._1 === y._1 && x._2 === y._2 && (x._3.a === y._3.a && x._3.b === y._3.b); } + return false; + } + return false; + } +}; +const ordTest2 = { + compare: x => y => { + if (x.tag === "Bottom2") { + if (y.tag === "Bottom2") { + const v = Data$dOrd.ordInt.compare(x._1)(y._1); + if (v.tag === "LT") { return Data$dOrdering.LT; } + if (v.tag === "GT") { return Data$dOrdering.GT; } + const v1 = Data$dOrd.ordBoolean.compare(x._2)(y._2); + if (v1.tag === "LT") { return Data$dOrdering.LT; } + if (v1.tag === "GT") { return Data$dOrdering.GT; } + const v2 = Data$dOrd.ordInt.compare(x._3.a)(y._3.a); + if (v2.tag === "LT") { return Data$dOrdering.LT; } + if (v2.tag === "GT") { return Data$dOrdering.GT; } + return Data$dOrd.ordBoolean.compare(x._3.b)(y._3.b); + } + return Data$dOrdering.LT; + } + if (y.tag === "Bottom2") { return Data$dOrdering.GT; } + if (x.tag === "Ignored2") { + if (y.tag === "Ignored2") { + const v = Data$dOrd.ordInt.compare(x._1)(y._1); + if (v.tag === "LT") { return Data$dOrdering.LT; } + if (v.tag === "GT") { return Data$dOrdering.GT; } + const v1 = Data$dOrd.ordBoolean.compare(x._2)(y._2); + if (v1.tag === "LT") { return Data$dOrdering.LT; } + if (v1.tag === "GT") { return Data$dOrdering.GT; } + const v2 = Data$dOrd.ordInt.compare(x._3.a)(y._3.a); + if (v2.tag === "LT") { return Data$dOrdering.LT; } + if (v2.tag === "GT") { return Data$dOrdering.GT; } + return Data$dOrd.ordBoolean.compare(x._3.b)(y._3.b); + } + return Data$dOrdering.LT; + } + if (y.tag === "Ignored2") { return Data$dOrdering.GT; } + if (x.tag === "Top2") { + if (y.tag === "Top2") { + const v = Data$dOrd.ordInt.compare(x._1)(y._1); + if (v.tag === "LT") { return Data$dOrdering.LT; } + if (v.tag === "GT") { return Data$dOrdering.GT; } + const v1 = Data$dOrd.ordBoolean.compare(x._2)(y._2); + if (v1.tag === "LT") { return Data$dOrdering.LT; } + if (v1.tag === "GT") { return Data$dOrdering.GT; } + const v2 = Data$dOrd.ordInt.compare(x._3.a)(y._3.a); + if (v2.tag === "LT") { return Data$dOrdering.LT; } + if (v2.tag === "GT") { return Data$dOrdering.GT; } + return Data$dOrd.ordBoolean.compare(x._3.b)(y._3.b); + } + $runtime.fail(); + } + $runtime.fail(); + }, + Eq0: () => eqTest2 +}; +const genericTest2 = { + to: x => { + if (x.tag === "Inl") { return $Test2("Bottom2", x._1._1, x._1._2._1, x._1._2._2); } + if (x.tag === "Inr") { + if (x._1.tag === "Inl") { return $Test2("Ignored2", x._1._1._1, x._1._1._2._1, x._1._1._2._2); } + if (x._1.tag === "Inr") { return $Test2("Top2", x._1._1._1, x._1._1._2._1, x._1._1._2._2); } + $runtime.fail(); + } + $runtime.fail(); + }, + from: x => { + if (x.tag === "Bottom2") { return Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.$Product(x._1, Data$dGeneric$dRep.$Product(x._2, x._3))); } + if (x.tag === "Ignored2") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.$Product(x._1, Data$dGeneric$dRep.$Product(x._2, x._3)))); } + if (x.tag === "Top2") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Product(x._1, Data$dGeneric$dRep.$Product(x._2, x._3)))); } + $runtime.fail(); + } +}; +const boundedTest2 = { + bottom: /* #__PURE__ */ $Test2("Bottom2", -2147483648, false, {a: -2147483648, b: false}), + top: /* #__PURE__ */ $Test2("Top2", 2147483647, true, {a: 2147483647, b: true}), + Ord0: () => ordTest2 +}; +export {$Test2, Bottom2, Ignored2, Top2, boundedTest2, eqTest2, genericTest2, ordTest2}; diff --git a/backend-es/test/snapshots-out/Snapshot.GenericBounded03.js b/backend-es/test/snapshots-out/Snapshot.GenericBounded03.js new file mode 100644 index 00000000..b108bd26 --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.GenericBounded03.js @@ -0,0 +1,75 @@ +// @inline export genericTest3.to arity=1 +import * as $runtime from "../runtime.js"; +import * as Data$dGeneric$dRep from "../Data.Generic.Rep/index.js"; +import * as Data$dOrd from "../Data.Ord/index.js"; +import * as Data$dOrdering from "../Data.Ordering/index.js"; +import * as Snapshot$dGenericBounded01 from "../Snapshot.GenericBounded01/index.js"; +import * as Snapshot$dGenericBounded02 from "../Snapshot.GenericBounded02/index.js"; +const $Test3 = (_1, _2, _3, _4, _5) => ({tag: "Both3", _1, _2, _3, _4, _5}); +const Both3 = value0 => value1 => value2 => value3 => value4 => $Test3(value0, value1, value2, value3, value4); +const eqTest3 = { + eq: x => y => x._1 === y._1 && x._2 === y._2 && (() => { + if (x._3.tag === "Bottom1") { return y._3.tag === "Bottom1"; } + if (x._3.tag === "Ignored1") { return y._3.tag === "Ignored1"; } + if (x._3.tag === "Top1") { return y._3.tag === "Top1"; } + return false; + })() && Snapshot$dGenericBounded02.eqTest2.eq(x._4)(y._4) && ( + x._5.a === y._5.a && x._5.b === y._5.b && (() => { + if (x._5.c.tag === "Bottom1") { return y._5.c.tag === "Bottom1"; } + if (x._5.c.tag === "Ignored1") { return y._5.c.tag === "Ignored1"; } + if (x._5.c.tag === "Top1") { return y._5.c.tag === "Top1"; } + return false; + })() && Snapshot$dGenericBounded02.eqTest2.eq(x._5.d)(y._5.d) + ) +}; +const ordTest3 = { + compare: x => y => { + const v = Data$dOrd.ordInt.compare(x._1)(y._1); + if (v.tag === "LT") { return Data$dOrdering.LT; } + if (v.tag === "GT") { return Data$dOrdering.GT; } + const v1 = Data$dOrd.ordBoolean.compare(x._2)(y._2); + if (v1.tag === "LT") { return Data$dOrdering.LT; } + if (v1.tag === "GT") { return Data$dOrdering.GT; } + const v2 = Snapshot$dGenericBounded01.ordTest1.compare(x._3)(y._3); + if (v2.tag === "LT") { return Data$dOrdering.LT; } + if (v2.tag === "GT") { return Data$dOrdering.GT; } + const v3 = Snapshot$dGenericBounded02.ordTest2.compare(x._4)(y._4); + if (v3.tag === "LT") { return Data$dOrdering.LT; } + if (v3.tag === "GT") { return Data$dOrdering.GT; } + const v4 = Data$dOrd.ordInt.compare(x._5.a)(y._5.a); + if (v4.tag === "LT") { return Data$dOrdering.LT; } + if (v4.tag === "GT") { return Data$dOrdering.GT; } + const v5 = Data$dOrd.ordBoolean.compare(x._5.b)(y._5.b); + if (v5.tag === "LT") { return Data$dOrdering.LT; } + if (v5.tag === "GT") { return Data$dOrdering.GT; } + const v6 = Snapshot$dGenericBounded01.ordTest1.compare(x._5.c)(y._5.c); + if (v6.tag === "LT") { return Data$dOrdering.LT; } + if (v6.tag === "GT") { return Data$dOrdering.GT; } + return Snapshot$dGenericBounded02.ordTest2.compare(x._5.d)(y._5.d); + }, + Eq0: () => eqTest3 +}; +const genericTest3 = { + to: x => $Test3(x._1, x._2._1, x._2._2._1, x._2._2._2._1, x._2._2._2._2), + from: x => Data$dGeneric$dRep.$Product(x._1, Data$dGeneric$dRep.$Product(x._2, Data$dGeneric$dRep.$Product(x._3, Data$dGeneric$dRep.$Product(x._4, x._5)))) +}; +const boundedTest3 = /* #__PURE__ */ (() => ( + { + bottom: $Test3( + -2147483648, + false, + Snapshot$dGenericBounded01.Bottom1, + Snapshot$dGenericBounded02.boundedTest2.bottom, + {a: -2147483648, b: false, c: Snapshot$dGenericBounded01.Bottom1, d: Snapshot$dGenericBounded02.boundedTest2.bottom} + ), + top: $Test3( + 2147483647, + true, + Snapshot$dGenericBounded01.Top1, + Snapshot$dGenericBounded02.boundedTest2.top, + {a: 2147483647, b: true, c: Snapshot$dGenericBounded01.Top1, d: Snapshot$dGenericBounded02.boundedTest2.top} + ), + Ord0: () => ordTest3 + } +))(); +export {$Test3, Both3, boundedTest3, eqTest3, genericTest3, ordTest3}; diff --git a/backend-es/test/snapshots-out/Snapshot.GenericBounded04.js b/backend-es/test/snapshots-out/Snapshot.GenericBounded04.js new file mode 100644 index 00000000..2b872d87 --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.GenericBounded04.js @@ -0,0 +1,189 @@ +// @inline export genericTest4.to arity=1 +import * as $runtime from "../runtime.js"; +import * as Data$dBounded from "../Data.Bounded/index.js"; +import * as Data$dGeneric$dRep from "../Data.Generic.Rep/index.js"; +import * as Data$dOrd from "../Data.Ord/index.js"; +import * as Data$dOrdering from "../Data.Ordering/index.js"; +import * as Data$dTuple from "../Data.Tuple/index.js"; +import * as Snapshot$dGenericBounded01 from "../Snapshot.GenericBounded01/index.js"; +import * as Snapshot$dGenericBounded02 from "../Snapshot.GenericBounded02/index.js"; +import * as Snapshot$dGenericBounded03 from "../Snapshot.GenericBounded03/index.js"; +const $Test4 = (tag, _1, _2, _3, _4, _5, _6, _7) => ({tag, _1, _2, _3, _4, _5, _6, _7}); +const Bottom4 = value0 => value1 => value2 => value3 => value4 => value5 => value6 => $Test4("Bottom4", value0, value1, value2, value3, value4, value5, value6); +const Ignored4 = /* #__PURE__ */ $Test4("Ignored4"); +const Top4 = value0 => value1 => value2 => value3 => value4 => value5 => value6 => $Test4("Top4", value0, value1, value2, value3, value4, value5, value6); +const eqTest4 = dictEq1 => dictEq => { + const eq12 = dictEq1.eq1(dictEq); + return { + eq: x => y => { + if (x.tag === "Bottom4") { + if (y.tag === "Bottom4") { + return x._1 === y._1 && x._2.a === y._2.a && (() => { + if (x._3.tag === "Bottom1") { return y._3.tag === "Bottom1"; } + if (x._3.tag === "Ignored1") { return y._3.tag === "Ignored1"; } + if (x._3.tag === "Top1") { return y._3.tag === "Top1"; } + return false; + })() && Snapshot$dGenericBounded02.eqTest2.eq(x._4)(y._4) && Snapshot$dGenericBounded03.eqTest3.eq(x._5)(y._5) && dictEq.eq(x._6)(y._6) && eq12(x._7)(y._7); + } + return false; + } + if (x.tag === "Ignored4") { return y.tag === "Ignored4"; } + if (x.tag === "Top4") { + if (y.tag === "Top4") { + return x._1 === y._1 && x._2.a === y._2.a && (() => { + if (x._3.tag === "Bottom1") { return y._3.tag === "Bottom1"; } + if (x._3.tag === "Ignored1") { return y._3.tag === "Ignored1"; } + if (x._3.tag === "Top1") { return y._3.tag === "Top1"; } + return false; + })() && Snapshot$dGenericBounded02.eqTest2.eq(x._4)(y._4) && Snapshot$dGenericBounded03.eqTest3.eq(x._5)(y._5) && dictEq.eq(x._6)(y._6) && eq12(x._7)(y._7); + } + return false; + } + return false; + } + }; +}; +const ordTest4 = dictOrd1 => { + const eqTest41 = eqTest4(dictOrd1.Eq10()); + return dictOrd => { + const compare12 = dictOrd1.compare1(dictOrd); + const eqTest42 = eqTest41(dictOrd.Eq0()); + return { + compare: x => y => { + if (x.tag === "Bottom4") { + if (y.tag === "Bottom4") { + const v = Data$dOrd.ordInt.compare(x._1)(y._1); + if (v.tag === "LT") { return Data$dOrdering.LT; } + if (v.tag === "GT") { return Data$dOrdering.GT; } + const v1 = Data$dOrd.ordInt.compare(x._2.a)(y._2.a); + if (v1.tag === "LT") { return Data$dOrdering.LT; } + if (v1.tag === "GT") { return Data$dOrdering.GT; } + const v2 = Snapshot$dGenericBounded01.ordTest1.compare(x._3)(y._3); + if (v2.tag === "LT") { return Data$dOrdering.LT; } + if (v2.tag === "GT") { return Data$dOrdering.GT; } + const v3 = Snapshot$dGenericBounded02.ordTest2.compare(x._4)(y._4); + if (v3.tag === "LT") { return Data$dOrdering.LT; } + if (v3.tag === "GT") { return Data$dOrdering.GT; } + const v4 = Snapshot$dGenericBounded03.ordTest3.compare(x._5)(y._5); + if (v4.tag === "LT") { return Data$dOrdering.LT; } + if (v4.tag === "GT") { return Data$dOrdering.GT; } + const v5 = dictOrd.compare(x._6)(y._6); + if (v5.tag === "LT") { return Data$dOrdering.LT; } + if (v5.tag === "GT") { return Data$dOrdering.GT; } + return compare12(x._7)(y._7); + } + return Data$dOrdering.LT; + } + if (y.tag === "Bottom4") { return Data$dOrdering.GT; } + if (x.tag === "Ignored4") { + if (y.tag === "Ignored4") { return Data$dOrdering.EQ; } + return Data$dOrdering.LT; + } + if (y.tag === "Ignored4") { return Data$dOrdering.GT; } + if (x.tag === "Top4") { + if (y.tag === "Top4") { + const v = Data$dOrd.ordInt.compare(x._1)(y._1); + if (v.tag === "LT") { return Data$dOrdering.LT; } + if (v.tag === "GT") { return Data$dOrdering.GT; } + const v1 = Data$dOrd.ordInt.compare(x._2.a)(y._2.a); + if (v1.tag === "LT") { return Data$dOrdering.LT; } + if (v1.tag === "GT") { return Data$dOrdering.GT; } + const v2 = Snapshot$dGenericBounded01.ordTest1.compare(x._3)(y._3); + if (v2.tag === "LT") { return Data$dOrdering.LT; } + if (v2.tag === "GT") { return Data$dOrdering.GT; } + const v3 = Snapshot$dGenericBounded02.ordTest2.compare(x._4)(y._4); + if (v3.tag === "LT") { return Data$dOrdering.LT; } + if (v3.tag === "GT") { return Data$dOrdering.GT; } + const v4 = Snapshot$dGenericBounded03.ordTest3.compare(x._5)(y._5); + if (v4.tag === "LT") { return Data$dOrdering.LT; } + if (v4.tag === "GT") { return Data$dOrdering.GT; } + const v5 = dictOrd.compare(x._6)(y._6); + if (v5.tag === "LT") { return Data$dOrdering.LT; } + if (v5.tag === "GT") { return Data$dOrdering.GT; } + return compare12(x._7)(y._7); + } + $runtime.fail(); + } + $runtime.fail(); + }, + Eq0: () => eqTest42 + }; + }; +}; +const genericTest4 = { + to: x => { + if (x.tag === "Inl") { return $Test4("Bottom4", x._1._1, x._1._2._1, x._1._2._2._1, x._1._2._2._2._1, x._1._2._2._2._2._1, x._1._2._2._2._2._2._1, x._1._2._2._2._2._2._2); } + if (x.tag === "Inr") { + if (x._1.tag === "Inl") { return Ignored4; } + if (x._1.tag === "Inr") { + return $Test4("Top4", x._1._1._1, x._1._1._2._1, x._1._1._2._2._1, x._1._1._2._2._2._1, x._1._1._2._2._2._2._1, x._1._1._2._2._2._2._2._1, x._1._1._2._2._2._2._2._2); + } + $runtime.fail(); + } + $runtime.fail(); + }, + from: x => { + if (x.tag === "Bottom4") { + return Data$dGeneric$dRep.$Sum( + "Inl", + Data$dGeneric$dRep.$Product( + x._1, + Data$dGeneric$dRep.$Product( + x._2, + Data$dGeneric$dRep.$Product(x._3, Data$dGeneric$dRep.$Product(x._4, Data$dGeneric$dRep.$Product(x._5, Data$dGeneric$dRep.$Product(x._6, x._7)))) + ) + ) + ); + } + if (x.tag === "Ignored4") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments)); } + if (x.tag === "Top4") { + return Data$dGeneric$dRep.$Sum( + "Inr", + Data$dGeneric$dRep.$Sum( + "Inr", + Data$dGeneric$dRep.$Product( + x._1, + Data$dGeneric$dRep.$Product( + x._2, + Data$dGeneric$dRep.$Product(x._3, Data$dGeneric$dRep.$Product(x._4, Data$dGeneric$dRep.$Product(x._5, Data$dGeneric$dRep.$Product(x._6, x._7)))) + ) + ) + ) + ); + } + $runtime.fail(); + } +}; +const boundedTest4 = dictOrd1 => { + const ordTest41 = ordTest4(dictOrd1); + return dictBounded => dictBounded1 => { + const ordTest42 = ordTest41(dictBounded1.Ord0()); + return { + bottom: $Test4( + "Bottom4", + -2147483648, + {a: -2147483648}, + Snapshot$dGenericBounded01.Bottom1, + Snapshot$dGenericBounded02.boundedTest2.bottom, + Snapshot$dGenericBounded03.boundedTest3.bottom, + dictBounded1.bottom, + dictBounded.bottom + ), + top: $Test4( + "Top4", + 2147483647, + {a: 2147483647}, + Snapshot$dGenericBounded01.Top1, + Snapshot$dGenericBounded02.boundedTest2.top, + Snapshot$dGenericBounded03.boundedTest3.top, + dictBounded1.top, + dictBounded.top + ), + Ord0: () => ordTest42 + }; + }; +}; +const boundedTest41 = /* #__PURE__ */ boundedTest4(/* #__PURE__ */ Data$dTuple.ord1Tuple(Data$dOrd.ordInt))(/* #__PURE__ */ Data$dTuple.boundedTuple(Data$dBounded.boundedInt)(Data$dBounded.boundedInt))(Data$dBounded.boundedInt); +const test5 = /* #__PURE__ */ (() => boundedTest41.bottom)(); +const test6 = /* #__PURE__ */ (() => boundedTest41.top)(); +export {$Test4, Bottom4, Ignored4, Top4, boundedTest4, boundedTest41, eqTest4, genericTest4, ordTest4, test5, test6}; diff --git a/backend-es/test/snapshots-out/Snapshot.GenericEnum01.js b/backend-es/test/snapshots-out/Snapshot.GenericEnum01.js new file mode 100644 index 00000000..e61b2aa5 --- /dev/null +++ b/backend-es/test/snapshots-out/Snapshot.GenericEnum01.js @@ -0,0 +1,198 @@ +// @inline export genericTest1.to arity=1 +// @inline export genericTest1.from arity=1 +import * as $runtime from "../runtime.js"; +import * as Data$dEnum$dGeneric from "../Data.Enum.Generic/index.js"; +import * as Data$dGeneric$dRep from "../Data.Generic.Rep/index.js"; +import * as Data$dMaybe from "../Data.Maybe/index.js"; +import * as Data$dOrdering from "../Data.Ordering/index.js"; +const $Test1 = tag => ({tag}); +const genericBottomConstructor = {"genericBottom'": Data$dGeneric$dRep.NoArguments}; +const genericBottomSum = {"genericBottom'": /* #__PURE__ */ Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments)}; +const genericTopConstructor = {"genericTop'": Data$dGeneric$dRep.NoArguments}; +const genericEnumConstructor = /* #__PURE__ */ Data$dEnum$dGeneric.genericEnumConstructor(Data$dEnum$dGeneric.genericEnumNoArguments); +const A1 = /* #__PURE__ */ $Test1("A1"); +const B1 = /* #__PURE__ */ $Test1("B1"); +const C1 = /* #__PURE__ */ $Test1("C1"); +const D1 = /* #__PURE__ */ $Test1("D1"); +const eqTest1 = { + eq: x => y => { + if (x.tag === "A1") { return y.tag === "A1"; } + if (x.tag === "B1") { return y.tag === "B1"; } + if (x.tag === "C1") { return y.tag === "C1"; } + if (x.tag === "D1") { return y.tag === "D1"; } + return false; + } +}; +const ordTest1 = { + compare: x => y => { + if (x.tag === "A1") { + if (y.tag === "A1") { return Data$dOrdering.EQ; } + return Data$dOrdering.LT; + } + if (y.tag === "A1") { return Data$dOrdering.GT; } + if (x.tag === "B1") { + if (y.tag === "B1") { return Data$dOrdering.EQ; } + return Data$dOrdering.LT; + } + if (y.tag === "B1") { return Data$dOrdering.GT; } + if (x.tag === "C1") { + if (y.tag === "C1") { return Data$dOrdering.EQ; } + return Data$dOrdering.LT; + } + if (y.tag === "C1") { return Data$dOrdering.GT; } + if (x.tag === "D1") { + if (y.tag === "D1") { return Data$dOrdering.EQ; } + $runtime.fail(); + } + $runtime.fail(); + }, + Eq0: () => eqTest1 +}; +const genericTest1 = { + to: x => { + if (x.tag === "Inl") { return A1; } + if (x.tag === "Inr") { + if (x._1.tag === "Inl") { return B1; } + if (x._1.tag === "Inr") { + if (x._1._1.tag === "Inl") { return C1; } + if (x._1._1.tag === "Inr") { return D1; } + $runtime.fail(); + } + $runtime.fail(); + } + $runtime.fail(); + }, + from: x => { + if (x.tag === "A1") { return Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments); } + if (x.tag === "B1") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments)); } + if (x.tag === "C1") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments))); } + if (x.tag === "D1") { return Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.NoArguments))); } + $runtime.fail(); + } +}; +const boundedTest1 = {bottom: A1, top: D1, Ord0: () => ordTest1}; +const enumTest1 = { + pred: x => { + const $1 = Data$dEnum$dGeneric.genericEnumSum(genericEnumConstructor)(genericTopConstructor)(Data$dEnum$dGeneric.genericEnumSum(genericEnumConstructor)(genericTopConstructor)(genericEnumConstructor)(genericBottomConstructor))(genericBottomSum); + if (x.tag === "A1") { return Data$dMaybe.Nothing; } + if (x.tag === "B1") { + const v1 = $1["genericPred'"](Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments)); + if (v1.tag === "Nothing") { return Data$dMaybe.$Maybe("Just", A1); } + if (v1.tag === "Just") { + return Data$dMaybe.$Maybe( + "Just", + (() => { + if (v1._1.tag === "Inl") { return B1; } + if (v1._1.tag === "Inr") { + if (v1._1._1.tag === "Inl") { return C1; } + if (v1._1._1.tag === "Inr") { return D1; } + $runtime.fail(); + } + $runtime.fail(); + })() + ); + } + $runtime.fail(); + } + if (x.tag === "C1") { + const v1 = $1["genericPred'"](Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments))); + if (v1.tag === "Nothing") { return Data$dMaybe.$Maybe("Just", A1); } + if (v1.tag === "Just") { + return Data$dMaybe.$Maybe( + "Just", + (() => { + if (v1._1.tag === "Inl") { return B1; } + if (v1._1.tag === "Inr") { + if (v1._1._1.tag === "Inl") { return C1; } + if (v1._1._1.tag === "Inr") { return D1; } + $runtime.fail(); + } + $runtime.fail(); + })() + ); + } + $runtime.fail(); + } + if (x.tag === "D1") { + const v1 = $1["genericPred'"](Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.NoArguments))); + if (v1.tag === "Nothing") { return Data$dMaybe.$Maybe("Just", A1); } + if (v1.tag === "Just") { + return Data$dMaybe.$Maybe( + "Just", + (() => { + if (v1._1.tag === "Inl") { return B1; } + if (v1._1.tag === "Inr") { + if (v1._1._1.tag === "Inl") { return C1; } + if (v1._1._1.tag === "Inr") { return D1; } + $runtime.fail(); + } + $runtime.fail(); + })() + ); + } + $runtime.fail(); + } + $runtime.fail(); + }, + succ: x => { + const $1 = Data$dEnum$dGeneric.genericEnumSum(genericEnumConstructor)(genericTopConstructor)(Data$dEnum$dGeneric.genericEnumSum(genericEnumConstructor)(genericTopConstructor)(genericEnumConstructor)(genericBottomConstructor))(genericBottomSum); + if (x.tag === "A1") { return Data$dMaybe.$Maybe("Just", B1); } + if (x.tag === "B1") { + const $2 = $1["genericSucc'"](Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments)); + if ($2.tag === "Just") { + return Data$dMaybe.$Maybe( + "Just", + (() => { + if ($2._1.tag === "Inl") { return B1; } + if ($2._1.tag === "Inr") { + if ($2._1._1.tag === "Inl") { return C1; } + if ($2._1._1.tag === "Inr") { return D1; } + $runtime.fail(); + } + $runtime.fail(); + })() + ); + } + return Data$dMaybe.Nothing; + } + if (x.tag === "C1") { + const $2 = $1["genericSucc'"](Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inl", Data$dGeneric$dRep.NoArguments))); + if ($2.tag === "Just") { + return Data$dMaybe.$Maybe( + "Just", + (() => { + if ($2._1.tag === "Inl") { return B1; } + if ($2._1.tag === "Inr") { + if ($2._1._1.tag === "Inl") { return C1; } + if ($2._1._1.tag === "Inr") { return D1; } + $runtime.fail(); + } + $runtime.fail(); + })() + ); + } + return Data$dMaybe.Nothing; + } + if (x.tag === "D1") { + const $2 = $1["genericSucc'"](Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.$Sum("Inr", Data$dGeneric$dRep.NoArguments))); + if ($2.tag === "Just") { + return Data$dMaybe.$Maybe( + "Just", + (() => { + if ($2._1.tag === "Inl") { return B1; } + if ($2._1.tag === "Inr") { + if ($2._1._1.tag === "Inl") { return C1; } + if ($2._1._1.tag === "Inr") { return D1; } + $runtime.fail(); + } + $runtime.fail(); + })() + ); + } + return Data$dMaybe.Nothing; + } + $runtime.fail(); + }, + Ord0: () => ordTest1 +}; +export {$Test1, A1, B1, C1, D1, boundedTest1, enumTest1, eqTest1, genericBottomConstructor, genericBottomSum, genericEnumConstructor, genericTest1, genericTopConstructor, ordTest1}; diff --git a/backend-es/test/snapshots/Snapshot.Comparison01.purs b/backend-es/test/snapshots/Snapshot.Comparison01.purs new file mode 100644 index 00000000..40437a0b --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.Comparison01.purs @@ -0,0 +1,35 @@ +module Snapshot.Comparison01 where + +import Prelude + +import Data.Comparison (Comparison, defaultComparison) +import Data.Functor.Contravariant ((>$<)) +import Data.Tuple (Tuple, fst, snd) + +test1 = defaultComparison :: Comparison { foo :: Int } + +test2 = _.foo >$< (defaultComparison :: Comparison { foo :: Int }) + +test3 = + (_.foo >$< defCom) + <> (_.bar >$< defCom) + <> (_.baz >$< defCom) + where + defCom :: Comparison { foo :: Int, bar :: String, baz :: Boolean } + defCom = defaultComparison + +test4 = mempty :: Comparison String + +test5 = defaultComparison :: Comparison Int + +test6 = _.foo >$< (defaultComparison :: Comparison Int) + +test7 = + (fst >$< defCom) + <> (fst <<< snd >$< defCom) + <> (snd <<< snd >$< defCom) + where + defCom :: Comparison (Tuple Int (Tuple String Boolean)) + defCom = defaultComparison + +test8 = mempty :: Comparison String diff --git a/backend-es/test/snapshots/Snapshot.Const01.purs b/backend-es/test/snapshots/Snapshot.Const01.purs new file mode 100644 index 00000000..f4e03503 --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.Const01.purs @@ -0,0 +1,29 @@ +module Snapshot.Const01 where + +import Prelude + +import Data.Const (Const(..)) +import Data.Eq (eq1) +import Data.Ord (compare1) + +test1 = Const "h" == Const "i" +test2 = eq1 (Const "h" :: Const String Int) (Const "i" :: Const String Int) +test3 = Const "h" < Const "i" +test4 = compare1 (Const "h" :: Const String Int) (Const "i" :: Const String Int) +test5 = top :: Const Int Int +test6 = bottom :: Const Int Int +test7 = (Const "h" :: Const String Int) >>> (Const 1 :: Const Int Int) +test8 = (Const "h" :: Const String Int) <> (Const "i" :: Const String Int) +test9 = mempty :: Const String Int +test10 = (Const 1 :: Const Int Int) + (Const 1 :: Const Int Int) +test11 = zero :: Const Int String +test12 = one :: Const Int String +test13 = (Const 1 :: Const Int Int) - (Const 1 :: Const Int Int) +test14 = (Const 1 :: Const Int Int) * (Const 1 :: Const Int Int) +test15 = (Const 1 :: Const Int Int) / (Const 1 :: Const Int Int) +test16 = (Const 2 :: Const Int Int) `mod` (Const 2 :: Const Int Int) +test17 = (Const true :: Const Boolean Int) && (Const true :: Const Boolean Int) +test18 = (Const false :: Const Boolean Int) || (Const false :: Const Boolean Int) +test19 = map show (Const 1 :: Const Int Int) +test20 = apply (Const "h" :: Const String (Int -> String)) (Const "i" :: Const String Int) +test21 = pure 1 :: Const String Int diff --git a/backend-es/test/snapshots/Snapshot.DefaultRulesBiapply01.purs b/backend-es/test/snapshots/Snapshot.DefaultRulesBiapply01.purs new file mode 100644 index 00000000..ab15e04d --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.DefaultRulesBiapply01.purs @@ -0,0 +1,23 @@ +module Snapshot.DefaultRulesBiapply01 where + +import Prelude + +import Control.Biapply (biapplyFirst, biapplySecond, bilift2, bilift3) +import Data.Tuple (Tuple(..)) + +test1 = biapplyFirst (Tuple 'b' 2) (Tuple 'a' 1) + +test2 = biapplySecond (Tuple 'b' 2) (Tuple 'a' 1) + +test3 = bilift2 + (\a b -> a + b) + (\c d -> c <> d) + (Tuple 1 "hello") + (Tuple 2 " world") + +test4 = bilift3 + (\a b c -> a + b + c) + (\d e f -> d <> e <> f) + (Tuple 1 "hello") + (Tuple 2 " ") + (Tuple 3 "world") diff --git a/backend-es/test/snapshots/Snapshot.DefaultRulesBifunctor01.purs b/backend-es/test/snapshots/Snapshot.DefaultRulesBifunctor01.purs new file mode 100644 index 00000000..33168c02 --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.DefaultRulesBifunctor01.purs @@ -0,0 +1,10 @@ +module Snapshot.DefaultRulesBifunctor01 where + +import Prelude + +import Data.Bifunctor (lmap, rmap) +import Data.Tuple (Tuple(..)) + +test1 = lmap show (Tuple true 1) + +test2 = rmap show (Tuple true 1) diff --git a/backend-es/test/snapshots/Snapshot.DefaultRulesContravariant01.purs b/backend-es/test/snapshots/Snapshot.DefaultRulesContravariant01.purs new file mode 100644 index 00000000..82b73345 --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.DefaultRulesContravariant01.purs @@ -0,0 +1,15 @@ +module Snapshot.DefaultRulesContravariant01 where + +import Prelude + +import Data.Const (Const(..)) +import Data.Functor.Contravariant (imapC, (>#<)) +import Data.Op (Op(..)) + +test1 = (Const 1 :: Const Int Int) >#< (_ + 1) + +test2 = imapC (_ + 9) (_ + 1) (Const 1 :: Const Int Int) + +test3 = (Op \i -> i + 3) >#< (_ + 1) + +test4 = imapC (_ + 9) (_ + 1) (Op \i -> i + 4) diff --git a/backend-es/test/snapshots/Snapshot.GenericBounded01.purs b/backend-es/test/snapshots/Snapshot.GenericBounded01.purs new file mode 100644 index 00000000..7e49ac4d --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.GenericBounded01.purs @@ -0,0 +1,17 @@ +-- @inline export genericTest1.to arity=1 +module Snapshot.GenericBounded01 where + +import Prelude + +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Generic.Rep (class Generic) + +data Test1 = Bottom1 | Ignored1 | Top1 + +derive instance Eq Test1 +derive instance Ord Test1 +derive instance genericTest1 :: Generic Test1 _ + +instance Bounded Test1 where + bottom = genericBottom + top = genericTop diff --git a/backend-es/test/snapshots/Snapshot.GenericBounded02.purs b/backend-es/test/snapshots/Snapshot.GenericBounded02.purs new file mode 100644 index 00000000..e6df3685 --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.GenericBounded02.purs @@ -0,0 +1,20 @@ +-- @inline export genericTest2.to arity=1 +module Snapshot.GenericBounded02 where + +import Prelude + +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Generic.Rep (class Generic) + +data Test2 + = Bottom2 Int Boolean { a :: Int, b :: Boolean } + | Ignored2 Int Boolean { a :: Int, b :: Boolean } + | Top2 Int Boolean { a :: Int, b :: Boolean } + +derive instance Eq Test2 +derive instance Ord Test2 +derive instance genericTest2 :: Generic Test2 _ + +instance Bounded Test2 where + bottom = genericBottom + top = genericTop diff --git a/backend-es/test/snapshots/Snapshot.GenericBounded03.purs b/backend-es/test/snapshots/Snapshot.GenericBounded03.purs new file mode 100644 index 00000000..67580dfb --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.GenericBounded03.purs @@ -0,0 +1,19 @@ +-- @inline export genericTest3.to arity=1 +module Snapshot.GenericBounded03 where + +import Prelude + +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Generic.Rep (class Generic) +import Snapshot.GenericBounded01 (Test1) +import Snapshot.GenericBounded02 (Test2) + +data Test3 = Both3 Int Boolean Test1 Test2 { a :: Int, b :: Boolean, c :: Test1, d :: Test2 } + +derive instance Eq Test3 +derive instance Ord Test3 +derive instance genericTest3 :: Generic Test3 _ + +instance Bounded Test3 where + bottom = genericBottom + top = genericTop diff --git a/backend-es/test/snapshots/Snapshot.GenericBounded04.purs b/backend-es/test/snapshots/Snapshot.GenericBounded04.purs new file mode 100644 index 00000000..0b68c722 --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.GenericBounded04.purs @@ -0,0 +1,30 @@ +-- @inline export genericTest4.to arity=1 +module Snapshot.GenericBounded04 where + +import Prelude + +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Eq (class Eq1) +import Data.Generic.Rep (class Generic) +import Data.Ord (class Ord1) +import Data.Tuple (Tuple) +import Snapshot.GenericBounded01 (Test1) +import Snapshot.GenericBounded02 (Test2) +import Snapshot.GenericBounded03 (Test3) + +data Test4 f a + = Bottom4 Int { a :: Int } Test1 Test2 Test3 a (f a) + | Ignored4 + | Top4 Int { a :: Int } Test1 Test2 Test3 a (f a) + +derive instance (Eq1 f, Eq a) => Eq (Test4 f a) +derive instance (Ord1 f, Ord a) => Ord (Test4 f a) +derive instance genericTest4 :: Generic (Test4 f a) _ + +instance (Ord1 f, Bounded (f a), Bounded a) => Bounded (Test4 f a) where + bottom = genericBottom + top = genericTop + +test5 = bottom :: Test4 (Tuple Int) Int + +test6 = top :: Test4 (Tuple Int) Int diff --git a/backend-es/test/snapshots/Snapshot.GenericEnum01.purs b/backend-es/test/snapshots/Snapshot.GenericEnum01.purs new file mode 100644 index 00000000..fce4ce64 --- /dev/null +++ b/backend-es/test/snapshots/Snapshot.GenericEnum01.purs @@ -0,0 +1,28 @@ +-- @inline export genericTest1.to arity=1 +-- @inline export genericTest1.from arity=1 +module Snapshot.GenericEnum01 where + +import Prelude + +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) + +data Test1 + = A1 + | B1 + | C1 + | D1 + +derive instance Eq Test1 +derive instance Ord Test1 +derive instance genericTest1 :: Generic Test1 _ + +instance Bounded Test1 where + bottom = genericBottom + top = genericTop + +instance Enum Test1 where + pred = genericPred + succ = genericSucc diff --git a/backend-es/test/snapshots/spago.dhall b/backend-es/test/snapshots/spago.dhall index fed73208..f26d7aa1 100644 --- a/backend-es/test/snapshots/spago.dhall +++ b/backend-es/test/snapshots/spago.dhall @@ -1,10 +1,14 @@ { name = "snapshots" , dependencies = [ "arrays" + , "bifunctors" , "console" + , "const" + , "contravariant" , "convertable-options" , "effect" , "either" + , "enums" , "exists" , "foldable-traversable" , "functions" diff --git a/src/PureScript/Backend/Optimizer/Directives/Defaults.purs b/src/PureScript/Backend/Optimizer/Directives/Defaults.purs index 673f4055..d91bb113 100644 --- a/src/PureScript/Backend/Optimizer/Directives/Defaults.purs +++ b/src/PureScript/Backend/Optimizer/Directives/Defaults.purs @@ -3,8 +3,22 @@ module PureScript.Backend.Optimizer.Directives.Defaults where defaultDirectives :: String defaultDirectives = """ - -- Prelude - + -- bifunctors + Control.Biapply.biapplyFirst arity=1 + Control.Biapply.biapplySecond arity=1 + + -- const + Data.Const.applicativeConst arity=1 + + -- enums + Data.Enum.Generic.genericPred arity=1 + Data.Enum.Generic.genericSucc arity=1 + Data.Enum.Generic.genericEnumConstructor(..).genericPred' arity=1 + Data.Enum.Generic.genericEnumConstructor(..).genericSucc' arity=1 + Data.Enum.Generic.genericEnumSum(..).genericPred' arity=1 + Data.Enum.Generic.genericEnumSum(..).genericSucc' arity=1 + + -- prelude Control.Applicative.liftA1 arity=1 Control.Applicative.when arity=1 Control.Applicative.unless arity=1 @@ -43,19 +57,7 @@ defaultDirectives = Data.Bounded.boundedRecord arity=2 Data.Bounded.Generic.genericBottom arity=1 - Data.Bounded.Generic.genericBottom' arity=1 - Data.Bounded.Generic.genericBottomNoArguments.genericBottom' always - Data.Bounded.Generic.genericBottomArgument.genericBottom' arity=1 - Data.Bounded.Generic.genericBottomSum.genericBottom' arity=1 - Data.Bounded.Generic.genericBottomProduct.genericBottom' arity=2 - Data.Bounded.Generic.genericBottomConstructor.genericBottom' arity=1 Data.Bounded.Generic.genericTop arity=1 - Data.Bounded.Generic.genericTop' arity=1 - Data.Bounded.Generic.genericTopNoArguments.genericTop' always - Data.Bounded.Generic.genericTopArgument.genericTop' arity=1 - Data.Bounded.Generic.genericTopSum.genericTop' arity=1 - Data.Bounded.Generic.genericTopProduct.genericTop' arity=2 - Data.Bounded.Generic.genericTopConstructor.genericTop' arity=1 Data.DivisionRing.leftDiv arity=1 Data.DivisionRing.rightDiv arity=1 @@ -124,9 +126,13 @@ defaultDirectives = Data.Show.showRecordFieldsConsNil arity=2 Data.Show.showRecordFieldsCons arity=3 - Control.Monad.ST.Internal.modify arity=2 - Effect.applyEffect.apply arity=2 - Effect.Ref.modify arity=2 + -- record Record.Builder.build arity=1 Record.Builder.rename arity=8 + + -- refs + Effect.Ref.modify arity=2 + + -- st + Control.Monad.ST.Internal.modify arity=2 """