scalaz
package scalaz
Scalaz: Type classes and pure functional data structures for Scala.
This package, scalaz, contains:
- type class definitions
- data structures
- related functions
Type class instances and other functions related to the Scala and Java standard library are in scalaz.std
Implicit conversions and wrapper classes that provide a more convenient syntax for accessing the functionality of the library are in scalaz.syntax.
Type Classes Index
- scalaz.Semigroup
- scalaz.Monoid extends scalaz.Semigroup
- scalaz.Equal
- scalaz.Show
- scalaz.Order extends scalaz.Equal
- scalaz.Enum extends scalaz.Order
- scalaz.Plus
- scalaz.PlusEmpty extends scalaz.Plus
- scalaz.IsEmpty extends scalaz.PlusEmpty
- scalaz.Optional
- scalaz.InvariantFunctor
- scalaz.Functor extends scalaz.InvariantFunctor
- scalaz.Contravariant extends scalaz.InvariantFunctor
- scalaz.Divide extends scalaz.Contravariant
- scalaz.Divisible extends scalaz.Divide
- scalaz.Apply extends scalaz.Functor
- scalaz.Applicative extends scalaz.Apply
- scalaz.Align extends scalaz.Functor
- scalaz.Zip
- scalaz.Unzip
- scalaz.Cozip
- scalaz.Bind extends scalaz.Apply
- scalaz.BindRec extends scalaz.Bind
- scalaz.Monad extends scalaz.Applicative with scalaz.Bind
- scalaz.Cobind extends scalaz.Functor
- scalaz.Comonad extends scalaz.Cobind
- scalaz.ApplicativePlus extends scalaz.Applicative with scalaz.PlusEmpty
- scalaz.MonadPlus extends scalaz.Monad with scalaz.ApplicativePlus
- scalaz.Foldable
- scalaz.Foldable1 extends scalaz.Foldable
- scalaz.Traverse extends scalaz.Functor with scalaz.Foldable
- scalaz.Traverse1 extends scalaz.Traverse with scalaz.Foldable1
- scalaz.Associative
- scalaz.Bifunctor
- scalaz.Bifoldable
- scalaz.Bitraverse extends scalaz.Bifunctor with scalaz.Bifoldable
- scalaz.Nondeterminism extends scalaz.Monad
- scalaz.Compose
- scalaz.Profunctor
- scalaz.Strong extends scalaz.Profunctor
- scalaz.ProChoice extends scalaz.Profunctor
- scalaz.Category extends scalaz.Compose
- scalaz.Choice extends scalaz.Category
- scalaz.Split extends scalaz.Compose
- scalaz.Arrow extends scalaz.Split with scalaz.Strong with scalaz.Category
- scalaz.MonadState extends scalaz.Monad
- scalaz.MonadError extends scalaz.Monad
- scalaz.MonadTell extends scalaz.Monad
- scalaz.MonadReader extends scalaz.Monad
- scalaz.ComonadStore extends scalaz.Comonad
Data Structures Index
- scalaz.Validation Represent computations that may succeed or fail, accumulating multiple errors.
- scalaz.NonEmptyList A list containing at least one element.
- scalaz.DList A difference list, supporting efficient append and prepend.
- scalaz.EphemeralStream A stream that holds weak references to its elements, and recomputes them if needed if reclaimed by the garbage collector.
- scalaz.Heap A priority queue, implemented with bootstrapped skew binomial heaps.
- scalaz.Endo Represents functions from
A => A
. - scalaz.FingerTree A tree containing elements at it's leaves, and measures at the nodes. Can be adapted to various purposes by choosing a different measure, for example scalaz.IndSeq and scalaz.OrdSeq.
- scalaz.Lens Composable, functional alternative to getters and setters
- scalaz.Tree A multiway tree. Each node contains a single element, and a
Stream
of sub-trees. - scalaz.TreeLoc A cursor over a scalaz.Tree.
- scalaz.Zipper A functional cursor over a List.
- scalaz.Kleisli Represents a function
A => M[B]
, allowing chaining. Also known, and aliased, asscalaz.ReaderT
. - scalaz.StateT Computations that modify state.
- scalaz.WriterT Computations that log a value
- scalaz.OptionT Represents computations of type
F[Option[A]]
- scalaz.MaybeT Represents computations of type
F[Maybe[A]]
- scalaz.EitherT Represents computations of type
F[A \/ B]
- Source
- package.scala
- Alphabetic
- By Inheritance
- scalaz
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
Type Members
- final case class -\/[A, B](a: A) extends \/[A, B] with Product with Serializable
A left disjunction
A left disjunction
Often used to represent the failure case of a result
- sealed abstract class /~\[A[_], B[_]] extends AnyRef
Type-aligned pair.
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. - sealed class :+:[M, N] extends AnyRef
The coproduct (or free product) of monoids
M
andN
.The coproduct (or free product) of monoids
M
andN
. Conceptually this is an alternating list ofM
andN
values, with the identity as the empty list, and composition as list concatenation that combines adjacent elements when possible. - type :<:[F[_], G[_]] = Inject[F, G]
scalaz.Inject[F, G]
- type :≺:[F[_], G[_]] = Inject[F, G]
scalaz.Inject[F, G]
- type <~[F[_], G[_]] = NaturalTransformation[G, F]
A scalaz.NaturalTransformation[G, F].
- type ===[A, B] = Leibniz[⊥, ⊤, A, B]
(A === B)
is a supertype ofLeibniz[L,H,A,B]
- sealed abstract class ==>>[A, B] extends AnyRef
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
- type =?>[E, A] = Kleisli[Option, E, A]
- type @>[A, B] = LensFamily[A, A, B, B]
- See also
- type @?>[A, B] = PLensFamily[A, A, B, B]
- See also
- type @@[T, Tag] = scalaz.TagKind.@@[T, Tag]
Tag a type
T
withTag
.Tag a type
T
withTag
.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.
- abstract class Adjunction[F[_], G[_]] extends AnyRef
An adjunction formed by two functors
F
andG
such thatF
is left-adjoint toG
.An adjunction formed by two functors
F
andG
such thatF
is left-adjoint toG
. 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)
- sealed abstract class AdjunctionInstances extends AnyRef
- trait Align[F[_]] extends Functor[F]
- sealed abstract class Alpha extends Product with Serializable
An algebraic data type representing the characters 'a' to 'z'
- sealed abstract class AlphaInstances extends AnyRef
- trait Alt[F[_]] extends Applicative[F] with InvariantAlt[F]
https://hackage.haskell.org/package/semigroupoids-5.2.2/docs/Data-Functor-Alt.html
- final case class Alter[F[_], A](f: F[A]) extends Product with Serializable
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
- sealed abstract class AlterInstances extends AlterInstances0
- sealed abstract class AlterInstances0 extends AnyRef
- final case class Ap[F[_], A](f: F[A]) extends Product with Serializable
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
- sealed abstract class ApInstances extends ApInstances0
- sealed abstract class ApInstances0 extends AnyRef
- 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)
- All scalaz.Monads are also
- trait ApplicativeError[F[_], S] extends Applicative[F]
- trait ApplicativePlus[F[_]] extends Applicative[F] with PlusEmpty[F]
scalaz.Applicative combined with scalaz.PlusEmpty.
- trait Apply[F[_]] extends Functor[F]
scalaz.Applicative without
point
.scalaz.Applicative without
point
.- See also
- trait Arrow[=>:[_, _]] extends Split[=>:] with Strong[=>:] with Category[=>:]
A scalaz.Category supporting all ordinary functions, as well as combining arrows product-wise.
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.
- trait Associative[=>:[_, _]] extends AnyRef
- trait Band[F] extends Semigroup[F]
scalaz.Semigroup which is also idempotent, i.e.
scalaz.Semigroup which is also idempotent, i.e. appending a value with itself results in the same value.
- See also
- trait BiConstrainedNaturalTransformation[F[_, _], G[_, _], C[_], E[_]] extends AnyRef
A constrained transformation natural in both sides of a bifunctor
- trait BiNaturalTransformation[-F[_, _], +G[_, _]] extends AnyRef
A function universally quantified over two parameters.
- trait Bifoldable[F[_, _]] extends AnyRef
A type giving rise to two unrelated scalaz.Foldables.
- trait Bifunctor[F[_, _]] extends AnyRef
A type giving rise to two unrelated scalaz.Functors.
- final class BijectionT[F[_], G[_], A, B] extends AnyRef
- sealed abstract class BijectionTInstances extends BijectionTInstances0
- sealed abstract class BijectionTInstances0 extends AnyRef
- 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.
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
- 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.
- trait Bitraverse[F[_, _]] extends Bifunctor[F] with Bifoldable[F]
A type giving rise to two unrelated scalaz.Traverses.
- sealed abstract class CaseInsensitive[A] extends AnyRef
- sealed abstract class CaseInsensitiveInstances extends AnyRef
- trait Category[=>:[_, _]] extends Compose[=>:]
scalaz.Compose with identity.
scalaz.Compose with identity.
- See also
- trait Choice[=>:[_, _]] extends Category[=>:]
- trait Cobind[F[_]] extends Functor[F]
- abstract class Codensity[F[_], A] extends AnyRef
- sealed abstract class CodensityInstances extends AnyRef
- sealed abstract class Cofree[S[_], A] extends AnyRef
A cofree comonad for some functor
S
, i.e.A cofree comonad for some functor
S
, i.e. anS
-branching stream. - sealed abstract class CofreeInstances extends CofreeInstances0
- sealed abstract class CofreeInstances0 extends CofreeInstances1
- sealed abstract class CofreeInstances1 extends CofreeInstances2
- sealed abstract class CofreeInstances2 extends CofreeInstances3
- sealed abstract class CofreeInstances3 extends CofreeInstances4
- sealed abstract class CofreeInstances4 extends CofreeInstances5
- sealed abstract class CofreeInstances5 extends CofreeInstances6
- sealed abstract class CofreeInstances6 extends AnyRef
- trait Cohoist[F[_[_], _]] extends ComonadTrans[F]
- final case class Cokleisli[F[_], A, B](run: (F[A]) => B) extends Product with Serializable
- sealed abstract class CokleisliInstances extends CokleisliInstances0
- sealed abstract class CokleisliInstances0 extends AnyRef
- trait Comonad[F[_]] extends Cobind[F]
- trait ComonadStore[F[_], S] extends Comonad[F]
- trait ComonadTrans[F[_[_], _]] extends AnyRef
- trait Compose[=>:[_, _]] extends AnyRef
- final case class Const[A, B](getConst: A) extends Product with Serializable
- sealed abstract class ConstInstances extends ConstInstances0
- sealed abstract class ConstInstances0 extends ConstInstances1
- sealed abstract class ConstInstances1 extends AnyRef
- trait ConstrainedNaturalTransformation[F[_], G[_], E[_]] extends AnyRef
A constrained natural transformation
- type Cont[R, A] = IndexedContsT[scalaz.Id.Id, R, R, scalaz.Id.Id, A]
- type ContT[R, M[_], A] = IndexedContsT[scalaz.Id.Id, R, R, M, A]
- trait Contravariant[F[_]] extends InvariantFunctor[F]
Contravariant functors.
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. - sealed abstract class ContravariantCoyoneda[F[_], A] extends AnyRef
Decomposition of
fi.contramap(k)
into its components, as it is frequently convenient to applyk
separately from sorting or whatever process withfi
, even whenB
is unknown, which is very common.Decomposition of
fi.contramap(k)
into its components, as it is frequently convenient to applyk
separately from sorting or whatever process withfi
, even whenB
is unknown, which is very common.This is isomorphic to
F
as long asF
itself is a contravariant functor. The homomorphism fromF[A]
toContravariantCoyoneda[F,A]
exists even whenF
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
- sealed abstract class ContravariantCoyonedaInstances extends AnyRef
- type Conts[W[_], R, A] = IndexedContsT[W, R, R, scalaz.Id.Id, A]
- type ContsT[W[_], R, M[_], A] = IndexedContsT[W, R, R, M, A]
- final case class Coproduct[F[_], G[_], A](run: \/[F[A], G[A]]) extends Product with Serializable
F
on the left, andG
on the right, of scalaz.\/. - sealed abstract class CoproductInstances extends CoproductInstances0
- sealed abstract class CoproductInstances0 extends CoproductInstances1
- sealed abstract class CoproductInstances1 extends CoproductInstances2
- sealed abstract class CoproductInstances2 extends CoproductInstances3
- sealed abstract class CoproductInstances3 extends AnyRef
- sealed abstract class Cord extends AnyRef
A
Cord
is a purely functional data structure for efficiently creating aString
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 aString
from smaller parts, useful for printing ADTs that must write out their contents into a text format.A
z
interpolator is available for buildingString
from literals, using theShow
typeclass to populate each "hole", and acord
interpolator for buildingCord
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/1797If 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:- https://ecc-comp.blogspot.co.uk/2015/05/a-brief-glance-at-how-5-text-editors.html - https://pavelfatin.com/typing-with-pleasure/
- sealed abstract class CorecursiveList[A] extends AnyRef
The corecursive list; i.e.
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. - sealed abstract class CorecursiveListInstances extends AnyRef
- abstract class Corepresentable[F[_], X] extends AnyRef
Corepresentable functors
- sealed abstract class Coyoneda[F[_], A] extends AnyRef
The dual view of the Yoneda lemma.
The dual view of the Yoneda lemma. Also a free functor on
F
. This is isomorphic toF
as long asF
itself is a functor. The homomorphism fromF[A]
toCoyoneda[F,A]
exists even whenF
is not a functor. - sealed abstract class CoyonedaInstances extends CoyonedaInstances0
- sealed abstract class CoyonedaInstances0 extends CoyonedaInstances1
- sealed abstract class CoyonedaInstances1 extends CoyonedaInstances2
- sealed abstract class CoyonedaInstances10 extends CoyonedaInstances11
- sealed abstract class CoyonedaInstances11 extends CoyonedaInstances12
- sealed abstract class CoyonedaInstances12 extends AnyRef
- sealed abstract class CoyonedaInstances2 extends CoyonedaInstances3
- sealed abstract class CoyonedaInstances3 extends CoyonedaInstances4
- sealed abstract class CoyonedaInstances4 extends CoyonedaInstances5
- sealed abstract class CoyonedaInstances5 extends CoyonedaInstances6
- sealed abstract class CoyonedaInstances6 extends CoyonedaInstances7
- sealed abstract class CoyonedaInstances7 extends CoyonedaInstances8
- sealed abstract class CoyonedaInstances8 extends CoyonedaInstances9
- sealed abstract class CoyonedaInstances9 extends CoyonedaInstances10
- trait Cozip[F[_]] extends AnyRef
- type DLeft[A, B] = -\/[A, B]
- final class DList[A] extends AnyRef
Difference lists: a data structure for
O(1)
append on lists.Difference lists: a data structure for
O(1)
append on lists. Based onData.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. - sealed abstract class DListInstances extends AnyRef
- type DRight[A, B] = \/-[A, B]
- trait Day[F[_], G[_], A] extends AnyRef
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 }
- sealed abstract class DayInstances extends DayInstances1
- sealed abstract class DayInstances1 extends DayInstances2
- sealed abstract class DayInstances2 extends DayInstances3
- sealed abstract class DayInstances3 extends DayInstances4
- sealed abstract class DayInstances4 extends AnyRef
- trait Decidable[F[_]] extends Divisible[F] with InvariantAlt[F]
Coproduct analogue of Divide
Coproduct analogue of Divide
https://hackage.haskell.org/package/contravariant-1.4.1/docs/Data-Functor-Contravariant-Divisible.html#t:Decidable
- trait Density[F[_], Y] extends AnyRef
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.
- sealed abstract class DensityInstances extends DensityInstances0
- sealed abstract class DensityInstances0 extends AnyRef
- sealed abstract class Dequeue[A] extends AnyRef
A Double-ended queue, based on the Bankers Double Ended Queue as described by C.
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
- sealed abstract class DequeueInstances extends AnyRef
- trait DiNaturalTransformation[F[_, _], G[_, _]] extends AnyRef
- sealed abstract class Diev[A] extends AnyRef
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.
- trait DievImplementation extends AnyRef
- sealed abstract class DievInstances extends DievImplementation
- sealed abstract class Digit extends Product with Serializable
An algebraic data type representing the digits 0 - 9
- sealed abstract class DigitInstances extends AnyRef
- type Disjunction[A, B] = \/[A, B]
- sealed abstract class DisjunctionInstances extends DisjunctionInstances0
- sealed abstract class DisjunctionInstances0 extends DisjunctionInstances1
- sealed abstract class DisjunctionInstances1 extends DisjunctionInstances2
- sealed abstract class DisjunctionInstances2 extends AnyRef
- type DisjunctionT[A, F[_], B] = EitherT[A, F, B]
- trait Distributive[F[_]] extends Functor[F]
Dual of scalaz.Traverse.
Dual of scalaz.Traverse. To transform
F[G[B]]
toG[F[B]]
, you may useTraverse[F]
andApplicative[G]
, but alternativelyFunctor[F]
andDistributive[G]
, which permits greater sharing and nonstrictness. - trait Divide[F[_]] extends Contravariant[F]
Divide
is the contravariant analogue ofscalaz.Apply
Divide
is the contravariant analogue ofscalaz.Apply
- trait Divisible[F[_]] extends Divide[F] with InvariantApplicative[F]
Divisible
is the contravariant analogue ofscalaz.Applicative
Divisible
is the contravariant analogue ofscalaz.Applicative
- sealed abstract class DualInstances extends DualInstances0
- sealed abstract class DualInstances0 extends AnyRef
- sealed abstract class Either3[A, B, C] extends Product with Serializable
- final case class EitherT[A, F[_], B](run: F[\/[A, B]]) extends Product with Serializable
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))
- sealed abstract class EitherTInstances extends EitherTInstances0
- sealed abstract class EitherTInstances0 extends EitherTInstances1
- sealed abstract class EitherTInstances1 extends EitherTInstances2
- sealed abstract class EitherTInstances2 extends EitherTInstances3
- sealed abstract class EitherTInstances3 extends EitherTInstances4
- sealed abstract class EitherTInstances4 extends EitherTInstances5
- sealed abstract class EitherTInstances5 extends AnyRef
- final case class Endo[A](run: (A) => A) extends Product with Serializable
Endomorphisms.
Endomorphisms. They have special properties among functions, so are captured in this newtype.
- run
The captured function.
- final case class EndoByName[A](run: (=> A) => A) extends Product with Serializable
Endomorphisms using by-name evaluation.
Endomorphisms using by-name evaluation. They have special properties among functions, so are captured in this newtype.
- run
The captured function.
- sealed abstract class EndoByNameInstances extends AnyRef
- sealed abstract class EndoInstances extends AnyRef
- final case class Endomorphic[=>:[_, _], A](run: =>:[A, A]) extends Product with Serializable
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]
- sealed abstract class EndomorphicInstances extends EndomorphicInstances0
- sealed abstract class EndomorphicInstances0 extends EndomorphicInstances1
- sealed abstract class EndomorphicInstances1 extends EndomorphicInstances2
- sealed abstract class EndomorphicInstances2 extends AnyRef
- trait Enum[F] extends Order[F]
An scalaz.Orderable with discrete values.
- sealed abstract class EphemeralStream[A] extends AnyRef
Like scala.collection.immutable.LazyList, but doesn't save computed values.
Like scala.collection.immutable.LazyList, 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.
- sealed abstract class EphemeralStreamInstances extends AnyRef
- trait Equal[F] extends AnyRef
A type safe alternative to universal equality (
scala.Any#==
).A type safe alternative to universal equality (
scala.Any#==
).- See also
- final case class Failure[E, A](e: E) extends Validation[E, A] with Product with Serializable
- sealed abstract class FingerTree[V, A] extends AnyRef
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))
wherel1
andl2
are their sizes - Random access to an element at
n
isO(lg min(n, l - n))
, wherel
is the size of the tree. - Constructing a tree with n copies of a value is O(lg n).
- V
The type of the annotations of the nodes (the measure)
- A
The type of the elements stored at the leaves
- Access to the first and last elements is
- sealed abstract class FingerTreeInstances extends AnyRef
- type FirstMaybe[A] = scalaz.TagKind.@@[Maybe[A], First]
- type FirstOf[A] = scalaz.TagKind.@@[A, FirstVal]
- type FirstOption[A] = scalaz.TagKind.@@[Option[A], First]
- trait FoldCase[A] extends AnyRef
- sealed abstract class FoldCaseInstances extends AnyRef
- trait Foldable[F[_]] extends AnyRef
A type parameter implying the ability to extract zero or more values of that type.
- trait Foldable1[F[_]] extends Foldable[F]
A scalaz.Foldable where
foldMap
is total over semigroups.A scalaz.Foldable where
foldMap
is total over semigroups. That is,toList
cannot return an empty list. - trait Forall[P[_]] extends AnyRef
A universally quantified value
- trait Foralls extends AnyRef
- sealed abstract class Free[S[_], A] extends AnyRef
A free monad for a type constructor
S
.A free monad for a type constructor
S
. Binding is done using the heap instead of the stack, allowing tail-call elimination. - sealed abstract class FreeAp[F[_], A] extends AnyRef
Free applicative functors.
Free applicative functors. Less expressive than free monads, but more flexible to inspect and interpret.
- sealed abstract class FreeInstances extends FreeInstances0
- sealed abstract class FreeInstances0 extends FreeInstances1
- sealed abstract class FreeInstances1 extends FreeInstances2
- sealed abstract class FreeInstances2 extends FreeInstances3
- sealed abstract class FreeInstances3 extends FreeInstances4
- sealed abstract class FreeInstances4 extends AnyRef
- sealed abstract class FreeT[S[_], M[_], A] extends AnyRef
- sealed abstract class FreeTInstances extends FreeTInstances0
- sealed abstract class FreeTInstances0 extends FreeTInstances1
- sealed abstract class FreeTInstances1 extends FreeTInstances2
- sealed abstract class FreeTInstances2 extends FreeTInstances3
- sealed abstract class FreeTInstances3 extends FreeTInstances4
- sealed abstract class FreeTInstances4 extends FreeTInstances5
- sealed abstract class FreeTInstances5 extends FreeTInstances6
- sealed abstract class FreeTInstances6 extends AnyRef
- trait Functor[F[_]] extends InvariantFunctor[F]
Functors, covariant by nature if not by Scala type.
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
- trait Generator[C, Elem] extends AnyRef
Generator
a class of container of elements that knows how to efficiently apply a scalaz.Reducer to extract an answer by combining elements.Generator
a class of container of elements that knows how to efficiently apply a scalaz.Reducer to extract an answer by combining elements. AReducer
may supply efficient left-to-right and right-to-left reduction strategies that aGenerator
may avail itself of. - trait Generators extends AnyRef
- sealed abstract class Heap[A] extends AnyRef
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
- sealed abstract class HeapInstances extends AnyRef
- trait Hoist[F[_[_], _]] extends MonadTrans[F]
- final case class ICons[A](head: A, tail: IList[A]) extends IList[A] with Product with Serializable
- sealed abstract class IList[A] extends Product with Serializable
Safe, invariant alternative to stdlib
List
.Safe, invariant alternative to stdlib
List
. Most methods onList
have a sensible equivalent here, either on theIList
interface itself or via typeclass instances (which are the same as those defined for stdlibList
). All methods are total and stack-safe. - sealed abstract class IListInstance0 extends AnyRef
- sealed abstract class IListInstances extends IListInstance0
- type IMap[A, B] = ==>>[A, B]
- final case class INil[A] extends IList[A] with Product with Serializable
- type IRWS[R, W, S1, S2, A] = IndexedReaderWriterStateT[R, W, S1, S2, scalaz.Id.Id, A]
- type IRWST[R, W, S1, S2, F[_], A] = IndexedReaderWriterStateT[R, W, S1, S2, F, A]
- sealed abstract class ISet[A] extends AnyRef
- sealed abstract class ISetInstances extends AnyRef
- sealed abstract class IStream[A] extends AnyRef
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.
- trait IdInstances extends AnyRef
Mixed into object
Id
in the package object scalaz. - final case class IdT[F[_], A](run: F[A]) extends Product with Serializable
- sealed abstract class IdTInstances extends IdTInstances0
- sealed abstract class IdTInstances0 extends IdTInstances1
- sealed abstract class IdTInstances1 extends IdTInstances2
- sealed abstract class IdTInstances2 extends IdTInstances3
- sealed abstract class IdTInstances3 extends IdTInstances4
- sealed abstract class IdTInstances4 extends IdTInstances5
- sealed abstract class IdTInstances5 extends IdTInstances6
- sealed abstract class IdTInstances6 extends AnyRef
- sealed abstract class ImmutableArray[+A] extends AnyRef
An immutable wrapper for arrays
An immutable wrapper for arrays
- A
type of the elements of the array
- sealed abstract class ImmutableArrayInstances extends AnyRef
- final class IndSeq[A] extends AnyRef
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)
. - sealed abstract class IndSeqInstances extends AnyRef
- type IndexedCont[R, O, A] = IndexedContsT[scalaz.Id.Id, R, O, scalaz.Id.Id, A]
- type IndexedContT[R, O, M[_], A] = IndexedContsT[scalaz.Id.Id, R, O, M, A]
- type IndexedConts[W[_], R, O, A] = IndexedContsT[W, R, O, scalaz.Id.Id, A]
- final case class IndexedContsT[W[_], R, O, M[_], A](_run: (W[(A) => M[O]]) => M[R]) extends Product with Serializable
- trait IndexedContsTFunctions extends AnyRef
- abstract class IndexedContsTInstances extends IndexedContsTInstances0
- sealed abstract class IndexedContsTInstances0 extends IndexedContsTInstances1
- sealed abstract class IndexedContsTInstances1 extends IndexedContsTInstances2
- sealed abstract class IndexedContsTInstances2 extends AnyRef
- type IndexedReaderWriterState[R, W, S1, S2, A] = IndexedReaderWriterStateT[R, W, S1, S2, scalaz.Id.Id, A]
- sealed abstract class IndexedReaderWriterStateT[R, W, S1, S2, F[_], A] extends AnyRef
A monad transformer stack yielding
(R, S1) => F[(W, A, S2)]
. - sealed abstract class IndexedReaderWriterStateTInstances extends IndexedReaderWriterStateTInstances0
- sealed abstract class IndexedReaderWriterStateTInstances0 extends IndexedReaderWriterStateTInstances1
- sealed abstract class IndexedReaderWriterStateTInstances1 extends AnyRef
- type IndexedState[S1, S2, A] = IndexedStateT[S1, S2, scalaz.Id.Id, A]
- trait IndexedStateFunctions extends AnyRef
- sealed abstract class IndexedStateT[S1, S2, F[_], A] extends AnyRef
- trait IndexedStateTFunctions extends AnyRef
- sealed abstract class IndexedStateTInstances extends IndexedStateTInstances0
- sealed abstract class IndexedStateTInstances0 extends IndexedStateTInstances1
- sealed abstract class IndexedStateTInstances1 extends IndexedStateTInstances2
- sealed abstract class IndexedStateTInstances2 extends IndexedStateTInstances3
- sealed abstract class IndexedStateTInstances3 extends AnyRef
- type IndexedStore[I, A, B] = IndexedStoreT[scalaz.Id.Id, I, A, B]
- final case class IndexedStoreT[F[_], I, A, B](run: (F[(A) => B], I)) extends Product with Serializable
- See also
- trait IndexedStoreTFunctions extends AnyRef
- sealed abstract class IndexedStoreTInstances extends IndexedStoreTInstances0
- sealed abstract class IndexedStoreTInstances0 extends IndexedStoreTInstances1
- sealed abstract class IndexedStoreTInstances1 extends IndexedStoreTInstances2
- sealed abstract class IndexedStoreTInstances2 extends AnyRef
- sealed abstract class Inject[F[_], G[_]] extends ~>[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).
- sealed abstract class InjectInstances extends AnyRef
- case class Injective[T[_]]() extends Product with Serializable
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[_, _]]() extends Product with Serializable
- case class Injective3[T[_, _, _]]() extends Product with Serializable
- case class Injective4[T[_, _, _, _]]() extends Product with Serializable
- case class Injective5[T[_, _, _, _, _]]() extends Product with Serializable
- 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.
- 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.
- trait InvariantFunctor[F[_]] extends AnyRef
Unary type constructor that supports an
xmap
operation that converts anF[A]
to anF[B]
given two functions,A => B
andB => A
.Unary type constructor that supports an
xmap
operation that converts anF[A]
to anF[B]
given two functions,A => B
andB => 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.
- trait IsContravariant[F[_]] extends AnyRef
Type constructors that are contravariant with respect to subtyping.
Type constructors that are contravariant with respect to subtyping.
A type constructor
F[_]
admits an instanceIsContravariant[F]
iffF[B]
is a subtype ofF[A]
wheneverA
is a subtype ofB
.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 ofIsContravariant
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.
- trait IsCovariant[F[_]] extends AnyRef
Type constructors that are covariant with respect to subtyping.
Type constructors that are covariant with respect to subtyping.
A type constructor
F[_]
admits an instanceIsCovariant[F]
iffF[A]
is a subtype ofF[B]
wheneverA
is a subtype ofB
.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 ofIsCovariant
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.
- trait IsEmpty[F[_]] extends PlusEmpty[F]
Typeclass that permits testing whether some type with an empty representation is in fact empty.
- 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 IsomorphismApplicative[F[_], G[_]] extends Applicative[F] with IsomorphismApply[F, G] with IsomorphismInvariantApplicative[F, G]
- trait IsomorphismApplicativeError[F[_], G[_], S] extends ApplicativeError[F, S] with IsomorphismApplicative[F, G]
- trait IsomorphismApplicativePlus[F[_], G[_]] extends ApplicativePlus[F] with IsomorphismApplicative[F, G] with IsomorphismPlusEmpty[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 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 IsomorphismContravariant[F[_], G[_]] extends Contravariant[F] with IsomorphismInvariantFunctor[F, G]
- 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 IsomorphismDivisible[F[_], G[_]] extends Divisible[F] with IsomorphismDivide[F, G] with IsomorphismInvariantApplicative[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 IsomorphismInvariantAlt[F[_], G[_]] extends InvariantAlt[F] with IsomorphismInvariantApplicative[F, G]
- trait IsomorphismInvariantApplicative[F[_], G[_]] extends InvariantApplicative[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 class Isomorphisms extends AnyRef
- final case class Kleisli[M[_], A, B](run: (A) => M[B]) extends Product with Serializable
Represents a function
A => M[B]
. - abstract class KleisliInstances extends KleisliInstances0
- sealed abstract class KleisliInstances0 extends KleisliInstances1
- sealed abstract class KleisliInstances1 extends KleisliInstances2
- sealed abstract class KleisliInstances10 extends KleisliInstances11
- sealed abstract class KleisliInstances11 extends KleisliInstances12
- sealed abstract class KleisliInstances12 extends KleisliInstances13
- sealed abstract class KleisliInstances13 extends KleisliInstances14
- sealed abstract class KleisliInstances14 extends KleisliInstances15
- sealed abstract class KleisliInstances15 extends AnyRef
- sealed abstract class KleisliInstances2 extends KleisliInstances3
- sealed abstract class KleisliInstances3 extends KleisliInstances4
- sealed abstract class KleisliInstances4 extends KleisliInstances5
- sealed abstract class KleisliInstances5 extends KleisliInstances6
- sealed abstract class KleisliInstances6 extends KleisliInstances7
- sealed abstract class KleisliInstances7 extends KleisliInstances8
- sealed abstract class KleisliInstances8 extends KleisliInstances9
- sealed abstract class KleisliInstances9 extends KleisliInstances10
- trait Lan[G[_], H[_], A] extends AnyRef
The left Kan extension of
H
alongG
- sealed abstract class LanInstances extends LanInstances0
- sealed abstract class LanInstances0 extends AnyRef
- type LastMaybe[A] = scalaz.TagKind.@@[Maybe[A], Last]
- type LastOf[A] = scalaz.TagKind.@@[A, LastVal]
- type LastOption[A] = scalaz.TagKind.@@[Option[A], Last]
- sealed abstract class LazyEither[A, B] extends AnyRef
scala.Either, but with a value by name.
- sealed abstract class LazyEitherInstances extends AnyRef
- final case class LazyEitherT[F[_], A, B](run: F[LazyEither[A, B]]) extends Product with Serializable
- sealed abstract class LazyEitherTInstances extends LazyEitherTInstances0
- sealed abstract class LazyEitherTInstances0 extends LazyEitherTInstances1
- sealed abstract class LazyEitherTInstances1 extends AnyRef
- sealed abstract class LazyOption[A] extends Product with Serializable
scala.Option, but with a value by name.
- sealed abstract class LazyOptionInstances extends AnyRef
- final case class LazyOptionT[F[_], A](run: F[LazyOption[A]]) extends Product with Serializable
- sealed abstract class LazyOptionTInstances extends LazyOptionTInstances0
- sealed abstract class LazyOptionTInstances0 extends LazyOptionTInstances1
- sealed abstract class LazyOptionTInstances1 extends AnyRef
- sealed abstract class LazyTuple2[A, B] extends AnyRef
scala.Tuple2, but with values by name.
- sealed abstract class LazyTuple2Instances extends LazyTuple2Instances0
- sealed abstract class LazyTuple2Instances0 extends AnyRef
- sealed abstract class LazyTuple3[A, B, C] extends AnyRef
scala.Tuple3, but with values by name.
- sealed abstract class LazyTuple3Instances extends LazyTuple3Instances0
- sealed abstract class LazyTuple3Instances0 extends AnyRef
- sealed abstract class LazyTuple4[A, B, C, D] extends AnyRef
scala.Tuple4, but with values by name.
- sealed abstract class LazyTuple4Instances extends LazyTuple4Instances0
- sealed abstract class LazyTuple4Instances0 extends AnyRef
- final case class Left3[A, B, C](a: A) extends Either3[A, B, C] with Product with Serializable
- sealed abstract class Leibniz[-L, +H >: L, A >: L <: H, B >: L <: H] extends AnyRef
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 thatA
=B
, and that both of its types are betweenL
andH
. Subtyping lets you loosen the bounds onL
andH
.If you just need a witness that
A
=B
, then you can useA===B
which is a supertype of anyLeibniz[L,H,A,B]
The more refined types are useful if you need to be able to substitute into restricted contexts.
- sealed abstract class LeibnizF[A[_], B[_]] extends AnyRef
- sealed abstract class LeibnizInstances extends AnyRef
- 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
- sealed abstract class LensFamily[A1, A2, B1, B2] extends AnyRef
A Lens Family, offering a purely functional means to access and retrieve a field transitioning from type
B1
to typeB2
in a record simultaneously transitioning from typeA1
to typeA2
.A Lens Family, offering a purely functional means to access and retrieve a field transitioning from type
B1
to typeB2
in a record simultaneously transitioning from typeA1
to typeA2
. scalaz.Lens is a convenient alias for whenA1 === A2
, andB1 === 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
.- 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
- trait LensFamilyFunctions extends AnyRef
- trait LensFunctions extends LensFamilyFunctions
- abstract class LensInstances extends LensInstances0
- sealed abstract class LensInstances0 extends AnyRef
- sealed abstract class Liskov[-A, +B] extends AnyRef
Liskov substitutability: A better
<:<
Liskov substitutability: A better
<:<
A <: B
holds wheneverA
could be used in any negative context that expects aB
. (e.g. if you could pass anA
into any function that expects aB
.) - sealed abstract class LiskovF[-A[_], +B[_]] extends AnyRef
- sealed abstract class LiskovInstances extends AnyRef
- final case class ListT[M[_], A](run: M[IList[A]]) extends Product with Serializable
ListT monad transformer.
- sealed abstract class ListTInstances extends ListTInstances1
- sealed abstract class ListTInstances1 extends ListTInstances2
- sealed abstract class ListTInstances2 extends AnyRef
- sealed abstract class MapInstances extends MapInstances0
- sealed abstract class MapInstances0 extends MapInstances1
- sealed abstract class MapInstances1 extends MapInstances2
- sealed abstract class MapInstances2 extends AnyRef
- type MaxMaybe[A] = scalaz.TagKind.@@[Maybe[A], Max]
- type MaxOf[A] = scalaz.TagKind.@@[A, MaxVal]
- type MaxOption[A] = scalaz.TagKind.@@[Option[A], Max]
- sealed abstract class Maybe[A] extends AnyRef
An optional value
An optional value
A
Maybe[A]
will either be a wrappedA
instance (Just[A]
), or a lack of underlyingA
instance (Empty[A]
).Maybe[A]
is isomorphic toOption[A]
, however there are some differences between the two.Maybe
is invariant inA
whileOption
is covariant.Maybe[A]
does not expose an unsafeget
operation to access the underlyingA
value (that may not exist) likeOption[A]
does.Maybe[A]
does not come with an implicit conversion toIterable[A]
(a trait with over a dozen super types). - sealed abstract class MaybeInstances extends MaybeInstances0
- sealed abstract class MaybeInstances0 extends MaybeInstances1
- sealed abstract class MaybeInstances1 extends AnyRef
- final case class MaybeT[F[_], A](run: F[Maybe[A]]) extends Product with Serializable
monad transformer for Maybe
- sealed abstract class MaybeTInstances extends MaybeTInstances0
- sealed abstract class MaybeTInstances0 extends MaybeTInstances1
- sealed abstract class MaybeTInstances1 extends MaybeTInstances2
- sealed abstract class MaybeTInstances2 extends MaybeTInstances3
- sealed abstract class MaybeTInstances3 extends AnyRef
- sealed abstract class Memo[K, V] extends AnyRef
A function memoization strategy.
A function memoization strategy. See companion for various instances employing various strategies.
- sealed abstract class MemoInstances extends AnyRef
- final case class Middle3[A, B, C](b: B) extends Either3[A, B, C] with Product with Serializable
- type MinMaybe[A] = scalaz.TagKind.@@[Maybe[A], Min]
- type MinOf[A] = scalaz.TagKind.@@[A, MinVal]
- type MinOption[A] = scalaz.TagKind.@@[Option[A], Min]
- 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
- trait MonadError[F[_], S] extends Monad[F] with ApplicativeError[F, S]
- trait MonadListen[F[_], W] extends MonadTell[F, W]
- trait MonadPlus[F[_]] extends Monad[F] with ApplicativePlus[F]
- See also
- trait MonadReader[F[_], S] extends Monad[F]
- trait MonadState[F[_], S] extends Monad[F]
The class of monads supporting the operations of scalaz.State.
- trait MonadTell[F[_], S] extends Monad[F]
The class of monads supporting write operations
- trait MonadTrans[F[_[_], _]] extends AnyRef
Class of monad transformers.
- trait Monoid[F] extends Semigroup[F]
Provides an identity element (
zero
) to the binaryappend
operation in scalaz.Semigroup, subject to the monoid laws.Provides an identity element (
zero
) to the binaryappend
operation in scalaz.Semigroup, subject to the monoid laws.Example instances:
Monoid[Int]
:zero
andappend
are0
andInt#+
respectivelyMonoid[List[A]]
:zero
andappend
areNil
andList#++
respectively
References:
- sealed abstract class Name[A] extends AnyRef
Call by name
- trait NaturalTransformation[F[_], G[_]] extends AnyRef
A universally quantified function, usually written as
F ~> G
, for symmetry withA => B
.A universally quantified function, usually written as
F ~> G
, for symmetry withA => 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 andcosequence
from scalaz.Distributive give rise to([a]T[A[a]]) ~> ([a]A[T[a]])
, for varyingA
andT
constraints. - trait NaturalTransformations extends AnyRef
- final class Need[A] extends Name[A]
Call by need
- final class NonEmptyList[A] extends AnyRef
A singly-linked list that is guaranteed to be non-empty.
- sealed abstract class NonEmptyListInstances extends NonEmptyListInstances0
- sealed abstract class NonEmptyListInstances0 extends AnyRef
- trait Nondeterminism[F[_]] extends Monad[F]
A context supporting nondeterministic choice.
A context supporting nondeterministic choice. Unlike
Monad.bind
, which imposes a total order on the sequencing of effects throughout a computation, thechoose
andchooseAny
operations let us partially order the sequencing of effects. Canonical instances areconcurrent.Future
andconcurrent.Task
, which run their arguments in parallel, returning whichever comes back 'first'.TODO - laws
- sealed trait NotNothing[A] extends AnyRef
- final class NullArgument[A, B] extends AnyRef
- sealed abstract class NullArgumentInstances extends NullArgumentInstances0
- sealed abstract class NullArgumentInstances0 extends AnyRef
- final class NullResult[A, B] extends AnyRef
- sealed abstract class NullResultInstances extends NullResultInstances0
- sealed abstract class NullResultInstances0 extends AnyRef
- final class OneAnd[F[_], A] extends AnyRef
A generalization of
NonEmptyList
to non-List
things.A generalization of
NonEmptyList
to non-List
things. For example,OneAnd[Vector, A]
is a non-emptyVector
ofA
.Only
head
andtail
are provided as direct methods, because there's little you can do with aOneAnd
without knowing a bit aboutF
. So useful functions are provided in the form of typeclass instances onOneAnd
's companion; in combination with syntax extensions provided byscalaz.syntax
,OneAnd
has a large possible set of methods available by importing. For example,Applicative
on this requiresApplicativePlus[F]
, andTraverse1
on this requiresTraverse[F]
. See the companion documentation for a complete list of instances.Additionally, unlike
λ[α => (α, F[α])]
, the behavior of typeclass operations onOneAnd
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 twoOneAnd[Vector, *]
s orNonEmptyList
s 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, butpoint
of the latter yields a two-element sequence.- Since
7.0.3
- sealed abstract class OneAndInstances extends OneAndInstances0
- sealed abstract class OneAndInstances0 extends OneAndInstances1
- sealed abstract class OneAndInstances1 extends OneAndInstances2
- sealed abstract class OneAndInstances2 extends OneAndInstances3
- sealed abstract class OneAndInstances3 extends OneAndInstances4
- sealed abstract class OneAndInstances4 extends OneAndInstances5
- sealed abstract class OneAndInstances5 extends AnyRef
- final case class OneOr[F[_], A](run: \/[F[A], A]) extends Product with Serializable
- Since
7.0.3
- sealed abstract class OneOrInstances extends OneOrInstances0
- sealed abstract class OneOrInstances0 extends OneOrInstances1
- sealed abstract class OneOrInstances1 extends OneOrInstances2
- sealed abstract class OneOrInstances2 extends OneOrInstances3
- sealed abstract class OneOrInstances3 extends OneOrInstances4
- sealed abstract class OneOrInstances4 extends OneOrInstances5
- sealed abstract class OneOrInstances5 extends OneOrInstances6
- sealed abstract class OneOrInstances6 extends AnyRef
- final case class OptionT[F[_], A](run: F[Option[A]]) extends Product with Serializable
OptionT monad transformer.
- sealed abstract class OptionTInstances extends OptionTInstances0
- sealed abstract class OptionTInstances0 extends OptionTInstances1
- sealed abstract class OptionTInstances1 extends OptionTInstances2
- sealed abstract class OptionTInstances2 extends OptionTInstances3
- sealed abstract class OptionTInstances3 extends AnyRef
- trait Optional[F[_]] extends AnyRef
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.
- F
the container/context type
- See also
- 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 thanb
ifOrder[A].greaterThan(a, b)
.insert
and++
maintains the ordering.The measure is calculated with a
Semigroup[A @@ LastVal]
, whoseappend
operation favours the first argument. Accordingly, the measure of a node is the item with the highest priority contained recursively below that node. - trait Order[F] extends Equal[F]
Safer version of scala.math.Ordering.
- sealed abstract class Ordering 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 theInt
s returned by scala.math.Ordering.
- sealed abstract class OrderingInstances extends AnyRef
- type PIndexedState[S1, S2, A] = IndexedStateT[S1, S2, scalaz.Id.Id, Option[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
- sealed abstract class PLensFamily[A1, A2, B1, B2] extends AnyRef
Partial Lens Families, offering a purely functional means to access and retrieve an optional field transitioning from type
B1
to typeB2
in a record that is simultaneously transitioning from typeA1
to typeA2
.Partial Lens Families, offering a purely functional means to access and retrieve an optional field transitioning from type
B1
to typeB2
in a record that is simultaneously transitioning from typeA1
to typeA2
. scalaz.PLens is a convenient alias for whenA1 === A2
, andB1 === 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
.- 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
- trait PLensFamilyFunctions extends PLensInstances
- trait PLensFunctions extends PLensInstances with PLensFamilyFunctions
- abstract class PLensInstances extends AnyRef
- type PState[S, A] = IndexedStateT[S, S, scalaz.Id.Id, Option[A]]
- type PStateT[F[_], S, A] = IndexedStateT[S, S, F, Option[A]]
- type Pair[A] = (A, A)
- trait Plus[F[_]] extends AnyRef
Universally quantified scalaz.Semigroup.
- trait PlusEmpty[F[_]] extends Plus[F]
Universally quantified scalaz.Monoid.
- class PrioritySearchQueue[A, P, K] extends AnyRef
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.
- A
element type
- P
priority of an element. Multiple elements can have the same priority.
- K
lookup key. Unique—the queue holds at most one element with any given key.
- trait ProChoice[=>:[_, _]] extends Profunctor[=>:]
Strength on a coproduct.
- trait Profunctor[=>:[_, _]] extends AnyRef
Profunctors are covariant on the right and contravariant on the left.
- type RWS[R, W, S, A] = IndexedReaderWriterStateT[R, W, S, S, scalaz.Id.Id, A]
- type RWST[R, W, S, F[_], A] = IndexedReaderWriterStateT[R, W, S, S, F, A]
- trait Ran[G[_], H[_], A] extends AnyRef
The right Kan extension of
H
alongG
- type Reader[E, A] = Kleisli[scalaz.Id.Id, E, A]
- type ReaderT[E, F[_], A] = Kleisli[F, E, A]
- type ReaderWriterState[R, W, S, A] = IndexedReaderWriterStateT[R, W, S, S, scalaz.Id.Id, A]
- type ReaderWriterStateT[R, W, S, F[_], A] = IndexedReaderWriterStateT[R, W, S, S, F, A]
- trait ReaderWriterStateTFunctions extends AnyRef
- abstract class ReaderWriterStateTInstances extends ReaderWriterStateTInstances0
- sealed abstract class ReaderWriterStateTInstances0 extends IndexedReaderWriterStateTInstances
- trait Reducer[C, M] extends AnyRef
A
Reducer[C,M]
is a scalaz.Semigroup[M]
that maps values of typeC
throughunit
to values of typeM
.A
Reducer[C,M]
is a scalaz.Semigroup[M]
that maps values of typeC
throughunit
to values of typeM
. AC-Reducer
may also supply operations which tack on anotherC
to an existingSemigroup
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 namescons
andsnoc
work by analogy to the synonymous operations in the list semigroup.Minimal definition:
unit
orsnoc
Based on the Reducer Haskell library by Edward Kmett (https://hackage.haskell.org/package/reducers).
- sealed abstract class ReducerInstances extends AnyRef
- abstract class Representable[F[_], X] extends AnyRef
Representable functors, that is to say, those with isomorphisms to and from
[a](X => a)
.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 inX
, can be trivially derived forF
. - sealed abstract class RepresentableInstances extends AnyRef
- final case class Right3[A, B, C](c: C) extends Either3[A, B, C] with Product with Serializable
- type Select[R, A] = SelectT[R, scalaz.Id.Id, A]
- final case class SelectT[R, M[_], A](run: ((A) => M[R]) => M[A]) extends Product with Serializable
Selection monad transformer.
- sealed abstract class SelectTInstances extends SelectTInstances1
- sealed abstract class SelectTInstances1 extends SelectTInstances2
- sealed abstract class SelectTInstances2 extends SelectTInstances3
- sealed abstract class SelectTInstances3 extends SelectTInstances4
- sealed abstract class SelectTInstances4 extends SelectTInstances5
- sealed abstract class SelectTInstances5 extends SelectTInstances6
- sealed abstract class SelectTInstances6 extends SelectTInstances7
- sealed abstract class SelectTInstances7 extends AnyRef
- trait SemiLattice[F] extends Band[F]
scalaz.Band which is also commutative, i.e.
scalaz.Band which is also commutative, i.e. A + B == B + A
- trait Semigroup[F] extends AnyRef
An associative binary operation, circumscribed by type and the semigroup laws.
An associative binary operation, circumscribed by type and the semigroup laws. Unlike scalaz.Monoid, there is not necessarily a zero.
- trait Show[F] extends AnyRef
A typeclass for conversion to textual representation, done via scalaz.Cord for efficiency.
- trait Split[=>:[_, _]] extends Compose[=>:]
A scalaz.Compose (semigroupoid) permitting products.
- type State[S, A] = IndexedStateT[S, S, scalaz.Id.Id, A]
A state transition, representing a function
S => (S, A)
. - trait StateFunctions extends IndexedStateFunctions
- type StateT[S, F[_], A] = IndexedStateT[S, S, F, A]
- trait StateTFunctions extends IndexedStateTFunctions
- abstract class StateTInstances extends StateTInstances0
- sealed abstract class StateTInstances0 extends StateTInstances1
- sealed abstract class StateTInstances1 extends StateTInstances2
- sealed abstract class StateTInstances2 extends StateTInstances3
- sealed abstract class StateTInstances3 extends StateTInstances4
- sealed abstract class StateTInstances4 extends IndexedStateTInstances
- type Store[A, B] = IndexedStoreT[scalaz.Id.Id, A, A, B]
- type StoreT[F[_], A, B] = IndexedStoreT[F, A, A, B]
- trait StoreTFunctions extends IndexedStoreTFunctions
- abstract class StoreTInstances extends StoreTInstances0
- sealed abstract class StoreTInstances0 extends StoreTInstances1
- sealed abstract class StoreTInstances1 extends StoreTInstances2
- sealed abstract class StoreTInstances2 extends IndexedStoreTInstances
- abstract class StreamT[M[_], A] extends AnyRef
StreamT monad transformer.
- sealed abstract class StreamTInstances extends StreamTInstances0
- sealed abstract class StreamTInstances0 extends AnyRef
- case class StrictTree[A](rootLabel: A, subForest: Vector[StrictTree[A]]) extends Product with Serializable
- rootLabel
The label at the root of this tree.
- subForest
The child nodes of this tree.
- sealed abstract class StrictTreeInstances extends AnyRef
- final class StrictTreeUnzip[A1, A2] extends AnyVal
- trait Strong[=>:[_, _]] extends Profunctor[=>:]
Strength on a product.
- final case class Success[E, A](a: A) extends Validation[E, A] with Product with Serializable
- sealed abstract class TagKind extends AnyRef
- final case class Tannen[F[_], G[_, _], A, B](f: F[G[A, B]]) extends Product with Serializable
Composes a Functor on the outside of a Bifunctor.
Composes a Functor on the outside of a Bifunctor.
https://hackage.haskell.org/package/bifunctors-5.5/docs/Data-Bifunctor-Tannen.html#t:Tannen
- sealed abstract class TannenInstances extends TannenInstances0
- sealed abstract class TannenInstances0 extends AnyRef
- sealed abstract class TheseInstances extends TheseInstances0
- sealed abstract class TheseInstances0 extends TheseInstances1
- sealed abstract class TheseInstances1 extends AnyRef
- final case class TheseT[F[_], A, B](run: F[\&/[A, B]]) extends Product with Serializable
- sealed abstract class TheseTInstances extends TheseTInstances0
- sealed abstract class TheseTInstances0 extends TheseTInstances1
- sealed abstract class TheseTInstances1 extends AnyRef
- type Traced[A, B] = TracedT[scalaz.Id.Id, A, B]
- final case class TracedT[W[_], A, B](run: W[(A) => B]) extends Product with Serializable
- sealed abstract class TracedTInstances extends TracedTInstances0
- sealed abstract class TracedTInstances0 extends TracedTInstances1
- sealed abstract class TracedTInstances1 extends TracedTInstances2
- sealed abstract class TracedTInstances2 extends TracedTInstances3
- sealed abstract class TracedTInstances3 extends TracedTInstances4
- sealed abstract class TracedTInstances4 extends TracedTInstances5
- sealed abstract class TracedTInstances5 extends AnyRef
- 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
- trait Traverse1[F[_]] extends Traverse[F] with Foldable1[F]
A scalaz.Traverse where
traverse
is total over scalaz.Applys.A scalaz.Traverse where
traverse
is total over scalaz.Applys. That is,toList
cannot return an empty list. - sealed abstract class Tree[A] extends AnyRef
A multi-way tree, also known as a rose tree.
A multi-way tree, also known as a rose tree. Also known as Cofree[Stream, A].
- sealed abstract class TreeInstances extends AnyRef
- final case class TreeLoc[A](tree: Tree[A], lefts: TreeForest[A], rights: TreeForest[A], parents: Parents[A]) extends Product with Serializable
A rose-tree zipper.
A rose-tree zipper. Represents a scalaz.Tree together with a position in that tree. Provides navigation, persistent update, insertion, and deletes.
- tree
The currently selected node.
- lefts
The left siblings of the current node.
- rights
The right siblings of the current node.
- parents
The parent contexts of the current node.
- sealed abstract class TreeLocInstances extends AnyRef
- trait Unapply[TC[_[_]], MA] extends AnyRef
Represents a type
MA
that has been destructured into as a type constructorM[_]
applied to typeA
, along with a corresponding type class instanceTC[M]
.Represents a type
MA
that has been destructured into as a type constructorM[_]
applied to typeA
, along with a corresponding type class instanceTC[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.
- Annotations
- @implicitNotFound()
- trait Unapply2[TC[_[_, _]], MAB] extends AnyRef
- trait Unapply21[TC[_[_, _], _], MAB] extends AnyRef
- trait UnapplyProduct[TC[_[_]], MA, MB] extends AnyRef
- abstract class UnapplyProductInstances extends AnyRef
- 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 extends AnyRef
- sealed abstract class UnitReducer[C, M] extends Reducer[C, M]
- type Unwriter[W, A] = UnwriterT[scalaz.Id.Id, W, A]
- final case class UnwriterT[F[_], U, A](run: F[(U, A)]) extends Product with Serializable
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
orSemigroup
required. There is nopoint
operation. You can switch betweenWriterT
andUnwriterT
withunary_+
andunary_-
. - trait UnwriterTFunctions extends AnyRef
- sealed abstract class UnwriterTInstances extends UnwriterTInstances0
- sealed abstract class UnwriterTInstances0 extends UnwriterTInstances1
- sealed abstract class UnwriterTInstances1 extends UnwriterTInstances2
- sealed abstract class UnwriterTInstances2 extends AnyRef
- trait Unzip[F[_]] extends AnyRef
- sealed abstract class Validation[E, A] extends Product with Serializable
Represents either:
Represents either:
Success(a)
, orFailure(e)
.
Isomorphic to
scala.Either
andscalaz.\/
. The motivation for aValidation
is to provide the instanceApplicativea
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 aliasscalaz.ValidationNel[E]
is provided as a shorthand forscalaz.Validation[NonEmptyList[E]]
, and a methodValidation#toValidationNel
convertsValidation[E]
toValidationNel[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"))
- E
The type of the
Failure
- A
The type of the
Success
- final class ValidationFlatMap[E, A] extends AnyVal
- sealed abstract class ValidationInstances extends ValidationInstances0
- sealed abstract class ValidationInstances0 extends ValidationInstances1
- sealed abstract class ValidationInstances1 extends ValidationInstances2
- sealed abstract class ValidationInstances2 extends ValidationInstances3
- sealed abstract class ValidationInstances3 extends AnyRef
- type ValidationNel[E, X] = Validation[NonEmptyList[E], X]
An scalaz.Validation with a scalaz.NonEmptyList as the failure type.
- final case class Value[A](value: A) extends Name[A] with Product with Serializable
Call by value
- type Writer[W, A] = WriterT[W, scalaz.Id.Id, A]
- final case class WriterT[W, F[_], A](run: F[(W, A)]) extends Product with Serializable
- trait WriterTFunctions extends AnyRef
- sealed abstract class WriterTInstance5 extends WriterTInstances6
- sealed abstract class WriterTInstances extends WriterTInstances0
- sealed abstract class WriterTInstances0 extends WriterTInstances1
- sealed abstract class WriterTInstances1 extends WriterTInstances2
- sealed abstract class WriterTInstances10 extends WriterTInstances11
- sealed abstract class WriterTInstances11 extends WriterTInstances12
- sealed abstract class WriterTInstances12 extends WriterTInstances13
- sealed abstract class WriterTInstances13 extends WriterTInstances14
- sealed abstract class WriterTInstances14 extends WriterTInstances15
- sealed abstract class WriterTInstances15 extends WriterTInstances16
- sealed abstract class WriterTInstances16 extends AnyRef
- sealed abstract class WriterTInstances2 extends WriterTInstances3
- sealed abstract class WriterTInstances3 extends WriterTInstances4
- sealed abstract class WriterTInstances4 extends WriterTInstance5
- sealed abstract class WriterTInstances6 extends WriterTInstances7
- sealed abstract class WriterTInstances7 extends WriterTInstances8
- sealed abstract class WriterTInstances8 extends WriterTInstances9
- sealed abstract class WriterTInstances9 extends WriterTInstances10
- abstract class Yoneda[F[_], A] extends AnyRef
The cofree functor generated by
F
.The cofree functor generated by
F
. The Yoneda lemma says thatYoneda[F,A]
is isomorphic toF[A]
for any functorF
. The homomorphism fromYoneda[F,A]
toF[A]
exists even when we have forgotten thatF
is a functor. Can be seen as a partially appliedmap
for the functorF
. - trait Zap[F[_], G[_]] extends AnyRef
Functors that annihilate each other.
- sealed abstract class ZapInstances extends AnyRef
- trait Zip[F[_]] extends AnyRef
- final case class Zipper[A](lefts: LazyList[A], focus: A, rights: LazyList[A]) extends Product with Serializable
Provides a pointed stream, which is a non-empty zipper-like stream structure that tracks an index (focus) position in a stream.
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.
- sealed abstract class ZipperInstances extends AnyRef
- sealed abstract class \&/[A, B] extends Product with Serializable
- Since
7.0.3
- sealed abstract class \/[A, B] extends Product with Serializable
Represents a disjunction: a result that is either an
A
or aB
.Represents a disjunction: a result that is either an
A
or aB
.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 extendException
.A
\/B
is isomorphic toscala.Either[A, B]
, but \/ is right-biased for all Scala versions, so methods such asmap
andflatMap
apply only in the context of the "right" case. This right bias makes \/ more convenient to use thanscala.Either
in a monadic context in Scala versions <2.12. Methods such asswap
,swapped
, andleftMap
provide functionality thatscala.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. - final case class \/-[A, B](b: B) extends \/[A, B] with Product with Serializable
A right disjunction
A right disjunction
Often used to represent the success case of a result
- type |-->[A, B] = IndexedStoreT[scalaz.Id.Id, B, B, A]
- type ~>[F[_], G[_]] = NaturalTransformation[F, G]
A scalaz.NaturalTransformation[F, G].
- type ~~>[F[_, _], G[_, _]] = BiNaturalTransformation[F, G]
- type ∨[A, B] = \/[A, B]
- type ⊤ = Any
- type ⊥ = Nothing
Value Members
- val DLeft: -\/.type
- val DRight: \/-.type
- val Disjunction: \/.type
- val DisjunctionT: EitherT.type
- val IMap: ==>>.type
- val IRWS: IndexedReaderWriterState.type
- val IRWST: IndexedReaderWriterStateT.type
- val RWS: ReaderWriterState.type
- val RWST: ReaderWriterStateT.type
- def Traced[A, B](f: (A) => B): Traced[A, B]
- implicit val idInstance: Traverse1[scalaz.Id.Id] with Monad[scalaz.Id.Id] with BindRec[scalaz.Id.Id] with Comonad[scalaz.Id.Id] with Distributive[scalaz.Id.Id] with Zip[scalaz.Id.Id] with Unzip[scalaz.Id.Id] with Align[scalaz.Id.Id] with Cozip[scalaz.Id.Id] with Optional[scalaz.Id.Id]
- object -\/ extends Serializable
- object /~\
- object :+:
- object ==>> extends MapInstances
- object Adjunction extends AdjunctionInstances
- object Align
- object Alpha extends AlphaInstances with Serializable
- object Alt
- object Alter extends AlterInstances with Serializable
- object Ap extends ApInstances with Serializable
- object Applicative
- object ApplicativeError
- object ApplicativePlus
- object Apply
- object Arrow
- object Associative
- object Band
- object Bifoldable
- object Bifunctor
- object BijectionT extends BijectionTInstances
- object Bind
- object BindRec
- object Bitraverse
- object CaseInsensitive extends CaseInsensitiveInstances
- object Category
- object Choice
- object Cobind
- object Codensity extends CodensityInstances
- object Cofree extends CofreeInstances
- object Cohoist
- object Cokleisli extends CokleisliInstances with Serializable
- object Comonad
- object ComonadStore
- object ComonadTrans
- object Compose
- object Const extends ConstInstances with Serializable
- object Cont extends IndexedContsTInstances with IndexedContsTFunctions
- object ContT extends IndexedContsTInstances with IndexedContsTFunctions
- object Contravariant
- object ContravariantCoyoneda extends ContravariantCoyonedaInstances
- object Conts extends IndexedContsTInstances with IndexedContsTFunctions
- object ContsT extends IndexedContsTInstances with IndexedContsTFunctions
- object Coproduct extends CoproductInstances with Serializable
- object Cord
- object CorecursiveList extends CorecursiveListInstances
- object Coyoneda extends CoyonedaInstances
- object Cozip
- object DList extends DListInstances
- object Day extends DayInstances
- object Decidable
- object Density extends DensityInstances
- object Dequeue extends DequeueInstances
- object Diev extends DievInstances
- object DievInterval
- object Digit extends DigitInstances with Serializable
- object Distributive
- object Divide
- object Divisible
- object Dual extends DualInstances
- object Either3 extends Serializable
- object EitherT extends EitherTInstances with Serializable
- object EmptyDequeue extends Serializable
- object Endo extends EndoInstances with Serializable
- object EndoByName extends EndoByNameInstances with Serializable
- object Endomorphic extends EndomorphicInstances with Serializable
- object Enum
- object EphemeralStream extends EphemeralStreamInstances
- object Equal
- object FingerTree extends FingerTreeInstances
- object FoldCase extends FoldCaseInstances
- object Foldable
- object Foldable1
- object Forall extends Foralls
- object Free extends FreeInstances
- object FreeAp
- object FreeT extends FreeTInstances
- object Functor
- object Generator extends Generators
- object Heap extends HeapInstances
- object Hoist
- object IList extends IListInstances with Serializable
- object INil extends Serializable
- object ISet extends ISetInstances
- object IStream
- object Id extends IdInstances
- object IdT extends IdTInstances with Serializable
- object ImmutableArray extends ImmutableArrayInstances
- object IndSeq extends IndSeqInstances
- object IndexedCont extends IndexedContsTInstances with IndexedContsTFunctions
- object IndexedContT extends IndexedContsTInstances with IndexedContsTFunctions
- object IndexedConts extends IndexedContsTInstances with IndexedContsTFunctions
- object IndexedContsT extends IndexedContsTInstances with IndexedContsTFunctions with Serializable
- object IndexedReaderWriterState extends ReaderWriterStateTInstances with ReaderWriterStateTFunctions
- object IndexedReaderWriterStateT extends ReaderWriterStateTInstances with ReaderWriterStateTFunctions
- object IndexedState extends StateFunctions
- object IndexedStateT extends StateTInstances with StateTFunctions
- object IndexedStore
- object IndexedStoreT extends StoreTInstances with StoreTFunctions with Serializable
- object Inject extends InjectInstances
- object Injectivity
- object InvariantAlt
- object InvariantApplicative
- object InvariantFunctor
- object IsContravariant
- object IsCovariant
- object IsEmpty
- object Isomorphism extends Isomorphisms
- object Kleisli extends KleisliInstances with Serializable
- object Lan extends LanInstances
- object LazyEither extends LazyEitherInstances
- object LazyEitherT extends LazyEitherTInstances with Serializable
- object LazyOption extends LazyOptionInstances with Serializable
- object LazyOptionT extends LazyOptionTInstances with Serializable
- object LazyTuple
- object LazyTuple2 extends LazyTuple2Instances
- object LazyTuple3 extends LazyTuple3Instances
- object LazyTuple4 extends LazyTuple4Instances
- object Leibniz extends LeibnizInstances
- object LeibnizF
- object Lens extends LensInstances with LensFunctions
- See also
- object LensFamily extends LensInstances with LensFunctions
- object Liskov extends LiskovInstances
- object LiskovF
- object ListT extends ListTInstances with Serializable
- object Maybe extends MaybeInstances
- object MaybeT extends MaybeTInstances with Serializable
- object Memo extends MemoInstances
- object Monad
- object MonadError
- object MonadListen
- object MonadPlus
- object MonadReader
- object MonadState
- object MonadTell
- object MonadTrans
- object Monoid
- object Name
- object NaturalTransformation extends NaturalTransformations
- object Need
- object NonEmptyList extends NonEmptyListInstances
- object Nondeterminism
- object NotNothing
- object NullArgument extends NullArgumentInstances
- object NullResult extends NullResultInstances
- object OneAnd extends OneAndInstances
- object OneOr extends OneOrInstances with Serializable
- object OptionT extends OptionTInstances with Serializable
- object Optional
- object OrdSeq
- object Order
- object Ordering extends OrderingInstances with Serializable
- object PLens extends PLensInstances with PLensFunctions
- object PLensFamily extends PLensInstances with PLensFunctions
- object Plus
- object PlusEmpty
- object PrioritySearchQueue
- object ProChoice
- object Profunctor
- object Ran
- object Reader
- object ReaderT
- object ReaderWriterState extends ReaderWriterStateTInstances with ReaderWriterStateTFunctions
- object ReaderWriterStateT extends ReaderWriterStateTInstances with ReaderWriterStateTFunctions
- object Reducer extends ReducerInstances
- object Representable extends RepresentableInstances
- object Scalaz extends StateFunctions with ToTypeClassOps with ToDataOps with AllInstances with AllFunctions with ToAllStdOps with IdInstances
- case object ScalazBuildInfo extends Product with Serializable
This object was generated by sbt-buildinfo.
- object Select
- object SelectT extends SelectTInstances with Serializable
- object SemiLattice
- object Semigroup
- object Show
- object Split
- object State extends StateFunctions
- object StateT extends StateTInstances with StateTFunctions
- object Store
- object StoreT extends StoreTInstances with StoreTFunctions
- object StreamT extends StreamTInstances
- object StrictTree extends StrictTreeInstances with Serializable
- object Strong
- object Tag
- 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 .
- object Tannen extends TannenInstances with Serializable
- object TheseT extends TheseTInstances with Serializable
- object TracedT extends TracedTInstances with Serializable
- object Trampoline
- object Traverse
- object Traverse1
- object Tree extends TreeInstances
- object TreeLoc extends TreeLocInstances with Serializable
- object Unapply extends Unapply_0
- object Unapply2
- object Unapply21
- object UnapplyProduct extends UnapplyProductInstances
- object UnitReducer
- object Unwriter
- object UnwriterT extends UnwriterTInstances with UnwriterTFunctions with Serializable
- object Unzip
- object Validation extends ValidationInstances with Serializable
- object Value extends Serializable
- object Writer
- object WriterT extends WriterTInstances with WriterTFunctions with Serializable
- object Yoneda
- object Zap extends ZapInstances
- object Zip
- object Zipper extends ZipperInstances with Serializable
- object \&/ extends TheseInstances with Serializable
- object \/ extends DisjunctionInstances with Serializable
- object \/- extends Serializable