Skip to content

Commit

Permalink
Validated works as advertized
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefanos Stefanou committed Nov 1, 2023
1 parent 0595687 commit 837834c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion diagram.drawio
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mxfile host="Electron" modified="2023-11-01T11:36:57.394Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/18.0.0 Chrome/100.0.4896.143 Electron/18.2.0 Safari/537.36" etag="L6nvPp7twMavy9b-E-8H" version="18.0.0" type="device" pages="5"><diagram id="tPDxc9v9lSpUtl4Dx5MV" name="Initial Big Picture">7V1bd5u4Fv4t58GrnQe6uNt+tJ2k7TQ502lypk1fzpJBtnUCiAo5jufXH4mbAcnEjTGYTlZXE5CEEN++StpbGRgz/+k9AeHqBrvQG+iq+zQwLga6rhuWyX7xkm1aopujpGRJkJuUabuCW/Q3TAvVtHSNXBiVGlKMPYrCcqGDgwA6tFQGCMGbcrMF9spvDcESCgW3DvDE0q/IpaukdKQPd+UfIFqusjdr9jip8UHWOP2SaAVcvCkUGZcDY0YwpsmV/zSDHkcvwyV57mpPbT4wAgN6yAN3nz59vf8R3f5wv6qbCE9vr4bXipH08gi8dfrB6WDpNkOA4HXgQt6JNjCmmxWi8DYEDq/dMKKzshX1vbRaHFQ6zkdIKHwqFKWDfA+xDynZsiZprWIZVvJMyjOKnSK42RFAG9tpo1URfSttCVKqL/Ped8CwixQbOU7f77b2/Wzo+A78TD6FD7PVZK1ooz4AZY2kSKkiUrp5KqSsPgBlmIeylD5qAKjb+y/r77P3D5fmt3tbn3+/QauRoo0bRmqBA5oqUE1vBjkj450UOMsScTNGMv7SrVPB1rQkngA2Ra/CZnUO27AHsFXldHyolJpNqDMpbiMBJegyByG9xYSu8BIHwLvclU53OKrsbtfmGuMwRe9/kNJtCh9YU1zGFj4h+q1wfc+7emeldx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t6suO5voNmYZt4uqGvJXkgIrdP2kHKmelZ5vihMHmvH5VZsXp1FmP6yCU0icTvJu9C3+m6VUXCNewy0phUmHEfd/WJCxGhQGW0RAlH8094fQCloRygqV121w/s+Njvh+9aXfTT6HUjlgwmMXT/3uH59o4cviUsJfPu/itfJyaesHrW12D1/3w1sv/MNXuDP4tg+wI=</diagram><diagram id="SGkII9OIRVxXQt-IC64W" name="Semigroup">7VpNc5s8EP41HOsBic9jbKftoe10Jum0ORIjg1pAjJBjO7++EkjmQ3ZM+8aGd9JDYrSghX2e1e5qwYCLbPeBhkXymUQoNYAZ7Qy4NACwbODyHyHZ1xLf82pBTHFUi8xGcIefkZyppBscoVLKahEjJGW46ApXJM/RinVkIaVk271sTdKoIyjCGGmCu1WY6tLvOGKJtAJ4jfwjwnGi7my5QX0mC9XF0pIyCSOybYngrQEXlBBWH2W7BUoFeF1c3p84e3gwinI2ZEJ0X0AUffv19MXJogeyub/5/PGd1PIUppuuwSXbKwi4Go42H8y3CWborghX4syWE85lCctSPrL4YVgWNQVrvEP8rvM1TtMFSQnlspzkQoW8H6IM7U4aYh3g4X6FSIYY3fNL1AQP1FOkSwFT+ti2IQhKUdLiRslC6RLxQXODGj+QwP0BiEADEUweRAAnBiLUQITTBzHwpwWirYGYTx5EGwbTAtHRQJzNZhqM3GDWwyvFcc6PV9xwxDGaC1gwTyU38kSGo0hMn1NU4ufwsVJl8nFBcM4qM5y54SyFrg0jZZ0MheqSUfIL9bC/DB1QJWhFh+VodKiU1qbD8i9Eh6vRYQA3rbDnlrixODIWt0awVHJ+m9YpKSyU4CsHluEnJExKSCp+8032iGjZml8008/yPpSckq80nMdc4DSje8JX3fIdME+sR8LJXKdV3ZBw90G5cB+yySOxIivneY2M2s0FlmVrlFvBEc4950Kcqwd6kfSbKOJEknwY7UrwSPuSt043UNSeo9sGl6JbT/67yeetfhkKXTjTQ+VVM5el5//nyeMIrW4RBf1gZBT1AmA/eRT73mhb/tjeeGwXFPHNtRwSyhISkzx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" modified="2023-11-01T14:06:44.989Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/18.0.0 Chrome/100.0.4896.143 Electron/18.2.0 Safari/537.36" etag="3KwF2J992vwuRihss61P" version="18.0.0" type="device" pages="5"><diagram id="tPDxc9v9lSpUtl4Dx5MV" name="Initial Big Picture">7V1bd5u4Fv4t58Gr7QNd3G0/2k7Sdpqc6TQ906Yvs2SQbU0AUSHH8fz6I4HAgGTHjTHYnUzXtCAJIb591daW3LMm4eM7AuLFDfZh0DN1/7FnXfRM9p9jsX94yVqU6LablcwJ8rMyY1Nwi/6BolAXpUvkw6TSkGIcUBRXCz0cRdCjlTJACF5Vm81wUH1rDOZQKrj1QCCXfkU+XWSlA7O/KX8P0XyRv9lwh1lNCPLG4kuSBfDxqlRkXfasCcGYZlfh4wQGHL0cl+y5qy21xcAIjOg+D3z5+PHr3Y/k9of/VV8leHx71b/WBHkeQLAUHywGS9c5AgQvIx/yToyeNV4tEIW3MfB47YoRnZUtaBiIanlQYpwPkFD4WCoSg3wHcQgpWbMmolZzLCd7RvCM5goEVxsCGENXNFqU0XdESyCoPi963wDDLgQ2apy+f1m7d5O+F3rwE/kY308Wo6VmDM4BKGegREqXkTLtYyHlnANQlr0vS5mDBoC6vfu8/D55d39pf7tzzen3G7QYaMawYaRmOKJCgRpmM8hZOe8I4BxHxs0aqPjLdI4FW9OSeATYNLMOm9M5bP0zgK0up8N9pdRuQp0pcRtIKEGfOQjiFhO6wHMcgeByUzre4Kizu02ba4xjgd7fkNK1gA8sKa5iCx8R/Va6vuNdvXXE3cWj6Dm9Wec3Efvcb+Wb0lP8dvNYepc/t5VuCV4SD+6ARjAQBWQO6Y52dtaO47aTCwgMAEUPVcercYIOXwh6KEGdrgiqds2sLimqP4eiRpWi/VZJqgbROCkhNSVjdcOo4/dMN2BfMZ4SdjXnV6/jJYHsFTM2qhsQv9lh0/Q9bBoKggkOMEmftXwHDnyblSeU4HtY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zPPT6Vv7dHnR96cHut+BAK/Ywp2ehbfOdYZSkR6JNsovfMxe63gz4IKYbD7teTSBdME3abC5IN0Gbzh1qQ46KyRvypP3OIhWqV95a9ZbdvR49jpVTnz034GWFPnrIi/6LmQfGM9z0JIYed5VShw3N2F/cI0pHrI8fJ6UOS49vc1J+qS19mmPV584KtlLvJz7aQdvK86OPtiF/5NFlmqQ3CuZwSsBTO0H/ffs+NWlp2lHkd6iZpIkthTvtbIlJLhGbnpB0ymJORum05eyUvFZs0y+wbjM2r4w57nM+xsXSu0/do1hxFNUz9uReoxDxtuN8ipltyuXSySaYIIVM2I91OtusniDxIrvbzovQrH1FVz8WP8mR0z9BgHxGTf9owttKHtzm1xcKR7rNXGn38/sHkGgT+sn8K9YDO/GZBdy6fVAPwX0a6QEl+XktAjtvuHjhMMZ8eVP/e5lw4QvQfR7jScrp7Y2JkQgOXhSRQQ498kAwEhUhk5N0GqqifpU/1EszEi0VFN9K3mFNlCzVvgPVjx8Mj0VcU6GZD4odqVGrzWX3wqydcMywvmXRrf3MxL7RmH4trmMMax09OxjDbjc/hZQ13/yilHX5fw==</diagram><diagram id="b0HI96TgTr0dLWQZUHEw" name="Big Picture">vZVvb5swEMY/DVL3IhV/VtK8DcladaumLevW7U3l4qtxZXzMMQH26WvABBChqjRtr+LnZ5+5e44jThCl5ZUiWXKLFITju7R0go3j+957PzQ/NalacrlctoApTlvk9mDH/4CN7GjOKewta5FGFJpnYxijlBDrESNKYTE+9oSCjkBGGEzALiZiSn9wqhNbhb/s+TVwlnRP9sJVu5OS7rCtZJ8QisUABVsniBSibldpGYGozRv78mFm95iYAqnfEhASYLA63KltdJFTevl5j18Xgc1NV13BQE39VqLSCTKURGx7ulaYSwr1ra5R/ZlPiJmBnoHPoHVlm0lyjQYlOhV2F0qu7wfrn/VV5xdWbUp7cyOqTkitqvuhGETVsg9rVBfX1lcXNWubRXvMVWxPbeTd78K7WTzTb+739cPHqy/hr0X3+hHFQL/iqXdsrpkKwBRMPiZO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
35 changes: 28 additions & 7 deletions src/main/scala/mycats/examples/ValidatedExample.scala
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
package mycats.examples

import mycats.algebras.Validated
import mycats.algebras.{Invalid, Valid, Validated}
import mycats.examples.common.Expense
import mycats.examples.common.Utils.NonEmptyList
import mycats.instances.ValidatedInstances.validatedApplicativeErrorInstance
import mycats.lib.obj.Semigroup
import mycats.lib.syntax.SemigroupalSyntax
object ValidatedExample {
val validatedInstance = validatedApplicativeErrorInstance[Throwable,String]
type ValidatedNel[A] = Validated[NonEmptyList[String],A]
val validatedNelInstance = validatedApplicativeErrorInstance[NonEmptyList[String],Long]
implicit def semigroupOfNonEmptyList[A]:Semigroup[NonEmptyList[A]] = new Semigroup[NonEmptyList[A]] {
override def combine(x: NonEmptyList[A], y: NonEmptyList[A]): NonEmptyList[A] = x.appendedAll(y)
}


private def expenseIdValidation(expenseID:Long):ValidatedNel[Long]=
if(expenseID<=0) Invalid(List("Expense ID cannot be negative")) else Valid(expenseID)

private def expenseAmountValidation(expenseAmount:Double):ValidatedNel[Double]=
if(expenseAmount<=0) Invalid(List("Expense amount cannot be negative")) else Valid(expenseAmount)

private def mkExpense(id:Long,amount:Double):ValidatedNel[Expense] = {
val v1 = expenseIdValidation(id)
val v2 = expenseAmountValidation(amount)

val product: Validated[NonEmptyList[String], (Long, Double)] = validatedNelInstance.product(v1,v2)
validatedNelInstance.map(product)((Expense.apply _).tupled)

}
def main(args: Array[String]): Unit = {
val valid:Validated[Throwable,String] = validatedInstance.pure("Any")
val invalid:Validated[Throwable,String] = validatedInstance.raiseError(new Throwable("Mem error"))
val fn :String=>String=_+"hellow world"
val invalidMap = validatedInstance.map[String,String](invalid)(fn)
print(invalidMap)
val valid = mkExpense(-1,-12.0)
print(valid)

}
}
8 changes: 8 additions & 0 deletions src/main/scala/mycats/examples/common/Utils.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package mycats.examples.common




object Utils{
type NonEmptyList[A] = List[A] //Fake nonEmptyList
}
Loading

0 comments on commit 837834c

Please sign in to comment.