Check out example codes for "Types and CoProducts in scala". It will help you in understanding the concepts better.

Code Example 1

sealed trait Request
case class CreateUser(name: String)                   extends Request
case class ReadUserInfo(userId: Int)                  extends Request
case class UpdateUserInfo(userId: Int, name: String)  extends Request
case class DeleteUser(userId: Int)                    extends Request

Learn ReactJs, React Native from akashmittal.com