Skip to content

Commit ce08e39

Browse files
committed
Optimize instance Eq NormalizedFilePath
The `Ord` instance is also changed for consistency. Closes #629.
1 parent 774f0e9 commit ce08e39

File tree

1 file changed

+7
-1
lines changed
  • lsp-types/src/Language/LSP/Protocol/Types

1 file changed

+7
-1
lines changed

lsp-types/src/Language/LSP/Protocol/Types/Uri.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,13 @@ This is one of the most performance critical parts of HLS, do not
199199
modify it without profiling.
200200
-}
201201
data NormalizedFilePath = NormalizedFilePath !NormalizedUri {-# UNPACK #-} !Text
202-
deriving stock (Generic, Eq, Ord)
202+
deriving stock (Generic)
203+
204+
instance Eq NormalizedFilePath where
205+
NormalizedFilePath _uri1 fp1 == NormalizedFilePath _uri2 fp2 = fp1 == fp2
206+
207+
instance Ord NormalizedFilePath where
208+
compare (NormalizedFilePath _uri1 fp1) (NormalizedFilePath _uri2 fp2) = compare fp1 fp2
203209

204210
instance NFData NormalizedFilePath
205211

0 commit comments

Comments
 (0)