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 {
6666 }
6767 }
6868
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+
6974 given [T : Type : Liftable ] as Liftable [Option [T ]] = new Liftable [Option [T ]] {
7075 def toExpr (x : Option [T ]): given QuoteContext => Expr [Option [T ]] = x match {
7176 case Some (x) => ' { Some [T ]($ {x.toExpr}) }
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ object Test {
3232 val seq : Seq [Int ] = Seq (1 , 2 , 3 )
3333 val liftedSeq : Expr [Seq [Int ]] = seq
3434
35+ val set : Set [Int ] = Set (1 , 2 , 3 )
36+ val liftedSet : Expr [Set [Int ]] = set
37+
3538 liftedList.foldLeft[Int ](0 )(' { (acc : Int , x : Int ) => acc + x }).show
3639 liftedList.foreach(' { (x : Int ) => println(x) }).show
3740
You can’t perform that action at this time.
0 commit comments