scalaz

package scalaz

Type members

Classlikes

final case
class -\/[A, B](a: A) extends A \/ B

A left disjunction

A left disjunction

Often used to represent the failure case of a result

Companion
object
object -\/
Companion
class
sealed abstract
class /~\[A[_], B[_]]

Type-aligned pair. Isomorphic to

Type-aligned pair. Isomorphic to

(F[A], G[A]) forSome { type A }

but more robust with respect to type inference.

Notation is conjunction /\ blended with ~, which is often used to indicate higher kindedness.

Companion
object
object /~\
Companion
class
sealed
class :+:[M, N](rep: Vector[M \/ N])

The coproduct (or free product) of monoids M and N. Conceptually this is an alternating list of M and N values, with the identity as the empty list, and composition as list concatenation that combines adjacent elements when possible.

The coproduct (or free product) of monoids M and N. Conceptually this is an alternating list of M and N values, with the identity as the empty list, and composition as list concatenation that combines adjacent elements when possible.

Companion
object
object :+:
Companion
class
sealed abstract
class ==>>[A, B]

An immutable map of key/value pairs implemented as a balanced binary tree

An immutable map of key/value pairs implemented as a balanced binary tree

Based on Haskell's Data.Map

Since

7.0.3

Companion
object
object ==>> extends MapInstances
Companion
class
abstract
class Adjunction[F[_], G[_]](implicit val F: Functor[F], val G: Functor[G])

An adjunction formed by two functors F and G such that F is left-adjoint to G. The composite functor GF is a monad and the composite functor FG is a comonad.

An adjunction formed by two functors F and G such that F is left-adjoint to G. The composite functor GF is a monad and the composite functor FG is a comonad.

The minimal definition is either (unit, counit) or (leftAdjunct, rightAdjunct)

Companion
object
Companion
class
sealed abstract
trait Align[F[_]] extends Functor[F]
Companion
object
object Align
Companion
class
sealed abstract
class Alpha extends Product with Serializable

An algebraic data type representing the characters 'a' to 'z'

An algebraic data type representing the characters 'a' to 'z'

Companion
object
object Alpha extends AlphaInstances
Companion
class
sealed abstract
trait Alt[F[_]] extends Applicative[F] with InvariantAlt[F]

https://hackage.haskell.org/package/semigroupoids-5.2.2/docs/Data-Functor-Alt.html

object Alt
Companion
class
final case
class Alter[F[_], A](f: F[A])

Derive a Semigroup or Monoid instance from a Plus or PlusEmpty.

Derive a Semigroup or Monoid instance from a Plus or PlusEmpty.

https://hackage.haskell.org/package/reducers-3.12.1/docs/Data-Semigroup-Alt.html#t:Alter

Companion
object
object Alter extends AlterInstances
Companion
class
sealed abstract
sealed abstract
final case
class Ap[F[_], A](f: F[A])

Derive a Semigroup or Monoid instance from an Apply or Applicative.

Derive a Semigroup or Monoid instance from an Apply or Applicative.

https://hackage.haskell.org/package/reducers-3.12.1/docs/Data-Semigroup-Applicative.html#t:Ap

Companion
object
object Ap extends ApInstances
Companion
class
sealed abstract
sealed abstract
trait Applicative[F[_]] extends Apply[F] with InvariantApplicative[F]

Applicative Functor, described in Applicative Programming with Effects

Applicative Functor, described in Applicative Programming with Effects

Whereas a scalaz.Functor allows application of a pure function to a value in a context, an Applicative also allows application of a function in a context to a value in a context (ap).

It follows that a pure function can be applied to arguments in a context. (See apply2, apply3, ... )

Applicative instances come in a few flavours:

  • All scalaz.Monads are also Applicative
  • Any scalaz.Monoid can be treated as an Applicative (see scalaz.Monoid#applicative)
  • Zipping together corresponding elements of Naperian data structures (those of of a fixed, possibly infinite shape)
See also
Companion
object
Companion
class
trait ApplicativeError[F[_], S] extends Applicative[F]
Companion
object
Companion
class
trait ApplicativePlus[F[_]] extends Applicative[F] with PlusEmpty[F]
Companion
class
trait Apply[F[_]] extends Functor[F]

scalaz.Applicative without point.

scalaz.Applicative without point.

See also
Companion
object
object Apply
Companion
class
trait Arrow[=>:[_, _]] extends Split[=>:] with Strong[=>:] with Category[=>:]

A scalaz.Category supporting all ordinary functions, as well as combining arrows product-wise. Every Arrow forms a scalaz.Contravariant in one type parameter, and a scalaz.Applicative in the other, just as with ordinary functions.

A scalaz.Category supporting all ordinary functions, as well as combining arrows product-wise. Every Arrow forms a scalaz.Contravariant in one type parameter, and a scalaz.Applicative in the other, just as with ordinary functions.

Companion
object
object Arrow
Companion
class
trait Associative[=>:[_, _]]
Companion
object
Companion
class
trait Band[F] extends Semigroup[F]

scalaz.Semigroup which is also idempotent, i.e. appending a value with itself results in the same value.

scalaz.Semigroup which is also idempotent, i.e. appending a value with itself results in the same value.

See also
Companion
object
object Band
Companion
class
trait BiConstrainedNaturalTransformation[F[_, _], G[_, _], C[_], E[_]]

A constrained transformation natural in both sides of a bifunctor

A constrained transformation natural in both sides of a bifunctor

trait BiNaturalTransformation[-F[_, _], +G[_, _]]

A function universally quantified over two parameters.

A function universally quantified over two parameters.

trait Bifoldable[F[_, _]]

A type giving rise to two unrelated scalaz.Foldables.

A type giving rise to two unrelated scalaz.Foldables.

Companion
object
object Bifoldable
Companion
class
trait Bifunctor[F[_, _]]

A type giving rise to two unrelated scalaz.Functors.

A type giving rise to two unrelated scalaz.Functors.

Companion
object
object Bifunctor
Companion
class
final
class BijectionT[F[_], G[_], A, B]
Companion
object
Companion
class
sealed abstract
sealed abstract
trait Bind[F[_]] extends Apply[F]

An scalaz.Apply functor, where a lifted function can introduce new values and new functor context to be incorporated into the lift context. The essential new operation of scalaz.Monads.

An scalaz.Apply functor, where a lifted function can introduce new values and new functor context to be incorporated into the lift context. The essential new operation of scalaz.Monads.

See also
Companion
object
object Bind
Companion
class
trait BindRec[F[_]] extends Bind[F]

scalaz.Bind capable of using constant stack space when doing recursive binds.

scalaz.Bind capable of using constant stack space when doing recursive binds.

Implementations of tailrecM should not make recursive calls without the @tailrec annotation.

Based on Phil Freeman's work on stack safety in PureScript, described in Stack Safety for Free.

Companion
object
object BindRec
Companion
class
trait Bitraverse[F[_, _]] extends Bifunctor[F] with Bifoldable[F]

A type giving rise to two unrelated scalaz.Traverses.

A type giving rise to two unrelated scalaz.Traverses.

Companion
object
object Bitraverse
Companion
class
sealed abstract
Companion
object
sealed abstract
object Catchable
Companion
class
trait Category[=>:[_, _]] extends Compose[=>:]

scalaz.Compose with identity.

scalaz.Compose with identity.

See also
Companion
object
object Category
Companion
class
trait Choice[=>:[_, _]] extends Category[=>:]
Companion
object
object Choice
Companion
class
trait Cobind[F[_]] extends Functor[F]
Companion
object
object Cobind
Companion
class
abstract
class Codensity[F[_], A]
Companion
object
Companion
class
sealed abstract
sealed abstract
class Cofree[S[_], A]

A cofree comonad for some functor S, i.e. an S-branching stream.

A cofree comonad for some functor S, i.e. an S-branching stream.

Companion
object
object Cofree extends CofreeInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Cohoist[F[_[_], _]] extends ComonadTrans[F]
Companion
object
object Cohoist
Companion
class
final case
class Cokleisli[F[_], A, B](run: F[A] => B)
Companion
object
Companion
class
sealed abstract
sealed abstract
trait Comonad[F[_]] extends Cobind[F]
Companion
object
object Comonad
Companion
class
trait ComonadStore[F[_], S] extends Comonad[F]
Companion
object
Companion
class
trait ComonadTrans[F[_[_], _]]
Companion
object
Companion
class
trait Compose[=>:[_, _]]
Companion
object
object Compose
Companion
class
final case
class Const[A, B](getConst: A)
Companion
object
object Const extends ConstInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
trait ConstrainedNaturalTransformation[F[_], G[_], E[_]]

A constrained natural transformation

A constrained natural transformation

trait Contravariant[F[_]] extends InvariantFunctor[F]

Contravariant functors. For example, functions provide a scalaz.Functor in their result type, but a scalaz.Contravariant for each argument type.

Contravariant functors. For example, functions provide a scalaz.Functor in their result type, but a scalaz.Contravariant for each argument type.

Note that the dual of a scalaz.Functor is just a scalaz.Functor itself.

Providing an instance of this is a useful alternative to marking a type parameter with - in Scala.

See also
Companion
object
Companion
class
sealed abstract
class ContravariantCoyoneda[F[_], A]

Decomposition of fi.contramap(k) into its components, as it is frequently convenient to apply k separately from sorting or whatever process with fi, even when B is unknown, which is very common.

Decomposition of fi.contramap(k) into its components, as it is frequently convenient to apply k separately from sorting or whatever process with fi, even when B is unknown, which is very common.

This is isomorphic to F as long as F itself is a contravariant functor. The homomorphism from F[A] to ContravariantCoyoneda[F,A] exists even when F is not a contravariant functor.

See ContravariantCoyonedaUsage.scala in the scalaz source tree for an interesting usage demonstration.

As ContravariantCoyoneda(o)(identity).unlift = o, further factoring can occur as follows, for free:

ContravariantCoyoneda(o contramap g)(f).unlift =
 ContravariantCoyoneda(o)(g compose f).unlift
See also
Companion
object
sealed abstract
final case
class Coproduct[F[_], G[_], A](run: F[A] \/ G[A])

F on the left, and G on the right, of scalaz.\/.

F on the left, and G on the right, of scalaz.\/.

Value Params
run

The underlying scalaz.\/.

Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
class Cord

A Cord is a purely functional data structure for efficiently creating a String from smaller parts, useful for printing ADTs that must write out their contents into a text format.

A Cord is a purely functional data structure for efficiently creating a String from smaller parts, useful for printing ADTs that must write out their contents into a text format.

A z interpolator is available for building String from literals, using the Show typeclass to populate each "hole", and a cord interpolator for building Cord instances.

If a more efficient solution is required to write a large String to a network socket or file, consider https://github.com/scalaz/scalaz/issues/1797

If you require a general text manipulation data structure, consider using FingerTree or creating a custom structure to resemble that used by the popular text editors:

Companion
object
object Cord
Companion
class
sealed abstract

The corecursive list; i.e. the arguments to unfold saved off to a data structure. Generally does not have methods itself; as with scalaz.NonEmptyList, it provides typeclass instances instead, and you typically import typeclass syntax to get methods.

The corecursive list; i.e. the arguments to unfold saved off to a data structure. Generally does not have methods itself; as with scalaz.NonEmptyList, it provides typeclass instances instead, and you typically import typeclass syntax to get methods.

The corecursive list can be a very efficient way to represent "listlike" things in some cases; because it is so unlike "normal" collections, though, it's important to understand how its operations are implemented and what their performance characteristics are going to be. For example, using cons iteratively to add a bunch of elements to the beginning of a scala.collection.immutable.List is very efficient; it's very ''inefficient'' for corecursive list.

Operations are generally designed to preserve the isomorphism with scalaz.EphemeralStream; for example, ap could be a "zipping" ap, but instead is a less efficient "combination" style. This means that the scalaz.Monad has the same behavior as that of scalaz.EphemeralStream and more traditional strict list structures.

Companion
object
sealed abstract
abstract
class Corepresentable[F[_], X]()(implicit evidence$1: Contravariant[F])

Corepresentable functors

Corepresentable functors

sealed abstract
class Coyoneda[F[_], A]

The dual view of the Yoneda lemma. Also a free functor on F. This is isomorphic to F as long as F itself is a functor. The homomorphism from F[A] to Coyoneda[F,A] exists even when F is not a functor.

The dual view of the Yoneda lemma. Also a free functor on F. This is isomorphic to F as long as F itself is a functor. The homomorphism from F[A] to Coyoneda[F,A] exists even when F is not a functor.

Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Cozip[F[_]]
Companion
object
object Cozip
Companion
class
final
class DList[A]

Difference lists: a data structure for O(1) append on lists. Based on Data.DList, a Haskell library by Don Stewart.

Difference lists: a data structure for O(1) append on lists. Based on Data.DList, a Haskell library by Don Stewart.

A difference list is a function that given a list, returns the original contents of the difference list prepended at the given list.

This structure supports O(1) append and snoc operations on lists, making it very useful for append-heavy uses, such as logging and pretty printing.

Companion
object
object DList extends DListInstances
Companion
class
sealed abstract
trait Day[F[_], G[_], A]

Covariant Day Convolution

Covariant Day Convolution

Based on Edward Kmett implementation in Haskell: https://hackage.haskell.org/package/kan-extensions/docs/Data-Functor-Day.html

Day convolution is a special form of Functor multiplication. In monoidal category of endofunctors Applicative is a monoid object when Day covolution is used as tensor. If we use Functor composition as tensor then then monoid form a Monad instead of Applicative.

Can be seen as generalization of method apply2 from Apply:

def apply2(fa => F[A], fb => F[B])(f: (A, B) => C): F[C]

trait Day[F[_], G[_], A] { self =>
 // ...
 val fx: F[X]
 val gy: G[Y]
 def xya: (X, Y) => A
}
See also
Companion
object
object Day extends DayInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Decidable[F[_]] extends Divisible[F] with InvariantAlt[F]
object Decidable
Companion
class
trait Density[F[_], Y]

Density Comonad.

Density Comonad.

Density is Left Kan Extension where both Functors are the same.

Without any restrictions on F we can define Functor, Cobind, Comonad for Density[F]. Density is Comonad for free.

See also
Companion
object
object Density extends DensityInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
class Dequeue[A]

A Double-ended queue, based on the Bankers Double Ended Queue as described by C. Okasaki in "Purely Functional Data Structures"

A Double-ended queue, based on the Bankers Double Ended Queue as described by C. Okasaki in "Purely Functional Data Structures"

A queue that allows items to be put onto either the front (cons) or the back (snoc) of the queue in constant time, and constant time access to the element at the very front or the very back of the queue. Dequeueing an element from either end is constant time when amortized over a number of dequeues.

This queue maintains an invariant that whenever there are at least two elements in the queue, neither the front list nor back list are empty. In order to maintain this invariant, a dequeue from either side which would leave that side empty constructs the resulting queue by taking elements from the opposite side

Companion
object
object Dequeue extends DequeueInstances
Companion
class
sealed abstract
trait DiNaturalTransformation[F[_, _], G[_, _]]
sealed abstract
class Diev[A]

Implementation of a Discrete Interval Encoding Tree https://web.engr.oregonstate.edu/~erwig/diet/ that is actually implemented using a Vector and is balanced at all times as a result.

Implementation of a Discrete Interval Encoding Tree https://web.engr.oregonstate.edu/~erwig/diet/ that is actually implemented using a Vector and is balanced at all times as a result.

Companion
object
object Diev extends DievInstances
Companion
class
sealed abstract
sealed abstract
class Digit extends Product with Serializable

An algebraic data type representing the digits 0 - 9

An algebraic data type representing the digits 0 - 9

Companion
object
object Digit extends DigitInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Distributive[F[_]] extends Functor[F]

Dual of scalaz.Traverse. To transform F[G[B]] to G[F[B]], you may use Traverse[F] and Applicative[G], but alternatively Functor[F] and Distributive[G], which permits greater sharing and nonstrictness.

Dual of scalaz.Traverse. To transform F[G[B]] to G[F[B]], you may use Traverse[F] and Applicative[G], but alternatively Functor[F] and Distributive[G], which permits greater sharing and nonstrictness.

Companion
object
Companion
class
trait Divide[F[_]] extends Contravariant[F]

Divide is the contravariant analogue of scalaz.Apply

Divide is the contravariant analogue of scalaz.Apply

See also
Companion
object
object Divide
Companion
class
trait Divisible[F[_]] extends Divide[F] with InvariantApplicative[F]

Divisible is the contravariant analogue of scalaz.Applicative

object Divisible
Companion
class
object Dual extends DualInstances
sealed abstract
sealed abstract
sealed abstract
class Either3[A, B, C] extends Product with Serializable
Companion
object
object Either3
Companion
class
final case
class EitherT[A, F[_], B](run: F[A \/ B])

Represents a computation of type F[A \/ B].

Represents a computation of type F[A \/ B].

Example:

val x: Option[String \/ Int] = Some(\/-(1))
EitherT(x).map(1+).run // Some(\/-(2))
Companion
object
object EitherT extends EitherTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
final case
class Endo[A](run: A => A)

Endomorphisms. They have special properties among functions, so are captured in this newtype.

Endomorphisms. They have special properties among functions, so are captured in this newtype.

Value Params
run

The captured function.

Companion
object
object Endo extends EndoInstances
Companion
class
final case
class EndoByName[A](run: (=> A) => A)

Endomorphisms using by-name evaluation. They have special properties among functions, so are captured in this newtype.

Endomorphisms using by-name evaluation. They have special properties among functions, so are captured in this newtype.

Value Params
run

The captured function.

Companion
object
Companion
class
sealed abstract
sealed abstract
final case
class Endomorphic[=>:[_, _], A](run: A =>: A)

Endomorphisms have special properties among arrows, so are captured in this newtype.

Endomorphisms have special properties among arrows, so are captured in this newtype.

Endomorphic[Function1, A] is equivalent to Endo[A]

Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Enum[F] extends Order[F]

An scalaz.Orderable with discrete values.

An scalaz.Orderable with discrete values.

Companion
object
object Enum
Companion
class
sealed abstract

Like scala.collection.immutable.Stream, but doesn't save computed values. As such, it can be used to represent similar things, but without the space leak problem frequently encountered using that type.

Like scala.collection.immutable.Stream, but doesn't save computed values. As such, it can be used to represent similar things, but without the space leak problem frequently encountered using that type.

Companion
object
sealed abstract
trait Equal[F]

A type safe alternative to universal equality (scala.Any#==).

A type safe alternative to universal equality (scala.Any#==).

See also
Companion
object
object Equal
Companion
class
final case
class Failure[E, A](e: E) extends Validation[E, A]
sealed abstract
class FingerTree[V, A](implicit measurer: Reducer[A, V])

Finger trees with leaves of type A and Nodes that are annotated with type V.

Finger trees with leaves of type A and Nodes that are annotated with type V.

Finger Trees provide a base for implementations of various collection types, as described in "Finger trees: a simple general-purpose data structure", by Ralf Hinze and Ross Paterson. A gentle introduction is presented in the blog post "Monoids and Finger Trees" by Heinrich Apfelmus.

This is done by choosing a suitable type to annotate the nodes. For example, a binary tree can be implemented by annotating each node with the size of its subtree, while a priority queue can be implemented by labelling the nodes by the minimum priority of its children.

The operations on FingerTree enforce the constraint measured (in the form of a Reducer instance).

Finger Trees have excellent (amortized) asymptotic performance:

  • Access to the first and last elements is O(1)
  • Appending/prepending a single value is O(1)
  • Concatenating two trees is (O lg min(l1, l2)) where l1 and l2 are their sizes
  • Random access to an element at n is O(lg min(n, l - n)), where l is the size of the tree.
  • Constructing a tree with n copies of a value is O(lg n).
Type Params
A

The type of the elements stored at the leaves

V

The type of the annotations of the nodes (the '''measure''')

See also
Companion
object
Companion
class
sealed abstract
trait FoldCase[A]
Companion
object
Companion
class
sealed abstract
trait Foldable[F[_]]

A type parameter implying the ability to extract zero or more values of that type.

A type parameter implying the ability to extract zero or more values of that type.

Companion
object
object Foldable
Companion
class
trait Foldable1[F[_]] extends Foldable[F]

A scalaz.Foldable where foldMap is total over semigroups. That is, toList cannot return an empty list.

A scalaz.Foldable where foldMap is total over semigroups. That is, toList cannot return an empty list.

Companion
object
object Foldable1
Companion
class
trait Forall[P[_]]

A universally quantified value

A universally quantified value

Companion
object
object Forall extends Foralls
Companion
class
trait Foralls
object Free extends FreeInstances
Companion
class
sealed abstract
class Free[S[_], A] extends FreeFunctions[S, A]

A free monad for a type constructor S. Binding is done using the heap instead of the stack, allowing tail-call elimination.

A free monad for a type constructor S. Binding is done using the heap instead of the stack, allowing tail-call elimination.

Companion
object
sealed abstract
class FreeAp[F[_], A]

Free applicative functors. Less expressive than free monads, but more flexible to inspect and interpret.

Free applicative functors. Less expressive than free monads, but more flexible to inspect and interpret.

Companion
object
object FreeAp
Companion
class
trait FreeFunctions[S[_], A]
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
object FreeT extends FreeTInstances
Companion
class
sealed abstract
class FreeT[S[_], M[_], A]
Companion
object
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Functor[F[_]] extends InvariantFunctor[F]

Functors, covariant by nature if not by Scala type. Their key operation is map, whose behavior is constrained only by type and the functor laws.

Functors, covariant by nature if not by Scala type. Their key operation is map, whose behavior is constrained only by type and the functor laws.

Many useful functors also have natural scalaz.Apply or scalaz.Bind operations. Many also support scalaz.Traverse.

See also
Companion
object
object Functor
Companion
class
trait Generator[C, Elem]

Generator a class of container of elements that knows how to efficiently apply a scalaz.Reducer to extract an answer by combining elements. A Reducer may supply efficient left-to-right and right-to-left reduction strategies that a Generator may avail itself of.

Generator a class of container of elements that knows how to efficiently apply a scalaz.Reducer to extract an answer by combining elements. A Reducer may supply efficient left-to-right and right-to-left reduction strategies that a Generator may avail itself of.

Companion
object
object Generator extends Generators
Companion
class
sealed abstract
class Heap[A]

An efficient, asymptotically optimal, implementation of priority queues extended with support for efficient size.

An efficient, asymptotically optimal, implementation of priority queues extended with support for efficient size.

The implementation of 'Heap' is based on bootstrapped skew binomial heaps as described by: G. Brodal and C. Okasaki , "Optimal Purely Functional Priority Queues", Journal of Functional Programming 6:839-857 (1996),

Based on the heaps Haskell library by Edward Kmett

Companion
object
object Heap extends HeapInstances
Companion
class
sealed abstract
trait Hoist[F[_[_], _]] extends MonadTrans[F]
Companion
object
object Hoist
Companion
class
final case
class ICons[A](head: A, tail: IList[A]) extends IList[A]
sealed abstract
class IList[A] extends Product with Serializable

Safe, invariant alternative to stdlib List. Most methods on List have a sensible equivalent here, either on the IList interface itself or via typeclass instances (which are the same as those defined for stdlib List). All methods are total and stack-safe.

Safe, invariant alternative to stdlib List. Most methods on List have a sensible equivalent here, either on the IList interface itself or via typeclass instances (which are the same as those defined for stdlib List). All methods are total and stack-safe.

Companion
object
object IList extends IListInstances
Companion
class
sealed abstract
sealed abstract
sealed case
class INil[A] extends IList[A]
Companion
object
object INil
Companion
class
object ISet extends ISetInstances
Companion
class
sealed abstract
sealed abstract
class IStream[A]

A linked list with by-name head and tail, allowing some control over memory usage and evaluation of contents.

A linked list with by-name head and tail, allowing some control over memory usage and evaluation of contents.

This structure is a good choice when the contents are expensive to calculate and may not all need to be evaluated, at the cost of an overhead when the contents are calculated. Typeclass instances try to defer evaluation of contents, unless it would require a full traversal of the spine, preferring lazy semantics when an evaluation choice is to be made.

Companion
object
object IStream
Companion
class
object Id extends IdInstances

Mixed into object Id in the package object scalaz.

Mixed into object Id in the package object scalaz.

final case
class IdT[F[_], A](run: F[A])
Companion
object
object IdT extends IdTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
class ImmutableArray[+A]

An immutable wrapper for arrays

An immutable wrapper for arrays

Type Params
A

type of the elements of the array

Companion
object
sealed abstract
final
class IndSeq[A](val self: FingerTree[Int, A])

Indexed sequences, based on scalaz.FingerTree

Indexed sequences, based on scalaz.FingerTree

The measure is the count of the preceding elements, provided by UnitReducer((e: Int) => 1).

Companion
object
object IndSeq extends IndSeqInstances
Companion
class
sealed abstract
final case
class IndexedContsT[W[_], R, O, M[_], A](_run: W[A => M[O]] => M[R])
Companion
object
sealed abstract
sealed abstract
sealed abstract
sealed abstract
class IndexedReaderWriterStateT[R, W, S1, S2, F[_], A]

A monad transformer stack yielding (R, S1) => F[(W, A, S2)].

A monad transformer stack yielding (R, S1) => F[(W, A, S2)].

Companion
object
sealed abstract
class IndexedStateT[S1, S2, F[_], A]
Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
final case
class IndexedStoreT[F[_], I, A, B](run: (F[A => B], I))
See also
Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
class Inject[F[_], G[_]] extends NaturalTransformation[F, G]

Inject type class as described in "Data types a la carte" (Swierstra 2008).

Inject type class as described in "Data types a la carte" (Swierstra 2008).

See also
Companion
object
object Inject extends InjectInstances
Companion
class
sealed abstract
case
class Injective[T[_]]()

Given Injective[Foo]: If type Foo[A] = Foo[B] then A ~ B

Given Injective[Foo]: If type Foo[A] = Foo[B] then A ~ B

This represents an assertion that is used by other code that requires this condition.

case
class Injective2[T[_, _]]()
case
class Injective3[T[_, _, _]]()
case
class Injective4[T[_, _, _, _]]()
case
class Injective5[T[_, _, _, _, _]]()
trait InvariantAlt[F[_]] extends InvariantApplicative[F]

Invariant parent of Decidable and Alternative.

Invariant parent of Decidable and Alternative.

Used for typeclass derivation of products, coproducts and value types.

Companion
object
Companion
class
trait InvariantApplicative[F[_]] extends InvariantFunctor[F]

Invariant parent of Divisible and Applicative.

Invariant parent of Divisible and Applicative.

Used for typeclass derivation of products and value types.

Companion
object
Companion
class
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.

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
Companion
class
trait IsContravariant[F[_]]

Type constructors that are contravariant with respect to subtyping.

Type constructors that are contravariant with respect to subtyping.

A type constructor F[_] admits an instance IsContravariant[F] iff F[B] is a subtype of F[A] whenever A is a subtype of B.

The Scala language represents this natively using the [-A] notation on type constructors. The factory scalaContravariant provides an instance of this typeclass for any such type. However, type constructors which behave contravariantly despite not being thus notated can also implement this typeclass. The factory force constructs an instance of IsContravariant for any type, based on the programmer's assertion that it is indeed contravariant.

Note the relationship between this typeclass and Contravariant: whereas Contravariant instances are contravariant functors in the "category" of Scala types and functions, instances of this typeclass are contravariant functors in the "category" of Scala types and subtyping relations.

Companion
object
Companion
class
trait IsCovariant[F[_]]

Type constructors that are covariant with respect to subtyping.

Type constructors that are covariant with respect to subtyping.

A type constructor F[_] admits an instance IsCovariant[F] iff F[A] is a subtype of F[B] whenever A is a subtype of B.

The Scala language represents this natively using the [+A] notation on type constructors. The factory scalaCovariant provides an instance of this typeclass for any such type. However, type constructors which behave covariantly despite not being thus notated can also implement this typeclass. The factory force constructs an instance of IsCovariant for any type, based on the programmer's assertion that it is indeed covariant.

Note the relationship between this typeclass and Functor: whereas Functor instances are covariant functors in the "category" of Scala types and functions, instances of this typeclass are covariant functors in the "category" of Scala types and subtyping relations.

Companion
object
Companion
class
trait IsEmpty[F[_]] extends PlusEmpty[F]

Typeclass that permits testing whether some type with an empty representation is in fact empty.

Typeclass that permits testing whether some type with an empty representation is in fact empty.

Companion
object
object IsEmpty
Companion
class
sealed
trait IsoBifunctorTemplate0[F[_, _], G[_, _]]
sealed
trait IsoFunctorTemplate0[F[_], G[_]]
object Isomorphism extends Isomorphisms
trait IsomorphismAlign[F[_], G[_]] extends Align[F] with IsomorphismFunctor[F, G]
trait IsomorphismAlt[F[_], G[_]] extends Alt[F] with IsomorphismApplicative[F, G] with IsomorphismInvariantAlt[F, G]
trait IsomorphismApplicativeError[F[_], G[_], S] extends ApplicativeError[F, S] with IsomorphismApplicative[F, G]
trait IsomorphismApply[F[_], G[_]] extends Apply[F] with IsomorphismFunctor[F, G]
trait IsomorphismArrow[F[_, _], G[_, _]] extends Arrow[F] with IsomorphismSplit[F, G] with IsomorphismStrong[F, G] with IsomorphismCategory[F, G]
trait IsomorphismAssociative[F[_, _], G[_, _]] extends Associative[F]
trait IsomorphismBand[F, G] extends Band[F] with IsomorphismSemigroup[F, G]
trait IsomorphismBifoldable[F[_, _], G[_, _]] extends Bifoldable[F]
trait IsomorphismBifunctor[F[_, _], G[_, _]] extends Bifunctor[F]
trait IsomorphismBind[F[_], G[_]] extends Bind[F] with IsomorphismApply[F, G]
trait IsomorphismBindRec[F[_], G[_]] extends BindRec[F] with IsomorphismBind[F, G]
trait IsomorphismBitraverse[F[_, _], G[_, _]] extends Bitraverse[F] with IsomorphismBifunctor[F, G] with IsomorphismBifoldable[F, G]
trait IsomorphismCatchable[F[_], G[_]] extends Catchable[F]
trait IsomorphismCategory[F[_, _], G[_, _]] extends Category[F] with IsomorphismCompose[F, G]
trait IsomorphismChoice[F[_, _], G[_, _]] extends Choice[F] with IsomorphismCategory[F, G]
trait IsomorphismCobind[F[_], G[_]] extends Cobind[F] with IsomorphismFunctor[F, G]
trait IsomorphismComonad[F[_], G[_]] extends Comonad[F] with IsomorphismCobind[F, G]
trait IsomorphismComonadStore[F[_], G[_], S] extends ComonadStore[F, S] with IsomorphismComonad[F, G]
trait IsomorphismCompose[F[_, _], G[_, _]] extends Compose[F]
trait IsomorphismCozip[F[_], G[_]] extends Cozip[F]
trait IsomorphismDecidable[F[_], G[_]] extends Decidable[F] with IsomorphismDivisible[F, G] with IsomorphismInvariantAlt[F, G]
trait IsomorphismDistributive[F[_], G[_]] extends Distributive[F] with IsomorphismFunctor[F, G]
trait IsomorphismDivide[F[_], G[_]] extends Divide[F] with IsomorphismContravariant[F, G]
trait IsomorphismEnum[F, G] extends Enum[F] with IsomorphismOrder[F, G]
trait IsomorphismEqual[F, G] extends Equal[F]
trait IsomorphismFoldable[F[_], G[_]] extends Foldable[F]
trait IsomorphismFoldable1[F[_], G[_]] extends Foldable1[F] with IsomorphismFoldable[F, G]
trait IsomorphismFunctor[F[_], G[_]] extends Functor[F] with IsomorphismInvariantFunctor[F, G]
trait IsomorphismInvariantFunctor[F[_], G[_]] extends InvariantFunctor[F]
trait IsomorphismIsEmpty[F[_], G[_]] extends IsEmpty[F] with IsomorphismPlusEmpty[F, G]
trait IsomorphismMonad[F[_], G[_]] extends Monad[F] with IsomorphismApplicative[F, G] with IsomorphismBind[F, G]
trait IsomorphismMonadError[F[_], G[_], S] extends MonadError[F, S] with IsomorphismMonad[F, G] with IsomorphismApplicativeError[F, G, S]
trait IsomorphismMonadPlus[F[_], G[_]] extends MonadPlus[F] with IsomorphismMonad[F, G] with IsomorphismApplicativePlus[F, G]
trait IsomorphismMonadReader[F[_], G[_], S] extends MonadReader[F, S] with IsomorphismMonad[F, G]
trait IsomorphismMonadState[F[_], G[_], S] extends MonadState[F, S] with IsomorphismMonad[F, G]
trait IsomorphismMonadTell[F[_], G[_], S] extends MonadTell[F, S] with IsomorphismMonad[F, G]
trait IsomorphismMonoid[F, G] extends Monoid[F] with IsomorphismSemigroup[F, G]
trait IsomorphismNondeterminism[F[_], G[_]] extends Nondeterminism[F] with IsomorphismMonad[F, G]
trait IsomorphismOptional[F[_], G[_]] extends Optional[F]
trait IsomorphismOrder[F, G] extends Order[F] with IsomorphismEqual[F, G]
trait IsomorphismPlus[F[_], G[_]] extends Plus[F]
trait IsomorphismPlusEmpty[F[_], G[_]] extends PlusEmpty[F] with IsomorphismPlus[F, G]
trait IsomorphismProChoice[F[_, _], G[_, _]] extends ProChoice[F] with IsomorphismProfunctor[F, G]
trait IsomorphismProfunctor[F[_, _], G[_, _]] extends Profunctor[F]
trait IsomorphismSemiLattice[F, G] extends SemiLattice[F] with IsomorphismBand[F, G]
trait IsomorphismSemigroup[F, G] extends Semigroup[F]
trait IsomorphismShow[F, G] extends Show[F]
trait IsomorphismSplit[F[_, _], G[_, _]] extends Split[F] with IsomorphismCompose[F, G]
trait IsomorphismStrong[F[_, _], G[_, _]] extends Strong[F] with IsomorphismProfunctor[F, G]
trait IsomorphismTraverse[F[_], G[_]] extends Traverse[F] with IsomorphismFunctor[F, G] with IsomorphismFoldable[F, G]
trait IsomorphismTraverse1[F[_], G[_]] extends Traverse1[F] with IsomorphismTraverse[F, G] with IsomorphismFoldable1[F, G]
trait IsomorphismUnzip[F[_], G[_]] extends Unzip[F]
trait IsomorphismZip[F[_], G[_]] extends Zip[F]
sealed abstract
final case
class Kleisli[M[_], A, B](run: A => M[B])

Represents a function A => M[B].

Represents a function A => M[B].

Companion
object
object Kleisli extends KleisliInstances
Companion
class
abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Konst[A]
trait Lan[G[_], H[_], A]

The left Kan extension of H along G

The left Kan extension of H along G

Companion
object
object Lan extends LanInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
class LazyEither[A, B]

scala.Either, but with a value by name.

scala.Either, but with a value by name.

Companion
object
Companion
class
sealed abstract
final case
class LazyEitherT[F[_], A, B](run: F[LazyEither[A, B]])
Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
class LazyOption[A] extends Product with Serializable

scala.Option, but with a value by name.

scala.Option, but with a value by name.

Companion
object
Companion
class
sealed abstract
final case
class LazyOptionT[F[_], A](run: F[LazyOption[A]])
Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
object LazyTuple
sealed abstract
class LazyTuple2[A, B]

scala.Tuple2, but with values by name.

scala.Tuple2, but with values by name.

Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
class LazyTuple3[A, B, C]

scala.Tuple3, but with values by name.

scala.Tuple3, but with values by name.

Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
class LazyTuple4[A, B, C, D]

scala.Tuple4, but with values by name.

scala.Tuple4, but with values by name.

Companion
object
Companion
class
sealed abstract
sealed abstract
final case
class Left3[A, B, C](a: A) extends Either3[A, B, C]
sealed abstract
class Leibniz[-L, +H >: L, A >: L <: H, B >: L <: H]

Leibnizian equality: a better =:=

Leibnizian equality: a better =:=

This technique was first used in Typing Dynamic Typing (Baars and Swierstra, ICFP 2002).

It is generalized here to handle subtyping so that it can be used with constrained type constructors.

Leibniz[L,H,A,B] says that A = B, and that both of its types are between L and H. Subtyping lets you loosen the bounds on L and H.

If you just need a witness that A = B, then you can use A===B which is a supertype of any Leibniz[L,H,A,B]

The more refined types are useful if you need to be able to substitute into restricted contexts.

Companion
object
object Leibniz extends LeibnizInstances
Companion
class
sealed abstract
class LeibnizF[A[_], B[_]]
Companion
object
object LeibnizF
Companion
class
sealed abstract
object Lens extends LensInstances with LensFunctions
See also
sealed abstract
class LensFamily[A1, A2, B1, B2]

A Lens Family, offering a purely functional means to access and retrieve a field transitioning from type B1 to type B2 in a record simultaneously transitioning from type A1 to type A2. scalaz.Lens is a convenient alias for when A1 === A2, and B1 === B2.

A Lens Family, offering a purely functional means to access and retrieve a field transitioning from type B1 to type B2 in a record simultaneously transitioning from type A1 to type A2. scalaz.Lens is a convenient alias for when A1 === A2, and B1 === B2.

The term ''field'' should not be interpreted restrictively to mean a member of a class. For example, a lens family can address membership of a Set.

Type Params
A1

The initial type of the record

A2

The final type of the record

B1

The initial type of the field

B2

The final type of the field

See also
Companion
object
Companion
class
abstract
sealed abstract
sealed abstract
class Liskov[-A, +B]

Liskov substitutability: A better <:<

Liskov substitutability: A better <:<

A <: B holds whenever A could be used in any negative context that expects a B. (e.g. if you could pass an A into any function that expects a B.)

Companion
object
object Liskov extends LiskovInstances
Companion
class
sealed abstract
class LiskovF[-A[_], +B[_]]
Companion
object
object LiskovF
Companion
class
sealed abstract
final case
class ListT[M[_], A](run: M[IList[A]])

ListT monad transformer.

ListT monad transformer.

Companion
object
object ListT extends ListTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
class Maybe[A]

An optional value

An optional value

A Maybe[A] will either be a wrapped A instance (Just[A]), or a lack of underlying A instance (Empty[A]).

Maybe[A] is isomorphic to Option[A], however there are some differences between the two. Maybe is invariant in A while Option is covariant. Maybe[A] does not expose an unsafe get operation to access the underlying A value (that may not exist) like Option[A] does. Maybe[A] does not come with an implicit conversion to Iterable[A] (a trait with over a dozen super types).

Companion
object
object Maybe extends MaybeInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
final case
class MaybeT[F[_], A](run: F[Maybe[A]])

monad transformer for Maybe

monad transformer for Maybe

Companion
object
object MaybeT extends MaybeTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
class Memo[@specialized(Int) K, @specialized(Int, Long, Double) V]

A function memoization strategy. See companion for various instances employing various strategies.

A function memoization strategy. See companion for various instances employing various strategies.

Companion
object
object Memo extends MemoInstances
Companion
class
sealed abstract
final case
class Middle3[A, B, C](b: B) extends Either3[A, B, C]
trait Monad[F[_]] extends Applicative[F] with Bind[F]

Monad, an scalaz.Applicative that also supports scalaz.Bind, circumscribed by the monad laws.

Monad, an scalaz.Applicative that also supports scalaz.Bind, circumscribed by the monad laws.

See also
Companion
object
object Monad
Companion
class
trait MonadError[F[_], S] extends Monad[F] with ApplicativeError[F, S]
Companion
object
object MonadError
Companion
class
trait MonadListen[F[_], W] extends MonadTell[F, W]
Companion
object
Companion
class
trait MonadPlus[F[_]] extends Monad[F] with ApplicativePlus[F]
object MonadPlus
Companion
class
trait MonadReader[F[_], S] extends Monad[F]
Companion
object
Companion
class
trait MonadState[F[_], S] extends Monad[F]

The class of monads supporting the operations of scalaz.State.

The class of monads supporting the operations of scalaz.State.

Companion
object
object MonadState
Companion
class
trait MonadTell[F[_], S] extends Monad[F]

The class of monads supporting write operations

The class of monads supporting write operations

Companion
object
object MonadTell
Companion
class
trait MonadTrans[F[_[_], _]]

Class of monad transformers.

Class of monad transformers.

Companion
object
object MonadTrans
Companion
class
trait Monoid[F] extends Semigroup[F]

Provides an identity element (zero) to the binary append operation in scalaz.Semigroup, subject to the monoid laws.

Provides an identity element (zero) to the binary append operation in scalaz.Semigroup, subject to the monoid laws.

Example instances:

  • Monoid[Int]: zero and append are 0 and Int#+ respectively
  • Monoid[List[A]]: zero and append are Nil and List#++ respectively

References:

See also
Companion
object
object Monoid
Companion
class
sealed abstract
class Name[A]

Call by name

Call by name

Companion
object
object Name
Companion
class
trait NaturalTransformation[F[_], G[_]]

A universally quantified function, usually written as F ~> G, for symmetry with A => B.

A universally quantified function, usually written as F ~> G, for symmetry with A => B.

Can be used to encode first-class functor transformations in the same way functions encode first-class concrete value morphisms; for example, sequence from scalaz.Traverse and cosequence from scalaz.Distributive give rise to ([a]T[A[a]]) ~> ([a]A[T[a]]), for varying A and T constraints.

Companion
object
final
class Need[A] extends Name[A]

Call by need

Call by need

Companion
object
object Need
Companion
class
final
class NonEmptyList[A]

A singly-linked list that is guaranteed to be non-empty.

A singly-linked list that is guaranteed to be non-empty.

Companion
object
Companion
class
sealed abstract
sealed abstract
trait Nondeterminism[F[_]] extends Monad[F]

A context supporting nondeterministic choice. Unlike Monad.bind, which imposes a total order on the sequencing of effects throughout a computation, the choose and chooseAny operations let us partially order the sequencing of effects. Canonical instances are concurrent.Future and concurrent.Task, which run their arguments in parallel, returning whichever comes back 'first'.

A context supporting nondeterministic choice. Unlike Monad.bind, which imposes a total order on the sequencing of effects throughout a computation, the choose and chooseAny operations let us partially order the sequencing of effects. Canonical instances are concurrent.Future and concurrent.Task, which run their arguments in parallel, returning whichever comes back 'first'.

TODO - laws

Companion
object
Companion
class
sealed
trait NotNothing[A]
Companion
object
object NotNothing
Companion
class
final
class NullArgument[A, B]
Companion
object
Companion
class
sealed abstract
sealed abstract
final
class NullResult[A, B]
Companion
object
Companion
class
sealed abstract
sealed abstract
final
class OneAnd[F[_], A]

A generalization of NonEmptyList to non-List things. For example, OneAnd[Vector, A] is a non-empty Vector of A.

A generalization of NonEmptyList to non-List things. For example, OneAnd[Vector, A] is a non-empty Vector of A.

Only head and tail are provided as direct methods, because there's little you can do with a OneAnd without knowing a bit about F. So useful functions are provided in the form of typeclass instances on OneAnd's companion; in combination with syntax extensions provided by scalaz.syntax, OneAnd has a large possible set of methods available by importing. For example, Applicative on this requires ApplicativePlus[F], and Traverse1 on this requires Traverse[F]. See the companion documentation for a complete list of instances.

Additionally, unlike λ[α => (α, F[α])], the behavior of typeclass operations on OneAnd should be preserved across the natural transformation to scalaz.NonEmptyList where one exists. That is it should "be like" a nonempty structure. For example, ap-ing two OneAnd[Vector, *]s or NonEmptyLists of lengths a and b yields a sequence of same type of length a×b, but two λ[α => (α, Vector[α])]s of length c and d ap to one of length 1+(c–1)×(d–1). For another example, point of the former two yield a one-element sequence, but point of the latter yields a two-element sequence.

Since

7.0.3

Companion
object
object OneAnd extends OneAndInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
final case
class OneOr[F[_], A](run: F[A] \/ A)
Since

7.0.3

Companion
object
object OneOr extends OneOrInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
final case
class OptionT[F[_], A](run: F[Option[A]])

OptionT monad transformer.

OptionT monad transformer.

Companion
object
object OptionT extends OptionTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Optional[F[_]]

Abstraction over a container/context which may or may not provide a value.

Abstraction over a container/context which may or may not provide a value.

Type Params
F

the container/context type

See also
Companion
object
object Optional
Companion
class
sealed abstract
class OrdSeq[A] extends Ops[FingerTree[A @@ LastVal, A]]

Ordered sequences, based on scalaz.FingerTree

Ordered sequences, based on scalaz.FingerTree

a has a higher priority than b if Order[A].greaterThan(a, b).

insert and ++ maintains the ordering.

The measure is calculated with a Semigroup[A @@ LastVal], whose append operation favours the first argument. Accordingly, the measure of a node is the item with the highest priority contained recursively below that node.

Companion
object
object OrdSeq
Companion
class
trait Order[F] extends Equal[F]

Safer version of scala.math.Ordering.

Safer version of scala.math.Ordering.

Companion
object
object Order
Companion
class
sealed abstract
class Ordering(val toInt: Int, val name: String) extends Product with Serializable

A ternary marker of how two values relate in an ordering.

A ternary marker of how two values relate in an ordering.

Note

scalaz calls its version of scala.math.Ordering, scalaz.Order. This Ordering is analogous to the Ints returned by scala.math.Ordering.

Companion
object
Companion
class
sealed abstract
object PLens extends PLensInstances with PLensFunctions
sealed abstract
class PLensFamily[A1, A2, B1, B2]

Partial Lens Families, offering a purely functional means to access and retrieve an optional field transitioning from type B1 to type B2 in a record that is simultaneously transitioning from type A1 to type A2. scalaz.PLens is a convenient alias for when A1 === A2, and B1 === B2.

Partial Lens Families, offering a purely functional means to access and retrieve an optional field transitioning from type B1 to type B2 in a record that is simultaneously transitioning from type A1 to type A2. scalaz.PLens is a convenient alias for when A1 === A2, and B1 === B2.

The term ''field'' should not be interpreted restrictively to mean a member of a class. For example, a partial lens family can address the nth element of a List.

Type Params
A1

The initial type of the record

A2

The final type of the record

B1

The initial type of the optional field

B2

The final type of the optional field

See also
Companion
object
Companion
class
abstract
trait Plus[F[_]]

Universally quantified scalaz.Semigroup.

Universally quantified scalaz.Semigroup.

Companion
object
object Plus
Companion
class
trait PlusEmpty[F[_]] extends Plus[F]

Universally quantified scalaz.Monoid.

Universally quantified scalaz.Monoid.

Companion
object
object PlusEmpty
Companion
class
class PrioritySearchQueue[A, P, K]

Container whose elements have two different orders: by priority and by lookup key.

Container whose elements have two different orders: by priority and by lookup key.

Supports efficient implementation of the following operations:

  • insertion (O(log n)),
  • lookup by key (O(log n)),
  • deletion by key (O(log n)),
  • access to minimal-by-priority element (O(1)),
  • deletion of minimal-by-priority element (O(log n)).

Implemented using FingerTree.

Type Params
A

element type

K

lookup key. Unique—the queue holds at most one element with any given key.

P

priority of an element. Multiple elements can have the same priority.

Companion
object
Companion
class
trait ProChoice[=>:[_, _]] extends Profunctor[=>:]

Strength on a coproduct.

Strength on a coproduct.

Companion
object
object ProChoice
Companion
class
trait Profunctor[=>:[_, _]]

Profunctors are covariant on the right and contravariant on the left.

Profunctors are covariant on the right and contravariant on the left.

Companion
object
object Profunctor
Companion
class
trait Ran[G[_], H[_], A]

The right Kan extension of H along G

The right Kan extension of H along G

Companion
object
object Ran
Companion
class
object Reader
object ReaderT
trait Reducer[C, M]

A Reducer[C,M] is a scalaz.Semigroup[M] that maps values of type C through unit to values of type M. A C-Reducer may also supply operations which tack on another C to an existing Semigroup M on the left or right. These specialized reductions may be more efficient in some scenarios and are used when appropriate by a scalaz.Generator. The names cons and snoc work by analogy to the synonymous operations in the list semigroup.

A Reducer[C,M] is a scalaz.Semigroup[M] that maps values of type C through unit to values of type M. A C-Reducer may also supply operations which tack on another C to an existing Semigroup M on the left or right. These specialized reductions may be more efficient in some scenarios and are used when appropriate by a scalaz.Generator. The names cons and snoc work by analogy to the synonymous operations in the list semigroup.

Minimal definition: unit or snoc

Based on the Reducer Haskell library by Edward Kmett (https://hackage.haskell.org/package/reducers).

Companion
object
object Reducer extends ReducerInstances
Companion
class
sealed abstract
abstract
class Representable[F[_], X](implicit val F: Functor[F])

Representable functors, that is to say, those with isomorphisms to and from [a](X => a). As such, all typeclasses and operations on [a](X => a), that is, fixed in X, can be trivially derived for F.

Representable functors, that is to say, those with isomorphisms to and from [a](X => a). As such, all typeclasses and operations on [a](X => a), that is, fixed in X, can be trivially derived for F.

Companion
object
sealed abstract
final case
class Right3[A, B, C](c: C) extends Either3[A, B, C]
case

This object was generated by sbt-buildinfo.

This object was generated by sbt-buildinfo.

object Select
object SelectT extends SelectTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait SemiLattice[F] extends Band[F]

scalaz.Band which is also commutative, i.e. A + B == B + A

scalaz.Band which is also commutative, i.e. A + B == B + A

See also
Companion
object
Companion
class
trait Semigroup[F]

An associative binary operation, circumscribed by type and the semigroup laws. Unlike scalaz.Monoid, there is not necessarily a zero.

An associative binary operation, circumscribed by type and the semigroup laws. Unlike scalaz.Monoid, there is not necessarily a zero.

See also
Companion
object
object Semigroup
Companion
class
trait Show[F]

A typeclass for conversion to textual representation, done via scalaz.Cord for efficiency.

A typeclass for conversion to textual representation, done via scalaz.Cord for efficiency.

Companion
object
object Show
Companion
class
trait Split[=>:[_, _]] extends Compose[=>:]

A scalaz.Compose (semigroupoid) permitting products.

A scalaz.Compose (semigroupoid) permitting products.

Companion
object
object Split
Companion
class
object State extends StateFunctions
abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
object Store
abstract
sealed abstract
sealed abstract
sealed abstract
sealed
class StreamT[M[_], A](val step: M[Step[A, StreamT[M, A]]])

StreamT monad transformer.

StreamT monad transformer.

Companion
object
object StreamT extends StreamTInstances
Companion
class
sealed abstract
sealed abstract
case
class StrictTree[A](rootLabel: A, subForest: Vector[StrictTree[A]])
Value Params
rootLabel

The label at the root of this tree.

subForest

The child nodes of this tree.

Companion
object
Companion
class
sealed abstract
final
class StrictTreeUnzip[A1, A2](root: StrictTree[(A1, A2)]) extends AnyVal
trait Strong[=>:[_, _]] extends Profunctor[=>:]

Strength on a product.

Strength on a product.

Companion
object
object Strong
Companion
class
final case
class Success[E, A](a: A) extends Validation[E, A]
object Tag
sealed abstract
class TagKind
object Tags

Type tags that are used to discriminate between alternative type class instances.

Type tags that are used to discriminate between alternative type class instances.

See also

scalaz.Tag and, @@ in the package object scalaz .

final case
class Tannen[F[_], G[_, _], A, B](f: F[G[A, B]])

Composes a Functor on the outside of a Bifunctor.

object Tannen extends TannenInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
final case
class TheseT[F[_], A, B](run: F[A \&/ B])
Companion
object
object TheseT extends TheseTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
object TracedT extends TracedTInstances
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
object Trampoline
trait Traverse[F[_]] extends Functor[F] with Foldable[F]

Idiomatic traversal of a structure, as described in The Essence of the Iterator Pattern.

Idiomatic traversal of a structure, as described in The Essence of the Iterator Pattern.

See also
Companion
object
object Traverse
Companion
class
trait Traverse1[F[_]] extends Traverse[F] with Foldable1[F]

A scalaz.Traverse where traverse is total over scalaz.Applys. That is, toList cannot return an empty list.

A scalaz.Traverse where traverse is total over scalaz.Applys. That is, toList cannot return an empty list.

Companion
object
object Traverse1
Companion
class
sealed abstract
class Tree[A]

A multi-way tree, also known as a rose tree. Also known as Cofree[Stream, A].

A multi-way tree, also known as a rose tree. Also known as Cofree[Stream, A].

Companion
object
object Tree extends TreeInstances
Companion
class
sealed abstract
final case
class TreeLoc[A](tree: Tree[A], lefts: TreeForest[A], rights: TreeForest[A], parents: Parents[A])

A rose-tree zipper. Represents a scalaz.Tree together with a position in that tree. Provides navigation, persistent update, insertion, and deletes.

A rose-tree zipper. Represents a scalaz.Tree together with a position in that tree. Provides navigation, persistent update, insertion, and deletes.

Value Params
lefts

The left siblings of the current node.

parents

The parent contexts of the current node.

rights

The right siblings of the current node.

tree

The currently selected node.

Companion
object
object TreeLoc extends TreeLocInstances
Companion
class
sealed abstract
@implicitNotFound("Implicit not found: scalaz.Unapply[${TC}, ${MA}]. Unable to unapply type `${MA}` into a type constructor of kind `M[_]` that is classified by the type class `${TC}`. Check that the type class is defined by compiling `implicitly[${TC}[type constructor]]` and review the implicits in object Unapply, which only cover common type \'shapes.\'")
trait Unapply[TC[_[_]], MA]

Represents a type MA that has been destructured into as a type constructor M[_] applied to type A, along with a corresponding type class instance TC[M].

Represents a type MA that has been destructured into as a type constructor M[_] applied to type A, along with a corresponding type class instance TC[M].

The implicit conversions in the companion object provide a means to obtain type class instances for partially applied type constructors, in lieu of direct compiler support as described in SI-2712.

// Directly depending on Applicative[G]
def traverse[G[_], B](f: A => G[B])(implicit G: Applicative[G]): G[F[B]] =
 G.traverse(self)(f)

// Indirect lookup of the Applicative instance
def traverseI[GB](f: A => GB)(implicit G: Unapply[Applicative, GB]): G.M[F[G.A]] /*G[F[B]*/ = {
 G.TC.traverse(self)(a => G(f(a)))
}

// Deforested version of traverseI
def traverseI2[GB](f: A => GB)(implicit G: Unapply[Applicative, GB]): G.M[F[G.A]] /*G[F[B]*/ = {
 G.TC.traverse(self)(G.leibniz.onF(f))
}

// Old usage
def stateTraverse1 {
 import scalaz._, Scalaz._
 import State.{State, stateMonad}
 val ls = List(1, 2, 3)
 val traverseOpt: Option[List[Int]] = ls.traverse(a => Some(a))
 val traverseState: State[Int, List[Int]] = ls.traverse[State[Int, *], Int](a => State((x: Int) => (x + 1, a)))
}

// New usage
def stateTraverse2 {
 import scalaz._, Scalaz._
 val ls = List(1, 2, 3)
 val traverseOpt: Option[List[Int]] = ls.traverseI(a => some(a))
 val traverseState = ls.traverseI(a => State((x: Int) => (x + 1, a)))
}

Credits to Miles Sabin.

Companion
object
object Unapply extends Unapply_0
Companion
class
trait Unapply2[TC[_[_, _]], MAB]
Companion
object
object Unapply2
Companion
class
trait Unapply21[TC[_[_, _], _], MAB]
Companion
object
object Unapply21
Companion
class
trait UnapplyProduct[TC[_[_]], MA, MB]
Companion
object
Companion
class
sealed abstract
class Unapply_0 extends Unapply_2
sealed abstract
class Unapply_2 extends Unapply_3
sealed abstract
class Unapply_3 extends Unapply_4
sealed abstract
class Unapply_4
sealed abstract
class UnitReducer[C, M] extends Reducer[C, M]
Companion
object
Companion
class
object Unwriter
final case
class UnwriterT[F[_], U, A](run: F[(U, A)])

This data type is isomorphic to WriterT, however, it is NOT a monad.

This data type is isomorphic to WriterT, however, it is NOT a monad.

It implements flatMap+map and drops the write value. There is no Monoid or Semigroup required. There is no point operation. You can switch between WriterT and UnwriterT with unary_+ and unary_-.

Companion
object
sealed abstract
sealed abstract
sealed abstract
sealed abstract
trait Unzip[F[_]]
Companion
object
object Unzip
Companion
class
sealed abstract
class Validation[E, A] extends Product with Serializable

Represents either:

Represents either:

  • Success(a), or
  • Failure(e).

Isomorphic to scala.Either and scalaz.\/. The motivation for a Validation is to provide the instance Applicative[[a]Validation[E, a]] that accumulate failures through a scalaz.Semigroup[E].

scalaz.NonEmptyList is commonly chosen as a type constructor for the type E. As a convenience, an alias scalaz.ValidationNel[E] is provided as a shorthand for scalaz.Validation[NonEmptyList[E]], and a method Validation#toValidationNel converts Validation[E] to ValidationNel[E].

Example:

import scalaz._, std.AllInstances._

def parseInt(s: String): Validation[String, Int] =
 try { Success(s.toInt) } catch { case ex: NumberFormatException => Failure(ex.getMessage) }
val V = Applicative[ValidationNel[String, *]]

val x: ValidationNel[String, Int] =
 V.apply2(parseInt("1.x").toValidationNel, parseInt("1..0").toValidationNel)(_ * _)
 // Failure(NonEmptyList(For input string: "1..0", For input string: "1.x"))
Type Params
A

The type of the Success

E

The type of the Failure

Companion
object
Companion
class
final
class ValidationFlatMap[E, A] extends AnyVal
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
final case
class Value[A](value: A) extends Name[A]

Call by value

Call by value

Companion
object
object Value
Companion
class
object Writer
final case
class WriterT[W, F[_], A](run: F[(W, A)])
Companion
object
Companion
class
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
sealed abstract
abstract
class Yoneda[F[_], A]

The cofree functor generated by F. The Yoneda lemma says that Yoneda[F,A] is isomorphic to F[A] for any functor F. The homomorphism from Yoneda[F,A] to F[A] exists even when we have forgotten that F is a functor. Can be seen as a partially applied map for the functor F.

The cofree functor generated by F. The Yoneda lemma says that Yoneda[F,A] is isomorphic to F[A] for any functor F. The homomorphism from Yoneda[F,A] to F[A] exists even when we have forgotten that F is a functor. Can be seen as a partially applied map for the functor F.

Companion
object
object Yoneda
Companion
class
trait Zap[F[_], G[_]]

Functors that annihilate each other.

Functors that annihilate each other.

Companion
object
object Zap extends ZapInstances
Companion
class
sealed abstract
trait Zip[F[_]]
Companion
object
object Zip
Companion
class
final case
class Zipper[A](lefts: Stream[A], focus: A, rights: Stream[A])

Provides a pointed stream, which is a non-empty zipper-like stream structure that tracks an index (focus) position in a stream. Focus can be moved forward and backwards through the stream, elements can be inserted before or after the focused position, and the focused item can be deleted.

Provides a pointed stream, which is a non-empty zipper-like stream structure that tracks an index (focus) position in a stream. Focus can be moved forward and backwards through the stream, elements can be inserted before or after the focused position, and the focused item can be deleted.

Based on the pointedlist library by Jeff Wheeler.

Companion
object
object Zipper extends ZipperInstances
Companion
class
sealed abstract
sealed abstract
class \&/[A, B] extends Product with Serializable
Since

7.0.3

Companion
object
object \&/ extends TheseInstances
Companion
class
sealed abstract
class \/[A, B] extends Product with Serializable

Represents a disjunction: a result that is either an A or a B.

Represents a disjunction: a result that is either an A or a B.

An instance of A \/ B is either a -\/[A] (aka a "left") or a \/-[B] (aka a "right").

A common use of a disjunction is to explicitly represent the possibility of failure in a result as opposed to throwing an exception. By convention, the left is used for errors and the right is reserved for successes. For example, a function that attempts to parse an integer from a string may have a return type of NumberFormatException \/ Int. However, since there is no need to actually throw an exception, the type (A) chosen for the "left" could be any type representing an error and has no need to actually extend Exception.

A \/ B is isomorphic to scala.Either[A, B], but \/ is right-biased for all Scala versions, so methods such as map and flatMap apply only in the context of the "right" case. This right bias makes \/ more convenient to use than scala.Either in a monadic context in Scala versions <2.12. Methods such as swap, swapped, and leftMap provide functionality that scala.Either exposes through left projections.

A \/ B is also isomorphic to Validation[A, B]. The subtle but important difference is that Applicative instances for Validation accumulates errors ("lefts") while Applicative instances for \/ fail fast on the first "left" they evaluate. This fail-fast behavior allows \/ to have lawful Monad instances that are consistent with their Applicative instances, while Validation cannot.

Companion
object
object \/ extends DisjunctionInstances
Companion
class
final case
class \/-[A, B](b: B) extends A \/ B

A right disjunction

A right disjunction

Often used to represent the success case of a result

Companion
object
object \/-
Companion
class
class unused extends deprecated

Mark an explicit or implicit parameter as known to be unused, as shorthand for the longer form, useful in combination with -Ywarn-unused:explicits,implicits compiler options.

Mark an explicit or implicit parameter as known to be unused, as shorthand for the longer form, useful in combination with -Ywarn-unused:explicits,implicits compiler options.

Deprecated classlikes

@deprecated("No laws, and Throwable is not referentially transparent. Prefer MonadError", "7.3.0")
trait Catchable[F[_]]

A context in which exceptions can be caught and thrown.

A context in which exceptions can be caught and thrown.

This class places no other class constraints on F, but it should be the case that exceptions raised via fail are caught by the nearest surrounding attempt and returned as a Left. In addition to catching explicitly raised exceptions via fail, we expect that attempt catch ambient exceptions that might occur when 'evaluating' an F.

We can state the requirement that attempt catch all ambient exceptions by stipulating that for all total functions of the form g: forall A . F[Throwable \/ A] => B, g compose attempt is also total.

Companion
object
Deprecated

Types

type :<:[F[_], G[_]] = Inject[F, G]
type :≺:[F[_], G[_]] = Inject[F, G]
type ===[A, B] = Leibniz[, , A, B]

(A === B) is a supertype of Leibniz[L,H,A,B]

(A === B) is a supertype of Leibniz[L,H,A,B]

type =?>[E, A] = Kleisli[Option, E, A]
type @>[A, B] = Lens[A, B]
See also
type @?>[A, B] = PLens[A, B]
See also
type @@[T, Tag] = T @@ Tag

Tag a type T with Tag.

Tag a type T with Tag.

The resulting type is used to discriminate between type class instances.

See also

scalaz.Tag and scalaz.Tags Credit to Miles Sabin for the idea.

type Cont[R, A] = ContT[R, Id, A]
type ContT[R, M[_], A] = ContsT[Id, R, M, A]
type Conts[W[_], R, A] = ContsT[W, R, Id, A]
type ContsT[W[_], R, M[_], A] = IndexedContsT[W, R, R, M, A]
type DLeft[A, B] = A -\/ B
type DRight[A, B] = A \/- B
type Disjunction[A, B] = A \/ B
type DisjunctionT[A, F[_], B] = EitherT[A, F, B]
type FirstMaybe[A] = Maybe[A] @@ First
type FirstOf[A] = A @@ FirstVal
type FirstOption[A] = Option[A] @@ First
type IMap[A, B] = A ==>> B
type IRWS[R, W, S1, S2, A] = IndexedReaderWriterState[R, W, S1, S2, A]
type IRWST[R, W, S1, S2, F[_], A] = IndexedReaderWriterStateT[R, W, S1, S2, F, A]
type IndexedCont[R, O, A] = IndexedContT[R, O, Id, A]
type IndexedContT[R, O, M[_], A] = IndexedContsT[Id, R, O, M, A]
type IndexedConts[W[_], R, O, A] = IndexedContsT[W, R, O, Id, A]
type IndexedReaderWriterState[R, W, S1, S2, A] = IndexedReaderWriterStateT[R, W, S1, S2, Id, A]
type IndexedState[S1, S2, A] = IndexedStateT[S1, S2, Id, A]
type IndexedStore[I, A, B] = IndexedStoreT[Id, I, A, B]
type LastMaybe[A] = Maybe[A] @@ Last
type LastOf[A] = A @@ LastVal
type LastOption[A] = Option[A] @@ Last
type Lens[A, B] = LensFamily[A, A, B, B]

A lens that doesn't transform the type of the record.

A lens that doesn't transform the type of the record.

See also
type MaxMaybe[A] = Maybe[A] @@ Max
type MaxOf[A] = A @@ MaxVal
type MaxOption[A] = Option[A] @@ Max
type MinMaybe[A] = Maybe[A] @@ Min
type MinOf[A] = A @@ MinVal
type MinOption[A] = Option[A] @@ Min
type PIndexedState[S1, S2, A] = PIndexedStateT[Id, S1, S2, A]
type PIndexedStateT[F[_], S1, S2, A] = IndexedStateT[S1, S2, F, Option[A]]
type PLens[A, B] = PLensFamily[A, A, B, B]

A partial lens that doesn't transform the type of the record.

A partial lens that doesn't transform the type of the record.

See also
type PState[S, A] = PStateT[Id, S, A]
type PStateT[F[_], S, A] = PIndexedStateT[F, S, S, A]
type Pair[A] = (A, A)
type RWS[R, W, S, A] = ReaderWriterState[R, W, S, A]
type RWST[R, W, S, F[_], A] = ReaderWriterStateT[R, W, S, F, A]
type Reader[E, A] = ReaderT[E, Id, A]
type ReaderT[E, F[_], A] = Kleisli[F, E, A]
type ReaderWriterState[R, W, S, A] = ReaderWriterStateT[R, W, S, Id, A]
type ReaderWriterStateT[R, W, S, F[_], A] = IndexedReaderWriterStateT[R, W, S, S, F, A]
type Select[R, A] = SelectT[R, Id, A]
type State[S, A] = StateT[S, Id, A]

A state transition, representing a function S => (S, A).

A state transition, representing a function S => (S, A).

type StateT[S, F[_], A] = IndexedStateT[S, S, F, A]
type Store[A, B] = StoreT[Id, A, B]
type StoreT[F[_], A, B] = IndexedStoreT[F, A, A, B]
type Traced[A, B] = TracedT[Id, A, B]
type Unwriter[W, A] = UnwriterT[Id, W, A]

An scalaz.Validation with a scalaz.NonEmptyList as the failure type.

An scalaz.Validation with a scalaz.NonEmptyList as the failure type.

type Writer[W, A] = WriterT[W, Id, A]
type |-->[A, B] = Store[B, A]
type ~~>[F[_, _], G[_, _]] = BiNaturalTransformation[F, G]
type [A, B] = A \/ B
type = Any
type = Nothing

Value members

Concrete methods

def Traced[A, B](f: A => B): Traced[A, B]