1{
2 lib,
3 fetchurl,
4 ocaml,
5 buildDunePackage,
6}:
7
8let
9 params =
10 if lib.versionAtLeast ocaml.version "4.08" then
11 {
12 version = "1.3.4";
13 hash = "sha256-Hb8FHp9oV03ebi4lSma5xSTKQl6As26Zr5btlkq2EMM=";
14 }
15 else
16 {
17 version = "1.3.2";
18 hash = "sha256-NEDCuILVN65ekBHrBqu1P1Zn5lHqS7O0YOqCMPqMGSY=";
19 };
20in
21
22buildDunePackage rec {
23 pname = "easy-format";
24 inherit (params) version;
25
26 src = fetchurl {
27 url = "https://github.com/ocaml-community/easy-format/releases/download/${version}/easy-format-${version}.tbz";
28 inherit (params) hash;
29 };
30
31 doCheck = true;
32
33 meta = {
34 description = "High-level and functional interface to the Format module of the OCaml standard library";
35 longDescription = ''
36 This module offers a high-level and functional interface to the Format module of
37 the OCaml standard library. It is a pretty-printing facility, i.e. it takes as
38 input some code represented as a tree and formats this code into the most
39 visually satisfying result, breaking and indenting lines of code where
40 appropriate.
41
42 Input data must be first modelled and converted into a tree using 3 kinds of
43 nodes:
44
45 * atoms
46 * lists
47 * labelled nodes
48
49 Atoms represent any text that is guaranteed to be printed as-is. Lists can model
50 any sequence of items such as arrays of data or lists of definitions that are
51 labelled with something like "int main", "let x =" or "x:".
52 '';
53 homepage = "https://github.com/ocaml-community/easy-format";
54 changelog = "https://github.com/ocaml-community/easy-format/releases/tag/${params.version}";
55 license = lib.licenses.bsd3;
56 maintainers = with lib.maintainers; [ vbgl ];
57 };
58}