InvariantFunctor

trait InvariantFunctor[F[_]]

Unary type constructor that supports an xmap operation that converts an F[A] to an F[B] given two functions, A => B and B => A.

An invariant functor must satisfy two laws:

  • identity - xmap(ma)(identity, identity) == ma
  • composite - xmap(xmap(ma, f1, g1), f2, g2) == xmap(ma, f2 compose f1, g1, compose g2)

Also known as an exponential functor.

See also
Companion
object
class Object
trait Matchable
class Any
trait Contravariant[F]
trait Divide[F]
trait Divisible[F]
trait Functor[F]
trait Align[F]
trait Apply[F]
trait Applicative[F]
trait MonadPlus[F]
trait IsomorphismMonadTell[F, G, S]
trait Monad[F]
trait MonadError[F, S]
trait MonadReader[F, S]
trait MonadState[F, S]
trait MonadTell[F, S]
trait MonadListen[F, W]
trait MonadIO[F]
trait MonadCatchIO[M]
trait RegionTMonad[S, M]
trait Bind[F]
trait BindRec[F]
trait IsomorphismBind[F, G]
trait Cobind[F]
trait Comonad[F]
trait ComonadStore[F, S]
trait Distributive[F]
trait Traverse[F]
trait Traverse1[F]

Type members

Classlikes

Value members

Abstract methods

def xmap[A, B](ma: F[A], f: A => B, g: B => A): F[B]

Converts ma to a value of type F[B] using the provided functions f and g.

Converts ma to a value of type F[B] using the provided functions f and g.

Concrete methods

def xmapb[A, B](ma: F[A])(b: Bijection[A, B]): F[B]

Converts ma to a value of type F[B] using the provided bijection.

Converts ma to a value of type F[B] using the provided bijection.

def xmapi[A, B](ma: F[A])(iso: IsoSet[A, B]): F[B]

Converts ma to a value of type F[B] using the provided isomorphism.

Converts ma to a value of type F[B] using the provided isomorphism.