Skip to content

Conversation

@sjakobi
Copy link
Member

@sjakobi sjakobi commented Nov 19, 2025

The Ord instance is also changed for consistency.

Closes #629.

The `Ord` instance is also changed for consistency.

Closes haskell#629.
deriving stock (Generic)

instance Eq NormalizedFilePath where
NormalizedFilePath _uri1 fp1 == NormalizedFilePath _uri2 fp2 = fp1 == fp2
Copy link
Member Author

@sjakobi sjakobi Nov 19, 2025

Choose a reason for hiding this comment

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

This should be a bit faster when comparing arbitrary NFPs, but slower for NFPs that are likely to be equal, such as in HashMap operations:

Suggested change
NormalizedFilePath _uri1 fp1 == NormalizedFilePath _uri2 fp2 = fp1 == fp2
NormalizedFilePath (NormalizedUri h1 _) fp1 == NormalizedFilePath (NormalizedUri h2 _) fp2 =
h1 == h2 && fp1 == fp2

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.

Optimize instance Eq NormalizedFilepath?!

1 participant