higher-kinded-types

Higher-kinded generics in Java

Suppose I have the following class: public class FixExpr { Expr<FixExpr> in; } Now I want to introduce a generic argument, abstracting over the use of Expr: public class Fix<F> { F<Fix<F>> in; } But Eclipse doesn't like this: The type F is not generic; it cannot be parametrized with arguments <Fix<F>> Is this possible at ...

Haskell - specifying kind in data declaration

In this declaration data Const a = Const Integer Haskell infers that Const is * -> *. Is it possible to make Const take a type constructor instead, so it will be (* -> *) -> *? Ideally, it should be a -> *, but there are no polymorphic kinds. This thread shows one solution - adding unused constructor. Has the situation changed since 2...

Higher-kinded Types with C++

This question is for the people who know both Haskell (or any other functional language that supports Higher-kinded Types) and C++... Is it possible to model higher kinded types using C++ templates? If yes, then how? EDIT : From this presentation by Tony Morris: Higher-order Polymorphism : Languages such as Java and C# have first-o...

Common practice for higher-order-polymorphism in scala

Hi, I'm trying to grasp higher-order-polymophism in scala by implementing a very basic interface that describes a monad but I come across a problem that I don't really understand. I implemented the same with C++ and the code looks like this: #include <iostream> template <typename T> class Value { private: T value; public: Value(c...

Minimal framework in Scala for collections with inheriting return type

Suppose one wants to build a novel generic class, Novel[A]. This class will contain lots of useful methods--perhaps it is a type of collection--and therefore you want to subclass it. But you want the methods to return the type of the subclass, not the original type. In Scala 2.8, what is the minimal amount of work one has to do so tha...

Is variance of for generic type parameters in C# 4.0 a step closer for higher kind types?

We know that implementing classes are still invariant, despite the fact that their interfaces are variant. However I am inquiring, is cov/contravariance a step closer to parametric polymorphism or these are two separate concepts? ...

What are uses of polymorphic kinds?

Polymorphic kinds are an extension to Haskell's type system, supported by UHC, allowing data A x y = A (y x) to be typed (kinded?) as a -> (a -> *) -> *. What are they useful for? ...

Can we define a higher-kinded type-level identity function in Scala?

In Scala we can define the type-level identity function for lower-kinded types like so, type Id[A] = A Can we also define something similar for higher-kinded types? Ie. can we fill in the blanks in, type HKId[A[...]] = ... so that something similar to HKId[List] gets us back to the List type constructor? Binding of free names in t...