It would be neat if we had a primitive for calling memchr on a ByteArray#. Something like this:
memchr :: ByteArray# -> Word# -> Int# -> Int# -> Int#
The integer arguments are a starting index and length. I have a hunch that copyByteArray# and friends are just wrappers for memcpy that somehow prohibit the array from being moved by the GC while they are running. I would be happy to try to implement memchr# if it seems like an alright idea.