Skip to content

Instantly share code, notes, and snippets.

View Wpkenpachi's full-sized avatar
🎯
Focusing

Wesley Paulo Wpkenpachi

🎯
Focusing
View GitHub Profile
type Eq<A, B> = <X>(a: A, eq: (x: A & B) => X) => X;
const refute = (x: never) => x;
const refl = <A, X>(a: A, eq: (x: A) => X) => eq(a);
const sickos = <A>(x: A, eq: Eq<A, number>) => eq(x, (x) => x);
const two = sickos(2, refl);
type Ty<A> =
| { tag: "number"; eq: Eq<A, number> }
| { tag: "string"; eq: Eq<A, string> };