Skip to content

Commit

Permalink
chore: remove unused types
Browse files Browse the repository at this point in the history
  • Loading branch information
kory33 committed Mar 6, 2022
1 parent 72c53bb commit 7aad06a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ type IncludedInLockedT[T <: Tuple, A] <: Boolean =
case ? *: tail => IncludedInLockedT[tail, A]
}

/**
* INTERNAL. A type-level boolean indicating if T, mapped with [[Lock]], contains no duplicate
* types.
*
* Takes O(|T|^2) to compute.
*/
type ContainsDistinctLockedT[T <: Tuple] <: Boolean =
T match {
case Lock[head] *: tail => ![IncludedInLockedT[tail, head]] && ContainsDistinctLockedT[tail]
case EmptyTuple => true
}

/**
* INTERNAL. Lock tuple [[T]] using [[Lock]] constructor.
*/
Expand All @@ -55,13 +43,6 @@ type Includes[A] = [T <: Tuple] =>> Require[IncludedInT[T, A]]
*/
type IncludedBy[T <: Tuple] = [A] =>> Require[IncludedInT[T, A]]

/**
* A type-level boolean indicating if [[T]] only contains distinct types.
*
* Takes O(|T|^2) to compute.
*/
type ContainsDistinctT[T <: Tuple] = ContainsDistinctLockedT[LockTuple[T]]

/**
* INTERNAL. The index of [[A]] in a tuple [[T]] mapped with [[Lock]].
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,6 @@ class TupleSpec extends AnyFlatSpec with should.Matchers {
summon[IncludedInT[(Int, String, Double), Float] =:= false]
}

"ContainsDistinctT" should "tell whether a tuple contains distinct types" in {
summon[ContainsDistinctT[EmptyTuple] =:= true]
summon[ContainsDistinctT[Int *: EmptyTuple] =:= true]
summon[ContainsDistinctT[(Int, String, Double)] =:= true]
summon[ContainsDistinctT[(Int, 1, 2)] =:= true]
summon[ContainsDistinctT[(Int, Int | String, String)] =:= true]

summon[ContainsDistinctT[(Int, Int)] =:= false]
summon[ContainsDistinctT[(Int, String, Int)] =:= false]
summon[ContainsDistinctT[(String, Int, Int)] =:= false]
summon[ContainsDistinctT[(Int | String, String, Int, Int | String)] =:= false]
summon[ContainsDistinctT[(true, 1, 2, 3, 1, false)] =:= false]
}

"IndexOfT" should "extract the index of a specific type from a tuple" in {
summon[IndexOfT[Int, (String, Int)] =:= 1]
summon[IndexOfT[42, (String, Int, 42)] =:= 2]
Expand Down

0 comments on commit 7aad06a

Please sign in to comment.