-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
Tuple.ReverseOnto
and use it in Tuple.reverse
- Loading branch information
1 parent
d96e9e4
commit 1dda4b3
Showing
4 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import scala.Tuple.* | ||
def test[T1, T2, T3, T4] = | ||
summon[Reverse[EmptyTuple] =:= EmptyTuple] | ||
summon[Reverse[T1 *: EmptyTuple] =:= T1 *: EmptyTuple] | ||
summon[Reverse[(T1, T2)] =:= (T2, T1)] | ||
summon[Reverse[(T1, T2, T3)] =:= (T3, T2, T1)] | ||
summon[Reverse[(T1, T2, T3, T4)] =:= (T4, T3, T2, T1)] | ||
|
||
summon[Reverse[(T1, T2, T3, T4)] =:= Reverse[(T1, T2, T3, T4)]] | ||
summon[Reverse[(T1, T2, T3, T4)] <:< Reverse[(Any, Any, Any, Any)]] | ||
|
||
def test2[Tup <: Tuple] = | ||
summon[Reverse[Tup] =:= Reverse[Tup]] | ||
|
||
def test3[T1, T2, T3, T4](tup1: (T1, T2, T3, T4)) = | ||
summon[Reverse[tup1.type] =:= (T4, T3, T2, T1)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import scala.Tuple.* | ||
def test[T1, T2, T3, T4] = | ||
summon[ReverseOnto[(T1, T2), (T3, T4)] =:= ReverseOnto[(T1, T2), (T3, T4)]] | ||
summon[ReverseOnto[(T1, T2), (T3, T4)] =:= (T2, T1, T3, T4)] | ||
summon[ReverseOnto[(T1, T2), (T3, T4)] <:< (Any, Any, Any, Any)] | ||
summon[ReverseOnto[(T1, T2), (T3, T4)] <:< ReverseOnto[(Any, Any), (Any, Any)]] | ||
summon[ReverseOnto[(T1, T2), (T3, T4)] =:= Concat[Reverse[(T1, T2)], (T3, T4)]] | ||
|
||
def test2[Tup1 <: Tuple, Tup2 <: Tuple] = | ||
summon[ReverseOnto[EmptyTuple, Tup1] =:= Tup1] | ||
summon[ReverseOnto[Tup1, EmptyTuple] =:= Reverse[Tup1]] | ||
|
||
def test3[T1, T2, T3, T4](tup1: (T1, T2), tup2: (T3, T4)) = | ||
summon[ReverseOnto[tup1.type, tup2.type] <:< (T2, T1, T3, T4)] | ||
summon[ReverseOnto[tup1.type, tup2.type] =:= T2 *: T1 *: tup2.type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters