trait Invariant[F[_]] extends Serializable
Must obey the laws defined in cats.laws.InvariantLaws.
- Self Type
- Invariant[F]
Linear Supertypes
Known Subclasses
Ordering
- Alphabetic
- By Inheritance
Inherited
- Invariant
- Serializable
- Serializable
- Any
- Hide All
- Show All
Visibility
- Public
- All
Abstract Value Members
-
abstract
def
getClass(): Class[_]
- Definition Classes
- Any
-
abstract
def
imap[A, B](fa: F[A])(f: (A) ⇒ B)(g: (B) ⇒ A): F[B]
Transform an
F[A]
into anF[B]
by providing a transformation fromA
toB
and one fromB
toA
.Transform an
F[A]
into anF[B]
by providing a transformation fromA
toB
and one fromB
toA
.Example:
scala> import cats.implicits._ scala> import scala.concurrent.duration._ scala> val durSemigroup: Semigroup[FiniteDuration] = | Invariant[Semigroup].imap(Semigroup[Long])(Duration.fromNanos)(_.toNanos) scala> durSemigroup.combine(2.seconds, 3.seconds) res1: FiniteDuration = 5 seconds
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def compose[G[_]](implicit arg0: Invariant[G]): Invariant[[α]F[G[α]]]
- def composeContravariant[G[_]](implicit arg0: Contravariant[G]): Invariant[[α]F[G[α]]]
- def composeFunctor[G[_]](implicit arg0: Functor[G]): Invariant[[α]F[G[α]]]
-
def
equals(arg0: Any): Boolean
- Definition Classes
- Any
-
def
hashCode(): Int
- Definition Classes
- Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
toString(): String
- Definition Classes
- Any