Skip to content

Update ocamlformat, change style to match Jane Street style guide - #627

Closed
rybern wants to merge 2 commits into
stan-dev:masterfrom
rybern:update-ocamlformat
Closed

Update ocamlformat, change style to match Jane Street style guide#627
rybern wants to merge 2 commits into
stan-dev:masterfrom
rybern:update-ocamlformat

Conversation

@rybern

@rybern rybern commented Jul 10, 2020

Copy link
Copy Markdown
Collaborator

We've been pinned to ocamlformat 0.8, which is a couple years old now. I suggest we update to 0.13.

When I looked at the diff for the 0.13, I actually didn't like it much. When I switched the style to janestreet I liked it much much better. I think it makes sense for us to follow Jane Street anyway. Have a look at the diff and see what you think.

Also, could someone that uses Opam please check that ocamlformat 0.13 is available?

@nhuurre

nhuurre commented Jul 12, 2020

Copy link
Copy Markdown
Collaborator
nhuurre@nhuurre-HP-Notebook:~$ opam install ocamlformat.0.13
[ERROR] Package ocamlformat has no version 0.13.
nhuurre@nhuurre-HP-Notebook:~$ opam install ocamlformat.0.13.0
The following actions will be performed:
  ∗ install uutf        1.0.2         [required by ocamlformat]
  ∗ install uucp        13.0.0        [required by uuseg]
  ∗ install tyxml       4.4.0         [required by odoc]
  ∗ install uuseg       13.0.0        [required by ocamlformat]
  ∗ install odoc        1.5.1         [required by ocamlformat]
  ↗ upgrade ocamlformat 0.8 to 0.13.0
===== ∗ 5   ↗ 1 =====
Do you want to continue? [Y/n] n
nhuurre@nhuurre-HP-Notebook:~$ 

The latest available version is 0.14.2 but that requires dune 2.2.0 and we're pinned to 1.11.4.

@rybern

rybern commented Jul 12, 2020

Copy link
Copy Markdown
Collaborator Author

Thanks for looking into that. It looks from that page like the version I was looking for was 0.13.0 (instead of 0.13), and that's compatible with dune 1.11.4, would you mind trying that when you get time?

@nhuurre

nhuurre commented Jul 12, 2020

Copy link
Copy Markdown
Collaborator

Any idea what went wrong?

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of ocamlformat failed at "/home/nhuurre/.opam/opam-init/hooks/sandbox.sh build dune build -p ocamlformat -j 3".

#=== ERROR while compiling ocamlformat.0.13.0 =================================#
# context     2.0.4 | linux/x86_64 | ocaml-base-compiler.4.07.0 | https://opam.ocaml.org#6d7fcbc5
# path        ~/.opam/4.07.0/.opam-switch/build/ocamlformat.0.13.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ocamlformat -j 3
# exit-code   1
# env-file    ~/.opam/log/ocamlformat-17287-e7966f.env
# output-file ~/.opam/log/ocamlformat-17287-e7966f.out
### output ###
#     ocamlopt lib/.ocamlformat_lib.objs/native/ocamlformat_lib__Normalize.{cmx,o} (exit 2)
# (cd _build/default && /home/nhuurre/.opam/4.07.0/bin/ocamlopt.opt -w -40 -noassert -open Import -g -I lib/.ocamlformat_lib.objs/byte -I lib/.ocamlformat_lib.objs/native -I /home/nhuurre/.opam/4.07.0/lib/astring -I /home/nhuurre/.opam/4.07.0/lib/base -I /home/nhuurre/.opam/4.07.0/lib/base/caml -I /home/nhuurre/.opam/4.07.0/lib/base/shadow_stdlib -I /home/nhuurre/.opam/4.07.0/lib/bytes -I /home[...]
# File "lib/Normalize.ml", line 395, characters 13-34:
# Error: This expression has type
#          Ocamlformat_lib.Migrate_ast.Parsetree.toplevel_phrase ->
#          Ocamlformat_lib.Migrate_ast.Parsetree.toplevel_phrase -> Import.bool
#        but an expression was expected of type 'a Import.List.t = 'a list

@rybern

rybern commented Jul 12, 2020

Copy link
Copy Markdown
Collaborator Author

Oof. Thanks for checking. Guessing some dependency version bound is wrong in Opam. I'll have to set up a sandbox to figure it out. Gotta run for now.

@rybern

rybern commented Jul 13, 2020

Copy link
Copy Markdown
Collaborator Author

I had a miserable time trying to replicate this with a sandboxed Opam at ocaml 4.07.0, and it didn't replicate at 4.08.1. Would you trying with ocaml at 4.08.1 (I think opam switch create 4.08.1 should do it) when you get the chance?

@nhuurre

nhuurre commented Jul 15, 2020

Copy link
Copy Markdown
Collaborator

Ocamlformat works at 4.08.1 but some other required packages don't.

nhuurre@nhuurre-HP-Notebook:~$ opam install core_kernel.v0.11.1
The following dependencies couldn't be met:
  - core_kernel → base < v0.12 → ocaml < 4.08.0
      base of this switch (use `--unlock-base' to force)

No solution found, exiting
nhuurre@nhuurre-HP-Notebook:~$ opam install ppx_deriving.4.2.1
The following dependencies couldn't be met:
  - ppx_deriving → ocaml < 4.08.0
      base of this switch (use `--unlock-base' to force)

No solution found, exiting

@WardBrian WardBrian mentioned this pull request Nov 1, 2021
11 tasks
@WardBrian WardBrian added the cleanup Code simplification or clean-up label Nov 9, 2021
@WardBrian WardBrian closed this Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code simplification or clean-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants