signature PAIR
structure Pair : PAIR
Common combinators on type 'a * 'b.
The type constructor pair is available in the top-level environment.
See also: Alt
Imported implicitly.
signature PAIR =
sig
type ('a,'b) pair = 'a * 'b
type ('a,'b) t = ('a,'b) pair
val fst : ('a,'b) pair -> 'a
val snd : ('a,'b) pair -> 'b
val app : ('a -> unit) * ('b -> unit) -> ('a,'b) pair -> unit
val appFst : ('a -> unit) -> ('a,'b) pair -> unit
val appSnd : ('b -> unit) -> ('a,'b) pair -> unit
val map : ('a -> 'c) * ('b -> 'd) -> ('a,'b) pair -> ('c,'d) pair
val mapFst : ('a -> 'c) -> ('a,'b) pair -> ('c,'b) pair
val mapSnd : ('b -> 'c) -> ('a,'b) pair -> ('a,'c) pair
val mapSnd : ('a -> 'b) -> ('a,'a) pair -> ('b,'b) pair
val equal : ('a * 'a -> bool) * ('b * 'b -> bool) -> ('a,'b) pair * ('a,'b) pair -> bool
val collate : ('a * 'a -> order) * ('b * 'b -> order) -> ('a,'b) pair * ('a,'b) pair -> order
end
The type of cartesian products.
Returns the first (second) component of the pair p.
The function app applies the functions f and g to the first and second component of the pair p, respectively. For the functions appFst and appSnd the following equivalences hold:
appFst f p = app (f, ignore) p appSnd g p = app (ignore, g) p
The function map produces a pair by mapping the functions f and g on both components of p. For the functions mapFst, mapSnd and mapBoth the following equivalences hold:
mapFst f p = map (f, id) p mapSnd g p = map (id, g) p mapBoth f p = map (f, f) p
where id is the identity function.
Creates an equality function on pairs, given suitable equality functions for each component type.
Performs lexicographic comparison of the two pairs using the given orderings f and g on the component types.