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

Refactor: change PatternSynonyms in value module from Unidirectional to bidirectional #1045

Closed
soulomoon opened this issue Jan 22, 2022 · 2 comments

Comments

@soulomoon
Copy link
Collaborator

soulomoon commented Jan 22, 2022

In Value.hs
It is really cool to have the correspondence between nix and haskell.

These are how the conversion between nix and haskell currently are.

  • Value constructor, mkNV*.
  • Value destructor unidirectional PatternSynonyms, NV*.

But it seems superfluous since these two can actually be merged together by switching the PatternSynonyms from unidirectional to bidirectional.
We would have unified constructor and destructor for values.

  • pros, cleaner, coherent, shorter, easier to go through the code.
  • cons, We now need both constraints in PatternSynonyms from each of the two parts, (Comonad f, Applicative f) to make it work.

I have a working draft here #1046, hope you guys could review it and give advices.

@soulomoon soulomoon changed the title change bidirectional PatternSynonyms in value from Unidirectional to bidirectional change PatternSynonyms in value module from Unidirectional to bidirectional Jan 22, 2022
@soulomoon soulomoon changed the title change PatternSynonyms in value module from Unidirectional to bidirectional Refactor: change PatternSynonyms in value module from Unidirectional to bidirectional Jan 22, 2022
@Anton-Latukha
Copy link
Collaborator

It poped up in discussions in the past.

I've not yet internalized the design semantics of all types of PatternSynonyms application in the code, but probably it is just the time to do so.

Liking the result in #1046.

@soulomoon
Copy link
Collaborator Author

work is done for bidirectional 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

2 participants