Skip to content

Commit baea1f6

Browse files
committed
mina_stdlib: port to 5.2.1
1 parent 16b2ea3 commit baea1f6

25 files changed

+67
-65
lines changed

src/lib/mina_stdlib/bigstring.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Core_kernel
1+
open Core
22

33
(* add functions to library module Bigstring so we can derive hash for the type t below *)
44

src/lib/mina_stdlib/bigstring.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ open Core
33
[%%versioned:
44
module Stable : sig
55
module V1 : sig
6-
type t = Core_kernel.Bigstring.Stable.V1.t [@@deriving sexp, compare]
6+
type t = Bigstring.Stable.V1.t [@@deriving sexp, compare]
77

88
include Binable.S with type t := t
99

src/lib/mina_stdlib/bounded_types.ml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
open Core_kernel
2-
open Core_kernel.Hash.Builtin
1+
open Core
2+
open Hash.Builtin
33

44
module N16 = struct
55
let max_array_len = 16
@@ -21,7 +21,7 @@ struct
2121

2222
let hash_fold_t = hash_fold_array_frozen
2323

24-
[%%define_locally Core_kernel.Array.(compare, equal)]
24+
[%%define_locally Array.(compare, equal)]
2525

2626
let to_latest s = s
2727

@@ -66,7 +66,7 @@ module String = struct
6666

6767
let to_latest s = s
6868

69-
[%%define_locally Core_kernel.String.(compare, equal)]
69+
[%%define_locally String.(compare, equal)]
7070

7171
let hash = hash_string
7272

@@ -141,20 +141,18 @@ end
141141
module Wrapped_error = struct
142142
module Stable = struct
143143
module V1 = struct
144-
type t = Core_kernel.Error.Stable.V2.t [@@deriving sexp]
144+
type t = Error.Stable.V2.t [@@deriving sexp]
145145

146146
let __versioned__ = ()
147147

148-
let to_latest = Core_kernel.Fn.id
148+
let to_latest = Fn.id
149149

150150
include String.Of_stringable (struct
151151
type nonrec t = t
152152

153-
let to_string (s : t) =
154-
Core_kernel.Error.sexp_of_t s |> Core_kernel.Sexp.to_string_mach
153+
let to_string (s : t) = Error.sexp_of_t s |> Sexp.to_string_mach
155154

156-
let of_string s =
157-
Core_kernel.Error.t_of_sexp (Core_kernel.Sexp.of_string s)
155+
let of_string s = Error.t_of_sexp (Sexp.of_string s)
158156
end)
159157
end
160158
end

src/lib/mina_stdlib/deferred.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Core_kernel
1+
open Core
22
open Async_kernel
33

44
include (
@@ -34,15 +34,15 @@ module Result = struct
3434
open Deferred.Result.Let_syntax
3535

3636
let fold ls ~init ~f =
37-
Core_kernel.List.fold ls ~init:(return init) ~f:(fun acc x ->
37+
Core.List.fold ls ~init:(return init) ~f:(fun acc x ->
3838
let%bind acc' = acc in
3939
f acc' x )
4040

4141
let map ls ~f =
4242
fold ls ~init:[] ~f:(fun acc x ->
4343
let%map x' = f x in
4444
x' :: acc )
45-
>>| Core_kernel.List.rev
45+
>>| Core.List.rev
4646

4747
let iter ls ~f = fold ls ~init:() ~f:(fun () -> f)
4848
end

src/lib/mina_stdlib/deferred.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Core_kernel
1+
open Core
22
open Async_kernel
33

44
include module type of Deferred with module Result := Deferred.Result

src/lib/mina_stdlib/direction.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Core_kernel
1+
open Core
22

33
type t = Left | Right [@@deriving sexp, equal]
44

src/lib/mina_stdlib/dune

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
result
1616
sexplib0
1717
stdlib
18+
core
19+
core_kernel ; ppx deriving in Time/Bigstring still needs core_kernel, need to figure out how to remove it.
1820
; local libraries
1921
ppx_version.runtime)
2022
(instrumentation
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Core_kernel
1+
open Core
22

33
module type Hash_intf = sig
44
type t
@@ -14,10 +14,10 @@ let cache hash_mod ~init_hash depth =
1414
let last_hash = ref init_hash in
1515
Immutable_array.of_array
1616
@@ Array.init (depth + 1) ~f:(fun i ->
17-
if Int.equal i 0 then !last_hash
18-
else (
19-
last_hash := merge_hash hash_mod (i - 1) !last_hash ;
20-
!last_hash ) )
17+
if Int.equal i 0 then !last_hash
18+
else (
19+
last_hash := merge_hash hash_mod (i - 1) !last_hash ;
20+
!last_hash ) )
2121

2222
let extensible_cache hash_mod ~init_hash =
2323
let empty_hashes = ref [| init_hash |] in
@@ -26,10 +26,10 @@ let extensible_cache hash_mod ~init_hash =
2626
let height = Array.length prev - 1 in
2727
let deficit = i - height in
2828
( if deficit > 0 then
29-
let last_hash = ref (Array.last prev) in
30-
empty_hashes :=
31-
Array.append prev
32-
(Array.init deficit ~f:(fun i ->
33-
last_hash := merge_hash hash_mod (i + height) !last_hash ;
34-
!last_hash ) ) ) ;
29+
let last_hash = ref (Array.last prev) in
30+
empty_hashes :=
31+
Array.append prev
32+
(Array.init deficit ~f:(fun i ->
33+
last_hash := merge_hash hash_mod (i + height) !last_hash ;
34+
!last_hash ) ) ) ;
3535
!empty_hashes.(i)

src/lib/mina_stdlib/gadt.ml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
open Core
2+
13
module Peano = struct
24
type zero = unit
35

@@ -68,8 +70,8 @@ module Vect = struct
6870
let rec map : type n. f:('a -> 'b) -> ('a, n) t -> ('b, n) t =
6971
fun ~f ls -> match ls with [] -> [] | h :: t -> f h :: map ~f t
7072

71-
let rec map2 :
72-
type n. f:('a -> 'b -> 'c) -> ('a, n) t -> ('b, n) t -> ('c, n) t =
73+
let rec map2 : type n.
74+
f:('a -> 'b -> 'c) -> ('a, n) t -> ('b, n) t -> ('c, n) t =
7375
fun ~f ls_a ls_b ->
7476
match (ls_a, ls_b) with
7577
| [], [] ->
@@ -81,9 +83,8 @@ module Vect = struct
8183
fun ~init ~f ls ->
8284
match ls with [] -> init | h :: t -> fold ~init:(f init h) ~f t
8385

84-
let rec fold_map :
85-
type n. init:'b -> f:('b -> 'a -> 'b * 'c) -> ('a, n) t -> 'b * ('c, n) t
86-
=
86+
let rec fold_map : type n.
87+
init:'b -> f:('b -> 'a -> 'b * 'c) -> ('a, n) t -> 'b * ('c, n) t =
8788
fun ~init ~f ls ->
8889
match ls with
8990
| [] ->
@@ -94,11 +95,11 @@ module Vect = struct
9495
(init'', h' :: t')
9596

9697
module Quickcheck_generator = struct
97-
open Core_kernel.Quickcheck
98+
open Quickcheck
9899
open Generator.Let_syntax
99100

100-
let rec map :
101-
type n. f:('a -> 'b Generator.t) -> ('a, n) t -> ('b, n) t Generator.t =
101+
let rec map : type n.
102+
f:('a -> 'b Generator.t) -> ('a, n) t -> ('b, n) t Generator.t =
102103
fun ~f ls ->
103104
match ls with
104105
| [] ->

src/lib/mina_stdlib/gadt.mli

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
open Core
2+
13
module Peano : sig
24
type zero = unit
35

@@ -68,8 +70,8 @@ module Vect : sig
6870

6971
module Quickcheck_generator : sig
7072
val map :
71-
f:('a -> 'b Core_kernel.Quickcheck.Generator.t)
73+
f:('a -> 'b Quickcheck.Generator.t)
7274
-> ('a, 'n) t
73-
-> ('b, 'n) t Core_kernel.Quickcheck.Generator.t
75+
-> ('b, 'n) t Quickcheck.Generator.t
7476
end
7577
end

0 commit comments

Comments
 (0)