@@ -33,6 +33,29 @@ trait PartialNext[@sp A] {
33
33
def partialNext (a : A ): Option [A ]
34
34
}
35
35
36
+ object PartialNext {
37
+
38
+ def apply [A ](implicit A : PartialNext [A ]): PartialNext [A ] =
39
+ A
40
+
41
+ implicit def catsKernelPartialNextForUnit : PartialNext [Unit ] =
42
+ cats.kernel.instances.unit.catsKernelStdOrderForUnit
43
+ implicit def catsKernelPartialNextForBoolean : PartialNext [Boolean ] =
44
+ cats.kernel.instances.boolean.catsKernelStdOrderForBoolean
45
+ implicit def catsKernelPartialNextForByte : PartialNext [Byte ] =
46
+ cats.kernel.instances.byte.catsKernelStdOrderForByte
47
+ implicit def catsKernelPartialNextForInt : PartialNext [Int ] =
48
+ cats.kernel.instances.int.catsKernelStdOrderForInt
49
+ implicit def catsKernelPartialNextForShort : PartialNext [Short ] =
50
+ cats.kernel.instances.short.catsKernelStdOrderForShort
51
+ implicit def catsKernelPartialNextForLong : PartialNext [Long ] =
52
+ cats.kernel.instances.long.catsKernelStdOrderForLong
53
+ implicit def catsKernelPartialNextForChar : PartialNext [Char ] =
54
+ cats.kernel.instances.char.catsKernelStdOrderForChar
55
+ implicit def catsKernelPartialNextForBigInt : PartialNext [BigInt ] =
56
+ cats.kernel.instances.bigInt.catsKernelStdOrderForBigInt
57
+ }
58
+
36
59
/**
37
60
* A typeclass with an operation which returns a member which is
38
61
* always greater than the one supplied.
@@ -42,6 +65,14 @@ trait Next[@sp A] extends PartialNext[A] {
42
65
override def partialNext (a : A ): Option [A ] = Some (next(a))
43
66
}
44
67
68
+ object Next {
69
+ def apply [A ](implicit A : Next [A ]): Next [A ] =
70
+ A
71
+
72
+ implicit def catsKernelNextForBigInt : Next [BigInt ] =
73
+ cats.kernel.instances.bigInt.catsKernelStdOrderForBigInt
74
+ }
75
+
45
76
/**
46
77
* A typeclass with an operation which returns a member which is
47
78
* smaller or `None` than the one supplied.
@@ -51,6 +82,28 @@ trait PartialPrevious[@sp A] {
51
82
def partialPrevious (a : A ): Option [A ]
52
83
}
53
84
85
+ object PartialPrevious {
86
+ def apply [A ](implicit A : PartialPrevious [A ]): PartialPrevious [A ] =
87
+ A
88
+
89
+ implicit def catsKernelPartialPreviousForUnit : PartialPrevious [Unit ] =
90
+ cats.kernel.instances.unit.catsKernelStdOrderForUnit
91
+ implicit def catsKernelPartialPreviousForBoolean : PartialPrevious [Boolean ] =
92
+ cats.kernel.instances.boolean.catsKernelStdOrderForBoolean
93
+ implicit def catsKernelPartialPreviousForByte : PartialPrevious [Byte ] =
94
+ cats.kernel.instances.byte.catsKernelStdOrderForByte
95
+ implicit def catsKernelPartialPreviousForInt : PartialPrevious [Int ] =
96
+ cats.kernel.instances.int.catsKernelStdOrderForInt
97
+ implicit def catsKernelPartialPreviousForShort : PartialPrevious [Short ] =
98
+ cats.kernel.instances.short.catsKernelStdOrderForShort
99
+ implicit def catsKernelPartialPreviousForLong : PartialPrevious [Long ] =
100
+ cats.kernel.instances.long.catsKernelStdOrderForLong
101
+ implicit def catsKernelPartialPreviousForChar : PartialPrevious [Char ] =
102
+ cats.kernel.instances.char.catsKernelStdOrderForChar
103
+ implicit def catsKernelPartialPreviousForBigInt : PartialPrevious [BigInt ] =
104
+ cats.kernel.instances.bigInt.catsKernelStdOrderForBigInt
105
+ }
106
+
54
107
/**
55
108
* A typeclass with an operation which returns a member which is
56
109
* always smaller than the one supplied.
@@ -61,6 +114,14 @@ trait Previous[@sp A] extends PartialPrevious[A] {
61
114
override def partialPrevious (a : A ): Option [A ] = Some (previous(a))
62
115
}
63
116
117
+ object Previous {
118
+ def apply [A ](implicit A : Previous [A ]): Previous [A ] =
119
+ A
120
+
121
+ implicit def catsKernelPreviousForBigInt : Previous [BigInt ] =
122
+ cats.kernel.instances.bigInt.catsKernelStdOrderForBigInt
123
+ }
124
+
64
125
/**
65
126
* A typeclass which has both `previous` and `next` operations
66
127
* such that `next . previous == identity`.
@@ -70,6 +131,11 @@ trait UnboundedEnumerable[@sp A] extends Next[A] with Previous[A] {
70
131
override def partialOrder : PartialOrder [A ] = order
71
132
}
72
133
134
+ object UnboundedEnumerable {
135
+ def apply [A ](implicit A : UnboundedEnumerable [A ]): UnboundedEnumerable [A ] =
136
+ A
137
+ }
138
+
73
139
trait BoundedEnumerable [@ sp A ] extends PartialPreviousUpperBounded [A ] with PartialNextLowerBounded [A ] {
74
140
75
141
def order : Order [A ]
0 commit comments