[sledge] Move Vector.pp out of Import.Vector wrapper

Reviewed By: ngorogiannis

Differential Revision: D20482761

fbshipit-source-id: 6a646883b
master
Josh Berdine 5 years ago committed by Facebook GitHub Bot
parent c47881e664
commit a4613f001d

@ -115,13 +115,7 @@ module Option = Option
include Option.Monad_infix include Option.Monad_infix
include Option.Monad_syntax include Option.Monad_syntax
module List = List module List = List
module Vector = Vector
module Vector = struct
include Vector
let pp sep pp_elt fs v = List.pp sep pp_elt fs (to_list v)
end
include Vector.Infix include Vector.Infix
module type OrderedType = sig module type OrderedType = sig

@ -108,14 +108,7 @@ module Option = Option
include module type of Option.Monad_infix include module type of Option.Monad_infix
include module type of Option.Monad_syntax with type 'a t = 'a option include module type of Option.Monad_syntax with type 'a t = 'a option
module List = List module List = List
module Vector = Vector
module Vector : sig
include module type of Vector
val pp : (unit, unit) fmt -> 'a pp -> 'a t pp
(** Pretty-print a vector. *)
end
include module type of Vector.Infix include module type of Vector.Infix
module type OrderedType = sig module type OrderedType = sig

@ -7,7 +7,7 @@
(** Vector - Immutable view of an array *) (** Vector - Immutable view of an array *)
open Base open (Base : module type of Base with module List := Base.List)
(** = 'a array but covariant since imperative operations hidden *) (** = 'a array but covariant since imperative operations hidden *)
type +'a t type +'a t
@ -26,6 +26,9 @@ module Infix = struct
type +'a vector = 'a t [@@deriving compare, equal, hash, sexp] type +'a vector = 'a t [@@deriving compare, equal, hash, sexp]
end end
let to_list x = Array.to_list (a x)
let to_array = a
let pp sep pp_elt fs v = List.pp sep pp_elt fs (to_list v)
let concat_map x ~f = v (Array.concat_map (a x) ~f:(fun y -> a (f y))) let concat_map x ~f = v (Array.concat_map (a x) ~f:(fun y -> a (f y)))
let map_adjacent ~f dummy xs_v = let map_adjacent ~f dummy xs_v =
@ -123,6 +126,3 @@ let reduce_exn x ~f = Array.reduce_exn (a x) ~f
let unzip x = let unzip x =
let y, z = Array.unzip (a x) in let y, z = Array.unzip (a x) in
(v y, v z) (v y, v z)
let to_list x = Array.to_list (a x)
let to_array = a

@ -12,6 +12,7 @@
it inconvenient to mutate. *) it inconvenient to mutate. *)
open Base open Base
open Import0
type +'a t [@@deriving compare, equal, hash, sexp] type +'a t [@@deriving compare, equal, hash, sexp]
@ -19,6 +20,8 @@ module Infix : sig
type +'a vector = 'a t [@@deriving compare, equal, hash, sexp] type +'a vector = 'a t [@@deriving compare, equal, hash, sexp]
end end
val pp : (unit, unit) fmt -> 'a pp -> 'a t pp
(* val binary_search : (* val binary_search :
* ('a t, 'a, 'key) Base__Binary_searchable_intf.binary_search *) * ('a t, 'a, 'key) Base__Binary_searchable_intf.binary_search *)

Loading…
Cancel
Save