Commit | Line | Data |
---|---|---|
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 | ||
11 | functor Pair(structure X: T | |
12 | structure Y: T): PAIR = | |
13 | struct | |
14 | ||
15 | structure X = X | |
16 | structure Y = Y | |
17 | ||
18 | type t = X.t * Y.t | |
19 | ||
20 | fun equals((x, y), (x', y')) = X.equals(x, x') andalso Y.equals(y, y') | |
21 | ||
22 | local open Layout | |
23 | in fun layout(x, y) = | |
24 | paren(seq[X.layout x, str ", ", Y.layout y]) | |
25 | end | |
26 | (* | |
27 | fun 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 | *) | |
36 | end |