diff --git a/docs/modules/Observable.ts.md b/docs/modules/Observable.ts.md index 7b07b6b..d198ce7 100644 --- a/docs/modules/Observable.ts.md +++ b/docs/modules/Observable.ts.md @@ -12,10 +12,10 @@ Added in v0.6.0

Table of contents

-- [Alternative](#alternative) - - [zero](#zero) - [Alt](#alt) - [alt](#alt) +- [Alternative](#alternative) + - [zero](#zero) - [Applicative](#applicative) - [of](#of) - [Apply](#apply) @@ -43,7 +43,7 @@ Added in v0.6.0 - [fromTask](#fromtask) - [instances](#instances) - [Alt](#alt-1) - - [Alternative](#alternative) + - [Alternative](#alternative-1) - [Applicative](#applicative-1) - [Apply](#apply-1) - [Compactable](#compactable-1) @@ -65,32 +65,32 @@ Added in v0.6.0 --- -# Alternative +# Alt -## zero +## alt + +Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to +types of kind `* -> *`. **Signature** ```ts -export declare const zero: () => Observable +export declare const alt: (that: () => Observable) => (fa: Observable) => Observable ``` -Added in v0.6.12 - -# Alt +Added in v0.6.0 -## alt +# Alternative -Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to -types of kind `* -> *`. +## zero **Signature** ```ts -export declare const alt: (that: () => Observable) => (fa: Observable) => Observable +export declare const zero: () => Observable ``` -Added in v0.6.0 +Added in v0.6.12 # Applicative diff --git a/src/Observable.ts b/src/Observable.ts index 72e9e00..a807b36 100644 --- a/src/Observable.ts +++ b/src/Observable.ts @@ -18,7 +18,7 @@ import * as O from 'fp-ts/lib/Option' import { pipe } from 'fp-ts/lib/pipeable' import { Task } from 'fp-ts/lib/Task' import { combineLatest, defer, EMPTY, merge, Observable, of as rxOf } from 'rxjs' -import { map as rxMap, mergeMap } from 'rxjs/operators' +import { map as rxMap, switchMap } from 'rxjs/operators' import { MonadObservable1 } from './MonadObservable' // ------------------------------------------------------------------------------------- @@ -107,7 +107,7 @@ export const of: Applicative1['of'] = rxOf * @since 0.6.0 */ export const chain: (f: (a: A) => Observable) => (ma: Observable) => Observable = f => ma => - ma.pipe(mergeMap(f)) + ma.pipe(switchMap(f)) /** * Derivable from `Monad`. @@ -152,7 +152,7 @@ export const alt: (that: () => Observable) => (fa: Observable) => Obser */ export const filterMap = (f: (a: A) => O.Option) => (fa: Observable): Observable => fa.pipe( - mergeMap(a => + switchMap(a => pipe( f(a), // tslint:disable-next-line: deprecation