Compile-time refinement of lists?
jonathanfrawley opened this issue · 3 comments
Hi,
I am trying to use refined to do compile time refinement of lists / sequences. The following code:
val e : List[Int] Refined NonEmpty = List(1,2,3)
gives the following error:
compile-time refinement only works with literals
I thought the above was a literal so I am confused about why this doesn't work.
@jonathanfrawley Here is an older comment that explains that compile-time refinements only works with literals as defined by the Scala language specification. List(1, 2, 3)
is actually a method call of the List.apply method.
Thanks for the reply @fthomas. I thought as much. Is it a huge job to add support for this? I am happy to contribute some time to investigate, but if you think it is a huge task then I won't bother.
Think this should be closed, as it looks like this is not possible with the Scala spec.