From d6393f5f63c065226d49683434f17ce936b9f295 Mon Sep 17 00:00:00 2001 From: "marko.kocic" Date: Wed, 23 Sep 2009 09:45:39 +0000 Subject: [PATCH] Hlint: Warning: Use list comprehension --- Options.hs | 8 ++++---- tools/bench.hs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Options.hs b/Options.hs index 6cb04a4d2..dfb795e8d 100644 --- a/Options.hs +++ b/Options.hs @@ -113,16 +113,16 @@ data Opt = -- these make me nervous optsWithConstructor f opts = concatMap get opts - where get o = if f v == o then [o] else [] where v = value o + where get o = [o | f v == o] where v = value o optsWithConstructors fs opts = concatMap get opts - where get o = if any (== o) fs then [o] else [] + where get o = [o | any (== o) fs] optValuesForConstructor f opts = concatMap get opts - where get o = if f v == o then [v] else [] where v = value o + where get o = [v | f v == o] where v = value o optValuesForConstructors fs opts = concatMap get opts - where get o = if any (\f -> f v == o) fs then [v] else [] where v = value o + where get o = [v | any (\f -> f v == o) fs] where v = value o -- | Parse the command-line arguments into options, command name, and -- command arguments. Any dates in the options are converted to explicit diff --git a/tools/bench.hs b/tools/bench.hs index d67da3890..3739516f1 100644 --- a/tools/bench.hs +++ b/tools/bench.hs @@ -116,7 +116,7 @@ optValueWithDefault optcons def opts = optValuesForConstructor :: (String -> Opt) -> [Opt] -> [String] optValuesForConstructor optcons opts = concatMap get opts - where get o = if optcons v == o then [v] else [] where v = value o + where get o = [v | optcons v == o] where v = value o main = do args <- getArgs