ini 0.1.1 → 0.2.0
raw patch · 2 files changed
+8/−7 lines, 2 files
Files
- ini.cabal +1/−1
- src/Data/Ini.hs +7/−6
ini.cabal view
@@ -1,5 +1,5 @@ name: ini-version: 0.1.1+version: 0.2.0 synopsis: Quick and easy configuration files in the INI format. description: Quick and easy configuration files in the INI format. license: BSD3
src/Data/Ini.hs view
@@ -77,8 +77,8 @@ parseIni = parseOnly iniParser -- | Lookup values in the config.-lookupValue :: Ini -> Text -> Text -> Either String Text-lookupValue (Ini ini) name key =+lookupValue :: Text -> Text -> Ini -> Either String Text+lookupValue name key (Ini ini) = case M.lookup name ini of Nothing -> Left ("Couldn't find section: " ++ T.unpack name) Just section ->@@ -87,10 +87,11 @@ Just value -> return value -- | Read a value using a reader from "Data.Text.Read".-readValue :: Ini -> Text -> Text -> (Text -> Either String (a, Text))+readValue :: Text -> Text -> (Text -> Either String (a, Text))+ -> Ini -> Either String a-readValue ini section key f =- lookupValue ini section key >>= f >>= return . fst+readValue section key f ini =+ lookupValue section key ini >>= f >>= return . fst -- | Print the INI config to a file. writeIniFile :: FilePath -> Ini -> IO ()@@ -139,7 +140,7 @@ -- | Skip end of line and whitespace beyond. skipEndOfLine :: Parser ()-skipEndOfLine = skipWhile (\c -> isEndOfLine c || isSpace c)+skipEndOfLine = skipWhile (\c -> isEndOfLine c) -- | Skip comments starting at the beginning of the line. skipComments :: Parser ()