Skip to content

Support a --compatible flag #1126

@sellout

Description

@sellout

It can be difficult to get all developers on a single release of Ormolu (e.g., users of VSCode apparently have no idea what version they’re using, and no way to change it).

Instead of forcing developers to be on the same version, support a --compatible flag, so that

ormolu --compatible 0.5.2.0
  • fails if ormolu is older than 0.5.2.0
  • only applies formatting that won’t “cycle” with 0.5.2.0 or any version afterward.

E.g., I forget which version introduced it, but formatting myFun :: Functor f => f a -> f b as myFun :: (Functor f) => f a -> f b is a backward compatible change, as no version (at least not >=0.5.2.0) will remove the parens from the constraint.

But if 0.5.2.0 coverted (x y) to ( x y ), but then 0.7.0.0 converted ( x y ) to (x y), running ormolu-0.7.0.0 --compatible 0.5.2.0 would’t remove spaces inside parens, to avoid cycles of changes.

This effectively sets a lower bound on the version (and perhaps an upper-bound, as at some point it might be impractical to keep managing things that worked a dozen versions ago, so then you fail saying “0.5.2.0’s format is no longer supported”).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions