avoid unncessary nested lists for combineing StringContainingQuotedPath
This commit is contained in:
parent
2ba1559a8e
commit
1c21ce17d4
1 changed files with 3 additions and 3 deletions
|
@ -70,20 +70,20 @@ instance Quoteable RawFilePath where
|
||||||
data StringContainingQuotedPath
|
data StringContainingQuotedPath
|
||||||
= UnquotedString String
|
= UnquotedString String
|
||||||
| QuotedPath RawFilePath
|
| QuotedPath RawFilePath
|
||||||
| StringContainingQuotedPathMulti [StringContainingQuotedPath]
|
| StringContainingQuotedPath :+: StringContainingQuotedPath
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
|
|
||||||
instance Quoteable StringContainingQuotedPath where
|
instance Quoteable StringContainingQuotedPath where
|
||||||
quote _ (UnquotedString s) = encodeBS s
|
quote _ (UnquotedString s) = encodeBS s
|
||||||
quote qp (QuotedPath p) = quote qp p
|
quote qp (QuotedPath p) = quote qp p
|
||||||
quote qp (StringContainingQuotedPathMulti l) = S.concat (map (quote qp) l)
|
quote qp (a :+: b) = quote qp a <> quote qp b
|
||||||
|
|
||||||
instance IsString StringContainingQuotedPath where
|
instance IsString StringContainingQuotedPath where
|
||||||
fromString = UnquotedString
|
fromString = UnquotedString
|
||||||
|
|
||||||
instance Sem.Semigroup StringContainingQuotedPath where
|
instance Sem.Semigroup StringContainingQuotedPath where
|
||||||
UnquotedString a <> UnquotedString b = UnquotedString (a <> b)
|
UnquotedString a <> UnquotedString b = UnquotedString (a <> b)
|
||||||
a <> b = StringContainingQuotedPathMulti [a, b]
|
a <> b = a :+: b
|
||||||
|
|
||||||
instance Monoid StringContainingQuotedPath where
|
instance Monoid StringContainingQuotedPath where
|
||||||
mempty = UnquotedString mempty
|
mempty = UnquotedString mempty
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue