diff --git a/package.json b/package.json index fd318b4..16d6407 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xreact", - "version": "5.0.0", + "version": "5.0.1", "description": "Functional Reactive State Container for React", "repository": { "type": "git", @@ -29,10 +29,12 @@ "reflect-metadata": "^0.1.12" }, "peerDependencies": { - "@reactivex/rxjs": "^5.4.0", - "most": "^1.2.2", - "most-subject": "^5.3.0", - "react": "^15.5.4" + "react": "^16.2.0" + }, + "optionalDependencies": { + "@reactivex/rxjs": "^5.5.6", + "most": "^1.7.2", + "most-subject": "^5.3.0" }, "devDependencies": { "@reactivex/rxjs": "^5.5.6", diff --git a/src/fantasy/fantasyx.ts b/src/fantasy/fantasyx.ts index ef9ec4f..457dfa2 100644 --- a/src/fantasy/fantasyx.ts +++ b/src/fantasy/fantasyx.ts @@ -83,133 +83,6 @@ export class FantasyX<F extends Stream, I, S, A> { ), fB.plan) ), this.plan)) } - // patch(f: (a: A) => Partial<S> = _ => _): FantasyX<E, I, S, void> { - // return new FantasyX<E, I, S, void>(intent$ => { - // let machine = this.plan(intent$) - // let update$ = streamOps.map<State<S, A>, State<S, void>>( - // state => state.patch(f), - // machine.update$ - // ) - // return { update$, actions: machine.actions } - // }) - // } - - // bimap<B>( - // fa: (b?: Actions<I>) => Actions<I>, fb: (a: A) => B - // ): FantasyX<E, I, S, B> { - // return new FantasyX<E, I, S, B>(intent$ => { - // let machine = this.plan(intent$) - // let update$ = streamOps.map<State<S, A>, State<S, B>>( - // state => state.map(fb), - // machine.update$ - // ) - // return { update$, actions: fa(machine.actions) } - // }) - // } - - // combine3<B, C, D>( - // f: (a: A, b: B, c: C) => D, - // planB: FantasyX<E, I, S, B>, - // planC: FantasyX<E, I, S, C> - // ): FantasyX<E, I, S, D> { - // return new FantasyX<E, I, S, D>(intent$ => { - // let machineB = planB.plan(intent$), - // machineA = this.plan(intent$), - // machineC = planC.plan(intent$); - // let update$ = streamOps.combine<State<S, A>, State<S, B>, State<S, C>, State<S, D>>( - // (S1, S2, S3) => - // S1.chain(s1 => - // S2.chain(s2 => - // S3.chain(s3 => - // State.pure<S, D>(f(s1, s2, s3))))) - // , machineA.update$, machineB.update$, machineC.update$ - // ) - // let actions = Object.assign({}, machineA.actions, machineB.actions, machineC.actions) - // return { update$, actions } - // }) - // } - - // combine4<B, C, D, F>( - // f: (a: A, b: B, c: C, d: D) => F, - // planB: FantasyX<E, I, S, B>, - // planC: FantasyX<E, I, S, C>, - // planD: FantasyX<E, I, S, D> - // ): FantasyX<E, I, S, F> { - // return new FantasyX<E, I, S, F>(intent$ => { - // let machineB = planB.plan(intent$), - // machineA = this.plan(intent$), - // machineC = planC.plan(intent$), - // machineD = planD.plan(intent$) - // ; - // let update$ = streamOps.combine<State<S, A>, State<S, B>, State<S, C>, State<S, D>, State<S, F>>( - // (S1, S2, S3, S4) => - // S1.chain(s1 => - // S2.chain(s2 => - // S3.chain(s3 => - // S4.chain(s4 => - // State.pure<S, F>(f(s1, s2, s3, s4)))))) - // , machineA.update$, machineB.update$, machineC.update$, machineD.update$ - // ) - // let actions = Object.assign({}, machineA.actions, machineB.actions, machineC.actions, machineD.actions) - // return { update$, actions } - // }) - // } - - // combine5<B, C, D, F, G>( - // f: (a: A, b: B, c: C, d: D, e: F) => G, - // planB: FantasyX<E, I, S, B>, - // planC: FantasyX<E, I, S, C>, - // planD: FantasyX<E, I, S, D>, - // planE: FantasyX<E, I, S, F> - // ): FantasyX<E, I, S, G> { - // return new FantasyX<E, I, S, G>(intent$ => { - // let machineB = planB.plan(intent$), - // machineA = this.plan(intent$), - // machineC = planC.plan(intent$), - // machineD = planD.plan(intent$), - // machineE = planE.plan(intent$) - // ; - // let update$ = streamOps.combine<State<S, A>, State<S, B>, State<S, C>, State<S, D>, State<S, F>, State<S, G>>( - // (S1, S2, S3, S4, S5) => - // S1.chain(s1 => - // S2.chain(s2 => - // S3.chain(s3 => - // S4.chain(s4 => - // S5.chain(s5 => - // State.pure<S, G>(f(s1, s2, s3, s4, s5))))))) - // , machineA.update$, machineB.update$, machineC.update$, machineD.update$, machineE.update$ - // ) - // let actions = Object.assign({}, machineA.actions, machineB.actions, machineC.actions, machineD.actions, machineE.actions) - // return { update$, actions } - // }) - // } - - - // concat( - // fa: FantasyX<E, I, S, A> - // ): FantasyX<E, I, S, A> { - // return this.combine((a, b) => { - // if (isSemigroup(a) && isSemigroup(b)) - // return a.concat(b) - // else - // return b - // }, fa) - // } - - // merge<B>( - // fa: FantasyX<E, I, S, B> - // ): FantasyX<E, I, S, A | B> { - // return new FantasyX<E, I, S, A | B>(intent$ => { - // let machineA = this.plan(intent$) - // let machineB = fa.plan(intent$) - // let update$ = streamOps.merge<State<S, A | B>>( - // machineA.update$, - // machineB.update$ - // ) - // return { update$, actions: Object.assign({}, machineA.actions, machineB.actions) } - // }) - // } - } declare module './typeclasses' {