escapeSingle :: String -> String
escapeSingle s = case s of
  '$':'{':s' -> '\\':'$':'{':escapeSingle s'
  '\n':s' -> '\\':'n':escapeSingle s'
  '\t':s' -> '\\':'t':escapeSingle s'
  '\r':s' -> '\\':'r':escapeSingle s'
  '\b':s' -> '\\':'b':escapeSingle s'
  c:s' -> c : escapeSingle s'
  "" -> ""
escapeSingle :: String -> String
escapeSingle s = case s of
  '$':'{':s' -> '\\':'$':'{':escapeSingle s'
  '\n':s' -> '\\':'n':escapeSingle s'
  '\t':s' -> '\\':'t':escapeSingle s'
  '\r':s' -> '\\':'r':escapeSingle s'
  '\b':s' -> '\\':'b':escapeSingle s'
  c:s' -> c : escapeSingle s'
  "" -> ""
escapeSingle s = case s of
  '$':'{':s' -> '\\':'$':'{':escapeSingle s'
  '\n':s' -> '\\':'n':escapeSingle s'
  '\t':s' -> '\\':'t':escapeSingle s'
  '\r':s' -> '\\':'r':escapeSingle s'
  '\b':s' -> '\\':'b':escapeSingle s'
  c:s' -> c : escapeSingle s'
  "" -> ""