Permalink
Browse files

Make 'buildOptions' a top-level function.

Allows it to be reused.
  • Loading branch information...
1 parent 3de1049 commit bbee0d38a68c59e1925afbcd10018cd50a9be03a @23Skidoo committed Aug 24, 2012
Showing with 15 additions and 11 deletions.
  1. +15 −11 Cabal/Distribution/Simple/Setup.hs
@@ -75,7 +75,7 @@ module Distribution.Simple.Setup (
BenchmarkFlags(..), emptyBenchmarkFlags, defaultBenchmarkFlags, benchmarkCommand,
CopyDest(..),
configureArgs, configureOptions, configureCCompiler, configureLinker,
- installDirsOptions,
+ buildOptions, installDirsOptions,
defaultDistPref,
@@ -1225,22 +1225,26 @@ defaultBuildFlags = BuildFlags {
}
buildCommand :: ProgramConfiguration -> CommandUI BuildFlags
-buildCommand progConf = makeCommand name shortDesc longDesc defaultBuildFlags options
+buildCommand progConf = makeCommand name shortDesc longDesc
+ defaultBuildFlags (buildOptions progConf)
where
name = "build"
shortDesc = "Make this package ready for installation."
longDesc = Nothing
- options showOrParseArgs =
- optionVerbosity buildVerbosity (\v flags -> flags { buildVerbosity = v })
- : optionDistPref
- buildDistPref (\d flags -> flags { buildDistPref = d })
- showOrParseArgs
- : programConfigurationPaths progConf showOrParseArgs
- buildProgramPaths (\v flags -> flags { buildProgramPaths = v})
+buildOptions :: ProgramConfiguration -> ShowOrParseArgs
+ -> [OptionField BuildFlags]
+buildOptions progConf showOrParseArgs =
+ optionVerbosity buildVerbosity (\v flags -> flags { buildVerbosity = v })
+ : optionDistPref
+ buildDistPref (\d flags -> flags { buildDistPref = d })
+ showOrParseArgs
+
+ : programConfigurationPaths progConf showOrParseArgs
+ buildProgramPaths (\v flags -> flags { buildProgramPaths = v})
- ++ programConfigurationOptions progConf showOrParseArgs
- buildProgramArgs (\v flags -> flags { buildProgramArgs = v})
+ ++ programConfigurationOptions progConf showOrParseArgs
+ buildProgramArgs (\v flags -> flags { buildProgramArgs = v})
emptyBuildFlags :: BuildFlags
emptyBuildFlags = mempty

1 comment on commit bbee0d3

tibbe commented on bbee0d3 Aug 24, 2012

LGTM

Please sign in to comment.