Are there any (long term) plans to add higher order generics (a.k.a. higher kinded types) to Julia?



You are of course right, but even if there was an opportunity for a major redesign, I am not sure this topic makes a compelling case for one — the software engineering problem is still unclear. Cf


Julia is sound—by which I assume you mean “consistent” since “sound” is a type system term whereas “consistent” is a logic term—because it exists in the real world. Any real system, even in a computer, by virtue of actually existing must be consistent. This is because reality itself is consistent: different accurate descriptions of reality must all agree with each other. (If you don’t believe this then we’ve got deeper problems than whether Julia’s modeling of types is consistent or not.) You can no more create a paradoxical object in Julia than you could build one in your living room. I cannot create a type in Julia which both contains and does not contain itself for the same reason I cannot make a single-color chair that is both blue and red: if you construct a type object in Julia, it exists, and you can just check if it contains itself or not, just as you can look at the chair and see which color it actually is.

It is only in the context of formal systems like Principia Mathematica that consistency even becomes a question in the first place because these systems are just a made up set of rules, and it’s not a given that they don’t produce contradictions. One way to look at the issue of consistency is that it is fundamentally about whether a collection of mechanical rules (i.e. a formal system) describe something which could potentially be “real”. The most basic way in which a formal system can fail to be realistic is if it is can produce contradictory statements about the reality it is supposed to describe. A formal system that allows a set that both contains itself and doesn’t contain itself at the same time, for example, cannot possibly describe anything “real” since in reality the set would either contain itself or not.

So asking about the consistency of Julia is the wrong question. Julia is guaranteed to be consistent because it exists. The question you should ask is whether the type system implemented in Julia can be mapped into a formalized set theory like ZF/C. We have every reason to believe that it can as long as you add non-well-founded sets to ZF/C (via any of the various anti-foundation axioms), which allows a type like Type which contains itself to be modeled. No one has proven this to be the case, but since the types which can be constructed in Julia are all finite, it’s pretty unlikely that anything really wild could possibly happen—there’s not a whole lot of controversy in the realm of finite sets.



Thanks for the long reply and the patience.
I really meant “unsound” in the sense of:
Does julia has no support for user defined non well founded sets because it would invalidate its type system otherwise?

@Tamas_Papp wrote:

I am not sure this topic makes a compelling case for one — the software engineering problem is still unclear.

The discussion with @StefanKarpinski was not about HKTs anymore and I’m sorry for this.

To implement true HKTs we would need the complete support of function types which will (never) be the case from what I heard about @yuyichao and @jeff.bezanson

Whereas abstractions over parametric sets, e.g C{_}, which is different than HKTs is possible, at least in my mind, but complicated due to runtime subtyping additional to parametric subtyping in julia.


I was toying with the following idea:

define <: (less than or equal for types) arbitrary and dynamically and possibly more than once … so that it would be possible to define something similar too:

abstract type AbsInt end
abstract type Abs2Int end

struct Foo


what are the drawbacks? or asking from a different direction, what are the benefits of having a single parent?

bar(::AbsInt) = 1
bar(::Abs2Int) = 2



You might want to have a look at the lightweighted higher kinded types in Julia.
PDF is available here:

I have an article about this implementation coupled with type classes: