Skip to content

Add type inference for literal equality in guards#15041

Merged
josevalim merged 4 commits intomainfrom
jv-singleton-equality
Jan 9, 2026
Merged

Add type inference for literal equality in guards#15041
josevalim merged 4 commits intomainfrom
jv-singleton-equality

Conversation

@josevalim
Copy link
Copy Markdown
Member

No description provided.

@josevalim josevalim merged commit 45de6e5 into main Jan 9, 2026
21 of 22 checks passed
@josevalim josevalim deleted the jv-singleton-equality branch January 9, 2026 17:25
@josevalim
Copy link
Copy Markdown
Member Author

💚 💙 💜 💛 ❤️

Comment on lines +3994 to +3999
bdd
|> map_bdd_to_dnf()
|> Enum.map(fn {tag, fields, negs} ->
map_eliminate_while_negs_decrease(tag, fields, negs)
end)
|> map_fusion()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inner monologue: "Can this module leverage streams more often?"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Streams are often more expensive because they abstract over lazy collections. They are meant to deal with large collections, which is not the case here. If we want performance, then we should fold Enum operations, not use streams (i.e. don't do map |> map |> filter, do a single one, or use flat_map/reduce). We do all of these things already.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dig; make sense! thanks for the explanation!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants