Unlike Java and C++, OCaml refactoring can be done directly using language features.
Pattern-matching is one of the simplest and most powerful features of OCaml. At first sight, it looks like a "switch case", as in C. You will discover that you can match your data structure in depth. For example, when matching lists, you can check at the same time for the value of first, second and third elements and ignore the rest.
When you program with the typing system of OCaml, you can combine it with pattern matching and get a powerful refactoring system. The programming language will be able to ensure that you don’t forget any cases in your pattern. It helps you carry changes in your type system throughout your whole program, using the compiler.