A higher-order size system for a higher-order functional language