2016-10-05 32 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