-
Notifications
You must be signed in to change notification settings - Fork 170
Add Generic representations of # -> * and * -> * args
#855
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
Conversation
aa20a96 to
9aceb66
Compare
A comment in Prelude observes that higher-kinded args can't be handled in general; my interpretation is that this is because the lack of poly-kinded constructors means we can't have a `ConArg :: (k -> *) -> *`. But if we really want them, we can have any particular kind. I really want these two particular kinds, so I added them.
9aceb66 to
c286639
Compare
|
What was decided on whether to add a layer of hierarchy that could be matched on as a catch-all? The example in (Although I don't know if we need to start worrying about name pollution, and whether some of these types should be made more unique.) |
|
I think we decided against another layer of hierarchy, since type classes that want to actually utilize the |
|
Ok. I also don't think I realized that we already had So I can see now that having a catch-all on It does make me think In fact, maybe this argues for something like this?: which would allow defining an instance for |
|
Or rather: potentially leaving |
|
Hmm, perhaps something like I will note though that we already have a new internal release of bsc and are starting to use it internally, as I thought there was consensus on leaving it as-is at the last meeting. Changing the names again would be a bit annoying on our side and I'm not sure when I'll get around to it. Also, Ravi is on vacation for the next two weeks so I don't think we'll get further input from him soon. Would you be alright with potentially re-visiting this if we find that we need to support more kinds of type arguments? |
Generics can't include arbitrary-kinded type parameters in the generic representation, but we can add any particular kinds. It turns out that we really want to be able to represent constructors of kind
* -> *and# -> *. This addsStarConArgandNumConArgto the generic schema, and renamesConArg, the catch-all for other constructor kinds, toOtherConArg. There is a corresponding pull request making this change in bsc-contrib: B-Lang-org/bsc-contrib#39Change originally by @awpr; I rebased it on the upstream bsc repo and added tests. See MatX-inc#3