{- | get, parse and check an environment variable; provide the default
  value, only if the envionment variable is not set or the
  parse-check-function returns Nothing -}
getEnvSave :: a                   -- ^ default value
           -> String              -- ^ name of environment variable
           -> (String -> Maybe a) -- ^ parse and check value of variable
           -> IO a
getEnvSave defValue envVar readFun =
    liftM (maybe defValue (fromMaybe defValue . readFun)
           . lookup envVar) getEnvironment
getEnvSave :: a                   -- ^ default value
           -> String              -- ^ name of environment variable
           -> (String -> Maybe a) -- ^ parse and check value of variable
           -> IO a
getEnvSave defValue envVar readFun =
    liftM (maybe defValue (fromMaybe defValue . readFun)
           . lookup envVar) getEnvironment
getEnvSave defValue envVar readFun =
    liftM (maybe defValue (fromMaybe defValue . readFun)
           . lookup envVar) getEnvironment