You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
55 lines
1.2 KiB
3 years ago
|
(*
|
||
|
* 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.
|
||
|
*)
|
||
|
|
||
|
(** Global namespace intended to be opened in each source file *)
|
||
|
|
||
|
include NS0
|
||
|
|
||
|
(** Map-and-construct operations that preserve physical equality *)
|
||
|
|
||
|
let map1 f e cons x =
|
||
|
let x' = f x in
|
||
|
if x == x' then e else cons x'
|
||
|
|
||
|
let map2 f e cons x y =
|
||
|
let x' = f x in
|
||
|
let y' = f y in
|
||
|
if x == x' && y == y' then e else cons x' y'
|
||
|
|
||
|
let map3 f e cons x y z =
|
||
|
let x' = f x in
|
||
|
let y' = f y in
|
||
|
let z' = f z in
|
||
|
if x == x' && y == y' && z == z' then e else cons x' y' z'
|
||
|
|
||
|
let mapN f e cons xs =
|
||
|
let xs' = Array.map_endo ~f xs in
|
||
|
if xs' == xs then e else cons xs'
|
||
|
|
||
|
module Comparer = Comparer
|
||
|
module Array = Array
|
||
|
module Float = Float
|
||
|
module HashSet = HashSet
|
||
|
module HashTable = HashTable
|
||
|
module IArray = IArray
|
||
|
include IArray.Import
|
||
|
module Int = Int
|
||
|
module List = List
|
||
|
module Map = NSMap
|
||
|
module Monad = Monad
|
||
|
module Multiset = Multiset
|
||
|
module Option = Option
|
||
|
include Option.Import
|
||
|
module Q = Q_ext
|
||
|
module RAL = Ral
|
||
|
module Set = NSSet
|
||
|
module Sign = Sign
|
||
|
module String = String
|
||
|
module Sys = Sys
|
||
|
module Timer = Timer
|
||
|
module Z = Z_ext
|