Add replice and slice functions.
Various optimizations.

Make array reads and writes unsafe. Make parM, while, whileM inlineable.