Summary: In `Config`, the lists generated by `mk_string_list`, `mk_path_list`, `mk_rest_actions` are reversed implicitly, which made it hard for developers to use them correctly. What this and the next diff will do is to change the list variables of the `Config` to not-reversed one. * diff1: First this diff adds `RevList` to distinguish reversed lists explicitly. All usages of the reversed list should be changed to use `RevList`'s lib calls. * diff2: Then the next diff will change types of `Config` variables to not-reversed, normal list. Reviewed By: ngorogiannis Differential Revision: D25562297 fbshipit-source-id: b96622336master
							parent
							
								
									edc8754727
								
							
						
					
					
						commit
						153005c3cb
					
				| @ -0,0 +1,40 @@ | ||||
| (* | ||||
|  * 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 | ||||
| include List | ||||
| 
 | ||||
| let empty = [] | ||||
| 
 | ||||
| let to_list = rev | ||||
| 
 | ||||
| let of_list = rev | ||||
| 
 | ||||
| let rev_partition_map t ~f = | ||||
|   let rec loop t fst snd = | ||||
|     match t with | ||||
|     | [] -> | ||||
|         (fst, snd) | ||||
|     | x :: t -> ( | ||||
|       match (f x : _ Either.t) with | ||||
|       | First y -> | ||||
|           loop t (y :: fst) snd | ||||
|       | Second y -> | ||||
|           loop t fst (y :: snd) ) | ||||
|   in | ||||
|   loop t [] [] | ||||
| 
 | ||||
| 
 | ||||
| let rev_concat_map rev ~f = | ||||
|   let rec aux acc = function [] -> acc | hd :: tl -> aux (rev_append (f hd) acc) tl in | ||||
|   aux [] rev | ||||
| 
 | ||||
| 
 | ||||
| let rev_append2 = rev_append | ||||
| 
 | ||||
| let rec to_rev_seq rev = | ||||
|   match rev with [] -> fun () -> Seq.Nil | hd :: tl -> fun () -> Seq.Cons (hd, to_rev_seq tl) | ||||
| @ -0,0 +1,48 @@ | ||||
| (* | ||||
|  * 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 | ||||
| 
 | ||||
| type 'a t | ||||
| 
 | ||||
| val empty : 'a t | ||||
| 
 | ||||
| val is_empty : 'a t -> bool | ||||
| 
 | ||||
| val cons : 'a -> 'a t -> 'a t | ||||
| 
 | ||||
| val to_list : 'a t -> 'a list | ||||
| 
 | ||||
| val of_list : 'a list -> 'a t | ||||
| 
 | ||||
| val fold : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'b | ||||
| 
 | ||||
| val mem : 'a t -> 'a -> equal:('a -> 'a -> bool) -> bool | ||||
| 
 | ||||
| val exists : 'a t -> f:('a -> bool) -> bool | ||||
| 
 | ||||
| val map : 'a t -> f:('a -> 'b) -> 'b t | ||||
| 
 | ||||
| val rev_map : 'a t -> f:('a -> 'b) -> 'b list | ||||
| 
 | ||||
| val rev_map_append : 'a t -> 'b list -> f:('a -> 'b) -> 'b list | ||||
| 
 | ||||
| val rev_partition_map : 'a t -> f:('a -> ('b, 'c) Either.t) -> 'b list * 'c list | ||||
| 
 | ||||
| val find_map : 'a t -> f:('a -> 'b option) -> 'b option | ||||
| 
 | ||||
| val rev_filter_map : 'a t -> f:('a -> 'b option) -> 'b list | ||||
| 
 | ||||
| val rev_concat_map : 'a t -> f:('a -> 'b list) -> 'b list | ||||
| 
 | ||||
| val rev_append : 'a list -> 'a t -> 'a t | ||||
| 
 | ||||
| val rev_append2 : 'a t -> 'a list -> 'a list | ||||
| 
 | ||||
| val dedup_and_sort : compare:('a -> 'a -> int) -> 'a t -> 'a list | ||||
| 
 | ||||
| val to_rev_seq : 'a t -> 'a Seq.t | ||||
					Loading…
					
					
				
		Reference in new issue