@@ -74,6 +74,7 @@ import Data.Word (Word8)
74import Foreign.ForeignPtr (touchForeignPtr)
74import Foreign.ForeignPtr (touchForeignPtr)
75import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
75import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
76import Foreign.Storable (Storable(..))
76import Foreign.Storable (Storable(..))
77+import Fusion.Plugin.Types (Fuse(..))
77import GHC.Base (assert, unsafeChr)
78import GHC.Base (assert, unsafeChr)
78import GHC.ForeignPtr (ForeignPtr (..))
79import GHC.ForeignPtr (ForeignPtr (..))
79import GHC.IO.Encoding.Failure (isSurrogate)
80import GHC.IO.Encoding.Failure (isSurrogate)
@@ -248,6 +249,7 @@ decode1 table state codep byte =
249data DecodeError = DecodeError !DecodeState !CodePoint deriving Show
250data DecodeError = DecodeError !DecodeState !CodePoint deriving Show
252+{-# ANN type FreshPoint Fuse #-}
251data FreshPoint s a
253data FreshPoint s a
252 = FreshPointDecodeInit s
254 = FreshPointDecodeInit s
253 | FreshPointDecodeInit1 s Word8
255 | FreshPointDecodeInit1 s Word8
@@ -441,6 +443,7 @@ decodeUtf8EitherD :: Monad m
441 => Stream m Word8 -> Stream m (Either DecodeError Char)
443 => Stream m Word8 -> Stream m (Either DecodeError Char)
442decodeUtf8EitherD = resumeDecodeUtf8EitherD 0 0
444decodeUtf8EitherD = resumeDecodeUtf8EitherD 0 0
446+{-# ANN type FlattenState Fuse #-}
444data FlattenState s a
447data FlattenState s a
445 = OuterLoop s !(Maybe (DecodeState, CodePoint))
448 = OuterLoop s !(Maybe (DecodeState, CodePoint))
446 | InnerLoopDecodeInit s (ForeignPtr a) !(Ptr a) !(Ptr a)
449 | InnerLoopDecodeInit s (ForeignPtr a) !(Ptr a) !(Ptr a)
@@ -579,6 +582,7 @@ decodeUtf8ArraysD_ ::
579 -> Stream m Char
582 -> Stream m Char
580decodeUtf8ArraysD_ = decodeUtf8ArraysWithD DropOnCodingFailure
583decodeUtf8ArraysD_ = decodeUtf8ArraysWithD DropOnCodingFailure
585+{-# ANN type EncodeState Fuse #-}
582data EncodeState s = EncodeState s !WList
586data EncodeState s = EncodeState s !WList
584-- More yield points improve performance, but I am not sure if they can cause
588-- More yield points improve performance, but I am not sure if they can cause