Re: Bug in PAKCS data inspection ¿?

From: Wolfgang Lux <>
Date: Mon, 29 Oct 2007 09:14:11 +0100

Juan Carlos González Moreno wrote:

> Hi again,
> I am sorry and i don't want to polemicize. But the question
> is: Anyone knows and have use a similar data definition to:
>>> data Seq a = a | a :< Seq a
> in which use the the type variable name to define a new data
> constructor ?
> For me in this situation the expected error message must appear just
> in the first line because i expect that
> the interpreter must consider that "a" is a type variable introduced
> in the left side of the definition and then
> if it appears with no constructor associated in the right side then
> this definition must be considered as a wrong
> definition. If not the a renaming is done by the interpreter and it
> is not clear for me how works this renaming
> 1) data Seq a = b | b :< Seq b
> 2) data Seq a = b | a :< Seq a
> 3) data Seq a = b | b :< Seq a
> 4) data Seq a = b | a :< Seq b ...

As I wrote in my previous mail, type and value identifiers live in
different name spaces, i.e., you can use the same name as value and
a type identifier (and this is a reasonable choice). So in the four
declarations above, the first b is considered a value identifier
(because it is a legal data constructor declaration, as in your
original example), but the other occurrences of b in the declarations
can be considered only as type variables, and therefore all of the
declarations above are rejected with a free type variable error for
b in the second(!) constructor declaration.


curry mailing list
Received on Mo Okt 29 2007 - 09:25:11 CET

This archive was generated by hypermail 2.3.0 : Sa Feb 24 2024 - 07:15:09 CET