toggle x y a = mapM_ (($ True) . writeArray a) $ range (x, y) is exactly the same function as turnOn.