These are chat archives for fthomas/refined

Dec 2017
Nicolas Rinaudo
Dec 05 2017 21:08
I'm a bit surprised by this:
import eu.timepit.refined.api.Refined
import eu.timepit.refined.collection._

val test: List[String] Refined NonEmpty = List("foobar")
//[error] compile-time refinement only works with literals
how is that not a literal?
Frank S. Thomas
Dec 05 2017 22:25
@nrinaudo It is not a literal in the sense of Scala's AST / spec. In the current macro system it is not easy to decide if a tree is a constant expression and therefore safe to evaluate at compile time. I wrote something about the notion of "extended literals" here:
Oron Port
Dec 05 2017 22:37
I thought about adding this ability to singleton-ops, since it already travels the AST.
I really wanted to add a compile-time unrollable For
Frank S. Thomas
Dec 05 2017 22:42
@soronpo I think it is unpractical with the current macros because it is impossible to know if a term refers to e.g. _root_.scala.collection.immutable.List. I hoped this would be easier with a scalameta based macro system.
Oron Port
Dec 05 2017 22:45
@fthomas Sorry I wasn't clear. I was referring to HList or other compile-time structures.
Anyway, the future of the macro system is very uncertain, so ATM I'm holding off on adding more complex features to the library.