Dennis
Dennis

Reputation: 181

Rascal function with abstract pattern as formal parameter

I'm trying to do this:

data A = a(str s);
void show(A a(str s)) = println(s);
A x = a("hi");
show(x);

but I get this error:

|prompt:///|(0,7,<1,0>,<1,7>): The called signature: show(A),
does not match the declared signature:  void show(node);

Is this because this is currently broken (as the tutor page for TypeConstrained abstract patterns suggests), or am I making a mistake?

Upvotes: 1

Views: 31

Answers (1)

Davy Landman
Davy Landman

Reputation: 15439

I think it should be

void show(a(str s)) = println(s);

where did you see this A prefix in the tutor?

Upvotes: 1

Related Questions