High Order Function with Type Parameter

This is good advice :slight_smile: If you know all the types statically (you only need static polymorphism) then use generics, you will get faster code and the type checker can do more to help you. If you need runtime (dynamic) polymorphism them enums are first choice definitely, and they result in simpler easier to read code too. There are only two reasons to use boxed traits I can think of: you need runtime polymorphism and runtime extensibility (or linktime extensibility without recompiling binaries) or you have complex code and want to use the same definitions with static and dynamic polymorphism so you don't have twice as much code to debug.