Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modify finalChunk to return an empty stream when the parser is done, …

…and has consumed all of the input.
  • Loading branch information...
commit 9cd399da0133d9b0072ccbc8e32db97d065c48ca 1 parent aef7910
Grant Monroe authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/Data/Attoparsec/Iteratee.hs
View
7 src/Data/Attoparsec/Iteratee.hs
@@ -39,8 +39,11 @@ parserToIteratee p = IterateeG $ f (\s -> parse p s)
return $ Cont (error $ show m)
(Just $ Err m)
- finalChunk (Atto.Done rest r) =
- return $ Done r (Chunk $ toWrap $ L.fromChunks [rest])
+ finalChunk (Atto.Done rest r)
+ | S.null rest =
+ return $ Done r (EOF Nothing)
+ | otherwise =
+ return $ Done r (Chunk $ toWrap $ L.fromChunks [rest])
finalChunk (Atto.Partial _) =
return $ Cont (error "parser did not produce a value")
Please sign in to comment.
Something went wrong with that request. Please try again.