@@ -310,7 +310,7 @@ takeLazyText :: Parser L.Text
310310takeLazyText = L.fromChunks `fmap` takeRest
311311
312312data Scan s = Continue s
313− | Finished {-# UNPACK #-} !Int Text
313+ | Finished s {-# UNPACK #-} !Int Text
314314
315315scan_ :: (s -> [Text] -> Parser r) -> s -> (s -> Char -> Maybe s) -> Parser r
316316scan_ f s0 p = go [] s0
@@ -319,7 +319,7 @@ scan_ f s0 p = go [] s0
319319 case T.uncons t of
320320 Just (c,t') -> case p s c of
321321 Just s' -> scanner s' (n+1) t'
322− Nothing -> Finished n t
322+ Nothing -> Finished s n t
323323 Nothing -> Continue s
324324 go acc s = do
325325 input <- get
@@ -328,8 +328,8 @@ scan_ f s0 p = go [] s0
328328 if continue
329329 then go (input : acc) s'
330330 else f s' (input : acc)
331− Finished n t -> do advance (size input - size t)
332− f s (T.take n input : acc)
331+ Finished s' n t -> do advance (size input - size t)
332+ f s' (T.take n input : acc)
333333{-# INLINE scan_ #-}
334334
335335-- | A stateful scanner. The predicate consumes and transforms a