1. 13
    1. 2

      Is there a collection of common Haskell refactorings?

      The list of refactorings in Martin Fowler’s Refactoring book taught me much as a neophyte programmer.

      1. 7

        Common mechanical things I do:

        • Rename terms
        • Rename types
        • Move terms and types
        • Add field
        • Add constructor
        • Extract functions
        • Inline bindings
        • Extract type aliases
        • Inline type aliases
        • Make type declarations more polymorphic
        • Remove dead code
        • Use laws to simplify expressions
        • Replace conditionals with folds
        • Replace uses of record fields with lenses
        • Replace specific pattern matches with prisms
        • Church-Encode data structures
      2. 3

        I’m not aware of any, but find Fowler’s philosophy pretty useful even so. Some of them port over pretty easily, like Add Parameter/Remove Parameter, but others will make less sense (Replace Conditional with Polymorphism would probably end up being something like Replace Conditional with HOF).