This question was originally posted by lookatme
in the Perl6 IRC channel. The original intention is to constrain a Callable by using subsets or any other possible way. It works in signatures, however this:
subset WalkCb of Callable where *.signature ~~ :(Int $a);
my WalkCb $x = sub (Int $a) { return $a; };
returns
«Type check failed in assignment to $x; expected WalkCb but got Sub (sub (Int $a) { #`(Sub...) in block <unit> at <tmp> line 1»
Other variants of the declaration return similar messages. What would be the correct syntax?