CurryInfo: cass-4.1.0 / CASS.RCFile.readRCFile

definition:
readRCFile :: IO CConfig
readRCFile = do
  hashomedir <- getHomeDirectory >>= doesDirectoryExist
  if not hashomedir
   then readPropertiesAndStoreLocally
   else do
     installPropertyFile
     cc <- readPropertiesAndStoreLocally
     let distprops = rights defaultRCProps
         userprops = ccProps cc
     unless (rcKeys userprops == rcKeys distprops) $ do
       rcName <- propertyFileName
       debugMessage (debugLevel cc) 1 $ "Updating '" ++ rcName ++ "'..."
       renameFile rcName $ rcName <.> "bak"
       writeFile rcName defaultRC
       mapM_ (\ (n, v) -> maybe (return ())
                 (\uv -> if uv == v then return ()
                                    else updatePropertyFile rcName n uv)
                 (lookup n userprops))
             distprops
     return cc
 where
  rcKeys = sort . map fst
demand:
no demanded arguments
deterministic:
deterministic operation
documentation:
--- Reads the rc file (and try to install a user copy of it if it does not
--- exist) and returns its definition. Additionally, the definitions
--- are compared with the default property file of the CASS distribution.
--- If the set of variables is different, the rc file of the user is updated
--- with the distribution but the user's definitions are kept.
failfree:
<FAILING>
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{() |-> _}
name:
readRCFile
precedence:
no precedence defined
result-values:
_
signature:
Prelude.IO CASS.Configuration.CConfig
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term