@@ -85,12 +85,14 @@ import qualified Streamly.Prelude as S
8585
8686-- | Decode a stream of bytes to Unicode characters by mapping each byte to a
8787-- corresponding Unicode 'Char' in 0-255 range.
88+{-# INLINE decodeChar8 #-}
8889decodeChar8 :: (IsStream t, Monad m) => t m Word8 -> t m Char
8990decodeChar8 = S.map (unsafeChr . fromIntegral)
9091
9192-- | Encode a stream of Unicode characters to bytes by mapping each character
9293-- to a byte in 0-255 range. Throws an error if the input stream contains
9394-- characters beyond 255.
95+{-# INLINE encodeChar8 #-}
9496encodeChar8 :: (IsStream t, Monad m) => t m Char -> t m Word8
9597encodeChar8 = S.map convert
9698 where
@@ -104,6 +106,7 @@ encodeChar8 = S.map convert
104106-- | Like 'encodeChar8' but silently truncates and maps input characters beyond
105107-- 255 to (incorrect) chars in 0-255 range. No error or exception is thrown
106108-- when such truncation occurs.
109+{-# INLINE encodeChar8Unchecked #-}
107110encodeChar8Unchecked :: (IsStream t, Monad m) => t m Char -> t m Word8
108111encodeChar8Unchecked = S.map (fromIntegral . ord)
109112