Summary: I don't think anyone uses this. Meta-goal: cleaning up InferPrint.ml. Measuring stats about summaries is good in principle, but we should do it somewhere else instead of in the InferPrint callback hell. For instance when we record each summary. Meanwhile, delete this. Reviewed By: ngorogiannis Differential Revision: D20362639 fbshipit-source-id: c73d431a5master
parent
33626092d4
commit
96490d1bad
@ -1,37 +0,0 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
open! IStd
|
||||
module StringMap = Map.Make (String)
|
||||
|
||||
type ('r, 'a) user = {f: 'f. string -> ('r -> 'f) -> 'a} [@@unboxed]
|
||||
|
||||
type 'r elt = E : {name: string; get: 'r -> 'a} -> 'r elt
|
||||
|
||||
type 'r t = 'r elt list
|
||||
|
||||
type 'r sub = S : ('r, 'f) Field.t * 'f t -> 'r sub
|
||||
|
||||
let make ?(subfields = []) (map_poly : _ Field.user -> _) =
|
||||
let subfields =
|
||||
List.fold subfields ~init:StringMap.empty ~f:(fun acc (S (field, elts)) ->
|
||||
let name = Field.name field in
|
||||
let prefix = name ^ "." in
|
||||
let get = Field.get field in
|
||||
let elts =
|
||||
List.map elts ~f:(fun (E {name= subname; get= subget}) ->
|
||||
E {name= prefix ^ subname; get= (fun r -> get r |> subget)} )
|
||||
in
|
||||
StringMap.add_exn acc ~key:name ~data:elts )
|
||||
in
|
||||
let f field =
|
||||
let name = Field.name field in
|
||||
StringMap.find subfields name |> Option.value ~default:[E {name; get= Field.get field}]
|
||||
in
|
||||
E {name= "ALL"; get= Fn.id} :: List.concat (map_poly {f})
|
||||
|
||||
|
||||
let map elts {f} = List.map elts ~f:(fun (E {name; get}) -> f name get)
|
@ -1,27 +0,0 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
|
||||
(** Datastructure for polymorphic getters of record fields *)
|
||||
type 'r t
|
||||
|
||||
type 'r sub = S : ('r, 'f) Field.t * 'f t -> 'r sub
|
||||
|
||||
type ('r, 'a) user = {f: 'f. string -> ('r -> 'f) -> 'a} [@@unboxed]
|
||||
|
||||
val make : ?subfields:'r sub list -> ((_, 'r, 'r t) Field.user -> 'r t list) -> 'r t
|
||||
(** Pass [Fields.map_poly] generated by [@@deriving fields] for the record ['r] you are interested
|
||||
in to get the polymorphic getters of the fields of ['r]. A dummy field "ALL" is added too.
|
||||
|
||||
Subfields appearing in [subfields] will be added too. Each subfield is specified by
|
||||
[S (field, poly_fields)] where [field] is the corresponding [Field.t] value (generated by
|
||||
[@@deriving fields]) and [poly_fields] is the result of this function for the field record type. *)
|
||||
|
||||
val map : 'r t -> ('r, 'a) user -> 'a list
|
||||
(** [map r f] maps each field of [r] with the function [f]. [f] is called with two arguments: the
|
||||
name and the getter of the field. *)
|
Loading…
Reference in new issue