Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refined4s-cats] Add validateNecAs in refined4s.modules.cats.syntax to validate and return ValidatedNec #189

Closed
kevin-lee opened this issue Dec 29, 2023 · 0 comments · Fixed by #192
Assignees
Labels
Milestone

Comments

@kevin-lee
Copy link
Owner

Summary

[refined4s-cats] Add validateNecAs in refined4s.modules.cats.syntax to validate a value and return ValidatedNec

Version

0.6.0

Description

import refined4s.*
import refined4s.types.all.*

import refined4s.modules.cats.syntax.*

type Name = Name.Type
object Name extends Newtype[NonEmptyString]

"Kevin".validateNecAs[Name]
// ValidatedNec[String, Name] = Valid(Name(NonEmptyString("Kevin")))

"".validateNecAs[Name]
// ValidatedNec[String, Name] = Invalid(NonEmptyChain("Failed to create Name: Invalid value: []. It has to be a non-empty String but got \"\"))
@kevin-lee kevin-lee added the task label Dec 29, 2023
@kevin-lee kevin-lee added this to the m7 milestone Dec 29, 2023
@kevin-lee kevin-lee self-assigned this Dec 29, 2023
kevin-lee added a commit that referenced this issue Dec 29, 2023
…cats.syntax to validate and return ValidatedNec
kevin-lee added a commit that referenced this issue Dec 29, 2023
…cats.syntax to validate and return ValidatedNec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant