More work on index functions.

Now works on GHC 7.8.3!