Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / mlton / ssa / equatable.sig
1 (* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 *
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
6 *)
7
8 (*
9 * Equatable values can be equated, after which they are equals. Equating
10 * two value requires the client to specify how to compute the new value from
11 * the old.
12 *
13 * Equatable values can be either created by "new" or "delay". In the case of
14 * delay, the value is only computed if "value" is called.
15 *
16 * Equating a value created by delay with a value created by new will completely
17 * drop the delayed value. Hence, if a value is delayed, then nothing should
18 * be assumed about any of its subcomponents.
19 *)
20
21 signature EQUATABLE =
22 sig
23 type 'a t
24
25 val equals: 'a t * 'a t -> bool
26 val delay: (unit -> 'a) -> 'a t
27 val equate: 'a t * 'a t * ('a * 'a -> 'a) -> unit
28 val layout: 'a t * ('a -> Layout.t) -> Layout.t
29 val new: 'a -> 'a t
30 val value: 'a t -> 'a
31 val whenComputed: 'a t * ('a -> unit) -> unit
32 end