haskell-nix / hnix

A Haskell re-implementation of the Nix expression language
https://hackage.haskell.org/package/hnix
BSD 3-Clause "New" or "Revised" License
741 stars 114 forks source link

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

Closed soulomoon closed 2 years ago

soulomoon commented 2 years ago

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.

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.

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

Anton-Latukha commented 2 years ago

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 commented 2 years ago

work is done for bidirectional patterns