gcanti / fp-ts-rxjs

fp-ts bindings for RxJS
https://gcanti.github.io/fp-ts-rxjs/
MIT License
187 stars 29 forks source link

Add `chainW` #37

Closed OliverJAsh closed 3 years ago

OliverJAsh commented 3 years ago

This was recently added to types in fp-ts. It would be great to add it to Observable and ObservableEither.

anthonyjoeseph commented 3 years ago

Here's a quick copy-paste implementation until this issue gets a proper PR:

export const chainW = <E, A, B>(
  f: (a: A) => OBE.ObservableEither<E, B>
) => <D>(ma: OBE.ObservableEither<D, A>): OBE.ObservableEither<D | E, B> =>
  OBE.chain(f)(ma as any)