Protocols
The following protocols are available globally.
-
Protocol for automatic derivation of AffineTraversal optics.
See moreDeclaration
Swift
public protocol AutoAffineTraversal : AutoOptics
-
Protocol for automatic derivation of Getter optics
See moreDeclaration
Swift
public protocol AutoGetter : AutoOptics
-
Protocol for automatic derivation of lenses.
See moreDeclaration
Swift
public protocol AutoLens : AutoOptics
-
Base protocol for optics automatic derivation.
See moreDeclaration
Swift
public protocol AutoOptics
-
Protocol for automatic derivation of Prism optics.
See moreDeclaration
Swift
public protocol AutoPrism : AutoOptics
-
Protocol for automatic derivation of Setter
See moreDeclaration
Swift
public protocol AutoSetter : AutoOptics
-
See moreAt
provides aLens
for a this structure to focus atAtFoci
at a given indexAtIndex
.Declaration
Swift
public protocol At
-
See moreCons
provides aPrism
between this structure and a pair containing its first element and its tail. It provides a convenient way to attach or detach elements to the left side of a structure.Declaration
Swift
public protocol Cons
-
See moreEach
provides aTraversal
that can focus into this structure to see all its foci of typeEachFoci
.Declaration
Swift
public protocol Each
-
See moreFilterIndex
provides aTraversal
for this structure with all its fociFilterIndexFoci
whose indexFilterIndexType
satisfies a predicate.Declaration
Swift
public protocol FilterIndex
-
See moreIndex
provides anAffineTraversal
for this structure to focus on an optionalIndexFoci
at a given indexIndexType
.Declaration
Swift
public protocol Index
-
A Functor provides a type with the ability to transform its value type into another type, while preserving its structure.
Using the encoding for HKTs in Bow, in the type
See moreKind<F, A>
,A
is the value type andF
represents the structure of the type. An instance ofFunctor
forF
allows to transformA
into another type, while maintainingF
unchanged.Declaration
Swift
public protocol Functor : Invariant
-
Undocumented
Declaration
Swift
public protocol Birecursive : Corecursive, Recursive
-
Undocumented
See moreDeclaration
Swift
public protocol Corecursive
-
Async models how a data type runs an asynchronous computation that may fail, described by the
See moreProc
signature.Declaration
Swift
public protocol Async : MonadDefer
-
Bracket models a generalized abstracted pattern of safe resource acquisition and release in the face of errors or interruptions.
See moreDeclaration
Swift
public protocol Bracket : MonadError
-
Declaration
Swift
public protocol MonadDefer : MonadError
-
UsafeRun provides capabilities to run a computation unsafely, synchronous or asynchronously.
See moreDeclaration
Swift
public protocol UnsafeRun : MonadError
-
A Comonad is the dual of a
Monad
. It provides capabilities to compose functions that extract values from their context.Implementations of this instance must obey the following laws:
See moreextract(duplicate(fa)) == fa map(fa, f) == coflatMap(fa, { a in f(extract(a)) } coflatMap(fa, extract) == fa extract(coflatMap(fa, f)) == f(fa)
Declaration
Swift
public protocol Comonad : Functor
-
An Alternative is an
Applicative
withMonoidK
capabilities.Declaration
Swift
public protocol Alternative : Applicative, MonoidK
-
An Applicative Functor is a
Functor
that also provides functionality to lift pure expressions, and sequence computations and combine their results.Instances of this typeclass must obey the following laws:
Identity
ap(pure(id), v) == v
Composition
ap(ap(ap(pure(compose), u), v), w) == compose(u, compose(v, w))
Homomorphism
ap(pure(f), pure(x)) == pure(f(x))
Interchange
ap(fa, pure(b)) == ap(pure({ x in x(a) }), fa)
Declaration
Swift
public protocol Applicative : Functor
-
An ApplicativeError is an
Applicative
that has capabilities to raise and handle error values.It has an associated type
See moreE
to represent the error type that the implementing instance is able to handle.Declaration
Swift
public protocol ApplicativeError : Applicative
-
A Contravariant Functor is the dual of a Covariant Functor, usually referred to as just
See moreFunctor
. Whereas an intuition behind Covariant Functors is that they can be seen as containing or producing values, Contravariant Functors can be seen as consuming values.Declaration
Swift
public protocol Contravariant : Invariant
-
Divide is a type class that models the divide part of divide and conquer.
See moreDeclaration
Swift
public protocol Divide : Contravariant
-
EquatableK provides capabilities to check equality of values at the kind level.
See moreDeclaration
Swift
public protocol EquatableK
-
Foldable describes types that have the ability to be folded to a summary value.
See moreDeclaration
Swift
public protocol Foldable
-
EquatableK provides capabilities to compute a hash value at the kind level.
See moreDeclaration
Swift
public protocol HashableK : EquatableK
-
An Invariant Functor provides a type the ability to transform its value type into another type. An instance of
See moreFunctor
orContravariant
are Invariant Functors as well.Declaration
Swift
public protocol Invariant
-
A Monad provides functionality to sequence operations that are dependent from one another.
Instances of
Monad
must obey the following rules:flatMap(pure(a), f) == f(a) flatMap(fa, pure) == fa flatMap(fa) { a in flatMap(f(a), g) } == flatMap(flatMap(fa, f), g)
Also, instances of
Monad
derive a default implementation forApplicative.ap
as:
See moreap(ff, fa) == flapMap(ff, { f in map(fa, f) }
Declaration
Swift
public protocol Monad : Selective
-
A MonadCombine has the capabilities of
See moreMonadFilter
andAlternative
together.Declaration
Swift
public protocol MonadCombine : Alternative, MonadFilter
-
A MonadError has the same capabilities as a
See moreMonad
and anApplicativeError
.Declaration
Swift
public protocol MonadError : ApplicativeError, Monad
-
A MonadFilter is a
Monad
withFunctorFilter
capabilities. It also provides functionality to create a value that represents an empty element in the context implementing an instance of this typeclass.Implementing this typeclass automatically derives an implementation for
See moreFunctorFilter.mapFilter
.Declaration
Swift
public protocol MonadFilter : FunctorFilter, Monad
-
A MonoidK is a
See moreSemigroupK
that also has an empty element.Declaration
Swift
public protocol MonoidK : SemigroupK
-
The Monoidal type class adds an identity element to Semigroupal type class by defining the function identity.
Identity returns a specific identity
Kind<F, A>
value for a given type F and A.This type class complies with the following law: fa.product(identity) == identity.product(fa) == identity
In addition, the laws of Semigroupal type class also apply.
See moreDeclaration
Swift
public protocol Monoidal : Semigroupal
-
The Selective typeclass represents Selective Applicative Functors, described in this paper. Selective Applicative Functors enrich Applicative Functors by providing an operation that composes two effectful computations where the second depends on the first.
See moreDeclaration
Swift
public protocol Selective : Applicative
-
A semigroup is an algebraic structure that consists of a set of values and an associative operation.
See moreDeclaration
Swift
public protocol Semigroup
-
The Semigroupal type class for a given type
F
can be seen as an abstraction over the cartesian product. It defines the function product.The product function for a given type
F
,A
andB
combines aKind<F, A>
and aKind<F, B>
into aKind<F, (A, B)>
. This function guarantees compliance with the following laws:Semigroupals are associative under the bijection
f = (a,(b,c)) -> ((a,b),c)
orf = ((a,b),c) -> (a,(b,c))
. Therefore, the following laws also apply:f((a.product(b)).product(c)) == a.product(b.product(c))
See moref(a.product(b.product(c))) == (a.product(b)).product(c)
Declaration
Swift
public protocol Semigroupal
-
TraverseFilter represents array-like structures that can be traversed and filtered as a single combined operation. It provides the same capabilities as
See moreTraverse
andFunctorFilter
together.Declaration
Swift
public protocol TraverseFilter : FunctorFilter, Traverse