What do you mean when you say that "fields are a higher-kinded type"? Do you mean that fields are type constructors? Using the definition from the wikipedia article I can see that the field Temperature is a constructor from Vertex to float, so the type of Fields is a higher-kinded type, but not that fields themselves (e.g., Temperature) are higher-kinded types.

jpd

@grizt A "kind" is a "type of type". Just like a higher-order function is a function taking one function and turning it into another one, a higher-kinded type is a type taking one type and turning it into another one. Container types are a good example -- std::vector takes one type and turns it into another (eg. int to std::vector). Depending on how crazy the type system, it could also be a type that transforms other higher-kinded types, eg. a type that can take any container type and turning it into another variant -- examples are a bit hard to make in things like C++, but Haskell's Monad Transformers (https://wiki.haskell.org/Monad_Transformers) are good examples.

grizt

@jpd Sure - this means that the type of fields ("Fields") is a higher-kinded type, correct?

jpd

@grizt Yep. You can think of Fields as a type level function with kind (type -> type,type) -> type (ie. it takes a one-argument function on types, and a type, and returns a new type). That's assuming Vertex takes a parameter itself -- if not, Fields has kind (type,type) -> type

Lawliet

So from what I understand, fields are a type that takes in a type and transfroms it into another type. I guess this would be like some set of function signatures that takes in a type (ie int) and then outputs another type (ie float). But why is fields considered a type as well then?

What do you mean when you say that "fields are a higher-kinded type"? Do you mean that fields are type constructors? Using the definition from the wikipedia article I can see that the field Temperature is a constructor from Vertex to float, so the type of Fields is a higher-kinded type, but not that fields themselves (e.g., Temperature) are higher-kinded types.

@grizt A "kind" is a "type of type". Just like a higher-order function is a function taking one function and turning it into another one, a higher-kinded type is a type taking one type and turning it into another one. Container types are a good example -- std::vector takes one type and turns it into another (eg. int to std::vector). Depending on how crazy the type system, it could also be a type that transforms other higher-kinded types, eg. a type that can take any container type and turning it into another variant -- examples are a bit hard to make in things like C++, but Haskell's Monad Transformers (https://wiki.haskell.org/Monad_Transformers) are good examples.

@jpd Sure - this means that the type of fields ("Fields") is a higher-kinded type, correct?

@grizt Yep. You can think of Fields as a type level function with kind (type -> type,type) -> type (ie. it takes a one-argument function on types, and a type, and returns a new type). That's assuming Vertex takes a parameter itself -- if not, Fields has kind (type,type) -> type

So from what I understand, fields are a type that takes in a type and transfroms it into another type. I guess this would be like some set of function signatures that takes in a type (ie int) and then outputs another type (ie float). But why is fields considered a type as well then?