-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
Proposal for HKT restructuring #1005
Comments
If I may add my newcomer two cents, I re-implemented it, to understand how you managed to make it work and it is a pleasure to work with ! (especially coming from The only "confusing" thing was the separate declaration of I'm not sure choosing the variance is required (besides the complexity it might add), I tend to expect R to be contravariant, E & A to be covariant and would probably be confused otherwise. |
it could be |
(overall I agree, it is refreshing how simpler it is) |
My guess is it may be restored as a config param over the typeclass that doesn't get propagated into Kind at all (or it may) Arguably it isn't too useful |
I also agree - I really enjoy the new encoding! Excellent work on this @mikearnaldi 👏 With respect to variance, maybe it would be helpful to see a use case in user-land where variance may help avoid pitfalls? The reason I ask is because I also tend to agree with @isthatcentered in how I view |
As I was mentioning there really is no reasonable place where to use variance configured in any non standard setting. Typescript users, strict mode folks, rightfully expect inputs to be contravariant and outputs to be covariant (the language automatically defines variance based on usage). To better clarify the current hkt does not impose R to be contravariant, it makes no assumption of R at all but:
So while allowing invariance is a valid use case, making R covariant will break typeclasses that uses it. The initial thinking was 'let's call it R but let's keep it flexible as it may be Env for a type but output for another' while this is true it is bringing in an added level of complexity for a use case that really has nothing practical |
A side effect of this would be that Deno will be working (without tracing and plugins) #754 given the main issues was usage of module augmentation |
since #1162 was suppressed, is there any rough insight/plan around this? @mikearnaldi |
@shroomist yes we are working on a re-unification with |
oh nice, great news, I think it's a good decision to get the |
I was wondering are we still expecting to re-unify |
Since the time we implemented HKTs we found a new encoding that doesn't require having a central registry of URIs and that should have far better performances while allowing for more flexibility.
The encoding is implemented in:
https://github.com/mikearnaldi/hkt-new
I propose we change the current encoding to reflect the new implementation, as part of the change we will also need to remove the flexibility of choosing the variance of a type parameter namely in the current encoding we are using a config param to specify how a type parameter should be mixed, the problem with that approach is that it may generate inconsistencies, namely we do implementations on a reduced base using
HKT/HKT2
and we have a generic overload that considers all the params with their respective rules but there is no guarantee that the base impl would actually work with that set of rules, namely I could implement a base using R as contravariant and having R as covariant in the target type. Also we actually never used any other setting other thanS
invariant,R
contravariant, etc.The text was updated successfully, but these errors were encountered: