1#
This is not typeable with a finite type. This means that very few (if any) programming languages will be able to type this.
However, as you have demonstrated, there is a specific type for x that allows the function to be typed:
x :: t -> B
Where B
is some concrete type. This results in apply
being typed as:
apply :: (t -> B) -> B
Note that Hindley-Milner will not derive this type.
2#
This is easy to represent in Haskell (left as an exercise to the reader...)