I need to make extensive use of:
slice :: Int -> Int -> ByteString -> ByteString
slice start len = take len . drop start
Two part question:
- Does this already have a name? I can't find anything searching for that type on Hoogle, but it seems like it should be a really common need. I also tried searching for
(Int, Int) -> ByteString -> ByteString
and someflip
'd versions of same. I also tried looking for[a]
versions to see if there was a name in common use. - Is there a better way to write it?
I'm suspicious that I'm doing something wrong because I strongly expected to find lots of people having gone down the same road, but my google-fu isn't finding anything.
slice :: Int -> Int -> Vector a -> Vector a
, so that is precedent for the name choice. – Unseasoned