diff --git a/Distribution/ParseUtils.hs b/Distribution/ParseUtils.hs index 31a1c67e03ebc0797585d49b4409d1f24f7393c7..fb26775df43c424462dfa0129b731b087522d141 100644 --- a/Distribution/ParseUtils.hs +++ b/Distribution/ParseUtils.hs @@ -171,14 +171,18 @@ simpleField name showF readF get set commaListField :: String -> (a -> Doc) -> (ReadP [a] a) -> (b -> [a]) -> ([a] -> b -> b) -> FieldDescr b commaListField name showF readF get set = - liftField get set $ + liftField get set' $ field name (fsep . punctuate comma . map showF) (parseCommaList readF) + where + set' xs b = set (get b ++ xs) b listField :: String -> (a -> Doc) -> (ReadP [a] a) -> (b -> [a]) -> ([a] -> b -> b) -> FieldDescr b listField name showF readF get set = - liftField get set $ + liftField get set' $ field name (fsep . map showF) (parseOptCommaList readF) + where + set' xs b = set (get b ++ xs) b optsField :: String -> CompilerFlavor -> (b -> [(CompilerFlavor,[String])]) -> ([(CompilerFlavor,[String])] -> b -> b) -> FieldDescr b optsField name flavor get set = @@ -189,7 +193,7 @@ optsField name flavor get set = where update f opts [] = [(f,opts)] update f opts ((f',opts'):rest) - | f == f' = (f, opts ++ opts') : rest + | f == f' = (f, opts' ++ opts) : rest | otherwise = (f',opts') : update f opts rest ------------------------------------------------------------------------------