Created
June 20, 2016 04:50
-
-
Save debasishg/1b2900f499f2f874238a1ed4b6c5b3cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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