Created
December 11, 2018 13:53
-
-
Save siassaj/d4be57f33784a06365da8b6047c413de to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| type Dict<T> = { [key: string]: T } | |
| interface component { | |
| bacon: Stream<string> | |
| lettuce?: Stream<number> | |
| } | |
| type baconArgs = { | |
| firstBastard: Stream<string>, | |
| secondBastard: Stream<string> | |
| } | |
| function bacon(args: baconArgs): Stream<string> { | |
| return xs.merge(args.firstBastard, args.secondBastard) | |
| } | |
| type lettuceArgs = { | |
| secondBastard: Stream<number> | |
| } | |
| function lettuce(args: lettuceArgs): Stream<number> { | |
| return xs.merge(args.secondBastard) | |
| } | |
| function mix < | |
| T extends Dict<component>, | |
| V extends component, | |
| U extends { [K in keyof component]: (a: {[key in keyof T]: T[key][K]}) => component[K] } | |
| >(components: T, combinators: U): void { | |
| } | |
| mix({ | |
| firstBastard: { | |
| bacon: xs.of('abc') | |
| }, | |
| secondBastard: { | |
| bacon: xs.of('abcde'), | |
| lettuce: xs.of(123) | |
| } | |
| }, { | |
| bacon: bacon, | |
| lettuce: lettuce | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment