htoml 0.1.0.1 → 0.1.0.2
raw patch · 5 files changed
+106/−56 lines, 5 filesdep ~Cabaldep ~aesondep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal, aeson, base, bytestring, containers, file-embed, parsec, tasty, tasty-hspec, tasty-hunit, text, unordered-containers, vector
API changes (from Hackage documentation)
Files
- CHANGES.md +17/−0
- README.md +39/−10
- htoml.cabal +39/−37
- src/Text/Toml/Parser.hs +2/−2
- src/Text/Toml/Types.hs +9/−7
+ CHANGES.md view
@@ -0,0 +1,17 @@+Change log+==========++#### dev+* ...++#### 0.1.0.2+* Updated the REAMDE+* Added/relaxed dependency version contraints where applicable+* Fixed all warnings+* Added `CHANGES.md`++#### 0.1.0.1+* Fixes `cabal configure` error in cabal file++#### 0.1.0.0+* Initial upload to Hackage
README.md view
@@ -23,14 +23,23 @@ ### Quick start -To quickly show some features of `htoml` we use `GHCi`, from the-root of the repository run:+Installing `htoml` is easy. - cabal repl+ cabal install htoml -It picks up configuration from the `.ghci` file, so we can immediately-start exploring:+In order to make your project depend on it you can add it as a+dependency in your project's cabal file. +To quickly show some features of `htoml` we start `GHCi` from the+root of the repository so it picks up configuration from the+`.ghci` file that lives there.++ git clone https://github.com/cies/htoml.git+ cd htoml+ cabal repl ;# this starts GHCi++We can immediately start exploring from the `GHCi` prompt.+ > txt <- readFile "benchmarks/example.toml" > let r = parseTomlDoc "" txt > r@@ -46,9 +55,20 @@ unexpected '=' expecting "#", "[" or end of input -First notice that some outputs are truncated.+Notice that some outputs are truncated, indicated by `[...]`. +### Version contraints of `htoml`'s dependencies++If you encounter any problems because `htoml`'s dependecies are+constrained either too much or too little, please+[file a issue](https://github.com/cies/htoml/issues) for that.++I will try to have `htoml` included in [Stackage](http://stackage.org)+as soon as it is reviewed by the community. Stackage provides a very+attractive solution to most (dependency) version conflicts.++ ### Tests and benchmarks The test suite is build by default, `cabal configure --disable-tests` disables them.@@ -80,9 +100,9 @@ * Provides a JSON interface (suggested by Greg Weber) * Useful error messages (thanks to using Parsec over Attoparsec) * Understands arrays as described in [this issue](https://github.com/toml-lang/toml/issues/254)-* Provides a benchmark suite * Fails on mix-type arrays (as per spec)-* Haddock documentation+* Provides a benchmark suite+* Tries to be well documented (please raise an issue if you find documentation lacking) ### Todo@@ -103,6 +123,15 @@ Spiros Eliopoulos. -### License+### Copyright and licensing -BSD3 as found in the `LICENSE` file.+This package includes BurntSushi's language agnostic+[TOML tests](https://github.com/BurntSushi/toml-test), which are WTFPL+licensed.++The TOML examples that are used as part of the benchmarks are copied+from Tom Preston-Werner's TOML spec which is MIT licensed.++For all other files in this project the copyrights are specified in the+`htoml.cabal` file, and are distributed under the BSD3 license as found+in the `LICENSE` file.
htoml.cabal view
@@ -1,22 +1,24 @@ name: htoml-version: 0.1.0.1-synopsis: A parser for TOML files.-description: TOML is a obvious and minimal format for config files.+version: 0.1.0.2+synopsis: Parser for TOML files+description: TOML is an obvious and minimal format for config files. . This package provides a TOML parser,- build with the Parsec library of parser combinators.- .- It provides a JSON interface using the Aeson library.+ build with the Parsec library, and providing a JSON+ interface using the Aeson library. homepage: https://github.com/cies/htoml bug-reports: https://github.com/cies/htoml/issues license: BSD3 license-file: LICENSE+copyright: (c) 2013-2014 Cies Breijs author: Cies Breijs-maintainer: Cies Breijs-category: Text+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+ , CHANGES.md , test/BurntSushi/fetch-toml-tests.sh , test/BurntSushi/valid/*.toml , test/BurntSushi/valid/*.json@@ -36,15 +38,15 @@ ghc-options: -Wall hs-source-dirs: src default-language: Haskell2010- build-depends: base >= 4.6 && < 5- , parsec >= 3.1.5- , containers >= 0.5 && < 0.6- , unordered-containers- , vector- , aeson- , text- , time -any- , old-locale -any+ build-depends: base >= 4.3 && < 5+ , parsec >= 3.1.2 && < 4+ , containers >= 0.5+ , unordered-containers >= 0.2+ , vector >= 0.10+ , aeson >= 0.8+ , text >= 1.0 && < 2+ , time -any+ , old-locale -any executable tests hs-source-dirs: test@@ -53,21 +55,21 @@ other-modules: BurntSushi , Text.Toml.Parser.Spec default-language: Haskell2010- build-depends: base >= 4.6 && < 5- , parsec >= 3.1.5- , containers >= 0.5 && < 0.6- , bytestring- , file-embed+ build-depends: base+ , parsec+ , containers , unordered-containers , vector , aeson , text- , time -any- , Cabal >= 1.16.0+ , time+ , bytestring >= 0.9+ , file-embed >= 0.0.5+ , Cabal >= 1.16.0+ , tasty >= 0.10+ , tasty-hspec >= 0.2+ , tasty-hunit >= 0.9 , htoml- , tasty- , tasty-hspec- , tasty-hunit test-suite Tests hs-source-dirs: test@@ -77,16 +79,16 @@ , Text.Toml.Parser.Spec type: exitcode-stdio-1.0 default-language: Haskell2010- build-depends: base >= 4.6 && < 5- , parsec >= 3.1.5- , containers >= 0.5 && < 0.6+ build-depends: base+ , parsec+ , containers , bytestring , file-embed , unordered-containers , vector , text- , time -any- , Cabal >= 1.16.0+ , time+ , Cabal , htoml , tasty , tasty-hspec@@ -98,14 +100,14 @@ main-is: Benchmarks.hs type: exitcode-stdio-1.0 default-language: Haskell2010- build-depends: base >= 4.6 && < 5- , parsec >= 3.1.5- , containers >= 0.5 && < 0.6+ build-depends: base+ , parsec+ , containers , unordered-containers , vector , aeson , text- , time -any- , Cabal >= 1.16.0+ , time+ , Cabal , htoml , criterion
src/Text/Toml/Parser.hs view
@@ -12,7 +12,7 @@ import qualified Data.HashMap.Strict as M import qualified Data.List as L import qualified Data.Set as S-import Data.Text (Text, concat, pack, unpack)+import Data.Text (Text, pack, unpack) import Data.Time.Format (parseTime) import Numeric (readHex) import System.Locale (defaultTimeLocale, iso8601DateFormat)@@ -183,7 +183,7 @@ float :: Parser TValue float = VFloat <$> do n <- intStr- char '.'+ _ <- char '.' d <- uintStr e <- try (satisfy (\c -> c == 'e' || c == 'E') *> intStr) <|> return "0" return . read . L.concat $ [n, ".", d, "e", e]
src/Text/Toml/Types.hs view
@@ -61,10 +61,10 @@ Left ds -> Left $ T.concat [ "Cannot redefine key(s) (", (T.intercalate ", " ds) , "), from table named '", name, "'." ] Right r -> Right $ M.insert name (NTable r) ttbl- (NTArray _) -> commonInsertError node [name]+ _ -> commonInsertError node [name] Just (NTArray a) -> case node of- (NTable _) -> commonInsertError node [name] (NTArray na) -> Right $ M.insert name (NTArray $ a ++ na) ttbl+ _ -> commonInsertError node [name] Just _ -> commonInsertError node [name] insert (fullName@(name:ns), node) ttbl = -- In case 'name' is not final, but a sub-name@@ -93,11 +93,13 @@ -- | Convenience function to construct a common error message for the 'insert' function. commonInsertError :: Node -> [Text] -> Either Text Table-commonInsertError what name =- let w = case what of (NTable _) -> "tables"- _ -> "array of tables"- n = T.intercalate "." name- in Left $ T.concat ["Cannot insert ", w, " '", n, "' as key already exists."]+commonInsertError what name = Left . T.concat $ case what of+ NTValue _ -> ["Cannot insert a value '", n, "'."]+ _ -> ["Cannot insert ", w, " '", n, "' as key already exists."]+ where+ n = T.intercalate "." name+ w = case what of (NTable _) -> "tables"+ _ -> "array of tables"