cpp superior to ghc . . .

Koen Claessen koen@cs.chalmers.se
Thu, 26 Oct 2000 09:01:21 +0200 (MET DST)


George Russell complained:

 | Why does the Haskell language not allow "type"
 | declarations to appear in the declaration parts of
 | where and let clauses?

Marcin 'Qrczak' Kowalczyk replied:

 | Because you can always lift them to the top level.

This is the ultimate non-answer.

First of all, it is wrong. George meant to be able to use
type variables present in the top-level type in the local
type declarations. Something like:

  doWithStack :: a -> a
  doWithStack x = stacking []
   where
    type Stack = [a]

    stacking :: Stack -> a
    stacking = ...

The problem is really two-fold: bound type variables (like
"a") are not in scope in the body of the function, and local
type declarations are not allowed.

Secondly, "because another way of doing it is possible" is
not an answer. We allow local declarations of functions, but
we have known for ages we can all lambda-lift them to
top-level...

Regards,
Koen.

--
Koen Claessen         http://www.cs.chalmers.se/~koen     
phone:+46-31-772 5424      mailto:koen@cs.chalmers.se
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden