Commits

Anonymous committed d6f2bba

Fix for aeson 0.5

Comments (0)

Files changed (2)

couchdb-enumerator.cabal

   hs-source-dirs:   src
   build-depends:
         base >= 4,
-        aeson >= 0.4 && < 0.5,
+        aeson >= 0.4 && < 0.6,
         attoparsec >= 0.8 && < 0.11,
         attoparsec-enumerator >= 0.2 && < 0.4,
         bytestring >= 0.9 && < 0.10,
         text >= 0.11 && < 0.12,
         transformers >= 0.2 && < 0.3,
         unordered-containers >= 0.1 && < 0.2,
-        utf8-string >= 0.3 && < 0.4
+        utf8-string >= 0.3 && < 0.4,
+        blaze-builder
   exposed-modules:  
                     Database.CouchDB.Enumerator,
                     Database.CouchDB.Enumerator.Generic
   main-is:         Main.hs
   build-depends:   
         couchdb-enumerator,
-        -- following dependencies copied from above
         base >= 4,
-        aeson >= 0.4 && < 0.5,
+        aeson >= 0.4 && < 0.6,
         attoparsec >= 0.8 && < 0.11,
         attoparsec-enumerator >= 0.2 && < 0.4,
         bytestring >= 0.9 && < 0.10,
         transformers >= 0.2 && < 0.3,
         unordered-containers >= 0.1 && < 0.2,
         utf8-string >= 0.3 && < 0.4,
-
-        -- extra deps just for testing
         HUnit >= 1.2 && < 2,
         QuickCheck >= 2.4,
         test-framework >= 0.4.1,
         test-framework-quickcheck2,
         test-framework-hunit,
-        vector
+        vector,
+        blaze-builder
   other-modules:   
                    Database.CouchDB.Enumerator.Test.Generic,
                    Database.CouchDB.Enumerator.Test.Basic,

src/Database/CouchDB/Enumerator.hs

 import           Control.Monad.Trans.Reader (ReaderT, ask, runReaderT)
 import           Data.Maybe (fromJust)
 import qualified Data.Aeson as A
-import qualified Data.Aeson.Encode as AE
+--import qualified Data.Aeson.Encode as AE
 import           Data.Attoparsec
 import           Data.Attoparsec.Enumerator (iterParser)
 import qualified Data.ByteString as B
             _                 -> ""
     reason _ = []
 
--- | Converts a json object into a 'H.RequestBodyEnumChunked'
+-- | Converts a json object into a 'H.RequestBodyLBS'
 jsonToReqBody :: (A.ToJSON a, Monad m) => a -> H.RequestBody m
-jsonToReqBody val = H.RequestBodyEnumChunked enum
-    where jbuilder = AE.fromValue $ A.toJSON val
-          enum (Continue k) = k (Chunks [jbuilder])
-          enum step         = returnI step
+jsonToReqBody val = H.RequestBodyLBS $ A.encode val
+--  where 
+--    jbuilder = AE.fromValue $ A.toJSON val
+--    enum (Continue k) = k (Chunks [jbuilder])
+--    enum step         = returnI step
+--    trans = BLB.fromLazyByteString . TLE.encodeUtf8
+--    untrans = TLE.decodeUtf8 . BL.toLazyByteString
 
 -- | Convers a value to an object
 valToObj :: A.Value -> Either CouchError A.Object