on master help sign in
Add strictness annotations in ParserD
commit20916e742775fb6afd32208fb1ed292e6e2d7037 authorHarendra Kumar <harendra@composewell.com> dateThu 10 Mar 2022, 20:23 (5 years ago) parent68e2a79
1 file changed+5−5
core/src/Streamly/Internal/Data/Parser/ParserD/Type.hs+5−5
core/src/Streamly/Internal/Data/Parser/ParserD/Type.hs+5−5
@@ -195,7 +195,7 @@ import Prelude hiding (concatMap)
195195data Initial s b
196196 = IPartial !s -- ^ Wait for step function to be called with state @s@.
197197 | IDone !b -- ^ Return a result right away without an input.
198− | IError String -- ^ Return an error right away without an input.
198+ | IError !String -- ^ Return an error right away without an input.
199199
200200-- | @first@ maps on 'IPartial' and @second@ maps on 'IDone'.
201201--
@@ -272,7 +272,7 @@ instance Functor (Initial s) where
272272--
273273{-# ANN type Step Fuse #-}
274274data Step s b =
275− Partial Int s
275+ Partial !Int !s
276276 -- ^ Partial result with an optional backtrack request.
277277 --
278278 -- @Partial count state@ means a partial result is available which
@@ -281,7 +281,7 @@ data Step s b =
281281 -- The current input position is reset to @count@ elements back and any
282282 -- input before that is dropped from the backtrack buffer.
283283
284− | Continue Int s
284+ | Continue !Int !s
285285 -- ^ Need more input with an optional backtrack request.
286286 --
287287 -- @Continue count state@ means the parser has consumed the current input
@@ -289,14 +289,14 @@ data Step s b =
289289 -- The current input is retained in the backtrack buffer and the input
290290 -- position is reset to @count@ elements back.
291291
292− | Done Int b
292+ | Done !Int !b
293293 -- ^ Done with leftover input count and result.
294294 --
295295 -- @Done count result@ means the parser has finished, it will accept no
296296 -- more input, last @count@ elements from the input are unused and the
297297 -- result of the parser is in @result@.
298298
299− | Error String
299+ | Error !String
300300 -- ^ Parser failed without generating any output.
301301 --
302302 -- The parsing operation may backtrack to the beginning and try another