typed functions as arguments and return value checking