HN user

Trung0246

157 karma
Posts13
Comments82
View on HN

At that point just use whitelist-based approach. I already used gitignore like that. It also easier to avoid committing temp file and secret through whitelist because those file are never in gitignore in the first place.

For some funsie here's my fully working delimited continuation in C with effect handler example: https://godbolt.org/z/3ehehvo6E

No ASM involved so technically portable (although it depends on built-in).

Flix equivalent (copy paste to https://play.flix.dev/):

    eff Pick {
        def pick(): Int32
    }

    def body(): (Int32, Int32, Int32) \ Pick = {
        let a = Pick.pick();
        let b = Pick.pick();
        let c = Pick.pick();
        (a, b, c)
    }

    def handlePick(f: Unit -> a \ ef): List[a] \ ef - Pick =
        run {
            f() :: Nil
        } with handler Pick {
            def pick(_, resume) =
                resume(1) ::: resume(2) ::: resume(3)
        }

    def main(): Unit \ IO =
        println(handlePick(body))
Combinators 4 months ago

Wikipedia have a pretty good Z combinator demo: https://en.wikipedia.org/wiki/Fixed-point_combinator

---

const K = <A, B>(a: A) => (_b: B) => a; const S = <A, B, C>(a: (x: C) => (y: B) => A) => (b: (x: C) => B) => (c: C) => a(c)(b(c));

const I = S(K)(K); const B = S(K(S))(K); const C = S(B(B)(S))(K(K)); const W = C(S)(I); const T = C(I); const V = B(C)(T); const I1 = C(C(I)); const C1 = B(C); const R1 = C1(C1); const V1 = B(R1)(C1); const I2 = R1(V);

const Z = B(W(I1))(V1(B)(W(I2)));