packages feed

conf-json 1.1 → 1.2

raw patch · 3 files changed

+17/−17 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,3 +1,6 @@+#####   1.2+    refactor code. compatible with 1.1+       #####   1.1     include test-conf.json @@ -5,4 +8,3 @@     initial version          test pass -    
conf-json.cabal view
@@ -1,10 +1,10 @@ name:                conf-json-version:             1.1+version:             1.2 synopsis:            read, parse json config description:         read, parse json config to a Haskell type author:              Imants Cekusins maintainer:          Imants Cekusins-category:            Configuration JSON+category:            Configuration, JSON license:             PublicDomain license-file:        PublicDomain extra-source-files:  changelog.md,@@ -25,10 +25,10 @@              ghc-options:  -fwarn-unused-imports       -  build-depends:       base >=4.8 && <5.0,-                        directory,-                        bytestring,-                        aeson+  build-depends:    base >=4.8 && <5.0,+                    aeson,+                    bytestring,+                    directory                            hs-source-dirs:      src   default-language:    Haskell2010@@ -60,6 +60,7 @@    main-is: Main.hs   other-modules:+          Data.Conf.Json           Test.TestParse    build-depends:  base >= 4.8,
src/Data/Conf/Json.hs view
@@ -16,6 +16,7 @@ module Data.Conf.Json         (readParse) where +import Control.Monad import Data.Aeson as A import Data.ByteString as B import Data.ByteString.Lazy as L@@ -28,19 +29,15 @@      FilePath -> IO (Either String conf) readParse fullPath0 = do      tbs1 <- readEntireFile fullPath0::IO (Either String B.ByteString)-     pure $ tbs1 >>= -            Right . toLazy >>=-            eitherDecode'   --  ::Either String Config+     pure $ toLazy <$> tbs1 >>=+         eitherDecode'   --  ::Either String Config+     where toLazy::B.ByteString -> L.ByteString+           toLazy bs0 = L.fromChunks [bs0]   readEntireFile::FilePath -> IO (Either String B.ByteString) readEntireFile path0 = do     exists1 <- doesFileExist path0-    if exists1 then do-        a1 <- withBinaryFile path0 ReadMode B.hGetContents-        pure $ Right a1+    if exists1 then liftM Right $+        withBinaryFile path0 ReadMode B.hGetContents     else pure $ Left $ "file n/a: " ++ path0---toLazy::B.ByteString -> L.ByteString-toLazy bs0 = L.fromChunks [bs0]