C - The type of values stored in this class.T - A phantom type representing the type of values the functor and applicative operations transform.
No values of this type ever exist in objects of this type.public final class Const<C,T> extends Object
Functor that stores values of an unrelated type. As functor and applicative operations are performed
on const values, the stored values accumulate in a predictable fashion.
The type T is known as a phantom type. That is, no values of this type are ever required
to use const objects. Because of this, the type T may be any type, even a type without any instances.
The Const type is typically used to supply values to traversal algorithms when the desired result
does not depend on the types being traversed over.
Monoid,
Traversable| Modifier and Type | Class and Description |
|---|---|
static class |
Const.Instance<C>
The
Applicative type class instance for Const. |
| Modifier and Type | Method and Description |
|---|---|
static <C,T> Const<C,T> |
create(C value)
Creates a
Const with the given stored value. |
static <C,T> C |
unbox(Const<C,T> box)
Returns the value contained within the given const box.
|
public static <C,T> C unbox(Const<C,T> box)
C - The type of the stored value.T - The type of value the boxed const purports to support.box - The boxed Const.public static <C,T> Const<C,T> create(C value)
Const with the given stored value.C - The type of the stored value.T - The type of the value purportedly supported in the returned object.value - The stored value.Const that stores the given value.