Skip to content

Commit bdc3cb2

Browse files
authored
Merge pull request #782 from haskell-CI/merge-spaces
Merge spaces when parsing constraint set constraints
2 parents 8e5a948 + 54031f0 commit bdc3cb2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

haskell-ci.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: haskell-ci
3-
version: 0.19.20250531
3+
version: 0.19.20250604
44
synopsis: Haskell CI script generator
55
description:
66
Script generator (@haskell-ci@) for

src/HaskellCI/Newtypes.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,15 @@ newtype NoCommas = NoCommas String
6464
deriving anyclass (C.Newtype String)
6565

6666
instance C.Parsec NoCommas where
67-
parsec = NoCommas <$> liftA2 (:) (C.satisfy (not . isSpace)) (C.munch (/= ','))
67+
parsec = NoCommas . mergeSpaces <$> liftA2 (:) (C.satisfy (not . isSpace)) (C.munch (/= ','))
68+
69+
mergeSpaces :: String -> String
70+
mergeSpaces [] = []
71+
mergeSpaces (' ' : s) = ' ' : go s where
72+
go [] = []
73+
go (' ' : s') = go s'
74+
go (c : s') = c : mergeSpaces s'
75+
mergeSpaces (c : s) = c : mergeSpaces s
6876

6977
instance C.Pretty NoCommas where
7078
pretty (NoCommas p) = PP.text p

0 commit comments

Comments
 (0)