Draft
Conversation
This works with inline type classes and conditions that can be evaluated
at compile-time like `>`, `!`, and `==`:
```scala
scala> refineMV[Int, Positive1](5)
val res1: eu.timepit.refined.api.Refined[Int, eu.timepit.refined.Positive1] = 5
scala> refineMV[Int, Positive1](-5)
1 |refineMV[Int, Positive1](-5)
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|no
scala> refineMV[String, NonEmpty1]("hello")
val res2: eu.timepit.refined.api.Refined[String, eu.timepit.refined.NonEmpty1] = hello
scala> refineMV[String, NonEmpty1]("")
1 |refineMV[String, NonEmpty1]("")
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|no
```
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #921 +/- ##
=======================================
Coverage 92.39% 92.39%
=======================================
Files 63 63
Lines 815 815
Branches 6 6
=======================================
Hits 753 753
Misses 62 62 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
armanbilge
reviewed
May 16, 2022
| def refineV[P]: RefinePartiallyApplied[Refined, P] = RefType.refinedRefType.refine[P] | ||
|
|
||
| trait Predicate[T, P] { | ||
| inline def isValid(inline t: T): Boolean |
Contributor
There was a problem hiding this comment.
I'm giving this a try in armanbilge/lucuma-core#1. Interestingly I had to add transparent to make it work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This works with inline type classes and conditions that can be evaluated
at compile-time like
>,!, and==: