I am learning Haskell and as exercise I am doing Project Euler Problems. In this case PE1.
-- Sum any given finite Airthmetic Progression sumAP :: Integer -> Integer -> Integer -> Integer sumAP first limit step = do let last = limit - (limit `rem` step) let terms = (last - first) `quot` step + 1 let avg = first + last terms * avg `quot` 2
Now, off the bat I am shadowing the last function. How could I rename this variable along with first?
Is there any way I can improve readability? Any edge case or fail case I haven't covered? Any performance fail?