Skip to content

Instantly share code, notes, and snippets.

@debasishg
Created June 20, 2016 04:50
Show Gist options
  • Select an option

  • Save debasishg/1b2900f499f2f874238a1ed4b6c5b3cc to your computer and use it in GitHub Desktop.

Select an option

Save debasishg/1b2900f499f2f874238a1ed4b6c5b3cc to your computer and use it in GitHub Desktop.
import cats.data.Xor
import freek._
sealed trait Account
trait Repository {
sealed trait Repo[A]
case class Query(no: String) extends Repo[Xor[String, Account]]
case class Store(account: Account) extends Repo[Xor[String, Account]]
case class Delete(no: String) extends Repo[Xor[String, Unit]]
def query(no: String) = Query(no)
def store(account: Account) = Store(account)
def delete(no: String) = Delete(no)
// How do I write this function here ?
def update(no: String, f: Account => Account) = ???
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment