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

Add support for discriminated union shapes #51

Open
eiriktsarpalis opened this issue Nov 13, 2024 · 0 comments
Open

Add support for discriminated union shapes #51

eiriktsarpalis opened this issue Nov 13, 2024 · 0 comments
Milestone

Comments

@eiriktsarpalis
Copy link
Owner

There should be a type shape kind describing discriminated union like types. This would include polymorphic type hierarchies as well as F# discriminated unions and future C# discriminated unions.

Here's a simplistic sketch of an IUnionShape abstraction:

public interface IUnionTypeShape<TUnion> : ITypeShape<TUnion>
{
    Func<TUnion, int> GetGetUnionCaseIndex();
    IEnumerable<KeyValuePair<string, ITypeShape<TUnion>>> GetUnionCases();
    object? ITypeShape.Accept(ITypeShapeVisitor visitor, object? state) => visitor.VisitUnion(this, state);
}
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