Of course you can do anytype, but I was trying to define a type for the function. Clearly the compiler can do it, but can a user do it?
It’s just a programming puzzle. Nothing too serious.
edit: that’s doing it though. You would need to pass comb to comb (which probably works), but that’s not quite there. (ie, the function itself has to have the same signature as the function passed in).
No, you cannot define something with itself.
But you can have have pointers to that type, function pointers in your case.
A combinator is a high order function and higher order functions are common in zig.
But without closures and currying you cannot have the real Haskell thing.
I mean combinator in the lambda calculus sense. You don’t need currying or closures. There is only one type in that: const F = fn(x: F) F from there you can build up numbers (called Church numerals where the depth of the call is the number – crazy cool) and develop recursion (The infamous Y combinator).
comptime seems to have all the mechanics, but that dependency on itself seems to be the one thing it doesn’t like. That might just be a synax problem even, bc I think the compiler can represent it - i find it a fascinating question.