You can achieve that with a functor:
Though it is probably good to be sure that’s is the best strategy for what you really want to do.