definition:
|
readConfigurationWith :: [(String,String)] -> ErrorLogger (Either String Config)
readConfigurationWith defsettings = do
home <- liftIOEL $ getHomeDirectory
let configFile = home </> ".cpmrc"
exfile <- liftIOEL $ doesFileExist configFile
rcsettings <- liftIOEL $
if exfile
then do rcdefs <- readPropertyFile configFile >>= return . stripProps
return rcdefs
else return []
unless (null rcsettings) $ logDebug $
"Properties defined in " ++ configFile ++ ":\n" ++
unlines (map (\ (x,y) -> " " ++ x ++ "=" ++ y) rcsettings)
let mergedSettings = mergeConfigSettings defaultConfig
(rcsettings ++ stripProps defsettings)
case mergedSettings of
Left e -> return $ Left e
Right s0 -> do s1 <- liftIOEL $ replaceHome s0
s2 <- setCompilerVersion s1
s3 <- liftIOEL $ setAppPackageDir s2
s4 <- liftIOEL $ setHomePackageDir s3
liftIOEL $ createDirectories s4
return $ Right s4
|
demand:
|
no demanded arguments
|
deterministic:
|
deterministic operation
|
documentation:
|
--- Reads the .cpmrc file from the user's home directory (if present) and
--- merges its contents and some given default settings (first argument)
--- into the configuration used by CPM.
--- Resolves the $HOME variable after merging and creates
--- any missing directories. May return an error using `Left`.
|
failfree:
|
<FAILING>
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{(_) |-> _}
|
name:
|
readConfigurationWith
|
precedence:
|
no precedence defined
|
result-values:
|
_
|
signature:
|
[(String, String)] -> CPM.ErrorLogger.ErrorLogger (Prelude.Either String Config)
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|