File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
src-non-bootstrapped/scala/quoted Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -10,5 +10,11 @@ package object quoted {
1010
1111 implicit object ExprOps {
1212 def (x : T ) toExpr[T : Liftable ] given QuoteContext : Expr [T ] = the[Liftable [T ]].toExpr(x)
13+
14+ def (seq : Seq [Expr [T ]]) toExprOfSeq[T ] given (tp : Type [T ], qctx : QuoteContext ): Expr [Seq [T ]] =
15+ throw new Exception (" Non bootsrapped library" )
16+
17+ def (list : List [Expr [T ]]) toExprOfList[T ] given Type [T ], QuoteContext : Expr [List [T ]] =
18+ throw new Exception (" Non bootsrapped library" )
1319 }
1420}
Original file line number Diff line number Diff line change @@ -53,17 +53,13 @@ object Liftable {
5353 }
5454
5555 given [T : Type : Liftable ] as Liftable [Seq [T ]] = new Liftable [Seq [T ]] {
56- def toExpr (seq : Seq [T ]): given QuoteContext => Expr [Seq [T ]] = given qctx => {
57- import qctx .tasty ._
58- Repeated (seq.map(x => the[Liftable [T ]].toExpr(x).unseal).toList, the[quoted.Type [T ]].unseal).seal.asInstanceOf [Expr [Seq [T ]]]
59- }
56+ def toExpr (xs : Seq [T ]): given QuoteContext => Expr [Seq [T ]] =
57+ xs.map(the[Liftable [T ]].toExpr).toExprOfSeq
6058 }
6159
6260 given [T : Type : Liftable ] as Liftable [List [T ]] = new Liftable [List [T ]] {
63- def toExpr (x : List [T ]): given QuoteContext => Expr [List [T ]] = x match {
64- case x :: xs => ' { ($ {xs.toExpr}).:: [T ]($ {x.toExpr}) }
65- case Nil => ' { Nil : List [T ] }
66- }
61+ def toExpr (xs : List [T ]): given QuoteContext => Expr [List [T ]] =
62+ xs.map(the[Liftable [T ]].toExpr).toExprOfList
6763 }
6864
6965 given [T : Type : Liftable ] as Liftable [Set [T ]] = new Liftable [Set [T ]] {
You can’t perform that action at this time.
0 commit comments