Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(TS): add typescript definitions #3

Merged
merged 3 commits into from
Jun 2, 2016
Merged

Conversation

TylorS
Copy link
Member

@TylorS TylorS commented May 28, 2016

This is about the best that typescript can do unfortunately

This is about the best that typescript can do unfortunately
// first 2 then 1
export function sampleArray<A, B, C>(f: (a: A, b: B[]) => C, sampler: Stream<A>): (s: Stream<B>[]) => Stream<C>;
// 1 arg at a time
export function sampleArray<A, B, C>(f: (a: A, b: B[]) => C): (sampler: Stream<A>) => (s: Stream<B>[]) => Stream<C>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty brutal already, but I think it may need to be expanded even more if we want to really do it right. Like combineArray, I think we need to add polymorphic variants of sampleArray. Unfortunately, having to handle both partial application and polymorphism will cause a combinatoric explosion of type definitions :( Any ideas on other ways to do it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how to do it in a way that isn't super verbose :/

Brain exploding, hating typescript.
@TylorS
Copy link
Member Author

TylorS commented Jun 1, 2016

I very much remember the parts of TypeScript I don't like...

@briancavalier
Copy link
Member

Terrifying :) Looks right, tho.

@briancavalier briancavalier merged commit f38e558 into master Jun 2, 2016
@briancavalier briancavalier deleted the ts-definitions branch June 2, 2016 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants