haskell/haskell-language-server

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

Natka198902 opened this issue · 1 comments

          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 haskell/network-uri#89 (comment)

Hi! Thanks for the bug report!

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