Skip to content

Instantly share code, notes, and snippets.

@jrstrunk
Created May 18, 2024 22:07
Show Gist options
  • Save jrstrunk/e1a6c1aa6ddb296a641e46ad99bec36d to your computer and use it in GitHub Desktop.
Save jrstrunk/e1a6c1aa6ddb296a641e46ad99bec36d to your computer and use it in GitHub Desktop.
Decode33 Gleam Function
pub fn decode33(
constructor: fn(
t1,
t2,
t3,
t4,
t5,
t6,
t7,
t8,
t9,
t10,
t11,
t12,
t13,
t14,
t15,
t16,
t17,
t18,
t19,
t20,
t21,
t22,
t23,
t24,
t25,
t26,
t27,
t28,
t29,
t30,
t31,
t32,
t33,
) ->
t,
t1: Decoder(t1),
t2: Decoder(t2),
t3: Decoder(t3),
t4: Decoder(t4),
t5: Decoder(t5),
t6: Decoder(t6),
t7: Decoder(t7),
t8: Decoder(t8),
t9: Decoder(t9),
t10: Decoder(t10),
t11: Decoder(t11),
t12: Decoder(t12),
t13: Decoder(t13),
t14: Decoder(t14),
t15: Decoder(t15),
t16: Decoder(t16),
t17: Decoder(t17),
t18: Decoder(t18),
t19: Decoder(t19),
t20: Decoder(t20),
t21: Decoder(t21),
t22: Decoder(t22),
t23: Decoder(t23),
t24: Decoder(t24),
t25: Decoder(t25),
t26: Decoder(t26),
t27: Decoder(t27),
t28: Decoder(t28),
t29: Decoder(t29),
t30: Decoder(t30),
t31: Decoder(t31),
t32: Decoder(t32),
t33: Decoder(t33),
) -> Decoder(t) {
fn(x: Dynamic) {
case
t1(x),
t2(x),
t3(x),
t4(x),
t5(x),
t6(x),
t7(x),
t8(x),
t9(x),
t10(x),
t11(x),
t12(x),
t13(x),
t14(x),
t15(x),
t16(x),
t17(x),
t18(x),
t19(x),
t20(x),
t21(x),
t22(x),
t23(x),
t24(x),
t25(x),
t26(x),
t27(x),
t28(x),
t29(x),
t30(x),
t31(x),
t32(x),
t33(x)
{
Ok(a), Ok(b), Ok(c), Ok(d), Ok(e), Ok(f), Ok(g), Ok(h), Ok(i), Ok(j), Ok(
k,
), Ok(l), Ok(m), Ok(n), Ok(o), Ok(p), Ok(q), Ok(r), Ok(s), Ok(t), Ok(u), Ok(
v,
), Ok(w), Ok(x), Ok(y), Ok(z), Ok(aa), Ok(ab), Ok(ac), Ok(ad), Ok(ae), Ok(
af,
), Ok(ag) ->
Ok(constructor(
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z,
aa,
ab,
ac,
ad,
ae,
af,
ag,
))
a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, ab, ac, ad, ae, af, ag ->
Error(
list.concat([
all_errors(a),
all_errors(b),
all_errors(c),
all_errors(d),
all_errors(e),
all_errors(f),
all_errors(g),
all_errors(h),
all_errors(i),
all_errors(j),
all_errors(k),
all_errors(l),
all_errors(m),
all_errors(n),
all_errors(o),
all_errors(p),
all_errors(q),
all_errors(r),
all_errors(s),
all_errors(t),
all_errors(u),
all_errors(v),
all_errors(w),
all_errors(x),
all_errors(y),
all_errors(z),
all_errors(aa),
all_errors(ab),
all_errors(ac),
all_errors(ad),
all_errors(ae),
all_errors(af),
all_errors(ag),
]),
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment