When refactoring code it is easy to end up with some unnecessary parentheses:
-Workflow.run (makeRequest author) "/invoices"
+Workflow.run (makeRequest) "/invoices"
It would be nice if Fantomas could automatically remove the now unnecessary parentheses above!
I’m thinking that parentheses could be removed in the following cases:
- Around an identifier:
(x) → x
- Around a literal:
(5) → 5, ("x") → "x"
- Double parens:
((whatever foo)) → (whatever foo)
- Around a “top expression”:
let x = (whatever foo) → let x = whatever foo, | Some x -> (Ok x) → | Some x -> Ok x
- Maybe other cases as well that you can think of! For me, it does not have to be comprehensive – it would be helpful if at least a few of the most common cases was supported.
When refactoring code it is easy to end up with some unnecessary parentheses:
It would be nice if Fantomas could automatically remove the now unnecessary parentheses above!
I’m thinking that parentheses could be removed in the following cases:
(x)→x(5)→5,("x")→"x"((whatever foo))→(whatever foo)let x = (whatever foo)→let x = whatever foo,| Some x -> (Ok x)→| Some x -> Ok x