[erlang-questions] Built-in type var(_)
Kostis Sagonas
kostis@REDACTED
Sun Nov 7 02:05:35 CET 2010
Tony Hannan wrote:
> Hello,
>
> I was writing an MVar module (a' la Haskell) and defining the type
>
> -type var(A) :: {var, pid(), A}.
> % initial value kept in reference for type only, current value held in
> process
>
> But the compiler complained that
>
> "type var(_) is a builtin type; it cannot be redefined"
>
> I don't see this built-in var mentioned in any of the documentation and
> Google didn't find it either. So where is this var type defined and can I
> use it instead of creating my own var type.
The underlying type representation needs to have a way of representing
type variables (the A in your declaration) and it so happens that it has
chosen something involving var/1. I guess you are unlucky.
Simply choose some other name like mvar(A), myvar(A), my_var(A), ...
But you are right that this should probably be mentioned somewhere.
Kostis
More information about the erlang-questions
mailing list