@@ -218,9 +218,13 @@ head (Stream next s0 _len) = loop_head s0
218218 loop_head !s = case next s of
219219 Yield x _ -> x
220220 Skip s' -> loop_head s'
221− Done -> streamError "head" "Empty stream"
221+ Done -> head_empty
222222{-# INLINE [0] head #-}
223223
224+head_empty :: a
225+head_empty = streamError "head" "Empty stream"
226+{-# NOINLINE head_empty #-}
227+
224228-- | /O(1)/ Returns the first character and remainder of a 'Stream
225229-- Char', or 'Nothing' if empty. Subject to array fusion.
226230uncons :: Stream Char -> Maybe (Char, Stream Char)