Idris-style case split code generation
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.

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?
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

and of course interface hierarchies as well. i think it'd save a lot of time
@aciq I've been working on this for the last few days, and here's where it was in the noon:

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 🙂
@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.
IIRC, there was this in VS F# PowerTools:
https://github.com/fsprojects-archive/zzarchive-VisualFSharpPowerTools/blob/e928448af203713f67aae92ea4f45e88d49487eb/src/FSharp.Editing.VisualStudio/CodeGeneration/UnionPatternMatchCaseGeneratorSmartTagger.fs
maybe good to look at, depending how far you are @auduchinok?
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 🙂
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