To avoid serialization problems, particularly in distributed environments (e.g. Apache Spark), it is a best practice to implement the Serializable trait for type class instances.
Serializable