ParseableHeaderInstances

object ParseableHeaderInstances extends Functor[ParseableHeader] with SemigroupK[ParseableHeader]
trait SemigroupK[ParseableHeader]
trait Functor[ParseableHeader]
trait Invariant[ParseableHeader]
trait Serializable
class Object
trait Matchable
class Any

Value members

Concrete methods

override def combineK[A](x: ParseableHeader[A], y: ParseableHeader[A]): ParseableHeader[A]
Definition Classes
SemigroupK
override def map[A, B](fa: ParseableHeader[A])(f: A => B): ParseableHeader[B]
Definition Classes
Functor

Inherited methods

def algebra[A]: Semigroup[ParseableHeader[A]]

Given a type A, create a concrete Semigroup[F[A]].

Given a type A, create a concrete Semigroup[F[A]].

Example:

scala> import cats.implicits._
scala> val s: Semigroup[List[Int]] = SemigroupK[List].algebra[Int]
Inherited from:
SemigroupK
def as[A, B](fa: ParseableHeader[A], b: B): ParseableHeader[B]

Replaces the A value in F[A] with the supplied value.

Replaces the A value in F[A] with the supplied value.

Example:

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForList

scala> Functor[List].as(List(1,2,3), "hello")
res0: List[String] = List(hello, hello, hello)
Inherited from:
Functor
def combineAllOptionK[A](as: IterableOnce[ParseableHeader[A]]): Option[ParseableHeader[A]]

Given a sequence of as, combine them and return the total.

Given a sequence of as, combine them and return the total.

If the sequence is empty, returns None. Otherwise, returns Some(total).

Example:

scala> SemigroupK[List].combineAllOptionK(List(List("One"), List("Two"), List("Three")))
res0: Option[List[String]] = Some(List(One, Two, Three))

scala> SemigroupK[List].combineAllOptionK[String](List.empty)
res1: Option[List[String]] = None
Inherited from:
SemigroupK
def combineKEval[A](x: ParseableHeader[A], y: Eval[ParseableHeader[A]]): Eval[ParseableHeader[A]]

Similar to combineK but uses Eval to allow for laziness in the second argument. This can allow for "short-circuiting" of computations.

Similar to combineK but uses Eval to allow for laziness in the second argument. This can allow for "short-circuiting" of computations.

NOTE: the default implementation of combineKEval does not short-circuit computations. For data structures that can benefit from laziness, SemigroupK instances should override this method.

In the following example, x.combineK(bomb) would result in an error, but combineKEval "short-circuits" the computation. x is Some and thus the result of bomb doesn't even need to be evaluated in order to determine that the result of combineKEval should be x.

scala> import cats.{Eval, Later}
scala> import cats.implicits._
scala> val bomb: Eval[Option[Int]] = Later(sys.error("boom"))
scala> val x: Option[Int] = Some(42)
scala> x.combineKEval(bomb).value
res0: Option[Int] = Some(42)
Inherited from:
SemigroupK
def combineNK[A](a: ParseableHeader[A], n: Int): ParseableHeader[A]

Return a combined with itself n times.

Return a combined with itself n times.

Example:

scala> SemigroupK[List].combineNK(List(1), 5)
res0: List[Int] = List(1, 1, 1, 1, 1)

Inherited from:
SemigroupK
def compose[G[_]]: SemigroupK[[α] =>> ParseableHeader[G[α]]]

"Compose" with a G[_] type to form a SemigroupK for λ[α => F[G[α]]]. Note that this universally works for any G, because the "inner" structure isn't considered when combining two instances.

"Compose" with a G[_] type to form a SemigroupK for λ[α => F[G[α]]]. Note that this universally works for any G, because the "inner" structure isn't considered when combining two instances.

Example:

scala> import cats.implicits._
scala> type ListOption[A] = List[Option[A]]
scala> val s: SemigroupK[ListOption] = SemigroupK[List].compose[Option]
scala> s.combineK(List(Some(1), None, Some(2)), List(Some(3), None))
res0: List[Option[Int]] = List(Some(1), None, Some(2), Some(3), None)
Inherited from:
SemigroupK
def compose[G[_] : Functor]: Functor[[α] =>> ParseableHeader[G[α]]]
Inherited from:
Functor
def compose[G[_] : Invariant]: Invariant[[α] =>> ParseableHeader[G[α]]]

Compose Invariant F[_] and G[_] then produce Invariant[F[G[_]]] using their imap.

Compose Invariant F[_] and G[_] then produce Invariant[F[G[_]]] using their imap.

Example:

scala> import cats.implicits._
scala> import scala.concurrent.duration._

scala> val durSemigroupList: Semigroup[List[FiniteDuration]] =
    | Invariant[Semigroup].compose[List].imap(Semigroup[List[Long]])(Duration.fromNanos)(_.toNanos)
scala> durSemigroupList.combine(List(2.seconds, 3.seconds), List(4.seconds))
res1: List[FiniteDuration] = List(2 seconds, 3 seconds, 4 seconds)
Inherited from:
Invariant
override def composeContravariant[G[_] : Contravariant]: Contravariant[[α] =>> ParseableHeader[G[α]]]
Definition Classes
Functor -> Invariant
Inherited from:
Functor
def composeFunctor[G[_] : Functor]: Invariant[[α] =>> ParseableHeader[G[α]]]

Compose Invariant F[_] and Functor G[_] then produce Invariant[F[G[_]]] using F's imap and G's map.

Compose Invariant F[_] and Functor G[_] then produce Invariant[F[G[_]]] using F's imap and G's map.

Example:

scala> import cats.implicits._
scala> import scala.concurrent.duration._

scala> val durSemigroupList: Semigroup[List[FiniteDuration]] =
    | Invariant[Semigroup]
    |   .composeFunctor[List]
    |   .imap(Semigroup[List[Long]])(Duration.fromNanos)(_.toNanos)
scala> durSemigroupList.combine(List(2.seconds, 3.seconds), List(4.seconds))
res1: List[FiniteDuration] = List(2 seconds, 3 seconds, 4 seconds)
Inherited from:
Invariant
final def fmap[A, B](fa: ParseableHeader[A])(f: A => B): ParseableHeader[B]

Alias for map, since map can't be injected as syntax if the implementing type already had a built-in .map method.

Alias for map, since map can't be injected as syntax if the implementing type already had a built-in .map method.

Example:

scala> import cats.implicits._

scala> val m: Map[Int, String] = Map(1 -> "hi", 2 -> "there", 3 -> "you")

scala> m.fmap(_ ++ "!")
res0: Map[Int,String] = Map(1 -> hi!, 2 -> there!, 3 -> you!)
Inherited from:
Functor
def fproduct[A, B](fa: ParseableHeader[A])(f: A => B): ParseableHeader[(A, B)]

Tuple the values in fa with the result of applying a function with the value

Tuple the values in fa with the result of applying a function with the value

Example:

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForOption

scala> Functor[Option].fproduct(Option(42))(_.toString)
res0: Option[(Int, String)] = Some((42,42))
Inherited from:
Functor
def fproductLeft[A, B](fa: ParseableHeader[A])(f: A => B): ParseableHeader[(B, A)]

Pair the result of function application with A.

Pair the result of function application with A.

Example:

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForOption

scala> Functor[Option].fproductLeft(Option(42))(_.toString)
res0: Option[(String, Int)] = Some((42,42))
Inherited from:
Functor
def ifF[A](fb: ParseableHeader[Boolean])(ifTrue: => A, ifFalse: => A): ParseableHeader[A]

Lifts if to Functor

Lifts if to Functor

Example:

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForList

scala> Functor[List].ifF(List(true, false, false))(1, 0)
res0: List[Int] = List(1, 0, 0)
Inherited from:
Functor
override def imap[A, B](fa: ParseableHeader[A])(f: A => B)(g: B => A): ParseableHeader[B]
Definition Classes
Functor -> Invariant
Inherited from:
Functor
def lift[A, B](f: A => B): ParseableHeader[A] => ParseableHeader[B]

Lift a function f to operate on Functors

Lift a function f to operate on Functors

Example:

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForOption

scala> val o = Option(42)
scala> Functor[Option].lift((x: Int) => x + 10)(o)
res0: Option[Int] = Some(52)
Inherited from:
Functor
def reverse: SemigroupK[ParseableHeader]

return a semigroupK that reverses the order so combineK(a, b) == reverse.combineK(b, a)

return a semigroupK that reverses the order so combineK(a, b) == reverse.combineK(b, a)

Inherited from:
SemigroupK
def sum[A, B](fa: ParseableHeader[A], fb: ParseableHeader[B])(implicit F: Functor[ParseableHeader]): ParseableHeader[Either[A, B]]

Combines F[A] and F[B] into a F[Either[A,B]]].

Combines F[A] and F[B] into a F[Either[A,B]]].

Example:

scala> import cats.SemigroupK
scala> import cats.data.NonEmptyList
scala> SemigroupK[NonEmptyList].sum(NonEmptyList.one("abc"), NonEmptyList.one(2))
res0: NonEmptyList[Either[String,Int]] = NonEmptyList(Left(abc), Right(2))
Inherited from:
SemigroupK
def tupleLeft[A, B](fa: ParseableHeader[A], b: B): ParseableHeader[(B, A)]

Tuples the A value in F[A] with the supplied B value, with the B value on the left.

Tuples the A value in F[A] with the supplied B value, with the B value on the left.

Example:

scala> import scala.collection.immutable.Queue
scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForQueue

scala> Functor[Queue].tupleLeft(Queue("hello", "world"), 42)
res0: scala.collection.immutable.Queue[(Int, String)] = Queue((42,hello), (42,world))
Inherited from:
Functor
def tupleRight[A, B](fa: ParseableHeader[A], b: B): ParseableHeader[(A, B)]

Tuples the A value in F[A] with the supplied B value, with the B value on the right.

Tuples the A value in F[A] with the supplied B value, with the B value on the right.

Example:

scala> import scala.collection.immutable.Queue
scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForQueue

scala> Functor[Queue].tupleRight(Queue("hello", "world"), 42)
res0: scala.collection.immutable.Queue[(String, Int)] = Queue((hello,42), (world,42))
Inherited from:
Functor
def unzip[A, B](fab: ParseableHeader[(A, B)]): (ParseableHeader[A], ParseableHeader[B])

Un-zips an F[(A, B)] consisting of element pairs or Tuple2 into two separate F's tupled.

Un-zips an F[(A, B)] consisting of element pairs or Tuple2 into two separate F's tupled.

NOTE: Check for effect duplication, possibly memoize before

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForList

scala> Functor[List].unzip(List((1,2), (3, 4)))
res0: (List[Int], List[Int]) = (List(1, 3),List(2, 4))
Inherited from:
Functor
def void[A](fa: ParseableHeader[A]): ParseableHeader[Unit]

Empty the fa of the values, preserving the structure

Empty the fa of the values, preserving the structure

Example:

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForList

scala> Functor[List].void(List(1,2,3))
res0: List[Unit] = List((), (), ())
Inherited from:
Functor
def widen[A, B >: A](fa: ParseableHeader[A]): ParseableHeader[B]

Lifts natural subtyping covariance of covariant Functors.

Lifts natural subtyping covariance of covariant Functors.

NOTE: In certain (perhaps contrived) situations that rely on universal equality this can result in a ClassCastException, because it is implemented as a type cast. It could be implemented as map(identity), but according to the functor laws, that should be equal to fa, and a type cast is often much more performant. See this example of widen creating a ClassCastException.

Example:

scala> import cats.Functor
scala> import cats.implicits.catsStdInstancesForOption

scala> val s = Some(42)
scala> Functor[Option].widen(s)
res0: Option[Int] = Some(42)
Inherited from:
Functor