Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

43 lines (34 sloc) 974 Bytes
package cats.kernel
import scala.{specialized => sp}
/**
* A type class used to name the lower limit of a type.
*/
trait LowerBounded[@sp A] {
def partialOrder: PartialOrder[A]
/**
* Returns the lower limit of a type.
*/
def minBound: A
}
trait LowerBoundedFunctions[L[T] <: LowerBounded[T]] {
def minBound[@sp A](implicit ev: L[A]): A = ev.minBound
}
object LowerBounded extends LowerBoundedFunctions[LowerBounded] {
@inline def apply[A](implicit l: LowerBounded[A]): LowerBounded[A] = l
}
/**
* A type class used to name the upper limit of a type.
*/
trait UpperBounded[@sp A] {
def partialOrder: PartialOrder[A]
/**
* Returns the upper limit of a type.
*/
def maxBound: A
}
trait UpperBoundedFunctions[U[T] <: UpperBounded[T]] {
def maxBound[@sp A](implicit ev: U[A]): A = ev.maxBound
}
object UpperBounded extends UpperBoundedFunctions[UpperBounded] {
@inline def apply[A](implicit u: UpperBounded[A]): UpperBounded[A] = u
}
You can’t perform that action at this time.