1) I do not think you can use functions on the LHS (the "then" part). 2) Even if it were allowed, I don't see a return type for the controllo(String a). Maybe if you explained what the rule was supposed to be doing we could be more help.