sparsec

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

commit ac8734059b2ebf12436e90e253c43e6f3d65fc2a
parent 013c84c5eda42a2b3a499c14e091a08328eb70ce
Author: Robert Russell <robert@rr3.xyz>
Date:   Thu, 25 Dec 2025 17:53:27 -0800

Try enabling Strict for performance debugging

Diffstat:
Mpackage.yaml | 1+
Msrc/Sparsec.hs | 11+++++------
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/package.yaml b/package.yaml @@ -33,6 +33,7 @@ default-extensions: - UnboxedTuples - UndecidableInstances - UnliftedNewtypes + - Strict # TODO: Temp dependencies: - base >= 4.20 && < 5 diff --git a/src/Sparsec.hs b/src/Sparsec.hs @@ -427,12 +427,11 @@ match scrut cases = choose $ (scrut >>=) <$> cases next :: ParseT e a -> (Char -> ParseT e a) -> ParseT e a next ke kc = ParseT \s@(State# i l) -> case UTF8.decode i of - Just (c, w) - | c == '\xFFFD' -> Utf8Error# l - | otherwise -> - -- TODO: This strictness annotation apparently does nothing. - let !i' = BS.drop w i - in kc c `runParseT#` State# i' (locAdvance# c w l) + Just ('\xFFFD', _) -> Utf8Error# l + Just (c, w) -> + -- TODO: This strictness annotation apparently does nothing. + let !i' = BS.drop w i + in kc c `runParseT#` State# i' (locAdvance# c w l) Nothing -> ke `runParseT#` s {-# INLINE next #-}