A left disjunction
A left disjunction
Often used to represent the failure case of a result
The coproduct (or free product) of monoids M
and 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.
scalaz.Inject[F, G]
scalaz.Inject[F, G]
A scalaz.NaturalTransformation[G, F].
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
7.0.3
Tag a type T
with Tag
.
Tag a type T
with Tag
.
The resulting type is used to discriminate between type class instances.
Credit to Miles Sabin for the idea.
An adjunction formed by two functors F
and G
such that F
is left-adjoint to 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.
The minimal defition is either (unit, counit) or (leftAdjunct, rightAdjunct)
An algebraic data type representing the characters 'a' to 'z'
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:
Applicative
scalaz.Applicative combined with scalaz.PlusEmpty.
scalaz.Applicative without point
.
scalaz.Applicative without point
.
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.
A constrained transformation natural in both sides of a bifunctor
A function universally quantified over two parameters.
A type giving rise to two unrelated scalaz.Foldables.
A type giving rise to two unrelated scalaz.Functors.
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.
A type giving rise to two unrelated scalaz.Traverses.
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.
scalaz.Compose with identity.
scalaz.Compose with identity.
A cofree comonad for some functor S
, i.e.
A cofree comonad for some functor S
, i.e. an S
-branching stream.
A constrained natural transformation
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.
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
http://hackage.haskell.org/package/kan-extensions-4.0.1/docs/Data-Functor-Contravariant-Coyoneda.html
F
on the left, and G
on the right, of scalaz.\/.
A Cord
is a purely functional data structure for efficiently
storing and manipulating String
s that are potentially very long.
A Cord
is a purely functional data structure for efficiently
storing and manipulating String
s that are potentially very long.
Very similar to Rope[Char]
, but with better constant factors and a
simpler interface since it's specialized for String
s.
Corepresentable functors
The dual view of the Yoneda lemma.
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.
Difference lists: a data structure for O(1)
append on lists.
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.
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
Implementation of a Discrete Interval Encoding Tree http://web.engr.oregonstate.edu/~erwig/diet/ that is actually implemented using a Vector and is balanced at all times as a result.
An algebraic data type representing the digits 0 - 9
Dual of scalaz.Traverse.
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.
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))
Endomorphisms.
Endomorphisms. They have special properties among functions, so are captured in this newtype.
The captured function.
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]
An scalaz.Orderable with discrete values.
Like scala.collection.immutable.Stream, but doesn't save computed values.
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.
A type safe alternative to universal equality (scala.Any#==
).
A type safe alternative to universal equality (scala.Any#==
).
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 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:
O(1)
O(1)
(O lg min(l1, l2))
where l1
and l2
are their sizesn
is O(lg min(n, l - n))
, where l
is the size of the tree.The type of the annotations of the nodes (the measure)
The type of the elements stored at the leaves
A type parameter implying the ability to extract zero or more values of that type.
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.
A universally quantified value
A free operational monad for some functor S
.
A free operational monad for some functor S
. Binding is done using the heap instead of the stack,
allowing tail-call elimination.
Free applicative functors.
Free applicative functors. Less expressive than free monads, but more flexible to inspect and interpret.
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.
A Generator[C]
is a container of elements, and which knows how to efficiently apply a scalaz.Reducer
to extract an answer by combining elements.
A Generator[C]
is a container of elements, and which 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.
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
Safe, invariant alternative to stdlib List
.
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.
Mixed into object Id
in the package object scalaz.
An immutable wrapper for arrays
An immutable wrapper for arrays
type of the elements of the array
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)
.
A monad transformer stack yielding (R, S1) => F[(W, A, S2)]
.
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).
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.
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:
Also known as an exponential functor.
Typeclass that permits testing whether some type with an empty representation is in fact empty.
Represents a function A => M[B]
.
The left Kan extension of H
along G
scala.Either, but with a value by name.
scala.Option, but with a value by name.
scala.Tuple2, but with values by name.
scala.Tuple3, but with values by name.
scala.Tuple4, but with values by name.
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.
A lens that doesn't transform the type of the record.
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
.
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
.
The initial type of the record
The final type of the record
The initial type of the field
The final type of the field
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
.)
ListT monad transformer.
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).
monad transformer for Maybe
A function memoization strategy.
A function memoization strategy. See companion for various instances employing various strategies.
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.
This trait establishes a partial order among monads.
This trait establishes a partial order among monads. A "bigger" monad is one that does all of the effects of the "smaller" as part of its execution.
The class of monads supporting the operations of scalaz.State.
The class of monads supporting write operations
Class of monad transformers.
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#+
respectivelyMonoid[List[A]]
: zero
and append
are Nil
and List#++
respectivelyReferences:
Call by name
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.
Call by need
A singly-linked list that is guaranteed to be non-empty.
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, 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
7.0.3
7.0.3
OptionT monad transformer.
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.
the container/context type
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 Monoid[Option[A] @@ Last]
, whose append
operation favours the first argument. Accordingly, the measuer of a node is the
item with the highest priority contained recursively below that node.
Safer version of scala.math.Ordering.
A ternary marker of how two values relate in an ordering.
A ternary marker of how two values relate in an ordering.
scalaz calls its version of scala.math.Ordering,
scalaz.Order. This Ordering
is analogous to the
Int
s returned by scala.math.Ordering.
A partial lens that doesn't transform the type of the record.
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
.
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
.
The initial type of the record
The final type of the record
The initial type of the optional field
The final type of the optional field
Universally quantified scalaz.Semigroup.
Universally quantified scalaz.Monoid.
Strength on a coproduct.
Profunctors are covariant on the right and contravariant on the left.
The right Kan extension of H
along G
A Reducer[C,M]
is a scalaz.Monoid[M]
that maps
values of type C
through unit
to values of type M
.
A Reducer[C,M]
is a scalaz.Monoid[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 Monoid
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 monoid.
Minimal definition: unit
or snoc
Based on a Haskell library by Edward Kmett
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 in X
, can be trivially derived for
F
.
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.
A typeclass for conversion to textual representation, done via scalaz.Cord for efficiency.
A scalaz.Compose (semigroupoid) permitting products.
A state transition, representing a function S => (A, S)
.
StreamT monad transformer.
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.
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.
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].
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.
The currently selected node.
The left siblings of the current node.
The right siblings of the current node.
The parent contexts of the current node.
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 // Requires the -Ydep-method-types flag to scalac with scala 2.9.x (not required with 2.10) 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[({type ᅫᄏ[ᅫᄆ]=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.
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_-
.
Represents either:
Represents either:
Success(a)
, orFailure(e)
.Isomorphic to scala.Either
and scalaz.\/
. The motivation for a Validation
is to provide the instance
Applicativea
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[({type ᅫᄏ[ᅫᄆ]=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"))
The type of the Failure
The type of the Success
An scalaz.Validation with a scalaz.NonEmptyList as the failure type.
An scalaz.Validation with a scalaz.NonEmptyList as the failure type.
Useful for accumulating errors through the corresponding scalaz.Applicative instance.
Call by value
View of the left end of a sequence.
View of the right end of a sequence.
The free functor generated by F
.
The free 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
.
Functors that annihilate each other.
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.
7.0.3
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, 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. 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.
A right disjunction
A right disjunction
Often used to represent the success case of a result
A scalaz.NaturalTransformation[F, G].
Burkhard-Keller trees provide an implementation of sets which apart
from the ordinary operations also has an approximate member search,
allowing you to search for elements that are of a distance n
from
the element you are searching for.
Burkhard-Keller trees provide an implementation of sets which apart
from the ordinary operations also has an approximate member search,
allowing you to search for elements that are of a distance n
from
the element you are searching for. The distance is determined using
a metric on the type of elements. Therefore all elements must
implement the scalaz.MetricSpace type class, rather than the more usual
scalaz.Ordering.
The worst case complexity of many of these operations is quite bad,
but the expected behavior varies greatly with the metric. For
example, the discrete metric (distance x y | y == x = 0 |
otherwise = 1
) makes BK-trees behave abysmally. The metrics
mentioned above should give good performance characteristics.
This implementation is a port of Haskell's Data.Set.BKTree
(Since version 7.0.1) This class depends on MetricSpace
which is deprecated, too.
Newtype for strings representing character sets.
Newtype for strings representing character sets.
(Since version 7.1) CharSet is deprecated
(Since version 7.1) Cojoin has been merged into Cobind
Run a side effect once for each A
in the F
.
Run a side effect once for each A
in the F
.
(Since version 7.1) Each is deprecated
Random access through an integer index.
Random access through an integer index.
(Since version 7.1) Index is deprecated, use Foldable#index instead
Returns a list in order of key insertion.
Returns a list in order of key insertion.
(Since version 7.1) InsertionMap is deprecated
(Since version 7.1) InsertionMap is deprecated
(Since version 7.1) InsertionMap is deprecated
(Since version 7.1) Each is deprecated
(Since version 7.1) Index is deprecated, use Foldable instead
(Since version 7.1) Length is deprecated, use Foldable#length instead
Useful metric spaces include the manhattan distance between two points, the Levenshtein edit distance between two strings, the number of edges in the shortest path between two nodes in an undirected graph and the Hamming distance between two binary strings.
Useful metric spaces include the manhattan distance between two points, the Levenshtein edit distance between two strings, the number of edges in the shortest path between two nodes in an undirected graph and the Hamming distance between two binary strings. Any euclidean space also has a metric. However, in this module we use int-valued metrics and that's not compatible with the metrics of euclidean spaces which are real-values.
(Since version 7.0.1) Redundant to spire's MetricSpace
Ropes or 'heavyweight Strings' are an alternative to Strings.
Ropes or 'heavyweight Strings' are an alternative to Strings. In essence they are binary trees whose leaves are arrays of characters. Their advantage over ordinary strings is support for efficient concatenation and substring operations, which scale to long strings.
They were first described in the paper: Ropes: an Alternative to Strings. by Hans-J. Boehm , Russ Atkinson , Michael Plass
(Since version 7.1) Rope is deprecated. Use Cord
instead
http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.14.9450&rep=rep1&type=pdf
(Since version 7.1) Rope is deprecated. Use Cord
instead
(Since version 7.1) Rope is deprecated. Use Cord
instead
Union types using Curry-Howard isomorphism
Union types using Curry-Howard isomorphism
(Since version 7.1) unboxed union types are deprecated
http://www.chuusai.com/2011/06/09/scala-union-types-curry-howard/
(Since version 7.1) Rope is deprecated. Use Cord
instead
Type tags that are used to discriminate between alternative type class instances.
Type tags that are used to discriminate between alternative type class instances.
scalaz.Tag and, @@
in the package object scalaz .
Type Class instances for data structures in the Scala and Java standard libraries.
Implicits to provide a convenient syntax to work with type classes and functions.
Implicits to provide a convenient syntax to work with type classes and functions.
Non-trivial code should *not* be defined in this package; instead delegate.
(Since version 7.1) CharSet is deprecated
(Since version 7.1) Cojoin has been merged into Cobind
(Since version 7.1) Each is deprecated
(Since version 7.1) Index is deprecated, use Foldable#index instead
(Since version 7.1) InsertionMap is deprecated
(Since version 7.1) Length is deprecated, use Foldable#length instead
(Since version 7.1) Rope is deprecated. Use Cord
instead
(Since version 7.1) unboxed union types are deprecated
Scalaz: Type classes and pure functional data structures for Scala.
This package, scalaz, contains:
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
Data Structures Index
A => A
.Stream
of sub-trees.A => M[B]
, allowing chaining. Also known, and aliased, asscalaz.ReaderT
.F[Option[A]]
F[Maybe[A]]
F[A \/ B]