File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
src-non-bootstrapped/scala/quoted Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ package object quoted {
9
9
throw new Exception (" Non bootsrapped library" )
10
10
11
11
implicit object ExprOps {
12
- def (x : T ) toExpr[T : Liftable ] given QuoteContext : Expr [T ] = the[Liftable [T ]].toExpr(x)
12
+ def (x : T ) toExpr[T : Liftable ] given QuoteContext : Expr [T ] =
13
+ throw new Exception (" Non bootsrapped library" )
14
+
15
+ def (seq : Seq [Expr [T ]]) toExprOfSeq[T ] given (tp : Type [T ], qctx : QuoteContext ): Expr [Seq [T ]] =
16
+ throw new Exception (" Non bootsrapped library" )
17
+
18
+ def (list : List [Expr [T ]]) toExprOfList[T ] given Type [T ], QuoteContext : Expr [List [T ]] =
19
+ throw new Exception (" Non bootsrapped library" )
13
20
}
14
21
}
Original file line number Diff line number Diff line change @@ -53,17 +53,13 @@ object Liftable {
53
53
}
54
54
55
55
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
60
58
}
61
59
62
60
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
67
63
}
68
64
69
65
given [T : Type : Liftable ] as Liftable [Set [T ]] = new Liftable [Set [T ]] {
You can’t perform that action at this time.
0 commit comments