I have a function that takes an argument of type (Void) -> Void. However if I pass in
function () { trace("hi") ; }
I get an error
Void -> Void should be (Void) -> Void
And if I pass in a function
function( x : Void ) { trace("hi") ; }
I get an error
Arguments and variables of type Void are not allowed.
Is there a way to write a function of type (Void) -> Void ?
Background. In case you are wondering how I ended up needing a function that takes a (Void) -> Void, here is how. (This is not my actual application, but a simpler version.) I have a generic function
static function go<A,B>( f : B -> A, g : A -> Void, b : B) : Void { g(f(b)) ; }
Now I call it thus
go( function( i : Int ) : Void { }, function( x : Void ) { trace("hi") ; }, 41 )
Also: Some of the results I'm getting seem to vary according to target. Are there target dependent differences in how Void is treated?