Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* Copyright (C) 2013,2017 Matthew Fluet. |
2 | * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh | |
3 | * Jagannathan, and Stephen Weeks. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | *) | |
8 | ||
9 | signature TREE_STRUCTS = | |
10 | sig | |
11 | structure Seq: | |
12 | sig | |
13 | type 'a t | |
14 | ||
15 | val fold: 'a t * 'b * ('a * 'b -> 'b) -> 'b | |
16 | val foreach: 'a t * ('a -> unit) -> unit | |
17 | val layout: 'a t * ('a -> Layout.t) -> Layout.t | |
18 | val map: 'a t * ('a -> 'b) -> 'b t | |
19 | end | |
20 | end | |
21 | ||
22 | signature TREE = | |
23 | sig | |
24 | include TREE_STRUCTS | |
25 | ||
26 | datatype 'a t = T of 'a * 'a t Seq.t | |
27 | ||
28 | structure Forest: | |
29 | sig | |
30 | type 'a t = 'a t Seq.t | |
31 | ||
32 | val layout: 'a t * ('a -> Layout.t) -> Layout.t | |
33 | val layoutDot: | |
34 | 'a t * {nodeOptions: 'a -> Dot.NodeOption.t list, | |
35 | options: Dot.GraphOption.t list, | |
36 | title: string} | |
37 | -> Layout.t | |
38 | end | |
39 | ||
40 | val children: 'a t -> 'a Forest.t | |
41 | val foldPre: 'a t * 'b * ('a * 'b -> 'b) -> 'b | |
42 | val foldPost: 'a t * 'b * ('a * 'b -> 'b) -> 'b | |
43 | val foreachPre: 'a t * ('a -> unit) -> unit (* preorder traversal *) | |
44 | val foreachPost: 'a t * ('a -> unit) -> unit (* postorder traversal *) | |
45 | val layout: 'a t * ('a -> Layout.t) -> Layout.t | |
46 | val layoutDot: | |
47 | 'a t * {nodeOptions: 'a -> Dot.NodeOption.t list, | |
48 | options: Dot.GraphOption.t list, | |
49 | title: string} | |
50 | -> Layout.t | |
51 | val map: 'a t * ('a -> 'b) -> 'b t | |
52 | val traverse: 'a t * ('a -> unit -> unit) -> unit | |
53 | end |