Comments (6)
Aaah yes!! You right! 👍
I forgot this operator and it fully answer to my need
Many thanks!
from hamsters.
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.
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.
Can you provide a unit test please ?
from hamsters.
Sure, I will post it tonight.
from hamsters.
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)
- Write def (macro?) for Show HOT 2
- Enumerable.list should return a Set
- Rename Ko to Nok in Validation HOT 2
- Never ending test if we add monad list instance HOT 1
- Generate getSimpleName for case object
- Execution context should be passed implicitly in Retry
- Add a monad transformer for FutureTry HOT 4
- Macro compilation issues with Scala 2.13 HOT 6
- Move hlist and union types into extensions HOT 1
- Test new js package with mill
- Build in travis for Scala 2.12 and 2.13
- Integrate Validation.run in 4.0
- Make a 3.1 release with Long monoid
- FutureOps.fromOption HOT 1
- Hamsters REPL
- Macros not published for scala.js in the current build HOT 1
- Define a more explicit error message when implicit execution context is missing for monad transformers
- Add documentation for mapN
- Generate mapN for arity 4 to 22 using macros
- Test never ends if we add Monad instance for List HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hamsters.