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

Idris-style case split code generation #460

Open
ieviev opened this issue Dec 8, 2022 · 7 comments
Open

Idris-style case split code generation #460

ieviev opened this issue Dec 8, 2022 · 7 comments

Comments

@ieviev
Copy link
Contributor

ieviev commented Dec 8, 2022

i've recently looked into a lot of academic research languages and i found something that'd be very cool to have in F# as well.

the idea is to have an action on a discriminated union value that creates all the available cases like this.

case split

basically i want to implement the same thing, but i was hoping someone would help me out with this.
since filling in a single discriminated union is already implemented it shouldn't be much of a leap right?

@ieviev
Copy link
Contributor Author

ieviev commented Dec 8, 2022

plus what would be even more beneficial is generating match cases for OO hierarchies,

so in this C# AST example i could generate all possible implementations of the CSharpSyntaxNode abstract class

image

@ieviev
Copy link
Contributor Author

ieviev commented Dec 8, 2022

and of course interface hierarchies as well. i think it'd save a lot of time

@auduchinok
Copy link
Collaborator

auduchinok commented Dec 8, 2022

@Aciq I've been working on this for the last few days, and here's where it was in the noon:

generateMatch04

And I was working on the union cases just this evening, but there's no gif yet 🙂

There're a few things that I was going to implement separately, and I can keep some of them for you to implement if you wish 🙂

@ieviev
Copy link
Contributor Author

ieviev commented Dec 8, 2022

@auduchinok ok that is awesome

yeah i'll gladly help out with this

but one thing - is it possible to disable renaming the template holes when deconstructing tuples or filling in unions?
i find the default names fine most of the time.

@auduchinok
Copy link
Collaborator

maybe good to look at, depending how far you are @auduchinok?

@smoothdeveloper Thanks for the pointer! I've checked it, and it seems it's not going to help in any way 🙂

@auduchinok
Copy link
Collaborator

but one thing - is it possible to disable renaming the template holes when deconstructing tuples or filling in unions?
i find the default names fine most of the time.

Sure. It wouldn't make sense to do it when generating many patterns

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

3 participants