Open ocharles opened 9 years ago
These can skip the preview
and just view
.
pattern X x <- (view _x -> x)
I have to admit they make me rather uncomfortable as I prefer pattern synonyms that don't lose information.
I'm withholding judgment for now until others weigh in for a bit.
They came out of building a 2D platformer where I wanted to decompose motion along the X and Y axis - it was quite handy to be able to just pattern match the respective components out of the velocity vector. That said, there's no reason these synonyms can't live in that project rather than linear
. Let's keep it open and see if anyone else has thoughts.
Sounds good to me.
Thinking of things such as
probably with the corresponding
review
in as well. I say swizzling, as you could also haveIf people think this is a useful addition, I will put together a pull request.