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

Use foldr instead of foldl and reverse in Html.Styled.Internal #331

Open
wants to merge 1 commit into
base: html-styled
Choose a base branch
from

Conversation

ahstro
Copy link
Contributor

@ahstro ahstro commented Oct 20, 2017

Instead of using List.foldl to reduce children and then having to List.reverse the child nodes, use List.foldr and skip reversing.

I think this makes sense, since Dicts (the other thing being accumulated with the fold*) are often stated as a valid to use when order is irrelevant. I suppose there might be some potential problem if the order of the Dict is actually relied upon to order the styles properly (them being cascading and all). The example page looks the same after this change, but it's not very complex, so the likelihood of styles conflicting based on order is minimal.

@ahstro ahstro changed the title Use foldr instead of foldl and reverse Use foldr instead of foldl and reverse in Html.Styled.Internal Oct 20, 2017
@rtfeldman
Copy link
Owner

@ahstro I'm concerned that this would actually cause a regression instead of working as intended 😅 - do you think you could add a test case demonstrating that it still works properly?

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