Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlton / basic / pair.fun
CommitLineData
7f918cf1
CE
1(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 *
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
6 *)
7(*-------------------------------------------------------------------*)
8(* Pair *)
9(*-------------------------------------------------------------------*)
10
11functor Pair(structure X: T
12 structure Y: T): PAIR =
13struct
14
15structure X = X
16structure Y = Y
17
18type t = X.t * Y.t
19
20fun equals((x, y), (x', y')) = X.equals(x, x') andalso Y.equals(y, y')
21
22local open Layout
23in fun layout(x, y) =
24 paren(seq[X.layout x, str ", ", Y.layout y])
25end
26(*
27fun output((x, y), out) =
28 let val print = Out.outputc out
29 in (print "(" ;
30 X.output(x, out) ;
31 print ", " ;
32 Y.output(y, out) ;
33 print ")")
34 end
35 *)
36end