Skip to content

Commit 23758ae

Browse files
Improve the docs of Tuple.Filter
1 parent 9772ac3 commit 23758ae

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

library/src/scala/Tuple.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,16 @@ object Tuple {
125125
case h *: t => Concat[F[h], FlatMap[t, F]]
126126
}
127127

128-
/** Filters out those members of the tuple for which the predicate `P` returns `false`. */
128+
/** Filters out those members of the tuple for which the predicate `P` returns `false`.
129+
* A predicate `P[X]` is a type that can be either `true` or `false`. For example:
130+
* ```
131+
* type IsString[x] = x match {
132+
* case String => true
133+
* case _ => false
134+
* }
135+
* Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")
136+
* ```
137+
*/
129138
type Filter[Tup <: Tuple, P[_] <: Boolean] <: Tuple = Tup match {
130139
case EmptyTuple => EmptyTuple
131140
case h *: t => P[h] match {

0 commit comments

Comments
 (0)