Classes
The following classes are available globally.
-
An AffineTraversal is an optic that allows to see into a structure and getting, setting or modifying an optional focus.
A (polymorphic) PAffineTraversal is useful when setting or modifying a value for a type with an optional polymorphic focus.
A PAffineTraversal can be seen as a weaker
LensandPrismand combines their weakest functions: -setmeaning we can focus into anSand set a valueBfor a targetAand obtain a modified sourceT. -getOrModifymeaning it returns the focus of aPAffineTraversal(if present) or the original value.Type parameters: -
See moreS: Source. -T: Modified source. -A: Focus. -B: Modified focus.Declaration
Swift
public class PAffineTraversal<S, T, A, B>
-
A BoundSetter is a
See moreSetterthat is already bound to a concrete source.Declaration
Swift
public class BoundSetter<S, A>
-
A
Getteris an optic that allows to see into a structure and getting a focus.It can be seen as a function
(S) -> Ameaning that we can look into anSand get anA.Parameters: -
See moreS: source of theGetter. -A: focus of theGetter.Declaration
Swift
public class Getter<S, A>
-
Simulates a Higher-Kinded Type in Swift with 1 type argument.
This class simulates Higher-Kinded Type support in Swift.
Kind<F, A>is an alias forF<A>, which is not syntactically valid in Swift. Classes that want to have HKT support must extend this class. Type parameterFis reserved for a witness to prevent circular references in the inheritance relationship. By convention, witnesses are named like the class they represent, with the prefixFor. As an example:
See moreclass ForOption {} class Option<A>: Kind<ForOption, A> {}Declaration
Swift
open class Kind<F, A>
-
StateT transformer represents operations that need to write and read a state through a computation or effect.
Some computations may not require the full power of this transformer: - For read-only state, see
See moreReaderT/Kleisli. - To accumulate a value without using it on the way, seeWriterT.Declaration
Swift
public final class StateT<F, S, A> : StateTOf<F, S, A> -
Witness for the
StateT<F, S, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForStateT
-
Witness for the
ArrayK<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForArrayK
-
Witness for the
Const<A, T>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForConst
-
Witness for the
EitherK<F, G, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForEitherK -
Partial application of the EitherK type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class EitherKPartial<F, G> : Kind2<ForEitherK, F, G>
-
Witness for the
Either<A, B>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForEither
-
Witness for the
Id<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForId
-
Witness for the
Ior<A, B>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForIor
-
A NonEmptyArray is an array of elements that guarantees to have at least one element.
See moreDeclaration
Swift
public final class NonEmptyArray<A> : NonEmptyArrayOf<A> -
Witness for the
NonEmptyArray<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForNonEmptyArray
-
Represents optional values. Instances of this type may represent the presence of a value (
See moresome) or absence of it (none). This type is isomorphic to native SwiftOptional<A>(usually writtenA?), with the addition of behaving as a Higher Kinded Type.Declaration
Swift
public final class Option<A> : OptionOf<A> -
Witness for the
Option<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForOption
-
Witness for the
Try<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForTry
-
Validated is a data type to represent valid and invalid values. It is similar to
See moreEither, but with error accumulation in the invalid case.Declaration
Swift
public final class Validated<E, A> : ValidatedOf<E, A> -
Witness for the
Validated<E, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForValidated -
Partial application of the Validated type constructor, ommitting the last parameter.
See moreDeclaration
Swift
public final class ValidatedPartial<I> : Kind<ForValidated, I>
-
An Iso is a loss less invertible optic that defines an isomorphism between a type
SandA.A polimorphic
PIsois useful when setting or modifying a value for a constructed type; e.g.PIso<<Option<Int>, Option<String>, Int?, String?>.S: Source of aPIso.T: Modified source of aPIso.A: Focus of aPIso.B: Modified target of aPIso.
Declaration
Swift
public class PIso<S, T, A, B>
-
A Lens (or Functional Reference) is an optic that can focus into a structure for getting, setting or modifying the focus (target).
A (polymorphic) PLens is useful when setting or modifying a value for a constructed type.
A PLens can be seen as a pair of functions: -
get: (S) -> Ameaning we can focus intoSand extract anA. -set: (B, S) -> Tmeaning we can focus into anSand set a valueBfor a targetAand obtain a modified source.The type arguments are: -
See moreSis the source of a PLens. -Tis the modified source of a PLens. -Ais the focus of a PLens. -Bis the modified focus of a PLens.Declaration
Swift
public class PLens<S, T, A, B>
-
A Prism is a loss less invertible optic that can look into a structure and optionally find its focus. It is mostly used for finding a focus that is only present under certain conditions, like in a sum type.
A (polymorphic) PPrism is useful when setting or modifying a value for a polymorphic sum type.
A PPrism gathres the two concepts of pattern matching and constructor and thus can be seen as a pair of functions: -
getOrModifymeaning it returns the focus of a PPRism or the original value. -reverseGetmeaining we can construct the source type of a PPrism from a focus.Type parameters: -
See moreS: Source. -T: Modified source. -A: Focus. -B: Modified focus.Declaration
Swift
public class PPrism<S, T, A, B>
-
A Setter is an optic that allows to see into a structure and set or modify its focus.
A (polymorphic) PSetter is useful when setting or modifying a value for a constructed type.
A PSetter is a generalization of a
Functor.Parameters: -
See moreS: Source of the PSetter. -T: Modified source of the PSetter. -A: Focus of the PSetter. -B: Modified focus of the PSetter.Declaration
Swift
public class PSetter<S, T, A, B>
-
A Traversal is an optic that allows to see into a structure with 0 to N foci.
Traversal is a generalization of
Traverseand can be seen as a representation ofmodifyF. All methods are written in terms ofmodifyF.Type parameters: -
See moreS: Source. -T: Modified source. -A: Focus. -B: Modified focus.Declaration
Swift
open class PTraversal<S, T, A, B>
-
Undocumented
Declaration
Swift
public final class ForFix
-
Undocumented
Declaration
Swift
public final class ForMu
-
Undocumented
Declaration
Swift
public final class ForNu
-
Witness for the
Coproduct10data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct10 -
Represents a sum type of 10 different types.
See moreDeclaration
Swift
public final class Coproduct10<A, B, C, D, E, F, G, H, I, J> : Coproduct10Of<A, B, C, D, E, F, G, H, I, J>
-
Witness for the
Coproduct2data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct2 -
Represents a sum type of 2 different types.
See moreDeclaration
Swift
public final class Coproduct2<A, B> : Coproduct2Of<A, B>
-
Witness for the
Coproduct3data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct3 -
Represents a sum type of 3 different types.
See moreDeclaration
Swift
public final class Coproduct3<A, B, C> : Coproduct3Of<A, B, C>
-
Witness for the
Coproduct4data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct4 -
Represents a sum type of 4 different types.
See moreDeclaration
Swift
public final class Coproduct4<A, B, C, D> : Coproduct4Of<A, B, C, D>
-
Witness for the
Coproduct5data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct5 -
Represents a sum type of 5 different types.
See moreDeclaration
Swift
public final class Coproduct5<A, B, C, D, E> : Coproduct5Of<A, B, C, D, E>
-
Witness for the
Coproduct6data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct6 -
Represents a sum type of 6 different types.
See moreDeclaration
Swift
public final class Coproduct6<A, B, C, D, E, F> : Coproduct6Of<A, B, C, D, E, F>
-
Witness for the
Coproduct7data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct7 -
Represents a sum type of 7 different types.
See moreDeclaration
Swift
public final class Coproduct7<A, B, C, D, E, F, G> : Coproduct7Of<A, B, C, D, E, F, G>
-
Witness for the
Coproduct8data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct8 -
Represents a sum type of 8 different types.
See moreDeclaration
Swift
public final class Coproduct8<A, B, C, D, E, F, G, H> : Coproduct8Of<A, B, C, D, E, F, G, H>
-
Witness for the
Coproduct9data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCoproduct9 -
Represents a sum type of 9 different types.
See moreDeclaration
Swift
public final class Coproduct9<A, B, C, D, E, F, G, H, I> : Coproduct9Of<A, B, C, D, E, F, G, H, I>
-
Undocumented
See moreDeclaration
Swift
public class HList
-
Witness for the Cofree
data type. To be used in simulated Higher Kinded Types. Declaration
Swift
public final class ForCofree
-
Witness for the
Free<F, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForFree
-
A transformation between two kinds.
As
See moreFunction1<A, B>represents a transformation fromAtoB,FunctionK<F, G>represents a transformation fromKind<F, A>toKind<G, A>. Subclasses ofFunctionKneed to implementinvoke.Declaration
Swift
open class FunctionK<F, G>
-
Witness for the
Program<F, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForProgram -
Declaration
Swift
public final class ProgramPartial<F> : Kind<ForProgram, F> -
Program is a type that, given any type constructor, is able to provide a Monad instance, that can be interpreted into a more restrictive one.
As opposed to
See moreFree,Programdoes not requireFto be a functor, which means that evaluation ofmapcalls are deferred and left for the later interpretation in another monad.Declaration
Swift
public final class Program<F, A> : ProgramOf<F, A>
-
An atomically modifiable reference to a value
See moreDeclaration
Swift
public final class Atomic<A>
-
Partial application of the Kleisli type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class KleisliPartial<F, D> : Kind2<ForKleisli, F, D> -
Witness for the
Kleisli<F, D, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForKleisli
-
Witness for the
IO<E, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForIO
-
Ref is an asynchronous, concurrent mutable reference in the context of
See moreFholding a value of typeA. Provides safe concurrent access and modification of its content.Refis a purely functional wrapper over anAtomic<A>in contextFthat is always initialized to a value.Declaration
Swift
public class Ref<F, A>
-
Witness for the
Resource<F, A>type. To be used in simulated Higher Data Types.Declaration
Swift
public final class ForResource -
Partial application of the Resource type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class ResourcePartial<F> : Kind<ForResource, F> where F : Bracket -
Resource models resource allocation and releasing. It is specially useful when multiple resources that depend on each other need to be acquired and later released in reverse order. Whn a resource is created, one can make use of the
See moreusemethod to run a computation with the resource. The finalizers are guaranteed to run afterwards in reverse order of acquisition.Declaration
Swift
public class Resource<F, A> : ResourceOf<F, A> where F : Bracket
-
Witness for the
MaybeK<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForMaybeK
-
Witness for the
ObservableK<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForObservableK -
ObservableK is a Higher Kinded Type wrapper over RxSwift’s
See moreObservabledata type.Declaration
Swift
public final class ObservableK<A> : ObservableKOf<A>
-
Witness for the
SingleK<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForSingleK
-
Witness for the
Cokleisli<F, A, B>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForCokleisli -
Partial application of the Cokleisli type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class CokleisliPartial<F, I> : Kind2<ForCokleisli, F, I> -
Cokleisli represents a function with the signature
See more(Kind<F, A>) -> B.Declaration
Swift
public class Cokleisli<F, A, B> : CokleisliOf<F, A, B>
-
CokleisliK represents a function with the signature
See more(Kind<F, A>) -> Bthat is polymorphic on A, where F and B are fixed. Subclasses ofCokleisliKneed to implementinvoke.Declaration
Swift
open class CokleisliK<F, B>
-
Witness for the
Function0<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForFunction0 -
This data type acts as a wrapper over functions that receive no input and produce a value; namely, constant functions. This wrapper gives these functions capabilities to be used as a Higher Kinded Type and conform to typeclasses that have this requirement.
See moreDeclaration
Swift
public final class Function0<A> : Function0Of<A>
-
Witness for the
Function1<I, O>data type. To be used in simulated Higher Kinded Types`.Declaration
Swift
public final class ForFunction1 -
Declaration
Swift
public final class Function1Partial<I> : Kind<ForFunction1, I> -
This data type acts as a wrapper over functions. It receives two type parameters representing the input and output type of the function. The wrapper adds capabilities to use a function as a Higher Kinded Type and conform to typeclasses that have this requirement.
See moreDeclaration
Swift
public final class Function1<I, O> : Function1Of<I, O>
-
Witness for the
LazyFunction1<I, O>data type. To be used in simulated Higher Kinded Types`.Declaration
Swift
public final class ForLazyFunction1 -
Partial application of the
See moreLazyFunction1type constructor, omitting the last parameter.Declaration
Swift
public final class LazyFunction1Partial<I> : Kind<ForLazyFunction1, I> -
This data type acts as a wrapper over functions, like
See moreFunction1. As opposed toFunction1, function composition is stack-safe. This means that no matter how manyLazyFunction1s you compose, calling their composition won’t cause a stack overflow.Declaration
Swift
public final class LazyFunction1<I, O> : LazyFunction1Of<I, O>
-
Witness for the
CoT<W, M, A>data type. To be used in simulated Higher Kinded TypesDeclaration
Swift
public final class ForCoT -
CoT gives you
See morethe best
pairing monad transformer for any Comonad W In other words, an explorer for the state space given by W. It can also provide: - A MonadReader from a ComonadEnv - A MonadWriter from a ComonadTraced - A MonadState from a ComonadStore
-
Witness for the Coyoneda
data type. To be used in simulated Higher Kinded Types. Declaration
Swift
public final class ForCoyoneda -
Partial application of the Coyoneda type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class CoyonedaPartial<F> : Kind<ForCoyoneda, F> -
This type implements the dual version of the Yoneda lemma, stating that F is naturally isomorphic to Coyoneda
. Coyoneda can be viewed as the arguments that we need for the
See moremapfunction.Declaration
Swift
public final class Coyoneda<F, A> : CoyonedaOf<F, A>
-
Witness for the
Day<F, G, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForDay
-
Witness for the
DictionaryK<K, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForDictionaryK -
Partial application of the DictionaryK type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class DictionaryKPartial<K> : Kind<ForDictionaryK, K> where K : Hashable -
DictionaryK is a Higher Kinded Type wrapper over Swift dictionaries.
See moreDeclaration
Swift
public final class DictionaryK<K, A> : DictionaryKOf<K, A> where K : Hashable
-
Witness for the
Endo<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForEndo
-
Witness for the
Eval<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForEval -
Eval is a data type that describes a potentially lazy computation that produces a value.
Eval has three different evaluation strategies: - Now: the computation is evaluated immediately. - Later: the computation is evaluated when it is needed (typically by calling
Eval.value()), just once. This value is cached, so subsequent invocations do not trigger additional computations of the value. - Always: the computation is evaluated every time it is needed (typically by callingEval.value()).Now is an eager evaluation strategy, whereas Later and Always are lazy.
See moreDeclaration
Swift
public class Eval<A> : EvalOf<A>
-
Encodes the notion of existential type.
Exists<F>is a wrapper around aKind<F, X>value, whereXis some type that is not exposed onExistssignature.You provide a value of type
See moreKind<F, X>when constructing anExists<F>instance but the specific typeXthat you provide is hidden insideExists. The only way to interact with the content ofExists<F>is with a function of typeKind<F, X> -> Rthat is polymorphic onX(represented by theCokleisliK<F, Rclass). You pass aCokleisliK<F, R>to anExists<F>and the function is called with the specific type that is hidden inside theExists. This is done with therunmethod.Declaration
Swift
public final class Exists<F>
-
Witness for the
Moore<E, V>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForMoore
-
Witness for the
PairK<F, G, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForPairK
-
Witness for the
Pairing<F, G>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForPairing -
Partial application of the Pairing type constructor, omitting the last parameter.
Declaration
Swift
public final class PairingPartial<F> : Kind<ForPairing, F> where F : Functor -
The Pairing type represents a relationship between Functors F and G, where the sums in one can annihilate the products in the other.
The internals of this type embed a function of the following shape:
forall a b c. f a -> g b -> (a -> b -> c) -> cOr equivalently:forall a b. f (a -> b) -> g a -> bSwift lacks universal quantifiers, so these types are replaced by
See moreAny.
-
Witness for the
SetK<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForSetK
-
Witness for the
Sum<F, G, V>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForSum
-
Witness for the
Trampoline<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForTrampoline -
The Trampoline type helps us overcome stack safety issues of recursive calls by transforming them into loops.
See moreDeclaration
Swift
public final class Trampoline<A> : TrampolineOf<A>
-
Witness for the
Tree<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForTree
-
Witness for the Yoneda
data type. To be used in simulated Higher Kinded Types. Declaration
Swift
public final class ForYoneda -
This type implements the covariant form of the Yoneda lemma, stating that F is naturally isomorphic to Yoneda
. Yoneda can be viewed as the partial application of the
mapfunction, where the first argument is fixed:
See moremap :: (F<A>, (A) -> B) -> F<B>Yoneda :: ((A) -> B) -> F<B>
-
Witness for the
Zipper<A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForZipper
-
Undocumented
Declaration
Swift
public class First -
Undocumented
Declaration
Swift
public class Last -
Wrapper class to represent a constant present first option.
See moreDeclaration
Swift
public final class FirstOption<A> -
Wrapper class to represent a constant present last option.
See moreDeclaration
Swift
public final class LastOption<A>
-
Witness for the
EitherT<F, A, B>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForEitherT -
Partial application of the EitherT type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class EitherTPartial<F, L> : Kind2<ForEitherT, F, L>
-
Witness for the
EnvT<E, W, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForEnvT
-
Witness for the
OptionT<F, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForOptionT -
Partial application of the OptionT type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class OptionTPartial<F> : Kind<ForOptionT, F>
-
Witness for the
StoreT<S, W, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForStoreT
-
Witness for the
TracedT<M, W, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForTracedT -
Declaration
Swift
public final class TracedTPartial<M, W> : Kind2<ForTracedT, M, W>
-
Witness for the
WriterT<F, W, A>data type. To be used in simulated Higher Kinded Types.Declaration
Swift
public final class ForWriterT -
Partial application of the WriterT type constructor, omitting the last parameter.
See moreDeclaration
Swift
public final class WriterTPartial<F, W> : Kind2<ForWriterT, F, W>
-
A binding expression is one of the instructions of the form
x <- fxin a monad comprehension.In a binding expression of the form
x <- fx,xis the variable to be bound andfxis the monadic effect that we want to bind to the variable.Declaration
Swift
public class BindingExpression<F> where F : Monad
Install in Dash
Classes Reference