object
BifunctorUsage extends App
Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
def
args: Array[String]
-
final
def
asInstanceOf[T0]: T0
-
val
bff: Bifunctor[[α, β]List[\/[α, β]]]
-
val
bfres: List[\/[String, Int]]
-
def
clone(): AnyRef
-
-
-
val
executionStart: Long
-
def
finalize(): Unit
-
val
fourTwo: (Int, Int)
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
val
leftF: Functor[[α$0$]\/[α$0$, String]]
-
def
main(args: Array[String]): Unit
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
val
rightF: Functor[[β$1$]\/[String, β$1$]]
-
val
strlen: (String) ⇒ Int
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Deprecated Value Members
-
def
delayedInit(body: ⇒ Unit): Unit
A Bifunctor is very similar to a Functor, which you are hopefully already familiar with. Whereas a Functor operates on a * → * and has a single operation
map
which takes a function from A => B to map a F[A] to a F[B], a Bifunctor operates on a *,* → * and has a single operationbimap
which takes two functions: A => C and a B => D to map a F[A,B] to a F[C,D]:def bimap[A, B, C, D](fab: F[A, B])(f: A => C, g: B => D): F[C, D]
some examples of common types for which we have Bifunctor instances are Either, Validation, \/, Tuple2