extractUnquotes n (PRewrite fc by x y z)
  = do (x', ex1) <- extractUnquotes n x
       (y', ex2) <- extractUnquotes n y
       case z of
         Just zz -> do (z', ex3) <- extractUnquotes n zz
                       return (PRewrite fc by x' y' (Just z'), ex1 ++ ex2 ++ ex3)
         Nothing -> return (PRewrite fc by x' y' Nothing, ex1 ++ ex2)
extractUnquotes n (PRewrite fc by x y z)
  = do (x', ex1) <- extractUnquotes n x
       (y', ex2) <- extractUnquotes n y
       case z of
         Just zz -> do (z', ex3) <- extractUnquotes n zz
                       return (PRewrite fc by x' y' (Just z'), ex1 ++ ex2 ++ ex3)
         Nothing -> return (PRewrite fc by x' y' Nothing, ex1 ++ ex2)
extractUnquotes n (PRewrite fc by x y z)
  = do (x', ex1) <- extractUnquotes n x
       (y', ex2) <- extractUnquotes n y
       case z of
         Just zz -> do (z', ex3) <- extractUnquotes n zz
                       return (PRewrite fc by x' y' (Just z'), ex1 ++ ex2 ++ ex3)
         Nothing -> return (PRewrite fc by x' y' Nothing, ex1 ++ ex2)