generalize reducing optimizations a bit
fix build for latest purescript