Commit a72c6fd2 authored by ijones's avatar ijones
Browse files

used sequenceMap and concatMap

parent 9d8c49e0
......@@ -61,6 +61,7 @@ module Distribution.Package (
import Control.Monad(foldM, liftM)
import Data.Char
import Data.List(concatMap)
import Data.Maybe(fromMaybe)
import Text.PrettyPrint.HughesPJ
......@@ -120,7 +121,7 @@ emptyPackageDescription
-- |Get all the module names from this package
allModules :: PackageDescription -> [String]
allModules PackageDescription{executables=execs, library=lib}
= (concat $ map (\e -> modules $ buildInfo e) execs)
= (concatMap (\e -> modules $ buildInfo e) execs)
++ (maybe [] modules lib)
-- |Set the name for this package. Convenience function.
......
......@@ -264,14 +264,14 @@ maybeExit cmd = do
-- Exit with the same exitcode if the subcommand fails
rawSystemExit :: FilePath -> [String] -> IO ()
rawSystemExit path args = do
putStrLn (path ++ concat (map (' ':) args))
putStrLn (path ++ concatMap (' ':) args)
--ToDo: make command display conditional on -v flag?
maybeExit $ rawSystem path args
-- Exit with the same exitcode if the subcommand fails
rawSystemPathExit :: String -> [String] -> IO ()
rawSystemPathExit prog args = do
putStrLn (prog ++ concat (map (' ':) args))
putStrLn (prog ++ concatMap (' ':) args)
--ToDo: make command display conditional on -v flag?
maybeExit $ rawSystemPath prog args
......@@ -336,7 +336,7 @@ moduleToFilePath :: FilePath -- ^search location
moduleToFilePath pref s possibleSuffixes
= do let possiblePaths = moduleToPossiblePaths pref s possibleSuffixes
matchList <- sequence $ map (\x -> do y <- doesFileExist x; return (x, y)) possiblePaths
matchList <- sequenceMap (\x -> do y <- doesFileExist x; return (x, y)) possiblePaths
return [x | (x, True) <- matchList]
-- |Get the possible file paths based on this module name.
......@@ -366,7 +366,7 @@ moveSources pref _targetDir sources searchSuffixes
= do let targetDir = maybeAddSep _targetDir
createIfNotExists True targetDir
-- Create parent directories for everything:
sourceLocs' <- sequence $ map moduleToFPErr sources
sourceLocs' <- sequenceMap moduleToFPErr sources
let sourceLocs = concat sourceLocs'
let sourceLocsNoPref -- get rid of the prefix, for target location.
= if null pref then sourceLocs
......@@ -444,7 +444,7 @@ copyFile src dest
partitionIO :: (a -> IO Bool) -> [a] -> IO ([a], [a])
partitionIO f l
= do bools <- sequence $ map f l
= do bools <- sequenceMap f l
let both = zip l bools
return ([x | (x, True) <- both], [y | (y, False) <- both])
......@@ -474,7 +474,7 @@ removeFileRecursive startLoc
curDir <- getCurrentDirectory
setCurrentDirectory startLoc
dirs <- removeFiles cont
sequence $ map removeFileRecursive dirs
sequenceMap removeFileRecursive dirs
setCurrentDirectory curDir
removeDirectory startLoc
......
......@@ -135,7 +135,7 @@ instance Eq Version where
showVersion :: Version -> String
showVersion (Version branch tags)
= concat (intersperse "." (map show branch)) ++
concat (map ('-':) tags)
concatMap ('-':) tags
-- -----------------------------------------------------------------------------
-- Version ranges
......
** bug in srcDist where it doesn't move exe sources into place
** change all concat $ map to concatMap and sequence $ map to
sequenceMap
** sdist remove file probably doesn't look in the right place, doesn't
put in the files for executables
** sdist probably doesn't look in the right place, doesn't put in the
files for executables
** where are we using allModules, is this the right place?
......@@ -12,13 +10,9 @@
"." there.
** integrate w/ GHC distro
** Preprocessing
- what other preprocessors can't unlit?
- right now, preprocessors just stick files into the current
directory, then copies them into the destination. this is no good
since we now won't be able to tell them from real source files the
next time around. clean is broken here...
** what other preprocessors can't unlit?
** several solutions to above problem:
-- remember the source files to remove somehow
-- move them into place first, then preprocess them, leave source
......@@ -26,6 +20,7 @@
-- preprocess them, and put them in place in the new
location. best solution, but not set up well for that right now,
since we concat together the entire filename (including module name)
** is cpp ever run yet?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment