28019
|
1 |
(* Title: Pure/General/properties.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Makarius
|
|
4 |
|
|
5 |
Property lists.
|
|
6 |
*)
|
|
7 |
|
|
8 |
signature PROPERTIES =
|
|
9 |
sig
|
|
10 |
type property = string * string
|
|
11 |
type T = property list
|
|
12 |
val defined: T -> string -> bool
|
|
13 |
val get: T -> string -> string option
|
|
14 |
val put: string * string -> T -> T
|
|
15 |
val remove: string -> T -> T
|
|
16 |
end;
|
|
17 |
|
|
18 |
structure Properties: PROPERTIES =
|
|
19 |
struct
|
|
20 |
|
|
21 |
type property = string * string;
|
|
22 |
type T = property list;
|
|
23 |
|
|
24 |
fun defined (props: T) name = AList.defined (op =) props name;
|
|
25 |
fun get (props: T) name = AList.lookup (op =) props name;
|
|
26 |
fun put prop (props: T) = AList.update (op =) prop props;
|
|
27 |
fun remove name (props: T) = AList.delete (op =) name props;
|
|
28 |
|
|
29 |
end;
|