File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ object Liftable {
66
66
}
67
67
}
68
68
69
+ given [T : Type : Liftable ] as Liftable [Set [T ]] = new Liftable [Set [T ]] {
70
+ def toExpr (set : Set [T ]): given QuoteContext => Expr [Set [T ]] =
71
+ ' { Set ($ {set.toSeq.toExpr}: _* ) }
72
+ }
73
+
69
74
given [T : Type : Liftable ] as Liftable [Option [T ]] = new Liftable [Option [T ]] {
70
75
def toExpr (x : Option [T ]): given QuoteContext => Expr [Option [T ]] = x match {
71
76
case Some (x) => ' { Some [T ]($ {x.toExpr}) }
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ object Test {
32
32
val seq : Seq [Int ] = Seq (1 , 2 , 3 )
33
33
val liftedSeq : Expr [Seq [Int ]] = seq
34
34
35
+ val set : Set [Int ] = Set (1 , 2 , 3 )
36
+ val liftedSet : Expr [Set [Int ]] = set
37
+
35
38
liftedList.foldLeft[Int ](0 )(' { (acc : Int , x : Int ) => acc + x }).show
36
39
liftedList.foreach(' { (x : Int ) => println(x) }).show
37
40
You can’t perform that action at this time.
0 commit comments