Redid the rep function with the awareness of type classes