Mentions légales du service

Skip to content

merge Solver{Hi,Lo} and split them into separate modules

SCHERER Gabriel requested to merge gscherer/inferno:split-solver-modules into master

This is a follow-up on !16 (merged) (so it would be easier to review if we decide to integrate !16 (merged) in some form first). This PR merges SolverLo and SolverHi together, and then splits them into 4 modules:

  • ConstraintType: the type of (previously "raw") constraints
  • ConstraintPrinter: pretty-printer for constraints
  • ConstraintSolver: constraint solver
  • ConstraintCombinators: smart constraint constructors (what we previously had in SolverHi)

Then a single Constraints (note the plural) module is provided that packs those four modules together as submodules Type, Printer, Solver, Combinators.

In reality both solvers are functorized over (X)(S)(O), so those four modules contain functors and Constraints is useful to avoid having to apply several functors on the user side. (This is an instance of "big functor" spanning several compilation units; https://www.ocamlpro.com/2020/09/24/rehabilitating-packs-using-functors-and-recursivity-part-1/ .)

I am only moderately satisfied with the result: it was a bit tedious to rearrange the code, and I am only 70% convinced that this is an improvement over the previous state. If there were any users of Inferno outside this repository, I would also worry about compatibility breakage.¹ I wonder what @fpottier thinks.

¹: I think we should consider making a new release now and then, so that users can have a fixed tag to refer to the version they developed their code against. It may make sense to make a release "now" (before this PR, if we do merge it), because the PR breaks compatibility for all clients.

Merge request reports