Skip to content

Commit

Permalink
Fix parameter ordering and apply tree technique for correct currying (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
briancavalier authored Jun 17, 2019
1 parent 5540f53 commit 9b470b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/core/src/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ declare export function concatMap <A, B> (f: (A) => Stream<B>): (s: Stream<A>) =
declare export function mergeConcurrently <A> (concurrency: number, s: Stream<Stream<A>>): Stream<A>
declare export function mergeConcurrently <A> (concurrency: number): (s: Stream<Stream<A>>) => Stream<A>

declare export function mergeMapConcurrently <A, B> (concurrency: number, f: (A) => Stream<B>, s: Stream<A>): Stream<B>
declare export function mergeMapConcurrently <A, B> (concurrency: number): (f: (A) => Stream<B>, s: Stream<A>) => Stream<B>
declare export function mergeMapConcurrently <A, B> (concurrency: number, f: (A) => Stream<B>): (s: Stream<A>) => Stream<B>
declare export function mergeMapConcurrently <A, B> (concurrency: number): (f: (A) => Stream<B>) => (s: Stream<A>) => Stream<B>
declare export function mergeMapConcurrently <A, B> (f: (A) => Stream<B>, concurrency: number, s: Stream<A>): Stream<B>
declare export function mergeMapConcurrently <A, B> (f: (A) => Stream<B>, concurrency: number): (s: Stream<A>) => Stream<B>
declare export function mergeMapConcurrently <A, B> (f: (A) => Stream<B>): {
(concurrency: number, s: Stream<A>): Stream<B>,
(concurrency: number): (s: Stream<A>) => Stream<B>
}

declare export function continueWith <A> (f: (any) => Stream<A>, s: Stream<A>): Stream<A>
declare export function continueWith <A> (f: (any) => Stream<A>): (s: Stream<A>) => Stream<A>
Expand Down
15 changes: 15 additions & 0 deletions packages/core/test/flow/combinator/mergeConcurrently.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @flow
import { mergeMapConcurrently, now, runEffects } from '../../../src/index'
import { type Stream } from '@most/types'
import { newDefaultScheduler } from '@most/scheduler'

const s = now(123)
const s1: Stream<number> = mergeMapConcurrently(now, 2, s)
const s2: Stream<number> = mergeMapConcurrently(now, 2)(s)
const s3: Stream<number> = mergeMapConcurrently(now)(2, s)
const s4: Stream<number> = mergeMapConcurrently(now)(2)(s)

runEffects(s1, newDefaultScheduler())
runEffects(s2, newDefaultScheduler())
runEffects(s3, newDefaultScheduler())
runEffects(s4, newDefaultScheduler())

0 comments on commit 9b470b5

Please sign in to comment.