composewell / streamly

High performance, concurrent functional programming abstractions
https://streamly.composewell.com
Other
857 stars 64 forks source link

Remove unnecessary condition in newBytes #2564

Open harendra-kumar opened 1 year ago

harendra-kumar commented 1 year ago
{-# INLINE newBytes #-}
newBytes :: Int -> IO MutableByteArray
newBytes nbytes | nbytes < 0 =
  errorWithoutStackTrace "newBytes: size must be >= 0"
newBytes (I# nbytes) = IO $ \s ->

newByteArray# should take care of this case or error out.