The first of them is more effective in space. Calling a function defined in a type class is equivalent to calling a method in an object-oriented language: any functions that are polymorphic in type TeX t (i.e., have TeX t => in the type signature) will have to carry an additional, implicit parameter, namely, a dictionary storing specific methods for a given TeX instance.
Now, faster? I would suggest that for programs with a small amount of memory, the first method is slightly faster due to less memory allocation and even less indirectness for actually calling the TeX function. For programs with intensive distribution, the same will be done until the program overcomes some threshold of mdash memory allocation, which the first version will hit later, and therefore will be somewhat faster when the second gets to this point.
source share