Closed vreuter closed 5 days ago
Hello.
This is the intented behaviour. Back when RefinedTypeOps
was introduced, there was no such limitation but it caused other issues and after some tests I decided to go with the current design. It is still possible to make your own version of RefinedTypeOps
(the code is not very long) and change the apply
method.
Fortunately this issue might be resolved when Iron will be able to upgrade to newer Scala versions with the use of the erase
keyword.
Many thanks for the reply and explanation @Iltotore .
Hello, I have an intermediary-like library in which I'd like to defined, say,
type NonnegativeInt = Int :| Not[Negative]
ortype NonnegativeInt = Int :| GreaterEqual[0]
, and then be able to do something likeval ref: NonnegativeInt = NonnegativeInt(0)
. I've gotten this working with creating aobject NonnegativeInt
companion that extendsRefinedTypeOps
, but if and only if I haveautoRefine
in scope at the call site, via e.g.import io.github.iltotore.iron.*
orimport io.github.iltotore.iron.autoRefine
.Is it intended that call sites would need such an import to use the constructor-like syntax provided by
RefinedTypeOps
? Am I missing something that would make it possible for me to define a numerics-like library that then could be used by downstream projects without them needing to know about theiron
behind-the-scenes?