From 8306f261e785987b22b824fd0f823afd52192deb Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Mon, 6 Aug 2018 08:26:10 +0000 Subject: [PATCH] Add List.physically_equal Signed-off-by: Etienne Millon --- src/lib.ml | 2 +- src/stdune/list.ml | 2 ++ src/stdune/list.mli | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.ml b/src/lib.ml index 0cf8c91a..fd08f678 100644 --- a/src/lib.ml +++ b/src/lib.ml @@ -533,7 +533,7 @@ module Dep_stack = struct let to_required_by t ~stop_at = let stop_at = stop_at.stack in let rec loop acc l = - if l == stop_at then + if List.physically_equal l stop_at then List.rev acc else match l with diff --git a/src/stdune/list.ml b/src/stdune/list.ml index c24031c3..0c48614d 100644 --- a/src/stdune/list.ml +++ b/src/stdune/list.ml @@ -115,3 +115,5 @@ let rec nth t i = | [], _ -> None | x :: _, 0 -> Some x | _ :: xs, i -> nth xs (i - 1) + +let physically_equal = Pervasives.(==) diff --git a/src/stdune/list.mli b/src/stdune/list.mli index 6aa7dcd6..505b1de0 100644 --- a/src/stdune/list.mli +++ b/src/stdune/list.mli @@ -43,3 +43,5 @@ val assoc : ('a * 'b) t -> 'a -> 'b option val singleton : 'a -> 'a t val nth : 'a t -> int -> 'a option + +val physically_equal : 'a t -> 'a t -> bool