2016-10-05 31 views
1

我试图做到这一点:流氓功能与抽象图案的形式参数

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

,但我得到这个错误:

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

这是因为这是目前破(作为导师TypeConstrained抽象模式的页面建议),还是我犯了一个错误?

回答

1

我觉得应该是

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

你在哪里看到这个导师前缀A

+0

谢谢。我可能自己编写了这个“A”前缀(将函数声明的语法与正常参数和模式参数混合起来)。 – Dennis