on master help sign in
Add strictness annotations in ParserD
20916e7Harendra Kumar
core/src/Streamly/Internal/Data/Parser/ParserD/Type.hs+5−5
@@ -195,7 +195,7 @@ import Prelude hiding (concatMap)
195data Initial s b
195data Initial s b
196 = IPartial !s -- ^ Wait for step function to be called with state @s@.
196 = IPartial !s -- ^ Wait for step function to be called with state @s@.
197 | IDone !b -- ^ Return a result right away without an input.
197 | 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.
199
199
200-- | @first@ maps on 'IPartial' and @second@ maps on 'IDone'.
200-- | @first@ maps on 'IPartial' and @second@ maps on 'IDone'.
201--
201--
@@ -272,7 +272,7 @@ instance Functor (Initial s) where
272--
272--
273{-# ANN type Step Fuse #-}
273{-# ANN type Step Fuse #-}
274data Step s b =
274data Step s b =
275− Partial Int s
275+ Partial !Int !s
276 -- ^ Partial result with an optional backtrack request.
276 -- ^ Partial result with an optional backtrack request.
277 --
277 --
278 -- @Partial count state@ means a partial result is available which
278 -- @Partial count state@ means a partial result is available which
@@ -281,7 +281,7 @@ data Step s b =
281 -- The current input position is reset to @count@ elements back and any
281 -- The current input position is reset to @count@ elements back and any
282 -- input before that is dropped from the backtrack buffer.
282 -- input before that is dropped from the backtrack buffer.
283
283
284− | Continue Int s
284+ | Continue !Int !s
285 -- ^ Need more input with an optional backtrack request.
285 -- ^ Need more input with an optional backtrack request.
286 --
286 --
287 -- @Continue count state@ means the parser has consumed the current input
287 -- @Continue count state@ means the parser has consumed the current input
@@ -289,14 +289,14 @@ data Step s b =
289 -- The current input is retained in the backtrack buffer and the input
289 -- The current input is retained in the backtrack buffer and the input
290 -- position is reset to @count@ elements back.
290 -- position is reset to @count@ elements back.
291
291
292− | Done Int b
292+ | Done !Int !b
293 -- ^ Done with leftover input count and result.
293 -- ^ Done with leftover input count and result.
294 --
294 --
295 -- @Done count result@ means the parser has finished, it will accept no
295 -- @Done count result@ means the parser has finished, it will accept no
296 -- more input, last @count@ elements from the input are unused and the
296 -- more input, last @count@ elements from the input are unused and the
297 -- result of the parser is in @result@.
297 -- result of the parser is in @result@.
298
298
299− | Error String
299+ | Error !String
300 -- ^ Parser failed without generating any output.
300 -- ^ Parser failed without generating any output.
301 --
301 --
302 -- The parsing operation may backtrack to the beginning and try another
302 -- The parsing operation may backtrack to the beginning and try another