sparsec

simple Haskell parser combinator library
git clone git://git.rr3.xyz/sparsec
Log | Files | Refs | README | LICENSE

commit fb428a5eb17abcba1337ee246fee8bd40e1d1d1e
parent 08c78411b52b94e5c92c738ef5cce294422d349e
Author: Robert Russell <robert@rr3.xyz>
Date:   Thu, 25 Dec 2025 11:10:51 -0800

Try adding strictness in next

Diffstat:
Msrc/Sparsec.hs | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Sparsec.hs b/src/Sparsec.hs @@ -82,8 +82,6 @@ import Sparsec.Span -------------------------------------------------------------------------------- -- State# --- TODO: Try making ByteString part strict. - newtype State# = State_# (# ByteString, Loc# #) pattern State# :: ByteString -> Loc# -> State# @@ -410,7 +408,9 @@ next ke kc = ParseT \s@(State# i l) -> case UTF8.decode i of Just (c, w) | c == '\xFFFD' -> Utf8Error# l - | otherwise -> kc c `runParseT#` State# (BS.drop w i) (locAdvance# c w l) + | otherwise -> + let !i' = BS.drop w i + in kc c `runParseT#` State# i' (locAdvance# c w l) Nothing -> ke `runParseT#` s {-# INLINE next #-}