haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.71k stars 368 forks source link

For easier inspection here's the code change as a diff: #4398

Closed Natka198902 closed 1 month ago

Natka198902 commented 2 months ago
          For easier inspection here's the code change as a diff:
--- Network/URI.hs  2024-08-09 13:56:20
+++ Network/URI2.hs 2024-08-09 14:08:20
@@ -73,7 +73,7 @@
 --
 --------------------------------------------------------------------------------

-module Network.URI
+module Network.URI2
     (
     -- * The URI type
       URI(..)
@@ -545,7 +545,7 @@

 userinfo :: URIParser String
 userinfo =
-    do  { uu <- many (uchar ";:&=+$,")
+    do  { uu <- many (uchars ";:&=+$,")
         ; _ <- char '@'
         ; return (concat uu ++"@")
         }
@@ -776,38 +776,38 @@

 segment :: URIParser String
 segment =
-    do  { ps <- many pchar
+    do  { ps <- many pchars
         ; return $ concat ps
         }

 segmentNz :: URIParser String
 segmentNz =
-    do  { ps <- many1 pchar
+    do  { ps <- many1 pchars
         ; return $ concat ps
         }

 segmentNzc :: URIParser String
 segmentNzc =
-    do  { ps <- many1 (uchar "@")
+    do  { ps <- many1 (uchars "@")
         ; return $ concat ps
         }

-pchar :: URIParser String
-pchar = uchar ":@"
+pchars :: URIParser String
+pchars = uchars ":@"

 -- helper function for pchar and friends
-uchar :: String -> URIParser String
-uchar extras =
-        unreservedChar
+uchars :: String -> URIParser String
+uchars extras =
+    many1 (satisfy (\c -> isUnreserved c
+                       || isSubDelims c
+                       || c `elem` extras))
     <|> escaped
-    <|> subDelims
-    <|> do { c <- oneOf extras ; return [c] }

 --  RFC3986, section 3.4

 uquery :: URIParser String
 uquery =
-    do  { ss <- many $ uchar (":@"++"/?")
+    do  { ss <- many $ uchars (":@"++"/?")
         ; return $ '?':concat ss
         }

@@ -815,7 +815,7 @@

 ufragment :: URIParser String
 ufragment =
-    do  { ss <- many $ uchar (":@"++"/?")
+    do  { ss <- many $ uchars (":@"++"/?")
         ; return $ '#':concat ss
         }

Originally posted by @jgm in https://github.com/haskell/network-uri/issues/89#issuecomment-2278777942

fendor commented 2 months ago

Hi! Thanks for the bug report!

Was this issue intentionally created? If so, I would appreciate some context :)