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

Improve List.scanl #574

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@jvoigtlaender
Contributor

jvoigtlaender commented Apr 28, 2016

This has the exact same semantics as the current implementation of List.scanl.

The reason I consider it to be an improvement is the following lines in the current implementation:

     case accAcc of
       ...

       [] ->
         [] -- impossible

If something cannot happen, it's better to use types than code comments to express that. My version has that quality.

(If the current implementation stays, I think it would be more appropriate to replace the line [] -- impossible by a call to Debug.crash.)

@jvoigtlaender jvoigtlaender referenced this pull request Apr 28, 2016

Closed

Improve List.scanl #523

@jvoigtlaender jvoigtlaender deleted the jvoigtlaender:scanl branch May 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment