removeSubformula :: String -> String
removeSubformula = helper ""
  where
    helper acc str =
      case str of
        "" -> acc
        '(' : ')' : rest -> acc ++ rest
        '[' : ']' : rest -> acc ++ rest
        '{' : '}' : rest -> acc ++ rest
        x : rest -> helper (acc ++ [x]) rest


-- | Unsafe.
removeSubformula :: String -> String
removeSubformula = helper ""
  where
    helper acc str =
      case str of
        "" -> acc
        '(' : ')' : rest -> acc ++ rest
        '[' : ']' : rest -> acc ++ rest
        '{' : '}' : rest -> acc ++ rest
        x : rest -> helper (acc ++ [x]) rest


-- | Unsafe.
removeSubformula = helper ""
  where
    helper acc str =
      case str of
        "" -> acc
        '(' : ')' : rest -> acc ++ rest
        '[' : ']' : rest -> acc ++ rest
        '{' : '}' : rest -> acc ++ rest
        x : rest -> helper (acc ++ [x]) rest


-- | Unsafe.