-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
Added integrity checking and HKTAs #158
Added integrity checking and HKTAs #158
Conversation
I'm not quite sure why prettier fails btw, I'll need some help with that. |
While reading the code, I was wondering whether there is a specific reason to use: export type HKTS = keyof {
[key in URI2HKT<any>[keyof URI2HKT<any>]['_URI']]: any
} instead of simply: export type HKTS = URI2HKT<any>[keyof URI2HKT<any>]['_URI'] |
This POC looks good from my perspective. |
Yup, that simplication works, odd that I didn't think of that, I keep forgetting you can pass disjunct unions an indexer. You want to merge it in? It needs a fix for the "prettier" fail though, I'm not sure what's wrong |
How do you run it/how is it supposed to be run? I didn't see an |
you can run fix-prettier |
Oops, my bad. I was looking at the bottom of the file and didn't see that the scrips are actually at the top. Thank, you! |
In declare module './HKT' {
- interface URIHKT<A> {
+ interface URI2HKT<A> {
Identity: Identity<A>
}
} |
Good idea. @SimonMeskens I'd love to also keep that small 2-liner (...2 bugs found ;) |
Weird, just tried moving that 2-liner to tests but it doesn't work there |
Yeah, I did the same thing and moved it to tests, but somehow that doesn't work. I think it has to do with imports and merged declarations. I'll put it in HKT.ts for now |
@SimonMeskens to fix travis, you can run |
Aha, that does seem to work, thanks, now I understand. Prettier just checks, fix-prettier to actually fix, makes sense |
(yeah, I use vscode with prettier onsave, so usually I don't run fix-prettier) Excellent, LGTM |
I'm going to let you handle merging. Do you want any rebases done? |
Thanks @SimonMeskens |
Here's the POC for HKTAs. It's a very simple replacement for URI2HKT. It's just a bit more typesafe (forces use of HKTS) and stops you from using wrongly defined URI2HKT mappings. It also means users don't have to use indexers anymore, but just plain generics, to access the URI2HKT map.