GithubHelp home page GithubHelp logo

Comments (6)

Fabszn avatar Fabszn commented on July 27, 2024 1

Aaah yes!! You right! 👍
I forgot this operator and it fully answer to my need

Many thanks!

from hamsters.

dgouyette avatar dgouyette commented on July 27, 2024

Did you take a look to unit tests ?

https://github.com/scala-hamsters/hamsters/blob/master/src/test/scala/ValidationSpec.scala

You can do something like

    val e1 = OK(1)
    val e2 = KO("nan")
    val e3 = KO("nan2")

    val validation = Validation(e1, e2, e3)
    val failures: List[String] = validation.failures
    validation.hasFailures should be(true)
    failures should be(List("nan", "nan2"))
  }

from hamsters.

Fabszn avatar Fabszn commented on July 27, 2024

Many thanks Damien for your answer. My use case is little bit different.
I have one list of element as List(E1, E2, E3, etc)
I map my list to validate each element then I have one list of OK(E1)/KO(Error)
And now I want to know which are right and which are not right
In my case, I didn't know the exact number of element I have to validate

But my use case may be doen't fit with the Validation type finally ? What do you think about it?

from hamsters.

dgouyette avatar dgouyette commented on July 27, 2024

Can you provide a unit test please ?

from hamsters.

Fabszn avatar Fabszn commented on July 27, 2024

Sure, I will post it tonight.

from hamsters.

loicdescotte avatar loicdescotte commented on July 27, 2024

Hi @Fabszn and @dgouyette ,

I think you can use the ":_* " syntax, that converts a list to varargs :

val eithers = List(Ok, KO, KO)
val validation = Validation(eithers :_*)

from hamsters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.