From 491d8c15348c89e1c1b56d178b54299c27c1edcd Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 19 Feb 2020 08:48:22 +0100 Subject: [PATCH] version 0.6.7 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/Observable.ts | 14 ++------------ src/ReaderObservable.ts | 16 +++------------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5256b74..cc45c64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 0.6.7 + +- **New Feature** + - `ReaderObservable` + - add `Alternative` and `Filterable` instances (@mlegenhausen) + # 0.6.6 - **New Feature** diff --git a/package.json b/package.json index 226789b..cb34c38 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fp-ts-rxjs", - "version": "0.6.6", + "version": "0.6.7", "description": "fp-ts bindings for RxJS", "files": [ "lib", diff --git a/src/Observable.ts b/src/Observable.ts index baed112..553aeca 100644 --- a/src/Observable.ts +++ b/src/Observable.ts @@ -90,18 +90,8 @@ export const observable: Monad1 & Alternative1 & Filterable1 & Mo compact: fa => observable.filterMap(fa, identity), separate: fa => observable.partitionMap(fa, identity), partitionMap: (fa, f) => ({ - left: observable.filterMap(fa, a => - pipe( - f(a), - E.fold(O.some, () => O.none) - ) - ), - right: observable.filterMap(fa, a => - pipe( - f(a), - E.fold(() => O.none, O.some) - ) - ) + left: observable.filterMap(fa, a => O.fromEither(E.swap(f(a)))), + right: observable.filterMap(fa, a => O.fromEither(f(a))) }), partition: (fa: Observable, p: Predicate) => observable.partitionMap(fa, E.fromPredicate(p, identity)), filterMap: (fa: Observable, f: (a: A) => O.Option) => diff --git a/src/ReaderObservable.ts b/src/ReaderObservable.ts index 83ae524..aa0a9ab 100644 --- a/src/ReaderObservable.ts +++ b/src/ReaderObservable.ts @@ -4,7 +4,7 @@ import { Observable } from 'rxjs' import { getReaderM } from 'fp-ts/lib/ReaderT' import * as R from './Observable' -import { pipeable, pipe } from 'fp-ts/lib/pipeable' +import { pipeable } from 'fp-ts/lib/pipeable' import { IO } from 'fp-ts/lib/IO' import { Monad2 } from 'fp-ts/lib/Monad' import { Monoid } from 'fp-ts/lib/Monoid' @@ -164,18 +164,8 @@ export const readerObservable: Monad2 & Alternative2 & Filterable2 readerObservable.filterMap(fa, identity), separate: fa => readerObservable.partitionMap(fa, identity), partitionMap: (fa, f) => ({ - left: readerObservable.filterMap(fa, a => - pipe( - f(a), - E.fold(O.some, () => O.none) - ) - ), - right: readerObservable.filterMap(fa, a => - pipe( - f(a), - E.fold(() => O.none, O.some) - ) - ) + left: readerObservable.filterMap(fa, a => O.fromEither(E.swap(f(a)))), + right: readerObservable.filterMap(fa, a => O.fromEither(f(a))) }), partition: (fa: ReaderObservable, p: Predicate) => readerObservable.partitionMap(fa, E.fromPredicate(p, identity)),