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

Add update method to Refined #48

Closed
fthomas opened this issue Aug 3, 2015 · 1 comment
Closed

Add update method to Refined #48

fthomas opened this issue Aug 3, 2015 · 1 comment

Comments

@fthomas
Copy link
Owner

fthomas commented Aug 3, 2015

Something like this:

final case class Refined[T, P](get: T) extends AnyVal {
  def update(f: T => T)(implicit p: Predicate[P, T]): Either[String, Refined[T, P]]
}
@fthomas
Copy link
Owner Author

fthomas commented Aug 15, 2015

A better name and signature would probably be:

def mapRefine[U](f: T => U)(implicit p: Predicate[P, U]): Either[String, Refined[U, P]]

because it maps the T and then refines the resulting U.

And it should also be provided for @@ which hints at a type class that provides functions for refined values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant