Closed nikita-volkov closed 6 years ago
This isn't code duplication. What you suggest will incur a waste of performance on redundant operations like y + dy
(where dy = 0
), and packing/unpacking of a tuple. Elm won't optimize those away.
Yes, you're right, Elm is not Haskell yet unfortunately. As FP lovers we should be concerned about beautiful and reusable code more than about duplicating code for performance and let the inliner do its work. But Elm is not there yet.
I'll merge it and add a future note about inlining.
One of the things that were on my list, thank you!
I'd prefer however to have
shiftX
andshiftY
be defined in terms ofshift
itself, instead of repeating the code. Could you fix that?