Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlton / basic / ref.sig
1 (* Copyright (C) 1999-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 signature REF =
9 sig
10 type 'a t
11
12 val ! : 'a t -> 'a
13 val := : 'a t * 'a -> unit
14
15 val equals: 'a t * 'a t -> bool
16 val fluidLet: 'a t * 'a * (unit -> 'b) -> 'b
17 val getAndSet: ('a -> 'b ref) -> ('a -> 'b) * ('a * 'b -> unit)
18 val getSet: ('a -> Layout.t) -> {get: unit -> 'a,
19 set: 'a -> unit,
20 clear: unit -> unit,
21 layout: unit -> Layout.t,
22 output: Out.t -> unit,
23 print: unit -> unit}
24 val layout: ('a -> Layout.t) -> 'a t -> Layout.t
25 val memoize: 'a option t * (unit -> 'a) -> 'a
26 val swap: 'a t * 'a t -> unit
27 end