on master help sign in
Add bang on states of Applicative, Alt etc.

No change in perf but for consistency.

commit5be1d6e213dd1f72939a5d68a69e07a297e9d3f8 authorHarendra Kumar <harendra@composewell.com> dateMon 27 Feb 2023, 19:23 (4 years ago) parenta0cbb73
1 file changed+4−4
core/src/Streamly/Internal/Data/Parser/ParserD/Type.hs+4−4
core/src/Streamly/Internal/Data/Parser/ParserD/Type.hs+4−4
@@ -484,7 +484,7 @@ fromEffect b = Parser undefined (IDone <$> b) undefined
484484-------------------------------------------------------------------------------
485485
486486{-# ANN type SeqParseState Fuse #-}
487−data SeqParseState sl f sr = SeqParseL sl | SeqParseR f sr
487+data SeqParseState sl f sr = SeqParseL !sl | SeqParseR !f !sr
488488
489489-- Note: this implementation of splitWith is fast because of stream fusion but
490490-- has quadratic time complexity, because each composition adds a new branch
@@ -678,7 +678,7 @@ noErrorUnsafeSplitWith func (Parser stepL initialL extractL)
678678 Continue n s -> return $ Continue n (SeqParseL s)
679679
680680{-# ANN type SeqAState Fuse #-}
681−data SeqAState sl sr = SeqAL sl | SeqAR sr
681+data SeqAState sl sr = SeqAL !sl | SeqAR !sr
682682
683683-- This turns out to be slightly faster than splitWith
684684
@@ -829,7 +829,7 @@ instance Monad m => Applicative (Parser a m) where
829829-------------------------------------------------------------------------------
830830
831831{-# ANN type AltParseState Fuse #-}
832−data AltParseState sl sr = AltParseL Int sl | AltParseR sr
832+data AltParseState sl sr = AltParseL !Int !sl | AltParseR !sr
833833
834834-- Note: this implementation of alt is fast because of stream fusion but has
835835-- quadratic time complexity, because each composition adds a new branch that
@@ -1203,7 +1203,7 @@ instance Monad m => Alternative (Parser a m) where
12031203
12041204{-# ANN type ConcatParseState Fuse #-}
12051205data ConcatParseState sl m a b =
1206− ConcatParseL sl
1206+ ConcatParseL !sl
12071207 | forall s. ConcatParseR (s -> a -> m (Step s b)) s (s -> m (Step s b))
12081208
12091209-- | Map a 'Parser' returning function on the result of a 'Parser'.