https://stackoverflow.com/questions/37606035/pass-generic-function-as-argument