Comments (5)
ok, I opened a PR for this.
Beware, I'm a 3-day-old scala dev :D
from refined.
@err0r500 Your fix is has been released in 0.10.2 and your example is working now: https://scastie.scala-lang.org/bdbcLixJRjmP0JyMltq7CA
from refined.
It works if you remove the arbitraryFromValidate
import because startsWithArbitrary
is already imported: https://scastie.scala-lang.org/3zOprdJ5R7CRdcckNGfFVQ
If your refinement becomes more complex, you probably won't have luck with arbitraryFromValidate
because - as you already said - it is just a filter that discards not matching values.
from refined.
thanks @fthomas !
I use scala3 and if I just switch the target from your example, it doesn't compile : https://scastie.scala-lang.org/1J4smLVBQ86ckV9qgvf9pg
with the error :
No given instance of type org.scalacheck.Arbitrary[
eu.timepit.refined.api.Refined[String,
eu.timepit.refined.string.StartsWith[("a" : String)]
]
] was found for parameter a1 of method forAll in object Prop.
I found:
org.scalacheck.Arbitrary.arbContainer2[eu.timepit.refined.api.Refined, String,
eu.timepit.refined.string.StartsWith[("a" : String)]
](
org.scalacheck.Arbitrary.arbContainer2[Tuple2, String,
eu.timepit.refined.string.StartsWith[("a" : String)]
](
org.scalacheck.Arbitrary.arbContainer[([T2] =>> (String, T2)),
eu.timepit.refined.string.StartsWith[("a" : String)]
](
org.scalacheck.Arbitrary.arbContainer[eu.timepit.refined.string.StartsWith
,
("a" : String)](org.scalacheck.Arbitrary.arbEnum[A], ???, ???)
, ???, ???)
, ???, ???)
, ???, ???)
But method arbEnum in trait ArbitraryLowPriority does not match type org.scalacheck.Arbitrary[("a" : String)].
One of the following imports might make progress towards fixing the problem:
import eu.timepit.refined.scalacheck.any.arbitraryFromValidate
import shapeless.~?>.idKeyWitness
import shapeless.~?>.idValueWitness
import shapeless.~?>.witness
That's the reason why I had to add the arbitraryFromValidate
in my example. I guess I'm doing something wrong....
from refined.
I guess I'm doing something wrong....
No, you are not. I just saw that startsWithArbitrary
still uses shapeless.Witness
but that doesn't work with Scala 3. The Scala 3 version of this instance needs to be changed to use ValueOf
as is done here for example.
from refined.
Related Issues (20)
- refined-cats is not published for Scala 3.x HOT 3
- Broken link in README
- Versioning scheme is not declared
- OpenAPI with Refined Strings HOT 4
- Chaining refined string operation HOT 1
- Publish for Scala native? HOT 1
- Pureconfig not published for scala3 HOT 1
- Scala 3.2: Comparing NonNegInt with Int gives a compile error HOT 1
- Creating a Map of Literal Refined Types as the Key doesn't work HOT 1
- Size predicate validator error HOT 7
- `Greater[5] Or Equal[5]` results in drastic performance problems with `unsafeFrom` HOT 8
- Int Refined Positive does work with Scala 3.2.0 HOT 1
- Add support for `NonBlankString` and `StrippedString`
- Replace HList useages with Tuple in scala3 implmentations HOT 2
- Runtime `java.lang.AbstractMethodError` when combining refinement erasure, value class erasure, and generic type erasure HOT 3
- Define versionScheme
- Provide `Ordering` if the base type has one
- type mismatch with function argument HOT 1
- Inconsistency between 0.9.25 and 0.9.26 versions - possible regression HOT 4
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 refined.