Typed version of defun for easier generation of typed functions