Optimised list functions for doing index-related things
Description
Optimised list functions for doing index-related things. They're faster than
common idioms in all cases, they avoid
<https://ghc.haskell.org/trac/ghc/ticket/12620 space leaks>, and sometimes they
fuse better as well.