@@ -63,7 +63,7 @@ import Data.Data ( Data(..) )
6363import Data.Fix ( Fix (.. ) )
6464import qualified Data.HashSet as HashSet
6565import qualified Data.Map as Map
66- import Data.Text ( cons )
66+ import qualified Data.Text as Text
6767import Nix.Utils
6868import Nix.Expr.Types
6969import Nix.Expr.Shorthands hiding ( ($>) )
@@ -251,19 +251,17 @@ nixUri =
251251 do
252252 start <- letterChar
253253 protocol <-
254- many $
255- satisfy $
256- \ x ->
257- isAlphanumeric x
258- || (`elem` (" +-." :: String )) x
259- _ <- chunk " :"
254+ takeWhileP Nothing $
255+ \ x ->
256+ isAlphanumeric x
257+ || (`elem` (" +-." :: String )) x
258+ _ <- single ' :'
260259 address <-
261- some $
262- satisfy $
260+ takeWhile1P Nothing $
263261 \ x ->
264262 isAlphanumeric x
265263 || (`elem` (" %/?:@&=+$,-_.!~*'" :: String )) x
266- pure $ NStr $ DoubleQuoted $ one $ Plain $ toText $ one start <> protocol <> " :" <> address
264+ pure $ NStr $ DoubleQuoted $ one $ Plain $ start `Text.cons` protocol <> " :" <> address
267265
268266
269267-- ** Strings
@@ -343,7 +341,7 @@ identifier =
343341 try $
344342 do
345343 (coerce -> iD) <-
346- liftA2 cons
344+ liftA2 Text. cons
347345 (satisfy (\ x -> isAlpha x || x == ' _' ))
348346 (takeWhileP mempty identLetter)
349347 guard $ not $ iD `HashSet.member` reservedNames
@@ -422,14 +420,14 @@ slash =
422420
423421pathStr :: Parser Path
424422pathStr =
425- lexeme . coerce $
423+ lexeme $ coerce . toString <$>
426424 liftA2 (<>)
427- (many $ satisfy pathChar)
428- (concat <$>
425+ (takeWhileP Nothing pathChar)
426+ (Text. concat <$>
429427 some
430- (liftA2 (:)
428+ (liftA2 Text. cons
431429 slash
432- (some $ satisfy pathChar)
430+ (takeWhile1P Nothing pathChar)
433431 )
434432 )
435433
0 commit comments