@@ -13,7 +13,7 @@ module Streamly.Internal.Data.Parser
1313 -- $setup
1414
1515 module Streamly.Internal.Data.Parser.Type
16− --, module Streamly.Internal.Data.Parser.Tee
16+ --, module Streamly.Internal.Data.Parser.Tee
1717
1818 -- * Types
1919 , Parser (..)
@@ -681,9 +681,11 @@ takeBetween low high (Fold fstep finitial fextract) =
681681 in case res of
682682 FL.Partial s -> do
683683 let s1 = Tuple'Fused i1 s
684− if i1 < high
684+ if i1 < low
685685 then return $ Continue 0 s1
686− else extract foldErr s1
686+ else if i1 < high
687+ then return $ Partial 0 s1
688+ else fmap (Done 0) (fextract s)
687689 FL.Done b ->
688690 return
689691 $ if i1 >= low