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

Feature request: Generalize :&: #35

Open
liarokapisv opened this issue Mar 17, 2021 · 0 comments
Open

Feature request: Generalize :&: #35

liarokapisv opened this issue Mar 17, 2021 · 0 comments

Comments

@liarokapisv
Copy link

It would be very useful to have an indexed version of :&:.
Basically the alternative definition referenced in the docs:

This data type adds a constant product to a signature. Alternatively, this could have also been defined as
data (f :&': a) (g :: * -> *) e = f g e :&': a e
This is too general, however, for example for productHHom.

(I can't find any reference to productHHom.)

It also seems that the original :&: can be retrieved by just using a type synonym along with K:

type f :&: a = f :&': K a

In contrast the indexed version cannot be defined as a partially applied type synonym:

-- We can't do this, i is not visible:
-- type f :&': a = f :&: (a i) 
-- Instead we have to do this:
type (f :&': a) r i = (f :&: a i) r i

Unfortunately this means we can't use :&': with Term since we can't partially apply it. Therefore I think that working with the indexed version and retrieving the original with a type synonym would be more flexible. Here is an example where the indexed version is very useful. Note that for LNodeF we could use the original type while for ANodeF we need the indexed version.

Kinds regards.

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

No branches or pull requests

1 participant