com.jnape.palatable.lambda.functions.builtin.fn1

## Class Upcast<A extends B,B>

- java.lang.Object
- - com.jnape.palatable.lambda.functions.builtin.fn1.Upcast<A,B>

- Type Parameters:
    `A` - the covariant type
    `B` - the contravariant type
  All Implemented Interfaces:
    Fn1<A,B>, Applicative<B,Fn1<A,?>>, Cartesian<A,B,Fn1<?,?>>, Cocartesian<A,B,Fn1<?,?>>, Contravariant<A,Profunctor<?,B,Fn1<?,?>>>, Functor<B,Fn1<A,?>>, Profunctor<A,B,Fn1<?,?>>, Monad<B,Fn1<A,?>>, MonadReader<A,B,Fn1<A,?>>, MonadRec<B,Fn1<A,?>>, MonadWriter<A,B,Fn1<A,?>>

      public final class Upcast<A extends B,B>
      extends Object
      implements Fn1<A,B>

  Upcast a value of type `B` to a value of type `A` that `B` extends. This is principally useful when dealing with parametric types that are invariant in their parameters and a cast is necessary for compatibility purposes.

  Example:

       Iterable<String> have = new ArrayList<>();
       Iterable<CharSequence> want = map(upcast(), have); // necessary due to invariance in parameter

  Note that this is universally safe.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `B` | `checkedApply(A a)` Invoke this function with the given argument, potentially throwing any `Throwable`.
    `static <A extends B,B> Upcast<A,B>` | `upcast()`
    `static <A extends B,B> B` | `upcast(A a)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1

      `andThen, apply, carry, cartesian, censor, choose, cocartesian, compose, contraMap, diMap, diMapL, diMapR, discardL, discardR, flatMap, fmap, fn1, fromFunction, lazyZip, listens, local, pure, pureFn1, thunk, toFunction, trampolineM, widen, zip, zip`

    - ### Methods inherited from interface com.jnape.palatable.lambda.monad.Monad

      `join`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functor.Functor

      `coerce`

- - ### Method Detail

    - #### checkedApply

          public B checkedApply(A a)

      Description copied from interface: `Fn1`
      Invoke this function with the given argument, potentially throwing any `Throwable`.
      Specified by:
        `checkedApply` in interface `Fn1<A extends B,B>`
      Parameters:
        `a` - the argument
      Returns:
        the result of the function application

    - #### upcast

          public static <A extends B,B> Upcast<A,B> upcast()

    - #### upcast

          public static <A extends B,B> B upcast(A a)