@@ -13,7 +13,7 @@ module Streamly.Internal.Data.Parser
15 module Streamly.Internal.Data.Parser.Type
15 module Streamly.Internal.Data.Parser.Type
16− --, module Streamly.Internal.Data.Parser.Tee
16+ --, module Streamly.Internal.Data.Parser.Tee
18 -- * Types
18 -- * Types
19 , Parser (..)
19 , Parser (..)
@@ -681,9 +681,11 @@ takeBetween low high (Fold fstep finitial fextract) =
681 in case res of
681 in case res of
682 FL.Partial s -> do
682 FL.Partial s -> do
683 let s1 = Tuple'Fused i1 s
683 let s1 = Tuple'Fused i1 s
684− if i1 < high
684+ if i1 < low
685 then return $ Continue 0 s1
685 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)
687 FL.Done b ->
689 FL.Done b ->
689 $ if i1 >= low
691 $ if i1 >= low