on master help sign in
Add bang on states of Applicative, Alt etc.
5be1d6eHarendra Kumar
core/src/Streamly/Internal/Data/Parser/ParserD/Type.hs+4−4
@@ -484,7 +484,7 @@ fromEffect b = Parser undefined (IDone <$> b) undefined
484-------------------------------------------------------------------------------
484-------------------------------------------------------------------------------
485
485
486{-# ANN type SeqParseState Fuse #-}
486{-# 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
488
488
489-- Note: this implementation of splitWith is fast because of stream fusion but
489-- Note: this implementation of splitWith is fast because of stream fusion but
490-- has quadratic time complexity, because each composition adds a new branch
490-- has quadratic time complexity, because each composition adds a new branch
@@ -678,7 +678,7 @@ noErrorUnsafeSplitWith func (Parser stepL initialL extractL)
678 Continue n s -> return $ Continue n (SeqParseL s)
678 Continue n s -> return $ Continue n (SeqParseL s)
679
679
680{-# ANN type SeqAState Fuse #-}
680{-# ANN type SeqAState Fuse #-}
681−data SeqAState sl sr = SeqAL sl | SeqAR sr
681+data SeqAState sl sr = SeqAL !sl | SeqAR !sr
682
682
683-- This turns out to be slightly faster than splitWith
683-- This turns out to be slightly faster than splitWith
684
684
@@ -829,7 +829,7 @@ instance Monad m => Applicative (Parser a m) where
829-------------------------------------------------------------------------------
829-------------------------------------------------------------------------------
830
830
831{-# ANN type AltParseState Fuse #-}
831{-# ANN type AltParseState Fuse #-}
832−data AltParseState sl sr = AltParseL Int sl | AltParseR sr
832+data AltParseState sl sr = AltParseL !Int !sl | AltParseR !sr
833
833
834-- Note: this implementation of alt is fast because of stream fusion but has
834-- Note: this implementation of alt is fast because of stream fusion but has
835-- quadratic time complexity, because each composition adds a new branch that
835-- quadratic time complexity, because each composition adds a new branch that
@@ -1203,7 +1203,7 @@ instance Monad m => Alternative (Parser a m) where
1203
1203
1204{-# ANN type ConcatParseState Fuse #-}
1204{-# ANN type ConcatParseState Fuse #-}
1205data ConcatParseState sl m a b =
1205data ConcatParseState sl m a b =
1206− ConcatParseL sl
1206+ ConcatParseL !sl
1207 | forall s. ConcatParseR (s -> a -> m (Step s b)) s (s -> m (Step s b))
1207 | forall s. ConcatParseR (s -> a -> m (Step s b)) s (s -> m (Step s b))
1208
1208
1209-- | Map a 'Parser' returning function on the result of a 'Parser'.
1209-- | Map a 'Parser' returning function on the result of a 'Parser'.