What does `() => Unit` mean?
First, you have a list of features. Each function takes no parameters (that's what the open-close parentheses mean
) and returns
, which is a value with no result, similar to void.
In a pure functional world, a type function is
useless because it accepts nothing and returns nothing. However, Scala is not a purely functional language; it has side effects. To be useful, the functions on the list will undoubtedly have side effects. Since they are callback functions, they also have an idea of when they fire.
source to share