1
1
package com .thoughtworks
2
2
3
- private [thoughtworks] sealed trait LowPrirorityExtractor {
4
-
3
+ private [thoughtworks] sealed trait LowPriorityExtractor {
4
+
5
5
sealed trait SeqExtractor [- A , + B ] {
6
6
def unapplySeq (a : A ): Option [Seq [B ]]
7
7
}
8
-
9
- implicit final class OptionFunctionToSeqExtractor [- A , + B ] private [LowPrirorityExtractor ](underlying : A => Option [Seq [B ]]) {
8
+
9
+ implicit final class OptionFunctionToSeqExtractor [- A , + B ] private [LowPriorityExtractor ](underlying : A => Option [Seq [B ]]) {
10
10
def extractSeq = new SeqExtractor [A , B ] {
11
11
def unapplySeq (a : A ) = underlying(a)
12
12
}
13
13
}
14
14
15
- implicit final class OptionFunctionToExtractor [- A , + B ] private [LowPrirorityExtractor ](underlying : A => Option [B ]) {
15
+ implicit final class OptionFunctionToExtractor [- A , + B ] private [LowPriorityExtractor ](underlying : A => Option [B ]) {
16
16
def extract = new Extractor [A , B ] {
17
17
def unapply (a : A ) = underlying(a)
18
18
}
@@ -27,6 +27,7 @@ sealed trait Extractor[-A, +B] {
27
27
def unapply (a : A ): Option [B ]
28
28
}
29
29
30
+
30
31
/**
31
32
* Utilities to convert between `A => Option[B]`, `PartialFunction[A, B]` and [[Extractor ]].
32
33
*
@@ -64,7 +65,7 @@ sealed trait Extractor[-A, +B] {
64
65
}}}
65
66
*
66
67
*/
67
- object Extractor extends LowPrirorityExtractor {
68
+ object Extractor extends LowPriorityExtractor {
68
69
69
70
implicit final class PartialFunctionToSeqExtractor [- A , + B ] private [Extractor ](underlying : PartialFunction [A , Seq [B ]]) {
70
71
def extractSeq = new SeqExtractor [A , B ] {
@@ -84,4 +85,4 @@ object Extractor extends LowPrirorityExtractor {
84
85
}
85
86
}
86
87
87
- }
88
+ }
0 commit comments