In the book "Type-Driven developement with Idris" the author explains how to create variadic functions. He takes the example of a adder function that consumes a first parameter n: Nat and then n + 1 integer parameters to be added. In order to declare this function the book introduces the dependent type AdderType so that one can write:
adder: (numargs: Nat) -> (acc: Int) -> AdderType numargs
So far so good. But then the following definition of AdderType is proposed:
AdderType : (numargs: Nat) -> Type
AdderType Z = Int
AdderType (S k) = (next: Int) -> AdderType k
At this point I'm lost. Line AdderType Z = Int makes sense but the last one does not. I would have thought that the expression (next: Int) -> AdderType k had kind Int -> Type, but not kind Type. Does Idris consider that any dependent type is also a type? If yes, does that also apply to type constructor? (That is to say: does a value of kind Type -> Type also have kind Type ?)
Disclaimer: I'm a beginner in type theory so my usage of technical terms like "kind" and "dependent type" might be inappropriate. Please correct me if this is the case.