Alternatively you can implement everything on interface{} and force the user of the higher-order function to use type assertions everywhere.