IsString StringContainingQuotedPath optimisation

This causes an encodeBS thunk, and the first evaluation of the string
forces it. From then on, further uses operate on a ByteString. This
avoids converting repeatedly.
This commit is contained in:
Joey Hess 2023-04-11 15:29:04 -04:00
parent afa5b883dc
commit 4a5f18a8ec
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -99,7 +99,7 @@ instance Quoteable StringContainingQuotedPath where
noquote (a :+: b) = noquote a <> noquote b
instance IsString StringContainingQuotedPath where
fromString = UnquotedString
fromString = UnquotedByteString . encodeBS
instance Sem.Semigroup StringContainingQuotedPath where
UnquotedString a <> UnquotedString b = UnquotedString (a <> b)