hsini 0.4.2 → 0.5.0
raw patch · 4 files changed
+50/−47 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- hsini.cabal +42/−34
- src/Data/Ini.hs +6/−6
- src/Data/Ini/Reader.hs +1/−1
- src/Data/Ini/Reader/Internals.hs +1/−6
hsini.cabal view
@@ -1,43 +1,51 @@-name : hsini-version : 0.4.2-license : BSD3-license-file : LICENSE-author : Magnus Therning-maintainer : magnus@therning.org-copyright : Magnus Therning, 2010-2014-synopsis : Package for user configuration files (INI)-description : None yet-build-type : Custom-category : Network-cabal-version : >= 1.10+name: hsini+version: 0.5.0+license: BSD3+license-file: LICENSE+author: Magnus Therning+maintainer: magnus@therning.org+copyright: Magnus Therning, 2010-2014+synopsis: Package for user configuration files (INI)+description: None yet+build-type: Custom+category: Configuration, Data+cabal-version: >= 1.10 source-repository head- type : git- location : https://github.com/magthe/hsini.git+ type: git+ location: https://github.com/magthe/hsini.git library- hs-source-dirs : src- default-language : Haskell2010- build-depends : base ==4.8.*, bytestring ==0.10.*,- containers ==0.5.*, mtl ==2.2.*, parsec ==3.1.*- exposed-modules : Data.Ini Data.Ini.Types Data.Ini.Reader- other-modules : Data.Ini.Reader.Internals+ hs-source-dirs: src+ default-language: Haskell2010+ build-depends: base >=4.7 && <4.10,+ bytestring ==0.10.*,+ containers ==0.5.*,+ mtl ==2.2.*,+ parsec ==3.1.*+ exposed-modules: Data.Ini+ Data.Ini.Types+ Data.Ini.Reader+ other-modules: Data.Ini.Reader.Internals test-suite hsini-tests type: exitcode-stdio-1.0 hs-source-dirs: tst, src main-is: Main.hs- other-modules: Ini, ReaderI- default-language : Haskell2010- build-depends:- base,- containers,- bytestring,- parsec,- mtl,- HUnit,- tasty,- tasty-hunit,- tasty-quickcheck,- tasty-th,- QuickCheck+ other-modules: Data.Ini+ Data.Ini.Reader.Internals+ Data.Ini.Types+ Ini+ ReaderI+ default-language: Haskell2010+ build-depends: base,+ containers,+ bytestring,+ parsec,+ mtl,+ HUnit,+ tasty,+ tasty-hunit,+ tasty-quickcheck,+ tasty-th,+ QuickCheck
src/Data/Ini.hs view
@@ -54,19 +54,19 @@ -- | Sets the value of the option, adding it if it doesn't exist. setOption :: SectionName -> OptionName -> OptionValue -> Config -> Config-setOption sn on ov cfg = let+setOption sn on ov cfg = maybe (M.insert sn new_s cfg) (\ sec -> M.insert sn (M.insert on ov sec) cfg) s+ where s = getSection sn cfg new_s = M.insert on ov M.empty- in maybe (M.insert sn new_s cfg) (\ sec -> M.insert sn (M.insert on ov sec) cfg) s -- | Removes the option if it exists. Empty sections are pruned. delOption :: SectionName -> OptionName -> Config -> Config-delOption sn on cfg = let- s = getSection sn cfg- sEmptyAfterDelete = maybe True (\ sec -> M.empty == M.delete on sec) s- in if sEmptyAfterDelete+delOption sn on cfg = if sEmptyAfterDelete then M.delete sn cfg else maybe cfg (\ sec -> M.insert sn (M.delete on sec) cfg) s+ where+ s = getSection sn cfg+ sEmptyAfterDelete = maybe True (\ sec -> M.empty == M.delete on sec) s -- | Returns all options and their values of a section. allItems :: SectionName -> Config -> [(OptionName, OptionValue)]
src/Data/Ini/Reader.hs view
@@ -10,7 +10,7 @@ , IniParseResult ) where -import Control.Monad.Error+import Control.Monad.Except import qualified Text.ParserCombinators.Parsec as P import Data.Ini.Types
src/Data/Ini/Reader/Internals.hs view
@@ -7,9 +7,8 @@ -- Internal functions used in 'Data.Ini.Reader'. module Data.Ini.Reader.Internals where -import Control.Monad.Error+import Control.Monad.Except import Control.Monad.State--- import Text.ParserCombinators.Parsec as P import qualified Data.ByteString as BS import Text.Parsec as P import Text.Parsec.String@@ -22,10 +21,6 @@ | IniSyntaxError String | IniOtherError String deriving (Eq, Show)--instance Error IniReaderError where- noMsg = IniOtherError "Unknown error"- strMsg s = IniOtherError s type IniParseResult = Either IniReaderError