-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up Flow types and add check script (#68)
- Loading branch information
Showing
6 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
|
||
[lints] | ||
|
||
[options] | ||
|
||
[strict] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import { __ as block } from 'bs-platform/lib/es6/block'; | ||
import { talkbackPlaceholder } from './Wonka_helpers.bs'; | ||
import * as types from '../Wonka_types.gen'; | ||
|
||
type talkbackCb = (tb: types.talkbackT) => void; | ||
import { | ||
talkbackT, | ||
signalT | ||
} from '../Wonka_types.gen'; | ||
|
||
export const pull = (0 as any as types.talkbackT); | ||
export const close = (1 as any as types.talkbackT); | ||
type talkbackCb = (tb: talkbackT) => void; | ||
|
||
export const start = <a>(tb: talkbackCb): types.signalT<a> => block(0, [tb]) as any; | ||
export const push = <a>(x: a): types.signalT<a> => block(1, [x]) as any; | ||
export const end = <a>(): types.signalT<a> => 0 as any; | ||
export const pull = (0 as any as talkbackT); | ||
export const close = (1 as any as talkbackT); | ||
|
||
export const isStart = <a>(s: types.signalT<a>) => | ||
export const start = <a>(tb: talkbackCb): signalT<a> => block(0, [tb]) as any; | ||
export const push = <a>(x: a): signalT<a> => block(1, [x]) as any; | ||
export const end = <a>(): signalT<a> => 0 as any; | ||
|
||
export const isStart = <a>(s: signalT<a>) => | ||
typeof s !== 'number' && (s as any).tag === 0; | ||
export const isPush = <a>(s: types.signalT<a>) => | ||
export const isPush = <a>(s: signalT<a>) => | ||
typeof s !== 'number' && (s as any).tag === 1; | ||
export const isEnd = <a>(s: types.signalT<a>) => | ||
export const isEnd = <a>(s: signalT<a>) => | ||
typeof s === 'number' && (s as any) === 0; | ||
|
||
export const unboxPush = <a>(s: types.signalT<a>): a | null => | ||
export const unboxPush = <a>(s: signalT<a>): a | null => | ||
isPush(s) ? (s as any)[0] : null; | ||
export const unboxStart = <a>(s: types.signalT<a>): talkbackCb => | ||
export const unboxStart = <a>(s: signalT<a>): talkbackCb => | ||
isStart(s) ? (s as any)[0] : (talkbackPlaceholder as any); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @flow | ||
|
||
import * as Wonka from '../../'; | ||
|
||
Wonka.pipe( | ||
Wonka.fromArray([1, 2, 3]), | ||
Wonka.map(x => x * 2), | ||
Wonka.publish | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters