• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MinaProtocol / mina / 693

15 Oct 2025 02:40PM UTC coverage: 37.537% (+0.4%) from 37.108%
693

push

buildkite

web-flow
Merge pull request #17947 from MinaProtocol/dkijania/merge/compatible_to_develop_251015

merge compatible to develop 251015

2 of 53 new or added lines in 6 files covered. (3.77%)

43 existing lines in 10 files now uncovered.

27336 of 72824 relevant lines covered (37.54%)

36483.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/lib/mina_stdlib/nonempty_list.ml
1
open Core_kernel
149✔
2

3
(* A non-empty list is a tuple of the head and the rest (as a list) *)
4
[%%versioned
5
module Stable = struct
6
  module V1 = struct
7
    type 'a t = 'a * 'a list [@@deriving sexp, compare, equal, hash, to_yojson]
×
8
  end
9
end]
10

11
let init x xs = (x, xs)
67,184✔
12

13
let singleton x = (x, [])
67,779✔
14

15
let uncons = Fn.id
16

17
let cons x' (x, xs) = (x', x :: xs)
421,702✔
18

19
let head (x, _) = x
3,165✔
20

21
let tail (_, xs) = xs
5,240✔
22

23
let last (x, xs) = if List.is_empty xs then x else List.last_exn xs
×
24

25
let of_list_opt = function [] -> None | x :: xs -> Some (x, xs)
172✔
26

27
let tail_opt t = of_list_opt (tail t)
×
28

29
let map (x, xs) ~f = (f x, List.map ~f xs)
34,331✔
30

31
let mapi (x, xs) ~f = (f 0 x, List.mapi ~f:(fun idx x -> f (idx + 1) x) xs)
×
32

33
let rev (x, xs) = List.fold xs ~init:(singleton x) ~f:(Fn.flip cons)
67,324✔
34

35
(* As the Base.Container docs state, we'll add each function from C explicitly
36
 * rather than including C *)
37
module C = Container.Make (struct
38
  type nonrec 'a t = 'a t
39

40
  let fold (x, xs) ~init ~f = List.fold xs ~init:(f init x) ~f
800✔
41

42
  let iter = `Custom (fun (x, xs) ~f -> f x ; List.iter xs ~f)
10,970✔
43

44
  let length = `Define_using_fold
45
end)
46

47
[%%define_locally C.(find, find_map, iter, length, fold)]
48

49
let to_list (x, xs) = x :: xs
2,427✔
50

51
let append (x, xs) ys = (x, xs @ to_list ys)
120✔
52

53
let take (x, xs) = function
54
  | 0 ->
×
55
      None
56
  | 1 ->
×
57
      Some (x, [])
58
  | n ->
×
59
      Some (x, List.take xs (n - 1))
×
60

61
let min_elt ~compare (x, xs) =
62
  Option.value_map ~default:x (List.min_elt ~compare xs) ~f:(fun minimum ->
×
63
      if compare x minimum < 0 then x else minimum )
×
64

65
let max_elt ~compare (x, xs) =
66
  Option.value_map ~default:x (List.max_elt ~compare xs) ~f:(fun maximum ->
11,137✔
UNCOV
67
      if compare x maximum > 0 then x else maximum )
×
68

69
let rec iter_deferred (x, xs) ~f =
70
  let open Async_kernel in
×
71
  let%bind () = f x in
×
72
  match xs with [] -> return () | h :: t -> iter_deferred (h, t) ~f
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc