Skip to content
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

[ fix ] Make traverse and friends lazy for LazyList #3076

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

buzden
Copy link
Contributor

@buzden buzden commented Sep 15, 2023

Description

This change is like #2412, but for old long-existing functions. Since Applicative interface is inherently not lazy, the current implementation was not lazy by the effect, even if the underlying monad's effect could be short-cutting. One can see an example in the added test.

Since, LazyList is still Foldable, old behaviour is reachable by converting the LazyList to List.

It may seem that this change relies on some exploiting of the breakage of monadic laws, but it is fundamental for an eager language since monad interface is inherently lazy anyway.

Should this change go in the CHANGELOG?

  • If this is a fix, user-facing change, a compiler change, or a new paper
    implementation, I have updated CHANGELOG.md (and potentially also
    CONTRIBUTORS.md).

@gallais gallais merged commit 3886200 into idris-lang:main Sep 25, 2023
22 checks passed
@buzden buzden deleted the lazy-for-for-lazy-list branch September 25, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants