Skip to content

Instantly share code, notes, and snippets.

View abelbryo's full-sized avatar

Abel Terefe abelbryo

View GitHub Profile
object UserEntityModule {
case class UserEntityF[F[_], G[_]](id: G[Option[Long]] = None, username: F[String], password: F[String])
type Id[A] = A
type Forget[A] = Unit
// You can also just use Option if you don't care
// for the domain-specific type
sealed trait Updatable[+A] {
def foreach(f : A => Unit): Unit = this match {
@abelbryo
abelbryo / playjson-example.scala
Last active October 26, 2016 07:52
Json formatting with Play Json 2.5
import play.api.libs.functional.syntax._
import play.api.libs.json._
// Example showing different use cases
// of json formatting with Play-Json library
// case class with parameters
final case class DataType[T](value: T)
object DataType {
implicit def anyDataTypeJsonFmt[T: Format]: Format[DataType[T]] = {