Skip to content

Merge spaces when parsing constraint set constraints #782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion haskell-ci.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: haskell-ci
version: 0.19.20250531
version: 0.19.20250604
synopsis: Haskell CI script generator
description:
Script generator (@haskell-ci@) for
Expand Down
10 changes: 9 additions & 1 deletion src/HaskellCI/Newtypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ newtype NoCommas = NoCommas String
deriving anyclass (C.Newtype String)

instance C.Parsec NoCommas where
parsec = NoCommas <$> liftA2 (:) (C.satisfy (not . isSpace)) (C.munch (/= ','))
parsec = NoCommas . mergeSpaces <$> liftA2 (:) (C.satisfy (not . isSpace)) (C.munch (/= ','))

mergeSpaces :: String -> String
mergeSpaces [] = []
mergeSpaces (' ' : s) = ' ' : go s where
go [] = []
go (' ' : s') = go s'
go (c : s') = c : mergeSpaces s'
mergeSpaces (c : s) = c : mergeSpaces s

instance C.Pretty NoCommas where
pretty (NoCommas p) = PP.text p
Expand Down
Loading