Question aboutthe use of an inner forall

Ashley Yakeley ashley@semantic.org
Sun, 18 Aug 2002 19:26:39 -0700


At 2002-08-18 18:19, Scott J. wrote:

>A question: s is not a type variable as a isn't it?

Both are quantified type variables. But only one of those quantifiers can 
be placed at the top level of the expression.

   runST :: forall a. ((forall s. ST s a) -> a)

> I mean a can be of type Integer while s cannot.

Well yes, you can specialise "forall a" to Integer. So runST can be 
specialised to this type:

   runST ::[special] (forall s. ST s Integer) -> Integer

...whereas you cannot specialise "s" in the same way. Think of it in 
terms of logic, if for all a: f(a), then by simple specialisation 
f(Integer).

-- 
Ashley Yakeley, Seattle WA