Commit a61ed6ae authored by sof's avatar sof
Browse files

[project @ 2003-11-01 01:52:01 by sof]

expandEnvVars.expandStrings: flatten the expanded strings so as to
permit a substitution to expand into multiple elements of the final
list.

merge to stable.
parent 679a97e2
......@@ -406,7 +406,13 @@ expandEnvVars pkg defines force = do
, extra_frameworks= e_frames
})
where
expandStrings = mapM expandString
expandStrings vs = do
xs <- mapM expandString vs
-- Flatten the elements of the expanded list; this is
-- to permit substitutions for list-valued variables. e.g.,
-- package_deps["${deps}"] where env var (say) 'deps'
-- is "base,haskell98,network"
return (concat (map (wordsBy (==',')) xs))
-- Just for fun, keep this in the IO monad.
expandString :: String -> IO String
......@@ -430,6 +436,11 @@ expandEnvVars pkg defines force = do
show nm)
return "")
wordsBy :: (Char -> Bool) -> String -> [String]
wordsBy p s = case dropWhile p s of
"" -> []
s' -> w : wordsBy p s'' where (w,s'') = break p s'
-----------------------------------------------------------------------------
getProgramName :: IO String
......
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