doInstruction :: String -> Instruction -> String
doInstruction s (SwapPos x y) = take (min x y) s
                                ++ [larger]
                                ++ take (max x y - min x y - 1) (drop (min x y+1) s)
                                ++ [smaller]
                                ++ drop (max x y + 1) s
  where
    smaller = s !! min x y
    larger = s !! max x y
doInstruction :: String -> Instruction -> String
doInstruction s (SwapPos x y) = take (min x y) s
                                ++ [larger]
                                ++ take (max x y - min x y - 1) (drop (min x y+1) s)
                                ++ [smaller]
                                ++ drop (max x y + 1) s
  where
    smaller = s !! min x y
    larger = s !! max x y
doInstruction s (SwapPos x y) = take (min x y) s
                                ++ [larger]
                                ++ take (max x y - min x y - 1) (drop (min x y+1) s)
                                ++ [smaller]
                                ++ drop (max x y + 1) s
  where
    smaller = s !! min x y
    larger = s !! max x y