File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
src/Distribution/Server/Features/BuildReports Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -366,12 +366,19 @@ newtype FlagAss1 = FlagAss1 (FlagName,Bool)
366366instance Newtype (FlagName ,Bool ) FlagAss1
367367
368368instance Parsec FlagAss1 where
369- parsec = do
370- -- this is subtly different from Cabal's 'FlagName' parser
371- name <- P. munch1 (\ c -> Char. isAlphaNum c || c == ' _' || c == ' -' )
372- case name of
373- (' -' : flag) -> return $ FlagAss1 (mkFlagName flag, False )
374- flag -> return $ FlagAss1 (mkFlagName flag, True )
369+ parsec = fmap FlagAss1 (posPolarity <|> negPolarity <|> noPolarity)
370+ where
371+ posPolarity = do
372+ P. char ' +'
373+ (,) <$> flagName <*> pure True
374+ negPolarity = do
375+ P. char ' -'
376+ (,) <$> flagName <*> pure False
377+ noPolarity =
378+ (,) <$> flagName <*> pure True
379+
380+ -- this is subtly different from Cabal's 'FlagName' parser
381+ flagName = mkFlagName <$> P. munch1 (\ c -> Char. isAlphaNum c || c == ' _' || c == ' -' )
375382
376383instance Pretty FlagAss1 where
377384 pretty (FlagAss1 (fn, True )) = Disp. text (unFlagName fn)
You can’t perform that action at this time.
0 commit comments