-
Couldn't load subscription status.
- Fork 204
Consistent formatting of module types #2395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
These attributes are always formatted in short form and are never trailing.
The module type is hard to read on the right of a module argument, which can grow complex.
In the case where arguments are docked too, also dock `Pmty_ident` and some forms of `Pmty_with` to avoid lines with just `end`.
|
Are there regressions blocking this PR? or just the merge? Because the output looks like a net improvement and I would really like to have it merged! |
|
I would like to review the diff one more time. Since #2440, I plan to not dock empty signatures to avoid breaking the margin. There's also diffs like that, where I would like to get the community's opinion: (** Lift a set to a powerset domain ordered by subset. The elements of the set should be drawn from
a *finite* collection of possible values, since the widening operator here is just union. *)
-module FiniteSet (Element : PrettyPrintable.PrintableOrderedType) :
- FiniteSetS with type elt = Element.t
+module FiniteSet (Element : PrettyPrintable.PrintableOrderedType) : FiniteSetS
+ with type elt = Element.t-module type Make = functor (TransferFunctions : TransferFunctions.SIL) ->
- S with module TransferFunctions = TransferFunctions
+module type Make = functor (TransferFunctions : TransferFunctions.SIL) -> S
+ with module TransferFunctions = TransferFunctionstest_branch finds a few bugs like this: diff --git a/test/helpers/test_container.mli b/test/helpers/test_container.mli
index 6dbab81..648c1b1 100644
--- a/test/helpers/test_container.mli
+++ b/test/helpers/test_container.mli
@@ -7,7 +7,8 @@ module Test_S1_allow_skipping_tests (Container : sig
include Container.S1 with type 'a t := 'a t
val of_list : 'a list -> [ `Ok of 'a t | `Skip_test ]
-end) : sig
+end) :
+ sig
type 'a t [@@deriving sexp]
include Generic with type ('a, _) t := 'a t |
This PR refactors the function for formatting module types. It doesn't use the
blockconcept, which is hard to work with and brings bugs that are too hard to solve.The new function is based on the proven model of
~box ~pro ~epi. The output is much easier to tweak and generally more consistent.This affects module declarations too.
Some changes are considered bug fixes:
withconstraints. Spotted in Upgrade to ocamlformat 0.26.0 mirage/irmin#2262 (comment)This PR is not pure refactoring but also bring changes to be discussed:
with typeinto the previous line. Thewith-constraints are less indented.module Make (TT : TableFormat.TABLES) (ET : EngineTypes.TABLE - with type terminal = int - and type semantic_value = Obj.t) + with type terminal = int + and type semantic_value = Obj.t)This can be ambiguous and might require breaking before a
struct:module Bootstrap (MakeH : functor (Element : ORDERED) -> HEAP with module Elem = Element) - (Element : ORDERED) : HEAP with module Elem = Element = struct + (Element : ORDERED) : + HEAP with module Elem = Element = struct type tmodule M ...andmodule type T = functor ....