com.jnape.palatable.lambda.functor.builtin

## Class Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,A>

- java.lang.Object
- - com.jnape.palatable.lambda.functor.builtin.Compose<F,G,A>

- Type Parameters:
    `F` - The outer applicative
    `G` - The inner applicative
    `A` - The carrier type
  All Implemented Interfaces:
    Applicative<A,Compose<F,G,?>>, Functor<A,Compose<F,G,?>>

      public final class Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,A>
      extends Object
      implements Applicative<A,Compose<F,G,?>>

  A functor representing the type-level composition of two `Applicative` functors; useful for preserving nested type-level transformations during traversal of a `Traversable`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Compose(Applicative<? extends Applicative<A,G>,F> fga)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<B> Compose<F,G,B>` | `discardL(Applicative<B,Compose<F,G,?>> appB)` Sequence both this `Applicative` and `appB`, discarding this `Applicative's` result and returning `appB`.
    `<B> Compose<F,G,A>` | `discardR(Applicative<B,Compose<F,G,?>> appB)` Sequence both this `Applicative` and `appB`, discarding `appB's` result and returning this `Applicative`.
    `boolean` | `equals(Object other)`
    `<B> Compose<F,G,B>` | `fmap(Fn1<? super A,? extends B> fn)` Covariantly transmute this functor's parameter using the given mapping function.
    `<GA extends Applicative<A,G>,FGA extends Applicative<GA,F>> FGA` | `getCompose()`
    `int` | `hashCode()`
    `<B> Lazy<Compose<F,G,B>>` | `lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,Compose<F,G,?>>> lazyAppFn)` Given a `lazy` instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.
    `<B> Compose<F,G,B>` | `pure(B b)` Lift the value `b` into this applicative functor.
    `static <F extends Applicative<?,F>,G extends Applicative<?,G>> Pure<Compose<F,G,?>>` | `pureCompose(Pure<F> pureF, Pure<G> pureG)` The canonical `Pure` instance for `Compose`.
    `String` | `toString()`
    `<B> Compose<F,G,B>` | `zip(Applicative<Fn1<? super A,? extends B>,Compose<F,G,?>> appFn)` Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

      `coerce`

- - ### Constructor Detail

    - #### Compose

          public Compose(Applicative<? extends Applicative<A,G>,F> fga)

  - ### Method Detail

    - #### getCompose

          public <GA extends Applicative<A,G>,FGA extends Applicative<GA,F>> FGA getCompose()

    - #### fmap

          public <B> Compose<F,G,B> fmap(Fn1<? super A,? extends B> fn)

      Covariantly transmute this functor's parameter using the given mapping function. Generally this method is specialized to return an instance of the class implementing Functor.
      Specified by:
        `fmap` in interface `Applicative<A,Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,?>>`
      Specified by:
        `fmap` in interface `Functor<A,Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,?>>`
      Type Parameters:
        `B` - the new parameter type
      Parameters:
        `fn` - the mapping function
      Returns:
        a functor over B (the new parameter type)

    - #### pure

          public <B> Compose<F,G,B> pure(B b)

      Lift the value `b` into this applicative functor.
      Specified by:
        `pure` in interface `Applicative<A,Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,?>>`
      Type Parameters:
        `B` - the type of the returned applicative's parameter
      Parameters:
        `b` - the value
      Returns:
        an instance of this applicative over b

    - #### zip

          public <B> Compose<F,G,B> zip(Applicative<Fn1<? super A,? extends B>,Compose<F,G,?>> appFn)

      Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.
      Specified by:
        `zip` in interface `Applicative<A,Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,?>>`
      Type Parameters:
        `B` - the resulting applicative parameter type
      Parameters:
        `appFn` - the other applicative instance
      Returns:
        the mapped applicative

    - #### lazyZip

          public <B> Lazy<Compose<F,G,B>> lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,Compose<F,G,?>>> lazyAppFn)

      Given a `lazy` instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports. This is useful for applicatives that support lazy evaluation and early termination.
      Specified by:
        `lazyZip` in interface `Applicative<A,Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,?>>`
      Type Parameters:
        `B` - the resulting applicative parameter type
      Parameters:
        `lazyAppFn` - the lazy other applicative instance
      Returns:
        the mapped applicative
      See Also:
        `Maybe`, `Either`

    - #### discardL

          public <B> Compose<F,G,B> discardL(Applicative<B,Compose<F,G,?>> appB)

      Sequence both this `Applicative` and `appB`, discarding this `Applicative's` result and returning `appB`. This is generally useful for sequentially performing side-effects.
      Specified by:
        `discardL` in interface `Applicative<A,Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,?>>`
      Type Parameters:
        `B` - the type of the returned Applicative's parameter
      Parameters:
        `appB` - the other Applicative
      Returns:
        appB

    - #### discardR

          public <B> Compose<F,G,A> discardR(Applicative<B,Compose<F,G,?>> appB)

      Sequence both this `Applicative` and `appB`, discarding `appB's` result and returning this `Applicative`. This is generally useful for sequentially performing side-effects.
      Specified by:
        `discardR` in interface `Applicative<A,Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,?>>`
      Type Parameters:
        `B` - the type of appB's parameter
      Parameters:
        `appB` - the other Applicative
      Returns:
        this Applicative

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### pureCompose

          public static <F extends Applicative<?,F>,G extends Applicative<?,G>> Pure<Compose<F,G,?>> pureCompose(Pure<F> pureF,
                                                                                                                 Pure<G> pureG)

      The canonical `Pure` instance for `Compose`.
      Type Parameters:
        `F` - the outer `Applicative` type
        `G` - the inner `Applicative` type
      Parameters:
        `pureF` - the `Pure` constructor for the outer `Applicative`
        `pureG` - the `Pure` constructor for the inner `Applicative`
      Returns:
        the `Pure` instance