Import Upstream version 20180207
[hcoop/debian/mlton.git] / mlton / atoms / cases.sig
1 (* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 * Copyright (C) 1997-2000 NEC Research Institute.
5 *
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
8 *)
9
10 signature CASES_STRUCTS =
11 sig
12 type con
13 type word
14
15 val conEquals: con * con -> bool
16 val wordEquals: word * word -> bool
17 end
18
19 signature CASES =
20 sig
21 include CASES_STRUCTS
22
23 datatype 'a t =
24 Char of (char * 'a) vector
25 | Con of (con * 'a) vector
26 | Int of (IntInf.t * 'a) vector
27 | Word of (word * 'a) vector
28
29 val equals: 'a t * 'a t * ('a * 'a -> bool) -> bool
30 val fold: 'a t * 'b * ('a * 'b -> 'b) -> 'b
31 val forall: 'a t * ('a -> bool) -> bool
32 val foreach: 'a t * ('a -> unit) -> unit
33 val foreach': 'a t * ('a -> unit) * (con -> unit) -> unit
34 val hd: 'a t -> 'a
35 val isEmpty: 'a t -> bool
36 val length: 'a t -> int
37 val map: 'a t * ('a -> 'b) -> 'b t
38 end