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 type parameter to MergingRun to limit possible merge types #573

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mheinzel
Copy link
Collaborator

Description

This is just a phantom type parameter, the Merge inside still stores a general MergeType which is not statically guaranteed to be part of the restricted type. We can also go all the way, but then we get the type parameter and IsMergeType constraints in a lot of places, e.g. on Merge.steps and the NoThunks instances (which get quite a bit more cumbersome). So I decided against it for now, but I'm happy to revisit that choice.

Snapshots can always encode the full MergeType. At first I decided to do the partial conversion in fromSnapIncomingRun, potentially throwing an exception (first commit). Later I switched it to failing in decodeVersioned, which makes the serialisation code less mechanical, but seems to fit into our error handling better. I'm open to both solutions, so let me know if you have a preference.

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

Successfully merging this pull request may close these issues.

1 participant