htoml 1.0.0.1 → 1.0.0.2
raw patch · 3 files changed
+20/−41 lines, 3 filesdep ~aesondep ~basedep ~bytestring
Dependency ranges changed: aeson, base, bytestring, containers, file-embed, parsec, tasty, tasty-hspec, tasty-hunit, text, unordered-containers, vector
Files
- README.md +13/−9
- htoml.cabal +5/−30
- src/Text/Toml/Types.hs +2/−2
README.md view
@@ -2,11 +2,11 @@ ===== [](https://travis-ci.org/cies/htoml)-[](https://hackage.haskell.org/package/html)-[](https://hackage.haskell.org/package/html)+[](https://hackage.haskell.org/package/htoml)+[](https://hackage.haskell.org/package/htoml) -[](http://stackage.org/lts-4/package/htoml) [](http://stackage.org/lts-5/package/htoml)+[](http://stackage.org/lts-6/package/htoml) [](http://stackage.org/nightly/package/htoml) @@ -25,7 +25,7 @@ This library aims to be compatible with the latest version of the [TOML spec](https://github.com/mojombo/toml). Compatibility between `htoml` version and TOML (as proven by-[BurntSushi's language agnostic TOML test suite]())+[BurntSushi's language agnostic TOML test suite](https://github.com/BurntSushi/toml-test)) is as follows: * [TOML v0.4.0](https://github.com/toml-lang/toml/releases/tag/v0.4.0)@@ -74,9 +74,13 @@ stack solver --update-config -We can now start exploring `htoml` from a GHCi REPL. For instance-by reading a `.toml` file from the banchmarks, with:+We can now start exploring `htoml` from a GHCi REPL. From the+root of this repository run: + stack ghci++Now read a `.toml` file from the benchmark suite, with:+ ```haskell txt <- readFile "benchmarks/example.toml" let r = parseTomlDoc "" txt@@ -87,7 +91,7 @@ Right (fromList [("database",VTable (fromList [("enabled",VBoolean True),("po [...] -Then converting it to [Aeason's JSON](https://hackage.haskell.org/package/aeson), with:+Then convert it to [Aeson](https://hackage.haskell.org/package/aeson) (JSON), with: ```haskell let Right toml = r@@ -98,14 +102,14 @@ Object (fromList [("database",Object (fromList [("enabled",Bool True),("po [...] -Finally here an parse error produced with:+Finally trigger a parse error, with: ```haskell let Left err = parseTomlDoc "" "== invalid toml ==" err ``` -...which errors out showing:+...it errors out (as it should), showing: (line 1, column 1): unexpected '='
htoml.cabal view
@@ -1,5 +1,5 @@ name: htoml-version: 1.0.0.1+version: 1.0.0.2 synopsis: Parser for TOML files description: TOML is an obvious and minimal format for config files. .@@ -14,7 +14,6 @@ author: Cies Breijs maintainer: Cies Breijs <cies % kde ! nl> category: Data, Text, Parser, Configuration, JSON, Language-stability: provisional build-type: Simple cabal-version: >= 1.10 extra-source-files: README.md@@ -26,8 +25,7 @@ , benchmarks/example.toml , benchmarks/repeated.toml --source-repository head+source-repository head type: git location: https://github.com/cies/htoml.git @@ -48,32 +46,9 @@ , time -any , old-locale -any -executable tests- hs-source-dirs: test- ghc-options: -Wall- main-is: Test.hs- other-modules: BurntSushi- , Text.Toml.Parser.Spec- default-language: Haskell2010- build-depends: base- , parsec- , containers- , unordered-containers- , vector- , aeson- , text- , time- -- from here non-lib deps- , htoml- , bytestring >= 0.9- , file-embed >= 0.0.10- , tasty >= 0.10- , tasty-hspec >= 0.2- , tasty-hunit >= 0.9--test-suite Tests+test-suite htoml-test hs-source-dirs: test- ghc-options: -Wall+ ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N main-is: Test.hs other-modules: BurntSushi , Text.Toml.Parser.Spec@@ -97,7 +72,7 @@ benchmark benchmarks hs-source-dirs: benchmarks .- ghc-options: -O2 -Wall -rtsopts+ ghc-options: -O2 -Wall -threaded -rtsopts -with-rtsopts=-N main-is: Benchmarks.hs type: exitcode-stdio-1.0 default-language: Haskell2010
src/Text/Toml/Types.hs view
@@ -145,12 +145,12 @@ -- | Table redefinition error. tableClashError :: [Text] -> Parsec Text (Set [Text]) a tableClashError name = parserFail . T.unpack $ T.concat- [ "Cannot redefine table ('", T.intercalate ", " name , "'." ]+ [ "Cannot redefine table named: '", T.intercalate "." name, "'." ] -- | Common redefinition error. commonInsertError :: Node -> [Text] -> Parsec Text (Set [Text]) a commonInsertError what name = parserFail . concat $- [ "Cannot insert ", w, " '", n, "' as key already exists." ]+ [ "Cannot insert ", w, " as '", n, "' since key already exists." ] where n = T.unpack $ T.intercalate "." name w = case what of (VTable _) -> "tables"