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

using this style of generic programming in other languages #10

Open
GunpowderGuy opened this issue Apr 12, 2023 · 2 comments
Open

using this style of generic programming in other languages #10

GunpowderGuy opened this issue Apr 12, 2023 · 2 comments

Comments

@GunpowderGuy
Copy link

GunpowderGuy commented Apr 12, 2023

Hello, i am idris2 programmer ( considering moving to lean 4 ) that wonders whether "Practical generic programming over a universe of native datatypes" can be applied to either of those languages.

Idris2 specially would benefit from this since reflection meta-programming is less integrated with actual programming than in lean4

I apologize in advance if this isnt the place for such a high level question

@GunpowderGuy
Copy link
Author

@flupe @gallais What do you think?

@gallais
Copy link
Contributor

gallais commented May 24, 2023

I already do something somewhat similar in base: instead of deriving functions directly by analysing the
type, I start by computing a view of it that is known to be amenable to automatically deriving the thing I
am interested in. For instance, this inductive type in Deriving.Functor:

https://github.com/idris-lang/Idris2/blob/04c5531d9bf95f2a02cb4d74b6594390d565b6b9/libs/base/Deriving/Functor.idr#L79-L87

You could instead have a clean HasDesc interface and derive instances for it. Of course the advantage of
rolling out your own representation is that it can be ad-hoc for the property you care about. Not all functors
are traversable and so if you are going to reuse the same universe you will need to carve out appropriate
subsets.

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

2 participants