The `Chain` type-class is a lightweight Monad.

It exposes chain, which allows to have a value in a context (`F<A>`) and then feed that into a function that takes a normal value and returns a value in a context (`A => F<B>`).

One motivation for separating this out from `Monad` is that there are situations where we can implement `chain` but not `of`. For example, we can implement `map` or `chain` that transforms the values of a `Map<K, ?>` type, but we can't implement `of` (because we wouldn't know what key to use when instantiating the new `Map`).

In addition to `Apply`'s laws, `Chain` instances must obey these laws:

1. Associativity: `F.chain(g, F.chain(f, fa)) <-> F.chain(x => F.chain(g, f(x)), fa)`
2. Apply's `ap` can be derived: `(ff, fa) => F.chain(f => F.map(f, fa), ff)`

Equivalent with the `Chain` type-class in the Fantasy-Land and static-land specifications.

### Type parameters

- #### F

### Hierarchy

- Apply<F>
  - Chain
    - ChainRec

## Index

### Methods

- ap
- chain
- map

## Methods

### ap

- ap<A, B>(ff: HK<F, function>, fa: HK<F, A>): HK<F, B>

- Inherited from Apply.ap

  - Defined in apply.ts:31

  #### Type parameters

  - #### A

  - #### B

  #### Parameters

  - ##### ff: HK<F, function>

  - ##### fa: HK<F, A>

  #### Returns HK<F, B>

### chain

- chain<A, B>(f: function, fa: HK<F, A>): HK<F, B>

- - Defined in chain.ts:39

  #### Type parameters

  - #### A

  - #### B

  #### Parameters

  - ##### f: function

    - - (a: A): HK<F, B>

      - #### Parameters

        - ##### a: A

        #### Returns HK<F, B>

  - ##### fa: HK<F, A>

  #### Returns HK<F, B>

### map

- map<A, B>(f: function, fa: HK<F, A>): HK<F, B>

- Inherited from Functor.map

  - Defined in functor.ts:27

  #### Type parameters

  - #### A

  - #### B

  #### Parameters

  - ##### f: function

    - - (a: A): B

      - #### Parameters

        - ##### a: A

        #### Returns B

  - ##### fa: HK<F, A>

  #### Returns HK<F, B>

Generated using TypeDoc