yajl-enumerator 0.2.0.3 → 0.2.0.4
raw patch · 2 files changed
+13/−13 lines, 2 filesdep ~enumeratordep ~text
Dependency ranges changed: enumerator, text
Files
Text/JSON/YAJL/Enumerator.hs view
@@ -134,16 +134,16 @@ -> E.Enumeratee a Event m b eneeParser parseChunk parseComplete = E.checkDone (E.continue . step) where step k (E.Chunks xs) = parseLoop k xs- step k E.EOF = checkEvents k parseComplete+ step k E.EOF = checkEvents k E.EOF parseComplete (\k' -> E.yield (E.Continue k') E.EOF) (\_ -> throwError (T.pack "Unexpected EOF")) parseLoop k [] = E.continue (step k)- parseLoop k (x:xs) = checkEvents k (parseChunk x)+ parseLoop k (x:xs) = checkEvents k (E.Chunks xs) (parseChunk x) (\k' -> E.yield (E.Continue k') (E.Chunks xs)) (\k' -> parseLoop k' xs) - checkEvents k getEvents onFinished onContinue = do+ checkEvents k extra getEvents onFinished onContinue = do (events, status) <- lift getEvents let checkError k' = case status of Y.ParseError err -> throwError err@@ -152,7 +152,7 @@ Y.ParseCancelled -> throwError (T.pack "Parse cancelled") if null events then checkError k- else k (E.Chunks events) >>== E.checkDone checkError+ else k (E.Chunks events) >>== E.checkDoneEx extra checkError throwError = E.throwError . Exc.ErrorCall . T.unpack @@ -229,20 +229,20 @@ step k (E.Chunks xs) = parseLoop k xs step k E.EOF = E.yield (E.Continue k) E.EOF - parseLoop k [] = checkBuf k (E.continue . step)+ parseLoop k [] = checkBuf k [] (E.continue . step) parseLoop k (x:xs) = do maybeError <- lift $ genEvent x case maybeError of- Just Y.GenerationComplete -> checkBuf k+ Just Y.GenerationComplete -> checkBuf k xs (\k' -> E.yield (E.Continue k') (E.Chunks (x:xs)))- Just err -> checkBuf k (\_ -> E.throwError err)+ Just err -> checkBuf k xs (\_ -> E.throwError err) Nothing -> parseLoop k xs - checkBuf k next = do+ checkBuf k extra next = do buf <- lift takeBuf if null buf then next k- else k (E.Chunks [buf]) >>== E.checkDone next+ else k (E.Chunks [buf]) >>== E.checkDoneEx (E.Chunks extra) next genEventImpl :: Y.Generator s -> Event -> ST s () genEventImpl g e = case e of
yajl-enumerator.cabal view
@@ -1,5 +1,5 @@ name: yajl-enumerator-version: 0.2.0.3+version: 0.2.0.4 synopsis: Enumerator-based interface to YAJL, an event-based JSON implementation license: GPL-3 license-file: license.txt@@ -19,13 +19,13 @@ location: http://john-millikin.com/software/yajl-enumerator/ library- ghc-options: -Wall -fno-warn-unused-do-bind+ ghc-options: -Wall build-depends: base >= 4 && < 5 , bytestring >= 0.9 && < 0.10- , text >= 0.7 && < 0.11- , enumerator >= 0.4 && < 0.5+ , text >= 0.7 && < 0.12+ , enumerator >= 0.4.3 && < 0.5 , transformers >= 0.2 && < 0.3 , yajl >= 0.3 && < 0.4