git.iko.soy/rowtype-yoga/purescript-backend-optimizer
on main help sign in
34 lines 1.2 kB history raw
1// @inline Snapshot.RecursionSchemes01.cata arity=2
2// @inline Snapshot.RecursionSchemes01.functorExprF.map arity=2
3import * as $runtime from "../runtime.js";
4const $ExprF = (tag, _1, _2) => ({tag, _1, _2});
5const Add = value0 => value1 => $ExprF("Add", value0, value1);
6const Mul = value0 => value1 => $ExprF("Mul", value0, value1);
7const Lit = value0 => $ExprF("Lit", value0);
8const functorExprF = {
9 map: f => m => {
10 if (m.tag === "Add") { return $ExprF("Add", f(m._1), f(m._2)); }
11 if (m.tag === "Mul") { return $ExprF("Mul", f(m._1), f(m._2)); }
12 if (m.tag === "Lit") { return $ExprF("Lit", m._1); }
13 $runtime.fail();
14 }
15};
16const test1 = /* #__PURE__ */ (() => {
17 const go = v => {
18 if (v.tag === "Add") { return go(v._1) + go(v._2) | 0; }
19 if (v.tag === "Mul") { return go(v._1) * go(v._2) | 0; }
20 if (v.tag === "Lit") { return v._1; }
21 $runtime.fail();
22 };
23 return go;
24})();
25const test2 = /* #__PURE__ */ (() => {
26 const go = v => {
27 if (v.tag === "Add") { return go(v._1) + go(v._2) | 0; }
28 if (v.tag === "Mul") { return go(v._1) * go(v._2) | 0; }
29 if (v.tag === "Lit") { return v._1 + 1 | 0; }
30 $runtime.fail();
31 };
32 return go;
33})();
34export {$ExprF, Add, Lit, Mul, functorExprF, test1, test2};