You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have an intermediary-like library in which I'd like to defined, say, type NonnegativeInt = Int :| Not[Negative] or type NonnegativeInt = Int :| GreaterEqual[0], and then be able to do something like val ref: NonnegativeInt = NonnegativeInt(0). I've gotten this working with creating a object NonnegativeInt companion that extends RefinedTypeOps, but if and only if I have autoRefine in scope at the call site, via e.g. import io.github.iltotore.iron.* or import 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 the iron behind-the-scenes?
The text was updated successfully, but these errors were encountered:
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.
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?The text was updated successfully, but these errors were encountered: