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

add type parameters to polymorphic this type #5999

Closed
zpdDG4gta8XKpMCd opened this issue Dec 8, 2015 · 4 comments
Closed

add type parameters to polymorphic this type #5999

zpdDG4gta8XKpMCd opened this issue Dec 8, 2015 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@zpdDG4gta8XKpMCd
Copy link

It would be enormously helpful if this recognized type parameters:

abstract class Functor<a> {
   abstract map<b>(map: (value: a) => b): this<b>;
}

abstract class Monad<a> extends Functor<a> {
   abstract bind<b>(bind: (value: a) => this<b>): this<b>;
}
@mhegazy
Copy link
Contributor

mhegazy commented Dec 8, 2015

looks like a duplicate of #5845

@mhegazy mhegazy added the Duplicate An existing issue was already created label Dec 8, 2015
@zpdDG4gta8XKpMCd
Copy link
Author

I don't think it is a duplicate.

Higher kinded types are superior to what I am asking here, it would be great if TypeScript had HKT's, please please please, but in meanwhile, since the polymorphic this type was (surprisingly) added here, why not to tweak it a bit by allowing type parameters to it?

@mhegazy
Copy link
Contributor

mhegazy commented Dec 8, 2015

i do not think it is a "tweak". I am not sure I even understand the semantics of this<T> in this context; what if the extending class is not generic, what if it but the extending class type parameter count does not match that of the base, what if the type parameters are not the "same" type parameter of the base...

@zpdDG4gta8XKpMCd
Copy link
Author

... crap, fair questions, this inheritance thing never works out nicely, what's even more upsetting is that this "polimorfic" type is here but due to that inheritance nonsense you can only use it for 23% of what you wish you could, nevermind

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants