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

Change extension method for refinement type + newtype from value.as[A].validate to value.validateAs[A] #105

Closed
kevin-lee opened this issue Mar 15, 2022 · 0 comments · Fixed by #106
Assignees
Labels
task Task
Milestone

Comments

@kevin-lee
Copy link
Owner

Task

Summary

Change extension method for refinement type + newtype from value.as[A].validate to value.validateAs[A].

Project Details

Version: 0.6.0

Description

Although having one extension method without partially application may cause IntelliJ IDEA highlighting it as compilet-time error, there's no actual compile-time error for that syntax.

@newtype case class Name(value: NonEmptyString)

type PositiveInt = Int Refined Positive
object PositiveInt extends RefinedTypeOps[PositiveInt, Int]
@newtype case class Id(value: PositiveInt)

final case class Person(id: Id, name: Name)

val id  = idValue.validateAs[Id]
val name  = nameValue.validateAs[Name]

(id, name).parMapN(Person.apply)
@kevin-lee kevin-lee added the task Task label Mar 15, 2022
@kevin-lee kevin-lee added this to the milestone7 milestone Mar 15, 2022
@kevin-lee kevin-lee self-assigned this Mar 15, 2022
kevin-lee added a commit that referenced this issue Mar 15, 2022
…om `value.as[A].validate` to `value.validateAs[A]`
kevin-lee added a commit that referenced this issue Mar 15, 2022
Close #105 - Change extension method for refinement type + newtype from `value.as[A].validate` to `value.validateAs[A]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Task
Projects
None yet
1 participant