TFL/utils.sig
author wenzelm
Fri Mar 07 15:30:23 1997 +0100 (1997-03-07)
changeset 2768 bc6d915b8019
parent 2112 3902e9af752f
child 3245 241838c01caf
permissions -rw-r--r--
renamed SYSTEM to RAW_ML_SYSTEM;
paulson@2112
     1
signature Utils_sig =
paulson@2112
     2
sig
paulson@2112
     3
  (* General error format and reporting mechanism *)
paulson@2112
     4
  exception ERR of {module:string,func:string, mesg:string}
paulson@2112
     5
  val Raise : exn -> 'a
paulson@2112
     6
paulson@2112
     7
  (* infix 3 ## *)
paulson@2112
     8
  val ## : ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd
paulson@2112
     9
  val can   : ('a -> 'b) -> 'a -> bool
paulson@2112
    10
  val holds : ('a -> bool) -> 'a -> bool
paulson@2112
    11
  val assert: ('a -> bool) -> 'a -> 'a
paulson@2112
    12
  val W : ('a -> 'a -> 'b) -> 'a -> 'b
paulson@2112
    13
  val C : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
paulson@2112
    14
  val I : 'a -> 'a
paulson@2112
    15
  val curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
paulson@2112
    16
  val uncurry : ('a -> 'b -> 'c) -> 'a * 'b -> 'c
paulson@2112
    17
  val fst : 'a * 'b -> 'a
paulson@2112
    18
  val snd : 'a * 'b -> 'b
paulson@2112
    19
paulson@2112
    20
  (* option type *)
paulson@2112
    21
  datatype 'a option = SOME of 'a | NONE
paulson@2112
    22
paulson@2112
    23
  (* Set operations *)
paulson@2112
    24
  val mem : ('a -> 'a -> bool) -> 'a -> 'a list -> bool
paulson@2112
    25
  val union : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
paulson@2112
    26
  val Union : ('a -> 'a -> bool) -> 'a list list ->  'a list
paulson@2112
    27
  val intersect : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
paulson@2112
    28
  val set_diff : ('a -> 'b -> bool) -> 'a list -> 'b list -> 'a list
paulson@2112
    29
  val mk_set : ('a -> 'a -> bool) -> 'a list -> 'a list
paulson@2112
    30
  val set_eq : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
paulson@2112
    31
paulson@2112
    32
  val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
paulson@2112
    33
  val itlist : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
paulson@2112
    34
  val rev_itlist : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
paulson@2112
    35
  val end_itlist : ('a -> 'a -> 'a) -> 'a list -> 'a
paulson@2112
    36
  val itlist2 :('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
paulson@2112
    37
  val filter : ('a -> bool) -> 'a list -> 'a list
paulson@2112
    38
  val mapfilter : ('a -> 'b) -> 'a list -> 'b list
paulson@2112
    39
  val pluck : ('a -> bool) -> 'a list -> 'a * 'a list
paulson@2112
    40
  val assoc1 : ('a*'a->bool) -> 'a -> ('a * 'b) list -> ('a * 'b) option
paulson@2112
    41
  val front_back : 'a list -> 'a list * 'a
paulson@2112
    42
  val all : ('a -> bool) -> 'a list -> bool
paulson@2112
    43
  val exists : ('a -> bool) -> 'a list -> bool
paulson@2112
    44
  val zip : 'a list -> 'b list -> ('a*'b) list
paulson@2112
    45
  val zip3 : 'a list -> 'b list -> 'c list -> ('a*'b*'c) list
paulson@2112
    46
  val unzip : ('a*'b) list -> ('a list * 'b list)
paulson@2112
    47
  val take  : ('a -> 'b) -> int * 'a list -> 'b list
paulson@2112
    48
  val sort  : ('a -> 'a -> bool) -> 'a list -> 'a list
paulson@2112
    49
paulson@2112
    50
  val int_to_string : int -> string
paulson@2112
    51
  val concat : string -> string -> string
paulson@2112
    52
  val quote : string -> string
paulson@2112
    53
paulson@2112
    54
end;
paulson@2112
    55